| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/browser/web_contents/web_contents_view.h" | 9 #include "content/browser/web_contents/web_contents_view.h" |
| 10 #include "content/public/browser/load_notification_details.h" | 10 #include "content/public/browser/load_notification_details.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 LoadStopNotificationObserver load_observer( | 217 LoadStopNotificationObserver load_observer( |
| 218 &shell()->web_contents()->GetController()); | 218 &shell()->web_contents()->GetController()); |
| 219 // Start a new pending navigation as soon as the first load commits. | 219 // Start a new pending navigation as soon as the first load commits. |
| 220 // We will hear a DidStopLoading from the first load as the new load | 220 // We will hear a DidStopLoading from the first load as the new load |
| 221 // is started. | 221 // is started. |
| 222 NavigateOnCommitObserver commit_observer( | 222 NavigateOnCommitObserver commit_observer( |
| 223 shell(), embedded_test_server()->GetURL("/title2.html")); | 223 shell(), embedded_test_server()->GetURL("/title2.html")); |
| 224 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 224 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
| 225 load_observer.Wait(); | 225 load_observer.Wait(); |
| 226 | 226 |
| 227 EXPECT_EQ("/title1.html", load_observer.url_.path()); | 227 EXPECT_EQ("/title2.html", load_observer.url_.path()); |
| 228 EXPECT_EQ(0, load_observer.session_index_); | 228 EXPECT_EQ(1, load_observer.session_index_); |
| 229 EXPECT_EQ(&shell()->web_contents()->GetController(), | 229 EXPECT_EQ(&shell()->web_contents()->GetController(), |
| 230 load_observer.controller_); | 230 load_observer.controller_); |
| 231 } | 231 } |
| 232 // Test that a renderer-initiated navigation to an invalid URL does not leave | 232 // Test that a renderer-initiated navigation to an invalid URL does not leave |
| 233 // around a pending entry that could be used in a URL spoof. We test this in | 233 // around a pending entry that could be used in a URL spoof. We test this in |
| 234 // a browser test because our unit test framework incorrectly calls | 234 // a browser test because our unit test framework incorrectly calls |
| 235 // DidStartProvisionalLoadForFrame for in-page navigations. | 235 // DidStartProvisionalLoadForFrame for in-page navigations. |
| 236 // See http://crbug.com/280512. | 236 // See http://crbug.com/280512. |
| 237 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, | 237 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, |
| 238 ClearNonVisiblePendingOnFail) { | 238 ClearNonVisiblePendingOnFail) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 "a.target = '_blank';" | 451 "a.target = '_blank';" |
| 452 "document.body.appendChild(a);" | 452 "document.body.appendChild(a);" |
| 453 "a.click();")); | 453 "a.click();")); |
| 454 WebContents* new_web_contents = new_web_contents_observer.GetWebContents(); | 454 WebContents* new_web_contents = new_web_contents_observer.GetWebContents(); |
| 455 WaitForLoadStop(new_web_contents); | 455 WaitForLoadStop(new_web_contents); |
| 456 EXPECT_TRUE(new_web_contents_observer.RenderViewCreatedCalled()); | 456 EXPECT_TRUE(new_web_contents_observer.RenderViewCreatedCalled()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace content | 459 } // namespace content |
| 460 | 460 |
| OLD | NEW |