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 // Create a service process that uses a Mock to respond to the browser in order | 5 // Create a service process that uses a Mock to respond to the browser in order |
6 // to test launching the browser using the cloud print policy check command | 6 // to test launching the browser using the cloud print policy check command |
7 // line switch. | 7 // line switch. |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/service/service_process.h" | 27 #include "chrome/service/service_process.h" |
28 #include "chrome/test/base/test_launcher_utils.h" | 28 #include "chrome/test/base/test_launcher_utils.h" |
29 #include "chrome/test/base/testing_browser_process.h" | 29 #include "chrome/test/base/testing_browser_process.h" |
30 #include "chrome/test/base/testing_pref_service.h" | 30 #include "chrome/test/base/testing_pref_service.h" |
31 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
32 #include "chrome/test/base/testing_profile_manager.h" | 32 #include "chrome/test/base/testing_profile_manager.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
35 #include "content/public/test/test_browser_thread.h" | 35 #include "content/public/test/test_browser_thread.h" |
36 #include "ipc/ipc_descriptors.h" | 36 #include "ipc/ipc_descriptors.h" |
| 37 #include "ipc/ipc_multiprocess_test.h" |
37 #include "ipc/ipc_switches.h" | 38 #include "ipc/ipc_switches.h" |
38 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
39 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
40 #include "testing/multiprocess_func_list.h" | 41 #include "testing/multiprocess_func_list.h" |
41 | 42 |
42 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
43 #include "chrome/common/mac/mock_launchd.h" | 44 #include "chrome/common/mac/mock_launchd.h" |
44 #endif | 45 #endif |
45 #if defined(OS_POSIX) | 46 #if defined(OS_POSIX) |
46 #include "base/global_descriptors_posix.h" | 47 #include "base/global_descriptors_posix.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return kExpectationsNotMet; | 258 return kExpectationsNotMet; |
258 if (!g_good_shutdown) | 259 if (!g_good_shutdown) |
259 return kShutdownNotGood; | 260 return kShutdownNotGood; |
260 return 0; | 261 return 0; |
261 } | 262 } |
262 | 263 |
263 void SetServiceEnabledExpectations(MockServiceIPCServer* server) { | 264 void SetServiceEnabledExpectations(MockServiceIPCServer* server) { |
264 server->SetServiceEnabledExpectations(); | 265 server->SetServiceEnabledExpectations(); |
265 } | 266 } |
266 | 267 |
267 MULTIPROCESS_TEST_MAIN(CloudPrintMockService_StartEnabledWaitForQuit) { | 268 MULTIPROCESS_IPC_TEST_MAIN(CloudPrintMockService_StartEnabledWaitForQuit) { |
268 return CloudPrintMockService_Main( | 269 return CloudPrintMockService_Main( |
269 base::Bind(&SetServiceEnabledExpectations)); | 270 base::Bind(&SetServiceEnabledExpectations)); |
270 } | 271 } |
271 | 272 |
272 void SetServiceWillBeDisabledExpectations(MockServiceIPCServer* server) { | 273 void SetServiceWillBeDisabledExpectations(MockServiceIPCServer* server) { |
273 server->SetWillBeDisabledExpectations(); | 274 server->SetWillBeDisabledExpectations(); |
274 } | 275 } |
275 | 276 |
276 MULTIPROCESS_TEST_MAIN(CloudPrintMockService_StartEnabledExpectDisabled) { | 277 MULTIPROCESS_IPC_TEST_MAIN(CloudPrintMockService_StartEnabledExpectDisabled) { |
277 return CloudPrintMockService_Main( | 278 return CloudPrintMockService_Main( |
278 base::Bind(&SetServiceWillBeDisabledExpectations)); | 279 base::Bind(&SetServiceWillBeDisabledExpectations)); |
279 } | 280 } |
280 | 281 |
281 class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, | 282 class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, |
282 public IPC::Listener { | 283 public IPC::Listener { |
283 public: | 284 public: |
284 CloudPrintProxyPolicyStartupTest(); | 285 CloudPrintProxyPolicyStartupTest(); |
285 ~CloudPrintProxyPolicyStartupTest(); | 286 ~CloudPrintProxyPolicyStartupTest(); |
286 | 287 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // No expectations on run_loop being true here; that would be a race | 533 // No expectations on run_loop being true here; that would be a race |
533 // condition. | 534 // condition. |
534 if (run_loop) | 535 if (run_loop) |
535 MessageLoop::current()->Run(); | 536 MessageLoop::current()->Run(); |
536 | 537 |
537 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); | 538 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); |
538 | 539 |
539 ShutdownAndWaitForExitWithTimeout(handle); | 540 ShutdownAndWaitForExitWithTimeout(handle); |
540 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); | 541 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); |
541 } | 542 } |
OLD | NEW |