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