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/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 bool BrowserNavigatorTest::OpenPOSTURLInNewForegroundTabAndGetTitle( | 83 bool BrowserNavigatorTest::OpenPOSTURLInNewForegroundTabAndGetTitle( |
84 const GURL& url, const std::string& post_data, bool is_browser_initiated, | 84 const GURL& url, const std::string& post_data, bool is_browser_initiated, |
85 base::string16* title) { | 85 base::string16* title) { |
86 chrome::NavigateParams param(MakeNavigateParams()); | 86 chrome::NavigateParams param(MakeNavigateParams()); |
87 param.disposition = NEW_FOREGROUND_TAB; | 87 param.disposition = NEW_FOREGROUND_TAB; |
88 param.url = url; | 88 param.url = url; |
89 param.is_renderer_initiated = !is_browser_initiated; | 89 param.is_renderer_initiated = !is_browser_initiated; |
90 param.uses_post = true; | 90 param.uses_post = true; |
91 param.browser_initiated_post_data = new base::RefCountedStaticMemory( | 91 param.browser_initiated_post_data = new base::RefCountedStaticMemory( |
92 reinterpret_cast<const uint8*>(post_data.data()), post_data.size()); | 92 post_data.data(), post_data.size()); |
93 | 93 |
94 ui_test_utils::NavigateToURL(¶m); | 94 ui_test_utils::NavigateToURL(¶m); |
95 if (!param.target_contents) | 95 if (!param.target_contents) |
96 return false; | 96 return false; |
97 | 97 |
98 // Navigate() should have opened the contents in new foreground tab in the | 98 // Navigate() should have opened the contents in new foreground tab in the |
99 // current Browser. | 99 // current Browser. |
100 EXPECT_EQ(browser(), param.browser); | 100 EXPECT_EQ(browser(), param.browser); |
101 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), | 101 EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), |
102 param.target_contents); | 102 param.target_contents); |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 // Open a renderer initiated POST request in new foreground tab. | 1349 // Open a renderer initiated POST request in new foreground tab. |
1350 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); | 1350 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle)); |
1351 std::string post_data = kExpectedTitle; | 1351 std::string post_data = kExpectedTitle; |
1352 base::string16 title; | 1352 base::string16 title; |
1353 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( | 1353 ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle( |
1354 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); | 1354 test_server()->GetURL(kEchoTitleCommand), post_data, false, &title)); |
1355 EXPECT_NE(expected_title, title); | 1355 EXPECT_NE(expected_title, title); |
1356 } | 1356 } |
1357 | 1357 |
1358 } // namespace | 1358 } // namespace |
OLD | NEW |