OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "base/command_line.h" | |
6 #include "base/file_util.h" | |
7 #include "base/path_service.h" | |
8 #include "base/process_util.h" | |
9 #include "base/test/test_timeouts.h" | |
10 #include "chrome/common/chrome_notification_types.h" | |
11 #include "chrome/common/chrome_result_codes.h" | |
12 #include "chrome/common/chrome_switches.h" | |
13 #include "chrome/test/base/in_process_browser_test.h" | |
14 #include "chrome/test/base/ui_test_utils.h" | |
15 #include "content/public/browser/notification_service.h" | |
16 #include "content/public/common/result_codes.h" | |
17 | |
18 // These tests don't apply to the Mac version; see GetCommandLineForRelaunch | |
19 // for details. | |
20 #if !defined(OS_MACOSX) | |
Lei Zhang
2012/07/09 22:40:04
Can we just exclude this file on Mac in the .gypi
Scott Byer
2012/07/10 16:23:12
Done.
| |
21 | |
22 namespace { | |
23 | |
24 class CloudPrintPolicyTest : public InProcessBrowserTest { | |
25 public: | |
26 CloudPrintPolicyTest() {} | |
27 }; | |
28 | |
29 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, NormalPassedFlag) { | |
30 FilePath test_file_path = ui_test_utils::GetTestFilePath( | |
31 FilePath(), FilePath().AppendASCII("empty.html")); | |
32 CommandLine new_command_line(GetCommandLineForRelaunch()); | |
33 new_command_line.AppendArgPath(test_file_path); | |
34 | |
35 ui_test_utils::WindowedNotificationObserver observer( | |
36 chrome::NOTIFICATION_TAB_ADDED, | |
37 content::NotificationService::AllSources()); | |
38 | |
39 base::ProcessHandle handle; | |
40 bool launched = | |
41 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | |
42 EXPECT_TRUE(launched); | |
43 | |
44 observer.Wait(); | |
45 | |
46 int exit_code = -100; | |
47 bool exited = | |
48 base::WaitForExitCodeWithTimeout(handle, &exit_code, | |
49 TestTimeouts::action_timeout_ms()); | |
Albert Bodenhamer
2012/07/09 04:09:40
Do we need action_timeout_ms or action_timeout her
Scott Byer
2012/07/10 16:23:12
action_timeout_ms. I don't like integer (sec/tick/
| |
50 | |
51 EXPECT_TRUE(exited); | |
52 EXPECT_EQ(exit_code, chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED); | |
53 base::CloseProcessHandle(handle); | |
54 } | |
55 | |
56 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, CloudPrintPolicyFlag) { | |
57 CommandLine new_command_line(GetCommandLineForRelaunch()); | |
58 new_command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | |
59 | |
60 base::ProcessHandle handle; | |
61 bool launched = | |
62 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | |
63 EXPECT_TRUE(launched); | |
64 | |
65 int exit_code = -100; | |
66 bool exited = | |
67 base::WaitForExitCodeWithTimeout(handle, &exit_code, | |
68 TestTimeouts::action_timeout_ms()); | |
69 | |
70 EXPECT_TRUE(exited); | |
71 EXPECT_EQ(exit_code, content::RESULT_CODE_NORMAL_EXIT); | |
72 base::CloseProcessHandle(handle); | |
73 } | |
74 | |
75 } // namespace | |
76 | |
77 #endif // !OS_MACOSX | |
OLD | NEW |