| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 Relaunch(); | 66 Relaunch(); |
| 67 observer.WaitForSingleNewBrowser(); | 67 observer.WaitForSingleNewBrowser(); |
| 68 ASSERT_EQ(BrowserList::GetBrowserCount(browser()->profile()), 2u); | 68 ASSERT_EQ(BrowserList::GetBrowserCount(browser()->profile()), 2u); |
| 69 } | 69 } |
| 70 | 70 |
| 71 IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { | 71 IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { |
| 72 FilePath test_file_path = ui_test_utils::GetTestFilePath( | 72 FilePath test_file_path = ui_test_utils::GetTestFilePath( |
| 73 FilePath(), FilePath().AppendASCII("empty.html")); | 73 FilePath(), FilePath().AppendASCII("empty.html")); |
| 74 new_command_line_.AppendArgPath(test_file_path); | 74 new_command_line_.AppendArgPath(test_file_path); |
| 75 ui_test_utils::WindowedNotificationObserver observer( | 75 ui_test_utils::WindowedNotificationObserver observer( |
| 76 content::NOTIFICATION_TAB_ADDED, | 76 chrome::NOTIFICATION_TAB_ADDED, |
| 77 content::NotificationService::AllSources()); | 77 content::NotificationService::AllSources()); |
| 78 Relaunch(); | 78 Relaunch(); |
| 79 observer.Wait(); | 79 observer.Wait(); |
| 80 | 80 |
| 81 GURL url = net::FilePathToFileURL(test_file_path); | 81 GURL url = net::FilePathToFileURL(test_file_path); |
| 82 content::WebContents* tab = browser()->GetSelectedWebContents(); | 82 content::WebContents* tab = browser()->GetSelectedWebContents(); |
| 83 ASSERT_EQ(url, tab->GetController().GetActiveEntry()->GetVirtualURL()); | 83 ASSERT_EQ(url, tab->GetController().GetActiveEntry()->GetVirtualURL()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 // There should only be the incognito window open now. | 130 // There should only be the incognito window open now. |
| 131 ASSERT_EQ(1u, BrowserList::size()); | 131 ASSERT_EQ(1u, BrowserList::size()); |
| 132 ASSERT_EQ(0u, BrowserList::GetBrowserCountForType(profile, true)); | 132 ASSERT_EQ(0u, BrowserList::GetBrowserCountForType(profile, true)); |
| 133 | 133 |
| 134 // Run with just an URL specified, no --incognito switch. | 134 // Run with just an URL specified, no --incognito switch. |
| 135 FilePath test_file_path = ui_test_utils::GetTestFilePath( | 135 FilePath test_file_path = ui_test_utils::GetTestFilePath( |
| 136 FilePath(), FilePath().AppendASCII("empty.html")); | 136 FilePath(), FilePath().AppendASCII("empty.html")); |
| 137 new_command_line_.AppendArgPath(test_file_path); | 137 new_command_line_.AppendArgPath(test_file_path); |
| 138 ui_test_utils::WindowedNotificationObserver tab_observer( | 138 ui_test_utils::WindowedNotificationObserver tab_observer( |
| 139 content::NOTIFICATION_TAB_ADDED, | 139 chrome::NOTIFICATION_TAB_ADDED, |
| 140 content::NotificationService::AllSources()); | 140 content::NotificationService::AllSources()); |
| 141 Relaunch(); | 141 Relaunch(); |
| 142 tab_observer.Wait(); | 142 tab_observer.Wait(); |
| 143 | 143 |
| 144 // There should be one normal and one incognito window now. | 144 // There should be one normal and one incognito window now. |
| 145 ASSERT_EQ(2u, BrowserList::size()); | 145 ASSERT_EQ(2u, BrowserList::size()); |
| 146 ASSERT_EQ(1u, BrowserList::GetBrowserCountForType(profile, true)); | 146 ASSERT_EQ(1u, BrowserList::GetBrowserCountForType(profile, true)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 #endif // !OS_MACOSX | 149 #endif // !OS_MACOSX |
| OLD | NEW |