Add ICU message format support
[chromium-blink-merge.git] / chrome / common / mac / mock_launchd.h
blob64d37ace460f39226277d5ccc447b80c73db7b66
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_MAC_MOCK_LAUNCHD_H_
6 #define CHROME_COMMON_MAC_MOCK_LAUNCHD_H_
8 #include <launch.h>
10 #include <string>
12 #include "base/files/file_path.h"
13 #include "base/mac/scoped_cftyperef.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/common/mac/launchd.h"
16 #include "chrome/common/multi_process_lock.h"
18 namespace base {
19 class MessageLoop;
22 // TODO(dmaclach): Write this in terms of a real mock.
23 // http://crbug.com/76923
24 class MockLaunchd : public Launchd {
25 public:
26 static bool MakeABundle(const base::FilePath& dst,
27 const std::string& name,
28 base::FilePath* bundle_root,
29 base::FilePath* executable);
31 MockLaunchd(const base::FilePath& file, base::MessageLoop* loop,
32 bool create_socket, bool as_service);
33 ~MockLaunchd() override;
35 CFDictionaryRef CopyJobDictionary(CFStringRef label) override;
36 CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error) override;
37 bool RemoveJob(CFStringRef label, CFErrorRef* error) override;
38 bool RestartJob(Domain domain,
39 Type type,
40 CFStringRef name,
41 CFStringRef session_type) override;
42 CFMutableDictionaryRef CreatePlistFromFile(Domain domain,
43 Type type,
44 CFStringRef name) override;
45 bool WritePlistToFile(Domain domain,
46 Type type,
47 CFStringRef name,
48 CFDictionaryRef dict) override;
49 bool DeletePlist(Domain domain, Type type, CFStringRef name) override;
51 void SignalReady();
53 bool restart_called() const { return restart_called_; }
54 bool remove_called() const { return remove_called_; }
55 bool checkin_called() const { return checkin_called_; }
56 bool write_called() const { return write_called_; }
57 bool delete_called() const { return delete_called_; }
59 private:
60 base::FilePath file_;
61 std::string pipe_name_;
62 base::MessageLoop* message_loop_;
63 scoped_ptr<MultiProcessLock> running_lock_;
64 bool create_socket_;
65 bool as_service_;
66 bool restart_called_;
67 bool remove_called_;
68 bool checkin_called_;
69 bool write_called_;
70 bool delete_called_;
73 #endif // CHROME_COMMON_MAC_MOCK_LAUNCHD_H_