| 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/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 EXPECT_EQ(browser, params.browser); | 195 EXPECT_EQ(browser, params.browser); |
| 196 EXPECT_EQ(1, browser->tab_strip_model()->count()); | 196 EXPECT_EQ(1, browser->tab_strip_model()->count()); |
| 197 EXPECT_EQ(GURL(url::kAboutBlankURL), | 197 EXPECT_EQ(GURL(url::kAboutBlankURL), |
| 198 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 198 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void BrowserNavigatorTest::SetUpCommandLine(base::CommandLine* command_line) { | 201 void BrowserNavigatorTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 202 // Disable settings-in-a-window so that we can use the settings page and | 202 // Disable settings-in-a-window so that we can use the settings page and |
| 203 // sub-pages to test browser navigation. | 203 // sub-pages to test browser navigation. |
| 204 command_line->AppendSwitch(::switches::kDisableSettingsWindow); | 204 command_line->AppendSwitch(::switches::kDisableSettingsWindow); |
| 205 | |
| 206 // Disable new downloads UI as it is very very slow. https://crbug.com/526577 | |
| 207 // TODO(dbeam): remove this once the downloads UI is not slow. | |
| 208 command_line->AppendSwitch(switches::kDisableMaterialDesignDownloads); | |
| 209 } | 205 } |
| 210 | 206 |
| 211 void BrowserNavigatorTest::Observe( | 207 void BrowserNavigatorTest::Observe( |
| 212 int type, | 208 int type, |
| 213 const content::NotificationSource& source, | 209 const content::NotificationSource& source, |
| 214 const content::NotificationDetails& details) { | 210 const content::NotificationDetails& details) { |
| 215 switch (type) { | 211 switch (type) { |
| 216 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { | 212 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
| 217 ++this->created_tab_contents_count_; | 213 ++this->created_tab_contents_count_; |
| 218 break; | 214 break; |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 chrome::ShowHistory(browser()); | 1270 chrome::ShowHistory(browser()); |
| 1275 observer.Wait(); | 1271 observer.Wait(); |
| 1276 } | 1272 } |
| 1277 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1273 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| 1278 EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL), | 1274 EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL), |
| 1279 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1275 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 1280 } | 1276 } |
| 1281 | 1277 |
| 1282 // TODO(linux_aura) http://crbug.com/163931 | 1278 // TODO(linux_aura) http://crbug.com/163931 |
| 1283 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 1279 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
| 1284 #define MAYBE_NavigateFromDefaultToBookmarksInSameTab DISABLED_NavigateFromDefau
ltToBookmarksInSameTab | 1280 #define MAYBE_NavigateFromDefaultToBookmarksInSameTab \ |
| 1281 DISABLED_NavigateFromDefaultToBookmarksInSameTab |
| 1285 #else | 1282 #else |
| 1286 #define MAYBE_NavigateFromDefaultToBookmarksInSameTab NavigateFromDefaultToBookm
arksInSameTab | 1283 #define MAYBE_NavigateFromDefaultToBookmarksInSameTab \ |
| 1284 NavigateFromDefaultToBookmarksInSameTab |
| 1287 #endif | 1285 #endif |
| 1288 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1286 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1289 MAYBE_NavigateFromDefaultToBookmarksInSameTab) { | 1287 MAYBE_NavigateFromDefaultToBookmarksInSameTab) { |
| 1290 { | 1288 { |
| 1291 content::WindowedNotificationObserver observer( | 1289 content::WindowedNotificationObserver observer( |
| 1292 content::NOTIFICATION_LOAD_STOP, | 1290 content::NOTIFICATION_LOAD_STOP, |
| 1293 content::NotificationService::AllSources()); | 1291 content::NotificationService::AllSources()); |
| 1294 chrome::ShowBookmarkManager(browser()); | 1292 chrome::ShowBookmarkManager(browser()); |
| 1295 observer.Wait(); | 1293 observer.Wait(); |
| 1296 } | 1294 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 EXPECT_EQ(expected_title, params.target_contents->GetTitle()); | 1410 EXPECT_EQ(expected_title, params.target_contents->GetTitle()); |
| 1413 // GURL always keeps non-ASCII characters escaped, but check them anyways. | 1411 // GURL always keeps non-ASCII characters escaped, but check them anyways. |
| 1414 EXPECT_EQ(GURL(expected_url).spec(), params.target_contents->GetURL().spec()); | 1412 EXPECT_EQ(GURL(expected_url).spec(), params.target_contents->GetURL().spec()); |
| 1415 // Check the omnibox text. It should have escaped RTL with unescaped text. | 1413 // Check the omnibox text. It should have escaped RTL with unescaped text. |
| 1416 LocationBar* location_bar = browser()->window()->GetLocationBar(); | 1414 LocationBar* location_bar = browser()->window()->GetLocationBar(); |
| 1417 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); | 1415 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); |
| 1418 EXPECT_EQ(base::UTF8ToUTF16(expected_url), omnibox_view->GetText()); | 1416 EXPECT_EQ(base::UTF8ToUTF16(expected_url), omnibox_view->GetText()); |
| 1419 } | 1417 } |
| 1420 | 1418 |
| 1421 } // namespace | 1419 } // namespace |
| OLD | NEW |