Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/common/mac/mock_launchd.h

Issue 9131016: Cloud Print Policy - service side enforcement, Mac browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More tweaks Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <launch.h> 9 #include <launch.h>
10 10
11 #include <string>
12
11 #include "base/file_path.h" 13 #include "base/file_path.h"
12 #include "base/mac/scoped_cftyperef.h" 14 #include "base/mac/scoped_cftyperef.h"
15 #include "base/memory/scoped_ptr.h"
13 #include "chrome/common/mac/launchd.h" 16 #include "chrome/common/mac/launchd.h"
17 #include "chrome/common/multi_process_lock.h"
14 18
15 class MessageLoop; 19 class MessageLoop;
16 20
17 // TODO(dmaclach): Write this in terms of a real mock. 21 // TODO(dmaclach): Write this in terms of a real mock.
18 // http://crbug.com/76923 22 // http://crbug.com/76923
19 class MockLaunchd : public Launchd { 23 class MockLaunchd : public Launchd {
20 public: 24 public:
21 static bool MakeABundle(const FilePath& dst, 25 static bool MakeABundle(const FilePath& dst,
22 const std::string& name, 26 const std::string& name,
23 FilePath* bundle_root, 27 FilePath* bundle_root,
24 FilePath* executable); 28 FilePath* executable);
25 29
26 MockLaunchd(const FilePath& file, MessageLoop* loop) 30 MockLaunchd(const FilePath& file, MessageLoop* loop,
27 : file_(file), 31 bool create_socket, bool as_service);
28 message_loop_(loop), 32 virtual ~MockLaunchd();
29 restart_called_(false),
30 remove_called_(false),
31 checkin_called_(false),
32 write_called_(false),
33 delete_called_(false) {
34 }
35 virtual ~MockLaunchd() { }
36 33
37 virtual CFDictionaryRef CopyExports() OVERRIDE; 34 virtual CFDictionaryRef CopyExports() OVERRIDE;
38 virtual CFDictionaryRef CopyJobDictionary(CFStringRef label) OVERRIDE; 35 virtual CFDictionaryRef CopyJobDictionary(CFStringRef label) OVERRIDE;
39 virtual CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error) 36 virtual CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error)
40 OVERRIDE; 37 OVERRIDE;
41 virtual bool RemoveJob(CFStringRef label, CFErrorRef* error) OVERRIDE; 38 virtual bool RemoveJob(CFStringRef label, CFErrorRef* error) OVERRIDE;
42 virtual bool RestartJob(Domain domain, 39 virtual bool RestartJob(Domain domain,
43 Type type, 40 Type type,
44 CFStringRef name, 41 CFStringRef name,
45 CFStringRef session_type) OVERRIDE; 42 CFStringRef session_type) OVERRIDE;
46 virtual CFMutableDictionaryRef CreatePlistFromFile( 43 virtual CFMutableDictionaryRef CreatePlistFromFile(
47 Domain domain, 44 Domain domain,
48 Type type, 45 Type type,
49 CFStringRef name) OVERRIDE; 46 CFStringRef name) OVERRIDE;
50 virtual bool WritePlistToFile(Domain domain, 47 virtual bool WritePlistToFile(Domain domain,
51 Type type, 48 Type type,
52 CFStringRef name, 49 CFStringRef name,
53 CFDictionaryRef dict) OVERRIDE; 50 CFDictionaryRef dict) OVERRIDE;
54 virtual bool DeletePlist(Domain domain, 51 virtual bool DeletePlist(Domain domain,
55 Type type, 52 Type type,
56 CFStringRef name) OVERRIDE; 53 CFStringRef name) OVERRIDE;
57 54
55 void SignalReady();
56
58 bool restart_called() const { return restart_called_; } 57 bool restart_called() const { return restart_called_; }
59 bool remove_called() const { return remove_called_; } 58 bool remove_called() const { return remove_called_; }
60 bool checkin_called() const { return checkin_called_; } 59 bool checkin_called() const { return checkin_called_; }
61 bool write_called() const { return write_called_; } 60 bool write_called() const { return write_called_; }
62 bool delete_called() const { return delete_called_; } 61 bool delete_called() const { return delete_called_; }
63 62
64 private: 63 private:
65 FilePath file_; 64 FilePath file_;
65 std::string pipe_name_;
66 MessageLoop* message_loop_; 66 MessageLoop* message_loop_;
67 scoped_ptr<MultiProcessLock> running_lock_;
68 bool create_socket_;
69 bool as_service_;
67 bool restart_called_; 70 bool restart_called_;
68 bool remove_called_; 71 bool remove_called_;
72 bool job_called_;
69 bool checkin_called_; 73 bool checkin_called_;
70 bool write_called_; 74 bool write_called_;
71 bool delete_called_; 75 bool delete_called_;
72 }; 76 };
73 77
74 #endif // CHROME_COMMON_MAC_MOCK_LAUNCHD_H_ 78 #endif // CHROME_COMMON_MAC_MOCK_LAUNCHD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698