Chromium Code Reviews| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "content/public/browser/interstitial_page.h" | 64 #include "content/public/browser/interstitial_page.h" |
| 65 #include "content/public/browser/navigation_controller.h" | 65 #include "content/public/browser/navigation_controller.h" |
| 66 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
| 67 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 68 #include "content/public/browser/render_frame_host.h" | 68 #include "content/public/browser/render_frame_host.h" |
| 69 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
| 70 #include "content/public/browser/render_widget_host_view.h" | 70 #include "content/public/browser/render_widget_host_view.h" |
| 71 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
| 72 #include "content/public/browser/web_contents_observer.h" | 72 #include "content/public/browser/web_contents_observer.h" |
| 73 #include "content/public/common/content_switches.h" | 73 #include "content/public/common/content_switches.h" |
| 74 #include "content/public/common/page_state.h" | |
| 74 #include "content/public/common/security_style.h" | 75 #include "content/public/common/security_style.h" |
| 75 #include "content/public/common/ssl_status.h" | 76 #include "content/public/common/ssl_status.h" |
| 76 #include "content/public/test/browser_test_utils.h" | 77 #include "content/public/test/browser_test_utils.h" |
| 77 #include "content/public/test/download_test_observer.h" | 78 #include "content/public/test/download_test_observer.h" |
| 78 #include "content/public/test/test_navigation_observer.h" | 79 #include "content/public/test/test_navigation_observer.h" |
| 79 #include "content/public/test/test_renderer_host.h" | 80 #include "content/public/test/test_renderer_host.h" |
| 80 #include "content/public/test/test_utils.h" | 81 #include "content/public/test/test_utils.h" |
| 81 #include "net/base/host_port_pair.h" | 82 #include "net/base/host_port_pair.h" |
| 82 #include "net/base/net_errors.h" | 83 #include "net/base/net_errors.h" |
| 83 #include "net/cert/cert_status_flags.h" | 84 #include "net/cert/cert_status_flags.h" |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3118 | 3119 |
| 3119 ui_test_utils::NavigateToURL(browser(), | 3120 ui_test_utils::NavigateToURL(browser(), |
| 3120 https_server.GetURL("/ssl/google.html")); | 3121 https_server.GetURL("/ssl/google.html")); |
| 3121 | 3122 |
| 3122 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), | 3123 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), |
| 3123 net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION, | 3124 net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION, |
| 3124 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | 3125 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, |
| 3125 AuthState::SHOWING_INTERSTITIAL); | 3126 AuthState::SHOWING_INTERSTITIAL); |
| 3126 } | 3127 } |
| 3127 | 3128 |
| 3129 IN_PROC_BROWSER_TEST_F(SSLUITest, RestoreHasSSLState) { | |
| 3130 ASSERT_TRUE(https_server_.Start()); | |
| 3131 GURL url(https_server_.GetURL("/ssl/google.html")); | |
| 3132 ui_test_utils::NavigateToURL(browser(), url); | |
| 3133 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 3134 CheckAuthenticatedState(tab, AuthState::NONE); | |
| 3135 | |
| 3136 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | |
|
nasko
2016/09/01 01:35:29
GetLastCommittedEntry(). GetActiveEntry is depreca
jam
2016/09/01 02:58:56
Done.
| |
| 3137 std::unique_ptr<NavigationEntry> restored_entry = | |
| 3138 content::NavigationController::CreateNavigationEntry( | |
| 3139 url, content::Referrer(), ui::PAGE_TRANSITION_RELOAD, false, | |
| 3140 std::string(), tab->GetBrowserContext()); | |
| 3141 restored_entry->SetPageID(0); | |
| 3142 restored_entry->SetPageState(entry->GetPageState()); | |
| 3143 | |
| 3144 WebContents::CreateParams params(tab->GetBrowserContext()); | |
| 3145 WebContents* tab2 = WebContents::Create(params); | |
| 3146 tab->GetDelegate()->AddNewContents( | |
| 3147 nullptr, tab2, WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect(), | |
| 3148 false, nullptr); | |
| 3149 std::vector<std::unique_ptr<NavigationEntry>> entries; | |
| 3150 entries.push_back(std::move(restored_entry)); | |
| 3151 content::TestNavigationObserver observer(tab2); | |
| 3152 tab2->GetController().Restore( | |
| 3153 entries.size() - 1, | |
| 3154 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); | |
| 3155 tab2->GetController().LoadIfNecessary(); | |
| 3156 observer.Wait(); | |
| 3157 CheckAuthenticatedState(tab2, AuthState::NONE); | |
| 3158 } | |
| 3159 | |
| 3128 // TODO(jcampan): more tests to do below. | 3160 // TODO(jcampan): more tests to do below. |
| 3129 | 3161 |
| 3130 // Visit a page over https that contains a frame with a redirect. | 3162 // Visit a page over https that contains a frame with a redirect. |
| 3131 | 3163 |
| 3132 // XMLHttpRequest insecure content in synchronous mode. | 3164 // XMLHttpRequest insecure content in synchronous mode. |
| 3133 | 3165 |
| 3134 // XMLHttpRequest insecure content in asynchronous mode. | 3166 // XMLHttpRequest insecure content in asynchronous mode. |
| 3135 | 3167 |
| 3136 // XMLHttpRequest over bad ssl in synchronous mode. | 3168 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3137 | 3169 |
| 3138 // XMLHttpRequest over OK ssl in synchronous mode. | 3170 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |