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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/frame_host/cross_site_transferring_request.h" | 8 #include "content/browser/frame_host/cross_site_transferring_request.h" |
9 #include "content/browser/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.h" |
10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 1419 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
1420 EXPECT_EQ(pending_rfh, contents()->GetMainFrame()); | 1420 EXPECT_EQ(pending_rfh, contents()->GetMainFrame()); |
1421 EXPECT_EQ(2, controller().GetEntryCount()); | 1421 EXPECT_EQ(2, controller().GetEntryCount()); |
1422 } | 1422 } |
1423 | 1423 |
1424 // Test that NavigationEntries have the correct page state after going | 1424 // Test that NavigationEntries have the correct page state after going |
1425 // forward and back. Prevents regression for bug 1116137. | 1425 // forward and back. Prevents regression for bug 1116137. |
1426 TEST_F(WebContentsImplTest, NavigationEntryContentState) { | 1426 TEST_F(WebContentsImplTest, NavigationEntryContentState) { |
1427 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); | 1427 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); |
1428 | 1428 |
1429 // Navigate to URL. There should be no committed entry yet. | 1429 // Navigate to URL. There should only be the initial entry so far. |
1430 const GURL url("http://www.google.com"); | 1430 const GURL url("http://www.google.com"); |
1431 controller().LoadURL( | 1431 controller().LoadURL( |
1432 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 1432 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
1433 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 1433 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 1434 EXPECT_TRUE(controller().IsInitialNavigation()); |
1434 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 1435 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
1435 EXPECT_EQ(nullptr, entry); | 1436 EXPECT_EQ(GURL(url::kAboutBlankURL), entry->GetURL()); |
1436 | 1437 |
1437 // Committed entry should have page state after DidNavigate. | 1438 // Committed entry should have page state after DidNavigate. |
1438 orig_rfh->PrepareForCommit(); | 1439 orig_rfh->PrepareForCommit(); |
1439 contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url, | 1440 contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url, |
1440 ui::PAGE_TRANSITION_TYPED); | 1441 ui::PAGE_TRANSITION_TYPED); |
1441 entry = controller().GetLastCommittedEntry(); | 1442 entry = controller().GetLastCommittedEntry(); |
1442 EXPECT_TRUE(entry->GetPageState().IsValid()); | 1443 EXPECT_TRUE(entry->GetPageState().IsValid()); |
1443 | 1444 |
1444 // Navigate to same site. | 1445 // Navigate to same site. |
1445 const GURL url2("http://images.google.com"); | 1446 const GURL url2("http://images.google.com"); |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3375 backend->AllowCertForHost(*cert, test_url.host(), 1); | 3376 backend->AllowCertForHost(*cert, test_url.host(), 1); |
3376 EXPECT_TRUE(backend->HasAllowException(test_url.host())); | 3377 EXPECT_TRUE(backend->HasAllowException(test_url.host())); |
3377 | 3378 |
3378 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type", | 3379 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type", |
3379 RESOURCE_TYPE_MAIN_FRAME); | 3380 RESOURCE_TYPE_MAIN_FRAME); |
3380 | 3381 |
3381 EXPECT_TRUE(backend->HasAllowException(test_url.host())); | 3382 EXPECT_TRUE(backend->HasAllowException(test_url.host())); |
3382 } | 3383 } |
3383 | 3384 |
3384 } // namespace content | 3385 } // namespace content |
OLD | NEW |