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 #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 "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
21 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
(...skipping 24 matching lines...) Expand all Loading... |
49 FilePath(), FilePath().AppendASCII("empty.html")); | 50 FilePath(), FilePath().AppendASCII("empty.html")); |
50 CommandLine new_command_line(GetCommandLineForRelaunch()); | 51 CommandLine new_command_line(GetCommandLineForRelaunch()); |
51 new_command_line.AppendArgPath(test_file_path); | 52 new_command_line.AppendArgPath(test_file_path); |
52 ui_test_utils::WindowedNotificationObserver observer( | 53 ui_test_utils::WindowedNotificationObserver observer( |
53 chrome::NOTIFICATION_TAB_ADDED, | 54 chrome::NOTIFICATION_TAB_ADDED, |
54 content::NotificationService::AllSources()); | 55 content::NotificationService::AllSources()); |
55 Relaunch(new_command_line); | 56 Relaunch(new_command_line); |
56 observer.Wait(); | 57 observer.Wait(); |
57 | 58 |
58 GURL url = net::FilePathToFileURL(test_file_path); | 59 GURL url = net::FilePathToFileURL(test_file_path); |
59 content::WebContents* tab = browser()->GetActiveWebContents(); | 60 content::WebContents* tab = chrome::GetActiveWebContents(browser()); |
60 ASSERT_EQ(url, tab->GetController().GetActiveEntry()->GetVirtualURL()); | 61 ASSERT_EQ(url, tab->GetController().GetActiveEntry()->GetVirtualURL()); |
61 } | 62 } |
62 | 63 |
63 // ChromeMainTest.SecondLaunchWithIncognitoUrl is flaky on Win and Linux. | 64 // ChromeMainTest.SecondLaunchWithIncognitoUrl is flaky on Win and Linux. |
64 // http://crbug.com/130395 | 65 // http://crbug.com/130395 |
65 #if defined(OS_WIN) || defined(OS_LINUX) | 66 #if defined(OS_WIN) || defined(OS_LINUX) |
66 #define MAYBE_SecondLaunchWithIncognitoUrl DISABLED_SecondLaunchWithIncognitoUrl | 67 #define MAYBE_SecondLaunchWithIncognitoUrl DISABLED_SecondLaunchWithIncognitoUrl |
67 #else | 68 #else |
68 #define MAYBE_SecondLaunchWithIncognitoUrl SecondLaunchWithIncognitoUrl | 69 #define MAYBE_SecondLaunchWithIncognitoUrl SecondLaunchWithIncognitoUrl |
69 #endif | 70 #endif |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 content::NotificationService::AllSources()); | 123 content::NotificationService::AllSources()); |
123 Relaunch(new_command_line); | 124 Relaunch(new_command_line); |
124 tab_observer.Wait(); | 125 tab_observer.Wait(); |
125 | 126 |
126 // There should be one normal and one incognito window now. | 127 // There should be one normal and one incognito window now. |
127 ASSERT_EQ(2u, BrowserList::size()); | 128 ASSERT_EQ(2u, BrowserList::size()); |
128 ASSERT_EQ(1u, browser::GetTabbedBrowserCount(profile)); | 129 ASSERT_EQ(1u, browser::GetTabbedBrowserCount(profile)); |
129 } | 130 } |
130 | 131 |
131 #endif // !OS_MACOSX | 132 #endif // !OS_MACOSX |
OLD | NEW |