| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ | 5 #ifndef CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ |
| 6 #define CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ | 6 #define CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ |
| 7 | 7 |
| 8 #include <launch.h> | 8 #include <launch.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "chrome/common/mac/launchd.h" | 15 #include "chrome/common/mac/launchd.h" |
| 16 #include "chrome/common/multi_process_lock.h" | 16 #include "chrome/common/multi_process_lock.h" |
| 17 | 17 |
| 18 namespace base { |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 20 } |
| 19 | 21 |
| 20 // TODO(dmaclach): Write this in terms of a real mock. | 22 // TODO(dmaclach): Write this in terms of a real mock. |
| 21 // http://crbug.com/76923 | 23 // http://crbug.com/76923 |
| 22 class MockLaunchd : public Launchd { | 24 class MockLaunchd : public Launchd { |
| 23 public: | 25 public: |
| 24 static bool MakeABundle(const base::FilePath& dst, | 26 static bool MakeABundle(const base::FilePath& dst, |
| 25 const std::string& name, | 27 const std::string& name, |
| 26 base::FilePath* bundle_root, | 28 base::FilePath* bundle_root, |
| 27 base::FilePath* executable); | 29 base::FilePath* executable); |
| 28 | 30 |
| 29 MockLaunchd(const base::FilePath& file, MessageLoop* loop, | 31 MockLaunchd(const base::FilePath& file, base::MessageLoop* loop, |
| 30 bool create_socket, bool as_service); | 32 bool create_socket, bool as_service); |
| 31 virtual ~MockLaunchd(); | 33 virtual ~MockLaunchd(); |
| 32 | 34 |
| 33 virtual CFDictionaryRef CopyExports() OVERRIDE; | 35 virtual CFDictionaryRef CopyExports() OVERRIDE; |
| 34 virtual CFDictionaryRef CopyJobDictionary(CFStringRef label) OVERRIDE; | 36 virtual CFDictionaryRef CopyJobDictionary(CFStringRef label) OVERRIDE; |
| 35 virtual CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error) | 37 virtual CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error) |
| 36 OVERRIDE; | 38 OVERRIDE; |
| 37 virtual bool RemoveJob(CFStringRef label, CFErrorRef* error) OVERRIDE; | 39 virtual bool RemoveJob(CFStringRef label, CFErrorRef* error) OVERRIDE; |
| 38 virtual bool RestartJob(Domain domain, | 40 virtual bool RestartJob(Domain domain, |
| 39 Type type, | 41 Type type, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 | 57 |
| 56 bool restart_called() const { return restart_called_; } | 58 bool restart_called() const { return restart_called_; } |
| 57 bool remove_called() const { return remove_called_; } | 59 bool remove_called() const { return remove_called_; } |
| 58 bool checkin_called() const { return checkin_called_; } | 60 bool checkin_called() const { return checkin_called_; } |
| 59 bool write_called() const { return write_called_; } | 61 bool write_called() const { return write_called_; } |
| 60 bool delete_called() const { return delete_called_; } | 62 bool delete_called() const { return delete_called_; } |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 base::FilePath file_; | 65 base::FilePath file_; |
| 64 std::string pipe_name_; | 66 std::string pipe_name_; |
| 65 MessageLoop* message_loop_; | 67 base::MessageLoop* message_loop_; |
| 66 scoped_ptr<MultiProcessLock> running_lock_; | 68 scoped_ptr<MultiProcessLock> running_lock_; |
| 67 bool create_socket_; | 69 bool create_socket_; |
| 68 bool as_service_; | 70 bool as_service_; |
| 69 bool restart_called_; | 71 bool restart_called_; |
| 70 bool remove_called_; | 72 bool remove_called_; |
| 71 bool checkin_called_; | 73 bool checkin_called_; |
| 72 bool write_called_; | 74 bool write_called_; |
| 73 bool delete_called_; | 75 bool delete_called_; |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 #endif // CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ | 78 #endif // CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ |
| OLD | NEW |