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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 script = "var iframe = document.createElement('iframe');" | 500 script = "var iframe = document.createElement('iframe');" |
501 "iframe.src = 'data:text/html,<p>some page</p>';" | 501 "iframe.src = 'data:text/html,<p>some page</p>';" |
502 "document.body.appendChild(iframe);"; | 502 "document.body.appendChild(iframe);"; |
503 EXPECT_TRUE(content::ExecuteScript(new_root->current_frame_host(), script)); | 503 EXPECT_TRUE(content::ExecuteScript(new_root->current_frame_host(), script)); |
504 // The success check is of the last-committed entry, and there is none. | 504 // The success check is of the last-committed entry, and there is none. |
505 WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents()); | 505 WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents()); |
506 | 506 |
507 ASSERT_EQ(1U, new_root->child_count()); | 507 ASSERT_EQ(1U, new_root->child_count()); |
508 ASSERT_NE(nullptr, new_root->child_at(0)); | 508 ASSERT_NE(nullptr, new_root->child_at(0)); |
509 | 509 |
510 // Navigate it cross-site. | 510 // Navigate it. |
511 GURL frame_url = embedded_test_server()->GetURL( | 511 GURL frame_url = embedded_test_server()->GetURL( |
512 "foo.com", "/navigation_controller/simple_page_2.html"); | 512 "/navigation_controller/simple_page_2.html"); |
513 script = "location.assign('" + frame_url.spec() + "')"; | 513 script = "location.assign('" + frame_url.spec() + "')"; |
514 EXPECT_TRUE(content::ExecuteScript( | 514 EXPECT_TRUE(content::ExecuteScript( |
515 new_root->child_at(0)->current_frame_host(), script)); | 515 new_root->child_at(0)->current_frame_host(), script)); |
516 WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents()); | |
517 | 516 |
518 // Success is not crashing, and not navigating. | 517 // Success is not crashing, and not navigating. |
519 EXPECT_EQ(nullptr, | 518 EXPECT_EQ(nullptr, |
520 new_shell->web_contents()->GetController().GetLastCommittedEntry()); | 519 new_shell->web_contents()->GetController().GetLastCommittedEntry()); |
521 } | 520 } |
522 | 521 |
523 namespace { | 522 namespace { |
524 | 523 |
525 class FrameNavigateParamsCapturer : public WebContentsObserver { | 524 class FrameNavigateParamsCapturer : public WebContentsObserver { |
526 public: | 525 public: |
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3515 observer.Wait(); | 3514 observer.Wait(); |
3516 | 3515 |
3517 EXPECT_EQ(3, controller.GetEntryCount()); | 3516 EXPECT_EQ(3, controller.GetEntryCount()); |
3518 EXPECT_EQ(3, RendererHistoryLength(shell())); | 3517 EXPECT_EQ(3, RendererHistoryLength(shell())); |
3519 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 3518 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
3520 | 3519 |
3521 EXPECT_EQ(frame_url_1, frame->current_url()); | 3520 EXPECT_EQ(frame_url_1, frame->current_url()); |
3522 } | 3521 } |
3523 | 3522 |
3524 } // namespace content | 3523 } // namespace content |
OLD | NEW |