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. | 510 // Navigate it cross-site. |
511 GURL frame_url = embedded_test_server()->GetURL( | 511 GURL frame_url = embedded_test_server()->GetURL( |
512 "/navigation_controller/simple_page_2.html"); | 512 "foo.com", "/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()); | |
Charlie Reis
2016/03/30 15:26:08
Before the change in this CL, doing this crashes i
alexmos
2016/03/30 16:50:41
Nice!
| |
516 | 517 |
517 // Success is not crashing, and not navigating. | 518 // Success is not crashing, and not navigating. |
518 EXPECT_EQ(nullptr, | 519 EXPECT_EQ(nullptr, |
519 new_shell->web_contents()->GetController().GetLastCommittedEntry()); | 520 new_shell->web_contents()->GetController().GetLastCommittedEntry()); |
520 } | 521 } |
521 | 522 |
522 namespace { | 523 namespace { |
523 | 524 |
524 class FrameNavigateParamsCapturer : public WebContentsObserver { | 525 class FrameNavigateParamsCapturer : public WebContentsObserver { |
525 public: | 526 public: |
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3514 observer.Wait(); | 3515 observer.Wait(); |
3515 | 3516 |
3516 EXPECT_EQ(3, controller.GetEntryCount()); | 3517 EXPECT_EQ(3, controller.GetEntryCount()); |
3517 EXPECT_EQ(3, RendererHistoryLength(shell())); | 3518 EXPECT_EQ(3, RendererHistoryLength(shell())); |
3518 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 3519 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
3519 | 3520 |
3520 EXPECT_EQ(frame_url_1, frame->current_url()); | 3521 EXPECT_EQ(frame_url_1, frame->current_url()); |
3521 } | 3522 } |
3522 | 3523 |
3523 } // namespace content | 3524 } // namespace content |
OLD | NEW |