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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(url::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::SetUpCommandLine(base::CommandLine* command_line) { |
| 200 // Disable settings-in-a-window so that we can use the settings page and |
| 201 // sub-pages to test browser navigation. |
| 202 command_line->AppendSwitch(::switches::kDisableSettingsWindow); |
| 203 } |
| 204 |
199 void BrowserNavigatorTest::Observe( | 205 void BrowserNavigatorTest::Observe( |
200 int type, | 206 int type, |
201 const content::NotificationSource& source, | 207 const content::NotificationSource& source, |
202 const content::NotificationDetails& details) { | 208 const content::NotificationDetails& details) { |
203 switch (type) { | 209 switch (type) { |
204 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { | 210 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
205 ++this->created_tab_contents_count_; | 211 ++this->created_tab_contents_count_; |
206 break; | 212 break; |
207 } | 213 } |
208 default: | 214 default: |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 // Open a renderer initiated POST request in new foreground tab. | 1369 // Open a renderer initiated POST request in new foreground tab. |
1364 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); | 1370 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); |
1365 std::string post_data = kExpectedTitle; | 1371 std::string post_data = kExpectedTitle; |
1366 base::string16 title; | 1372 base::string16 title; |
1367 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( | 1373 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( |
1368 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); | 1374 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); |
1369 EXPECT_NE(expected_title, title); | 1375 EXPECT_NE(expected_title, title); |
1370 } | 1376 } |
1371 | 1377 |
1372 } // namespace | 1378 } // namespace |
OLD | NEW |