| 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { | 831 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { |
| 832 WebContentsImplTestBrowserClient browser_client; | 832 WebContentsImplTestBrowserClient browser_client; |
| 833 SetBrowserClientForTesting(&browser_client); | 833 SetBrowserClientForTesting(&browser_client); |
| 834 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 834 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 835 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); | 835 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); |
| 836 | 836 |
| 837 // Restore a navigation entry for URL that should not assign site to the | 837 // Restore a navigation entry for URL that should not assign site to the |
| 838 // SiteInstance. | 838 // SiteInstance. |
| 839 browser_client.set_assign_site_for_url(false); | 839 browser_client.set_assign_site_for_url(false); |
| 840 const GURL native_url("non-site-url://stuffandthings"); | 840 const GURL native_url("non-site-url://stuffandthings"); |
| 841 ScopedVector<NavigationEntry> entries; | 841 std::vector<scoped_ptr<NavigationEntry>> entries; |
| 842 scoped_ptr<NavigationEntry> new_entry = | 842 scoped_ptr<NavigationEntry> new_entry = |
| 843 NavigationControllerImpl::CreateNavigationEntry( | 843 NavigationControllerImpl::CreateNavigationEntry( |
| 844 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, | 844 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, |
| 845 std::string(), browser_context()); | 845 std::string(), browser_context()); |
| 846 new_entry->SetPageID(0); | 846 new_entry->SetPageID(0); |
| 847 entries.push_back(new_entry.Pass()); | 847 entries.push_back(new_entry.Pass()); |
| 848 controller().Restore( | 848 controller().Restore( |
| 849 0, | 849 0, |
| 850 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 850 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
| 851 &entries); | 851 &entries); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 881 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { | 881 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { |
| 882 WebContentsImplTestBrowserClient browser_client; | 882 WebContentsImplTestBrowserClient browser_client; |
| 883 SetBrowserClientForTesting(&browser_client); | 883 SetBrowserClientForTesting(&browser_client); |
| 884 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 884 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 885 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); | 885 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); |
| 886 | 886 |
| 887 // Restore a navigation entry for a regular URL ensuring that the embedder | 887 // Restore a navigation entry for a regular URL ensuring that the embedder |
| 888 // ShouldAssignSiteForUrl override is disabled (i.e. returns true). | 888 // ShouldAssignSiteForUrl override is disabled (i.e. returns true). |
| 889 browser_client.set_assign_site_for_url(true); | 889 browser_client.set_assign_site_for_url(true); |
| 890 const GURL regular_url("http://www.yahoo.com"); | 890 const GURL regular_url("http://www.yahoo.com"); |
| 891 ScopedVector<NavigationEntry> entries; | 891 std::vector<scoped_ptr<NavigationEntry>> entries; |
| 892 scoped_ptr<NavigationEntry> new_entry = | 892 scoped_ptr<NavigationEntry> new_entry = |
| 893 NavigationControllerImpl::CreateNavigationEntry( | 893 NavigationControllerImpl::CreateNavigationEntry( |
| 894 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, | 894 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, |
| 895 std::string(), browser_context()); | 895 std::string(), browser_context()); |
| 896 new_entry->SetPageID(0); | 896 new_entry->SetPageID(0); |
| 897 entries.push_back(new_entry.Pass()); | 897 entries.push_back(new_entry.Pass()); |
| 898 controller().Restore( | 898 controller().Restore( |
| 899 0, | 899 0, |
| 900 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 900 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
| 901 &entries); | 901 &entries); |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3366 backend->AllowCertForHost(*cert, test_url.host(), 1); | 3366 backend->AllowCertForHost(*cert, test_url.host(), 1); |
| 3367 EXPECT_TRUE(backend->HasAllowException(test_url.host())); | 3367 EXPECT_TRUE(backend->HasAllowException(test_url.host())); |
| 3368 | 3368 |
| 3369 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type", | 3369 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type", |
| 3370 RESOURCE_TYPE_MAIN_FRAME); | 3370 RESOURCE_TYPE_MAIN_FRAME); |
| 3371 | 3371 |
| 3372 EXPECT_TRUE(backend->HasAllowException(test_url.host())); | 3372 EXPECT_TRUE(backend->HasAllowException(test_url.host())); |
| 3373 } | 3373 } |
| 3374 | 3374 |
| 3375 } // namespace content | 3375 } // namespace content |
| OLD | NEW |