| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/common/site_isolation_policy.h" | 11 #include "content/common/site_isolation_policy.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/content_browser_test.h" | 15 #include "content/public/test/content_browser_test.h" |
| 15 #include "content/public/test/content_browser_test_utils.h" | 16 #include "content/public/test/content_browser_test_utils.h" |
| 16 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 17 #include "content/shell/browser/shell.h" | 18 #include "content/shell/browser/shell.h" |
| 18 #include "net/dns/mock_host_resolver.h" | 19 #include "net/dns/mock_host_resolver.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 BrowserThread::IO, FROM_HERE, | 195 BrowserThread::IO, FROM_HERE, |
| 195 base::Bind(&net::URLRequestFailedJob::AddUrlHandler)); | 196 base::Bind(&net::URLRequestFailedJob::AddUrlHandler)); |
| 196 NavigateToURL(shell(), error_url); | 197 NavigateToURL(shell(), error_url); |
| 197 EXPECT_EQ(error_url, observer.last_navigation_url()); | 198 EXPECT_EQ(error_url, observer.last_navigation_url()); |
| 198 NavigationEntry* entry = | 199 NavigationEntry* entry = |
| 199 shell()->web_contents()->GetController().GetLastCommittedEntry(); | 200 shell()->web_contents()->GetController().GetLastCommittedEntry(); |
| 200 EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType()); | 201 EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType()); |
| 201 } | 202 } |
| 202 } | 203 } |
| 203 | 204 |
| 205 // Ensure that browser side navigation handles POST navigations correctly. |
| 206 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, POSTNavigation) { |
| 207 GURL url(embedded_test_server()->GetURL("/session_history/form.html")); |
| 208 GURL post_url = embedded_test_server()->GetURL("/echotitle"); |
| 209 |
| 210 // Navigate to a page with a form. |
| 211 TestNavigationObserver observer(shell()->web_contents()); |
| 212 NavigateToURL(shell(), url); |
| 213 EXPECT_EQ(url, observer.last_navigation_url()); |
| 214 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 215 |
| 216 // Submit the form. |
| 217 GURL submit_url("javascript:submitForm('isubmit')"); |
| 218 NavigateToURL(shell(), submit_url); |
| 219 |
| 220 // Check that a proper POST navigation was done. |
| 221 EXPECT_EQ("text=&select=a", |
| 222 base::UTF16ToASCII(shell()->web_contents()->GetTitle())); |
| 223 EXPECT_EQ(post_url, shell()->web_contents()->GetLastCommittedURL()); |
| 224 EXPECT_TRUE(shell() |
| 225 ->web_contents() |
| 226 ->GetController() |
| 227 .GetActiveEntry() |
| 228 ->GetHasPostData()); |
| 229 } |
| 230 |
| 204 } // namespace content | 231 } // namespace content |
| OLD | NEW |