| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Navigate to the page. | 185 // Navigate to the page. |
| 186 chrome::NavigateParams p(MakeNavigateParams(browser)); | 186 chrome::NavigateParams p(MakeNavigateParams(browser)); |
| 187 p.disposition = OFF_THE_RECORD; | 187 p.disposition = OFF_THE_RECORD; |
| 188 p.url = url; | 188 p.url = url; |
| 189 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 189 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 190 chrome::Navigate(&p); | 190 chrome::Navigate(&p); |
| 191 | 191 |
| 192 // The page should not be opened. | 192 // The page should not be opened. |
| 193 EXPECT_EQ(browser, p.browser); | 193 EXPECT_EQ(browser, p.browser); |
| 194 EXPECT_EQ(1, browser->tab_strip_model()->count()); | 194 EXPECT_EQ(1, browser->tab_strip_model()->count()); |
| 195 EXPECT_EQ(GURL(content::kAboutBlankURL), | 195 EXPECT_EQ(GURL(url::kAboutBlankURL), |
| 196 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 196 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void BrowserNavigatorTest::Observe( | 199 void BrowserNavigatorTest::Observe( |
| 200 int type, | 200 int type, |
| 201 const content::NotificationSource& source, | 201 const content::NotificationSource& source, |
| 202 const content::NotificationDetails& details) { | 202 const content::NotificationDetails& details) { |
| 203 switch (type) { | 203 switch (type) { |
| 204 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { | 204 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
| 205 ++this->created_tab_contents_count_; | 205 ++this->created_tab_contents_count_; |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 } | 1077 } |
| 1078 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1078 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| 1079 EXPECT_EQ(GetSettingsURL(), | 1079 EXPECT_EQ(GetSettingsURL(), |
| 1080 ShortenUberURL(browser()->tab_strip_model()-> | 1080 ShortenUberURL(browser()->tab_strip_model()-> |
| 1081 GetActiveWebContents()->GetURL())); | 1081 GetActiveWebContents()->GetURL())); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1084 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1085 NavigateFromBlankToOptionsInSameTab) { | 1085 NavigateFromBlankToOptionsInSameTab) { |
| 1086 chrome::NavigateParams p(MakeNavigateParams()); | 1086 chrome::NavigateParams p(MakeNavigateParams()); |
| 1087 p.url = GURL(content::kAboutBlankURL); | 1087 p.url = GURL(url::kAboutBlankURL); |
| 1088 ui_test_utils::NavigateToURL(&p); | 1088 ui_test_utils::NavigateToURL(&p); |
| 1089 | 1089 |
| 1090 { | 1090 { |
| 1091 content::WindowedNotificationObserver observer( | 1091 content::WindowedNotificationObserver observer( |
| 1092 content::NOTIFICATION_LOAD_STOP, | 1092 content::NOTIFICATION_LOAD_STOP, |
| 1093 content::NotificationService::AllSources()); | 1093 content::NotificationService::AllSources()); |
| 1094 chrome::ShowSettings(browser()); | 1094 chrome::ShowSettings(browser()); |
| 1095 observer.Wait(); | 1095 observer.Wait(); |
| 1096 } | 1096 } |
| 1097 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1097 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 // Open a renderer initiated POST request in new foreground tab. | 1363 // Open a renderer initiated POST request in new foreground tab. |
| 1364 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); | 1364 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); |
| 1365 std::string post_data = kExpectedTitle; | 1365 std::string post_data = kExpectedTitle; |
| 1366 base::string16 title; | 1366 base::string16 title; |
| 1367 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( | 1367 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( |
| 1368 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); | 1368 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); |
| 1369 EXPECT_NE(expected_title, title); | 1369 EXPECT_NE(expected_title, title); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 } // namespace | 1372 } // namespace |
| OLD | NEW |