OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/test/automation/automation_proxy.h" | 11 #include "chrome/test/automation/automation_proxy.h" |
12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
13 | 13 |
14 typedef UITest ChromeMainTest; | 14 typedef UITest ChromeMainTest; |
15 | 15 |
16 #if !defined(OS_MACOSX) | 16 #if !defined(OS_MACOSX) |
| 17 |
| 18 #if defined(USE_AURA) |
| 19 // http://crbug.com/104650 |
| 20 #define MAYBE_SecondLaunch FAILS_SecondLaunch |
| 21 #define MAYBE_ReuseBrowserInstanceWhenOpeningFile \ |
| 22 FAILS_ReuseBrowserInstanceWhenOpeningFile |
| 23 #define MAYBE_SecondLaunchWithIncognitoUrl FAILS_SecondLaunchWithIncognitoUrl |
| 24 #define MAYBE_SecondLaunchFromIncognitoWithNormalUrl \ |
| 25 FAILS_SecondLaunchFromIncognitoWithNormalUrl |
| 26 #else |
| 27 #define MAYBE_SecondLaunch SecondLaunch |
| 28 #define MAYBE_ReuseBrowserInstanceWhenOpeningFile \ |
| 29 ReuseBrowserInstanceWhenOpeningFile |
| 30 #define MAYBE_SecondLaunchWithIncognitoUrl SecondLaunchWithIncognitoUrl |
| 31 #define MAYBE_SecondLaunchFromIncognitoWithNormalUrl \ |
| 32 SecondLaunchFromIncognitoWithNormalUrl |
| 33 #endif |
| 34 |
17 // These tests don't apply to the Mac version; see | 35 // These tests don't apply to the Mac version; see |
18 // LaunchAnotherBrowserBlockUntilClosed for details. | 36 // LaunchAnotherBrowserBlockUntilClosed for details. |
19 | 37 |
20 // Make sure that the second invocation creates a new window. | 38 // Make sure that the second invocation creates a new window. |
21 TEST_F(ChromeMainTest, SecondLaunch) { | 39 TEST_F(ChromeMainTest, MAYBE_SecondLaunch) { |
22 include_testing_id_ = false; | 40 include_testing_id_ = false; |
23 | 41 |
24 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed( | 42 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed( |
25 CommandLine(CommandLine::NO_PROGRAM))); | 43 CommandLine(CommandLine::NO_PROGRAM))); |
26 | 44 |
27 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 45 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
28 } | 46 } |
29 | 47 |
30 TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { | 48 TEST_F(ChromeMainTest, MAYBE_ReuseBrowserInstanceWhenOpeningFile) { |
31 include_testing_id_ = false; | 49 include_testing_id_ = false; |
32 | 50 |
33 FilePath test_file = test_data_directory_.AppendASCII("empty.html"); | 51 FilePath test_file = test_data_directory_.AppendASCII("empty.html"); |
34 | 52 |
35 CommandLine command_line(CommandLine::NO_PROGRAM); | 53 CommandLine command_line(CommandLine::NO_PROGRAM); |
36 command_line.AppendArgPath(test_file); | 54 command_line.AppendArgPath(test_file); |
37 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); | 55 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); |
38 | 56 |
39 ASSERT_TRUE(automation()->IsURLDisplayed(net::FilePathToFileURL(test_file))); | 57 ASSERT_TRUE(automation()->IsURLDisplayed(net::FilePathToFileURL(test_file))); |
40 } | 58 } |
41 | 59 |
42 TEST_F(ChromeMainTest, SecondLaunchWithIncognitoUrl) { | 60 TEST_F(ChromeMainTest, MAYBE_SecondLaunchWithIncognitoUrl) { |
43 include_testing_id_ = false; | 61 include_testing_id_ = false; |
44 int num_normal_windows; | 62 int num_normal_windows; |
45 // We should start with one normal window. | 63 // We should start with one normal window. |
46 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); | 64 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); |
47 ASSERT_EQ(1, num_normal_windows); | 65 ASSERT_EQ(1, num_normal_windows); |
48 | 66 |
49 // Run with --incognito switch and an URL specified. | 67 // Run with --incognito switch and an URL specified. |
50 FilePath test_file = test_data_directory_.AppendASCII("empty.html"); | 68 FilePath test_file = test_data_directory_.AppendASCII("empty.html"); |
51 CommandLine command_line(CommandLine::NO_PROGRAM); | 69 CommandLine command_line(CommandLine::NO_PROGRAM); |
52 command_line.AppendSwitch(switches::kIncognito); | 70 command_line.AppendSwitch(switches::kIncognito); |
53 command_line.AppendArgPath(test_file); | 71 command_line.AppendArgPath(test_file); |
54 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); | 72 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); |
55 | 73 |
56 // There should be one normal and one incognito window now. | 74 // There should be one normal and one incognito window now. |
57 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 75 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
58 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); | 76 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); |
59 ASSERT_EQ(1, num_normal_windows); | 77 ASSERT_EQ(1, num_normal_windows); |
60 } | 78 } |
61 | 79 |
62 TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) { | 80 TEST_F(ChromeMainTest, MAYBE_SecondLaunchFromIncognitoWithNormalUrl) { |
63 include_testing_id_ = false; | 81 include_testing_id_ = false; |
64 int num_normal_windows; | 82 int num_normal_windows; |
65 // We should start with one normal window. | 83 // We should start with one normal window. |
66 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); | 84 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); |
67 ASSERT_EQ(1, num_normal_windows); | 85 ASSERT_EQ(1, num_normal_windows); |
68 | 86 |
69 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 87 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
70 ASSERT_TRUE(browser_proxy.get()); | 88 ASSERT_TRUE(browser_proxy.get()); |
71 | 89 |
72 // Create an incognito window. | 90 // Create an incognito window. |
(...skipping 20 matching lines...) Expand all Loading... |
93 command_line.AppendArgPath(test_file); | 111 command_line.AppendArgPath(test_file); |
94 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); | 112 ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line)); |
95 | 113 |
96 // There should be one normal and one incognito window now. | 114 // There should be one normal and one incognito window now. |
97 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 115 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
98 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); | 116 ASSERT_TRUE(automation()->GetNormalBrowserWindowCount(&num_normal_windows)); |
99 ASSERT_EQ(1, num_normal_windows); | 117 ASSERT_EQ(1, num_normal_windows); |
100 } | 118 } |
101 | 119 |
102 #endif // !OS_MACOSX | 120 #endif // !OS_MACOSX |
OLD | NEW |