OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/time.h" | 5 #include "base/time.h" |
6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
7 #include "chrome/browser/pref_service.h" | 7 #include "chrome/browser/pref_service.h" |
8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
9 #include "chrome/browser/tab_contents/interstitial_page.h" | 9 #include "chrome/browser/tab_contents/interstitial_page.h" |
10 #include "chrome/browser/tab_contents/navigation_entry.h" | 10 #include "chrome/browser/tab_contents/navigation_entry.h" |
11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "chrome/test/in_process_browser_test.h" | 13 #include "chrome/test/in_process_browser_test.h" |
14 #include "chrome/test/ui_test_utils.h" | 14 #include "chrome/test/ui_test_utils.h" |
| 15 #include "net/base/cert_status_flags.h" |
| 16 #include "net/test/test_server.h" |
15 | 17 |
16 const wchar_t kDocRoot[] = L"chrome/test/data"; | 18 const wchar_t kDocRoot[] = L"chrome/test/data"; |
17 | 19 |
18 class SSLUITest : public InProcessBrowserTest { | 20 class SSLUITest : public InProcessBrowserTest { |
19 public: | 21 public: |
20 SSLUITest() { | 22 SSLUITest() { |
21 EnableDOMAutomation(); | 23 EnableDOMAutomation(); |
22 } | 24 } |
23 | 25 |
24 scoped_refptr<HTTPTestServer> PlainServer() { | 26 scoped_refptr<net::HTTPTestServer> PlainServer() { |
25 return HTTPTestServer::CreateServer(kDocRoot); | 27 return net::HTTPTestServer::CreateServer(kDocRoot); |
26 } | 28 } |
27 | 29 |
28 scoped_refptr<HTTPSTestServer> GoodCertServer() { | 30 scoped_refptr<net::HTTPSTestServer> GoodCertServer() { |
29 return HTTPSTestServer::CreateGoodServer(kDocRoot); | 31 return net::HTTPSTestServer::CreateGoodServer(kDocRoot); |
30 } | 32 } |
31 | 33 |
32 scoped_refptr<HTTPSTestServer> BadCertServer() { | 34 scoped_refptr<net::HTTPSTestServer> BadCertServer() { |
33 return HTTPSTestServer::CreateExpiredServer(kDocRoot); | 35 return net::HTTPSTestServer::CreateExpiredServer(kDocRoot); |
34 } | 36 } |
35 | 37 |
36 void CheckAuthenticatedState(TabContents* tab, | 38 void CheckAuthenticatedState(TabContents* tab, |
37 bool displayed_insecure_content) { | 39 bool displayed_insecure_content) { |
38 NavigationEntry* entry = tab->controller().GetActiveEntry(); | 40 NavigationEntry* entry = tab->controller().GetActiveEntry(); |
39 ASSERT_TRUE(entry); | 41 ASSERT_TRUE(entry); |
40 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type()); | 42 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type()); |
41 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style()); | 43 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style()); |
42 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); | 44 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); |
43 EXPECT_EQ(displayed_insecure_content, | 45 EXPECT_EQ(displayed_insecure_content, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Wait for the navigation to be done. | 115 // Wait for the navigation to be done. |
114 ui_test_utils::WaitForNavigation(&(tab->controller())); | 116 ui_test_utils::WaitForNavigation(&(tab->controller())); |
115 } | 117 } |
116 | 118 |
117 private: | 119 private: |
118 DISALLOW_COPY_AND_ASSIGN(SSLUITest); | 120 DISALLOW_COPY_AND_ASSIGN(SSLUITest); |
119 }; | 121 }; |
120 | 122 |
121 // Visits a regular page over http. | 123 // Visits a regular page over http. |
122 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { | 124 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { |
123 scoped_refptr<HTTPTestServer> server = PlainServer(); | 125 scoped_refptr<net::HTTPTestServer> server = PlainServer(); |
124 ASSERT_TRUE(server.get() != NULL); | 126 ASSERT_TRUE(server.get() != NULL); |
125 | 127 |
126 ui_test_utils::NavigateToURL(browser(), | 128 ui_test_utils::NavigateToURL(browser(), |
127 server->TestServerPage("files/ssl/google.html")); | 129 server->TestServerPage("files/ssl/google.html")); |
128 | 130 |
129 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 131 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); |
130 } | 132 } |
131 | 133 |
132 // Visits a page over http which includes broken https resources (status should | 134 // Visits a page over http which includes broken https resources (status should |
133 // be OK). | 135 // be OK). |
134 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give | 136 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give |
135 // the secure cookies away!). | 137 // the secure cookies away!). |
136 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 138 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
137 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 139 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
138 ASSERT_TRUE(http_server.get() != NULL); | 140 ASSERT_TRUE(http_server.get() != NULL); |
139 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 141 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
140 ASSERT_TRUE(bad_https_server.get() != NULL); | 142 ASSERT_TRUE(bad_https_server.get() != NULL); |
141 | 143 |
142 ui_test_utils::NavigateToURL(browser(), | 144 ui_test_utils::NavigateToURL(browser(), |
143 http_server->TestServerPage("files/ssl/page_with_unsafe_contents.html")); | 145 http_server->TestServerPage("files/ssl/page_with_unsafe_contents.html")); |
144 | 146 |
145 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 147 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); |
146 } | 148 } |
147 | 149 |
148 // Visits a page over OK https: | 150 // Visits a page over OK https: |
149 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) { | 151 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) { |
150 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 152 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
151 ASSERT_TRUE(https_server.get() != NULL); | 153 ASSERT_TRUE(https_server.get() != NULL); |
152 | 154 |
153 ui_test_utils::NavigateToURL(browser(), | 155 ui_test_utils::NavigateToURL(browser(), |
154 https_server->TestServerPage("files/ssl/google.html")); | 156 https_server->TestServerPage("files/ssl/google.html")); |
155 | 157 |
156 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); | 158 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); |
157 } | 159 } |
158 | 160 |
159 // Visits a page with https error and proceed: | 161 // Visits a page with https error and proceed: |
160 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { | 162 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { |
161 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 163 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
162 ASSERT_TRUE(bad_https_server.get() != NULL); | 164 ASSERT_TRUE(bad_https_server.get() != NULL); |
163 | 165 |
164 ui_test_utils::NavigateToURL(browser(), | 166 ui_test_utils::NavigateToURL(browser(), |
165 bad_https_server->TestServerPage("files/ssl/google.html")); | 167 bad_https_server->TestServerPage("files/ssl/google.html")); |
166 | 168 |
167 TabContents* tab = browser()->GetSelectedTabContents(); | 169 TabContents* tab = browser()->GetSelectedTabContents(); |
168 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 170 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
169 true); // Interstitial showing | 171 true); // Interstitial showing |
170 | 172 |
171 ProceedThroughInterstitial(tab); | 173 ProceedThroughInterstitial(tab); |
172 | 174 |
173 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 175 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
174 false); // No interstitial showing | 176 false); // No interstitial showing |
175 } | 177 } |
176 | 178 |
177 // Visits a page with https error and don't proceed (and ensure we can still | 179 // Visits a page with https error and don't proceed (and ensure we can still |
178 // navigate at that point): | 180 // navigate at that point): |
179 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
180 // Disabled, flakily exceeds test timeout, http://crbug.com/43575. | 182 // Disabled, flakily exceeds test timeout, http://crbug.com/43575. |
181 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 183 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
182 DISABLED_TestHTTPSExpiredCertAndDontProceed | 184 DISABLED_TestHTTPSExpiredCertAndDontProceed |
183 #else | 185 #else |
184 // Marked as flaky, see bug 40932. | 186 // Marked as flaky, see bug 40932. |
185 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 187 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
186 FLAKY_TestHTTPSExpiredCertAndDontProceed | 188 FLAKY_TestHTTPSExpiredCertAndDontProceed |
187 #endif | 189 #endif |
188 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { | 190 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { |
189 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 191 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
190 ASSERT_TRUE(http_server.get() != NULL); | 192 ASSERT_TRUE(http_server.get() != NULL); |
191 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 193 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
192 ASSERT_TRUE(good_https_server.get() != NULL); | 194 ASSERT_TRUE(good_https_server.get() != NULL); |
193 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 195 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
194 ASSERT_TRUE(bad_https_server.get() != NULL); | 196 ASSERT_TRUE(bad_https_server.get() != NULL); |
195 | 197 |
196 // First navigate to an OK page. | 198 // First navigate to an OK page. |
197 ui_test_utils::NavigateToURL(browser(), | 199 ui_test_utils::NavigateToURL(browser(), |
198 good_https_server->TestServerPage("files/ssl/google.html")); | 200 good_https_server->TestServerPage("files/ssl/google.html")); |
199 | 201 |
200 TabContents* tab = browser()->GetSelectedTabContents(); | 202 TabContents* tab = browser()->GetSelectedTabContents(); |
201 NavigationEntry* entry = tab->controller().GetActiveEntry(); | 203 NavigationEntry* entry = tab->controller().GetActiveEntry(); |
202 ASSERT_TRUE(entry); | 204 ASSERT_TRUE(entry); |
203 | 205 |
(...skipping 23 matching lines...) Expand all Loading... |
227 CheckAuthenticatedState(tab, false); | 229 CheckAuthenticatedState(tab, false); |
228 | 230 |
229 // Try to navigate to a new page. (to make sure bug 5800 is fixed). | 231 // Try to navigate to a new page. (to make sure bug 5800 is fixed). |
230 ui_test_utils::NavigateToURL(browser(), | 232 ui_test_utils::NavigateToURL(browser(), |
231 http_server->TestServerPage("files/ssl/google.html")); | 233 http_server->TestServerPage("files/ssl/google.html")); |
232 CheckUnauthenticatedState(tab); | 234 CheckUnauthenticatedState(tab); |
233 } | 235 } |
234 | 236 |
235 // Visits a page with https error and then goes back using Browser::GoBack. | 237 // Visits a page with https error and then goes back using Browser::GoBack. |
236 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBackViaButton) { | 238 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBackViaButton) { |
237 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 239 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
238 ASSERT_TRUE(http_server.get() != NULL); | 240 ASSERT_TRUE(http_server.get() != NULL); |
239 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 241 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
240 ASSERT_TRUE(bad_https_server.get() != NULL); | 242 ASSERT_TRUE(bad_https_server.get() != NULL); |
241 | 243 |
242 // First navigate to an HTTP page. | 244 // First navigate to an HTTP page. |
243 ui_test_utils::NavigateToURL(browser(), | 245 ui_test_utils::NavigateToURL(browser(), |
244 http_server->TestServerPage("files/ssl/google.html")); | 246 http_server->TestServerPage("files/ssl/google.html")); |
245 TabContents* tab = browser()->GetSelectedTabContents(); | 247 TabContents* tab = browser()->GetSelectedTabContents(); |
246 NavigationEntry* entry = tab->controller().GetActiveEntry(); | 248 NavigationEntry* entry = tab->controller().GetActiveEntry(); |
247 ASSERT_TRUE(entry); | 249 ASSERT_TRUE(entry); |
248 | 250 |
249 // Now go to a bad HTTPS page that shows an interstitial. | 251 // Now go to a bad HTTPS page that shows an interstitial. |
250 ui_test_utils::NavigateToURL(browser(), | 252 ui_test_utils::NavigateToURL(browser(), |
251 bad_https_server->TestServerPage("files/ssl/google.html")); | 253 bad_https_server->TestServerPage("files/ssl/google.html")); |
252 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 254 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
253 true); // Interstitial showing | 255 true); // Interstitial showing |
254 | 256 |
255 // Simulate user clicking on back button (crbug.com/39248). | 257 // Simulate user clicking on back button (crbug.com/39248). |
256 browser()->GoBack(CURRENT_TAB); | 258 browser()->GoBack(CURRENT_TAB); |
257 | 259 |
258 // We should be back at the original good page. | 260 // We should be back at the original good page. |
259 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); | 261 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); |
260 CheckUnauthenticatedState(tab); | 262 CheckUnauthenticatedState(tab); |
261 } | 263 } |
262 | 264 |
263 // Visits a page with https error and then goes back using GoToOffset. | 265 // Visits a page with https error and then goes back using GoToOffset. |
264 // Marked as flaky, see bug 40932. | 266 // Marked as flaky, see bug 40932. |
265 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { | 267 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { |
266 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 268 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
267 ASSERT_TRUE(http_server.get() != NULL); | 269 ASSERT_TRUE(http_server.get() != NULL); |
268 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 270 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
269 ASSERT_TRUE(bad_https_server.get() != NULL); | 271 ASSERT_TRUE(bad_https_server.get() != NULL); |
270 | 272 |
271 // First navigate to an HTTP page. | 273 // First navigate to an HTTP page. |
272 ui_test_utils::NavigateToURL(browser(), | 274 ui_test_utils::NavigateToURL(browser(), |
273 http_server->TestServerPage("files/ssl/google.html")); | 275 http_server->TestServerPage("files/ssl/google.html")); |
274 TabContents* tab = browser()->GetSelectedTabContents(); | 276 TabContents* tab = browser()->GetSelectedTabContents(); |
275 NavigationEntry* entry = tab->controller().GetActiveEntry(); | 277 NavigationEntry* entry = tab->controller().GetActiveEntry(); |
276 ASSERT_TRUE(entry); | 278 ASSERT_TRUE(entry); |
277 | 279 |
278 // Now go to a bad HTTPS page that shows an interstitial. | 280 // Now go to a bad HTTPS page that shows an interstitial. |
279 ui_test_utils::NavigateToURL(browser(), | 281 ui_test_utils::NavigateToURL(browser(), |
280 bad_https_server->TestServerPage("files/ssl/google.html")); | 282 bad_https_server->TestServerPage("files/ssl/google.html")); |
281 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 283 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
282 true); // Interstitial showing | 284 true); // Interstitial showing |
283 | 285 |
284 // Simulate user clicking and holding on back button (crbug.com/37215). | 286 // Simulate user clicking and holding on back button (crbug.com/37215). |
285 tab->controller().GoToOffset(-1); | 287 tab->controller().GoToOffset(-1); |
286 | 288 |
287 // We should be back at the original good page. | 289 // We should be back at the original good page. |
288 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); | 290 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); |
289 CheckUnauthenticatedState(tab); | 291 CheckUnauthenticatedState(tab); |
290 } | 292 } |
291 | 293 |
292 // Visits a page with https error and then goes forward using GoToOffset. | 294 // Visits a page with https error and then goes forward using GoToOffset. |
293 // Marked as flaky, see bug 40932. | 295 // Marked as flaky, see bug 40932. |
294 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { | 296 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { |
295 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 297 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
296 ASSERT_TRUE(http_server.get() != NULL); | 298 ASSERT_TRUE(http_server.get() != NULL); |
297 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 299 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
298 ASSERT_TRUE(bad_https_server.get() != NULL); | 300 ASSERT_TRUE(bad_https_server.get() != NULL); |
299 | 301 |
300 // First navigate to two HTTP pages. | 302 // First navigate to two HTTP pages. |
301 ui_test_utils::NavigateToURL(browser(), | 303 ui_test_utils::NavigateToURL(browser(), |
302 http_server->TestServerPage("files/ssl/google.html")); | 304 http_server->TestServerPage("files/ssl/google.html")); |
303 TabContents* tab = browser()->GetSelectedTabContents(); | 305 TabContents* tab = browser()->GetSelectedTabContents(); |
304 NavigationEntry* entry1 = tab->controller().GetActiveEntry(); | 306 NavigationEntry* entry1 = tab->controller().GetActiveEntry(); |
305 ASSERT_TRUE(entry1); | 307 ASSERT_TRUE(entry1); |
306 ui_test_utils::NavigateToURL(browser(), | 308 ui_test_utils::NavigateToURL(browser(), |
307 http_server->TestServerPage("files/ssl/blank_page.html")); | 309 http_server->TestServerPage("files/ssl/blank_page.html")); |
(...skipping 23 matching lines...) Expand all Loading... |
331 EXPECT_FALSE(tab->controller().CanGoForward()); | 333 EXPECT_FALSE(tab->controller().CanGoForward()); |
332 NavigationEntry* entry4 = tab->controller().GetActiveEntry(); | 334 NavigationEntry* entry4 = tab->controller().GetActiveEntry(); |
333 EXPECT_TRUE(entry2 == entry4); | 335 EXPECT_TRUE(entry2 == entry4); |
334 } | 336 } |
335 | 337 |
336 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 338 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
337 // link with a blank target). This is to test that the lack of navigation entry | 339 // link with a blank target). This is to test that the lack of navigation entry |
338 // does not cause any problems (it was causing a crasher, see | 340 // does not cause any problems (it was causing a crasher, see |
339 // http://crbug.com/19941). | 341 // http://crbug.com/19941). |
340 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { | 342 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { |
341 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 343 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
342 ASSERT_TRUE(http_server.get() != NULL); | 344 ASSERT_TRUE(http_server.get() != NULL); |
343 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 345 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
344 ASSERT_TRUE(bad_https_server.get() != NULL); | 346 ASSERT_TRUE(bad_https_server.get() != NULL); |
345 | 347 |
346 // Load a page with a link that opens a new window (therefore with no history | 348 // Load a page with a link that opens a new window (therefore with no history |
347 // and no navigation entries). | 349 // and no navigation entries). |
348 ui_test_utils::NavigateToURL(browser(), | 350 ui_test_utils::NavigateToURL(browser(), |
349 http_server->TestServerPage("files/ssl/page_with_blank_target.html")); | 351 http_server->TestServerPage("files/ssl/page_with_blank_target.html")); |
350 | 352 |
351 bool success = false; | 353 bool success = false; |
352 | 354 |
353 ui_test_utils::WindowedNotificationObserver<NavigationController> | 355 ui_test_utils::WindowedNotificationObserver<NavigationController> |
(...skipping 21 matching lines...) Expand all Loading... |
375 // We should have an interstitial page showing. | 377 // We should have an interstitial page showing. |
376 ASSERT_TRUE(browser()->GetSelectedTabContents()->interstitial_page()); | 378 ASSERT_TRUE(browser()->GetSelectedTabContents()->interstitial_page()); |
377 } | 379 } |
378 | 380 |
379 // | 381 // |
380 // Insecure content | 382 // Insecure content |
381 // | 383 // |
382 | 384 |
383 // Visits a page that displays insecure content. | 385 // Visits a page that displays insecure content. |
384 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { | 386 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { |
385 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 387 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
386 ASSERT_TRUE(https_server.get() != NULL); | 388 ASSERT_TRUE(https_server.get() != NULL); |
387 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 389 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
388 ASSERT_TRUE(http_server.get() != NULL); | 390 ASSERT_TRUE(http_server.get() != NULL); |
389 | 391 |
390 // Load a page that displays insecure content. | 392 // Load a page that displays insecure content. |
391 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( | 393 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( |
392 "files/ssl/page_displays_insecure_content.html")); | 394 "files/ssl/page_displays_insecure_content.html")); |
393 | 395 |
394 CheckAuthenticatedState(browser()->GetSelectedTabContents(), true); | 396 CheckAuthenticatedState(browser()->GetSelectedTabContents(), true); |
395 } | 397 } |
396 | 398 |
397 // Visits a page that runs insecure content and tries to suppress the insecure | 399 // Visits a page that runs insecure content and tries to suppress the insecure |
398 // content warnings by randomizing location.hash. | 400 // content warnings by randomizing location.hash. |
399 // Based on http://crbug.com/8706 | 401 // Based on http://crbug.com/8706 |
400 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecuredContentRandomizeHash) { | 402 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecuredContentRandomizeHash) { |
401 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 403 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
402 ASSERT_TRUE(https_server.get() != NULL); | 404 ASSERT_TRUE(https_server.get() != NULL); |
403 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 405 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
404 ASSERT_TRUE(http_server.get() != NULL); | 406 ASSERT_TRUE(http_server.get() != NULL); |
405 | 407 |
406 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( | 408 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( |
407 "files/ssl/page_runs_insecure_content.html")); | 409 "files/ssl/page_runs_insecure_content.html")); |
408 | 410 |
409 CheckAuthenticationBrokenState(browser()->GetSelectedTabContents(), 0, true, | 411 CheckAuthenticationBrokenState(browser()->GetSelectedTabContents(), 0, true, |
410 false); | 412 false); |
411 } | 413 } |
412 | 414 |
413 // Visits a page with unsafe content and make sure that: | 415 // Visits a page with unsafe content and make sure that: |
414 // - frames content is replaced with warning | 416 // - frames content is replaced with warning |
415 // - images and scripts are filtered out entirely | 417 // - images and scripts are filtered out entirely |
416 // Marked as flaky, see bug 40932. | 418 // Marked as flaky, see bug 40932. |
417 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { | 419 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { |
418 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 420 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
419 ASSERT_TRUE(good_https_server.get() != NULL); | 421 ASSERT_TRUE(good_https_server.get() != NULL); |
420 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 422 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
421 ASSERT_TRUE(bad_https_server.get() != NULL); | 423 ASSERT_TRUE(bad_https_server.get() != NULL); |
422 | 424 |
423 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage( | 425 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage( |
424 "files/ssl/page_with_unsafe_contents.html")); | 426 "files/ssl/page_with_unsafe_contents.html")); |
425 | 427 |
426 TabContents* tab = browser()->GetSelectedTabContents(); | 428 TabContents* tab = browser()->GetSelectedTabContents(); |
427 // When the bad content is filtered, the state is expected to be | 429 // When the bad content is filtered, the state is expected to be |
428 // authenticated. | 430 // authenticated. |
429 CheckAuthenticatedState(tab, false); | 431 CheckAuthenticatedState(tab, false); |
430 | 432 |
(...skipping 16 matching lines...) Expand all Loading... |
447 bool js_result = false; | 449 bool js_result = false; |
448 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 450 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
449 tab->render_view_host(), std::wstring(), | 451 tab->render_view_host(), std::wstring(), |
450 L"window.domAutomationController.send(IsFooSet());", &js_result)); | 452 L"window.domAutomationController.send(IsFooSet());", &js_result)); |
451 EXPECT_FALSE(js_result); | 453 EXPECT_FALSE(js_result); |
452 } | 454 } |
453 | 455 |
454 // Visits a page with insecure content loaded by JS (after the initial page | 456 // Visits a page with insecure content loaded by JS (after the initial page |
455 // load). | 457 // load). |
456 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) { | 458 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) { |
457 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 459 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
458 ASSERT_TRUE(https_server.get() != NULL); | 460 ASSERT_TRUE(https_server.get() != NULL); |
459 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 461 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
460 ASSERT_TRUE(http_server.get() != NULL); | 462 ASSERT_TRUE(http_server.get() != NULL); |
461 | 463 |
462 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( | 464 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( |
463 "files/ssl/page_with_dynamic_insecure_content.html")); | 465 "files/ssl/page_with_dynamic_insecure_content.html")); |
464 | 466 |
465 TabContents* tab = browser()->GetSelectedTabContents(); | 467 TabContents* tab = browser()->GetSelectedTabContents(); |
466 CheckAuthenticatedState(tab, false); | 468 CheckAuthenticatedState(tab, false); |
467 | 469 |
468 // Load the insecure image. | 470 // Load the insecure image. |
469 bool js_result = false; | 471 bool js_result = false; |
470 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 472 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
471 tab->render_view_host(), std::wstring(), L"loadBadImage();", &js_result)); | 473 tab->render_view_host(), std::wstring(), L"loadBadImage();", &js_result)); |
472 EXPECT_TRUE(js_result); | 474 EXPECT_TRUE(js_result); |
473 | 475 |
474 // We should now have insecure content. | 476 // We should now have insecure content. |
475 CheckAuthenticatedState(tab, true); | 477 CheckAuthenticatedState(tab, true); |
476 } | 478 } |
477 | 479 |
478 // Visits two pages from the same origin: one that displays insecure content and | 480 // Visits two pages from the same origin: one that displays insecure content and |
479 // one that doesn't. The test checks that we do not propagate the insecure | 481 // one that doesn't. The test checks that we do not propagate the insecure |
480 // content state from one to the other. | 482 // content state from one to the other. |
481 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { | 483 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { |
482 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 484 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
483 ASSERT_TRUE(https_server.get() != NULL); | 485 ASSERT_TRUE(https_server.get() != NULL); |
484 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 486 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
485 ASSERT_TRUE(http_server.get() != NULL); | 487 ASSERT_TRUE(http_server.get() != NULL); |
486 | 488 |
487 ui_test_utils::NavigateToURL(browser(), | 489 ui_test_utils::NavigateToURL(browser(), |
488 https_server->TestServerPage("files/ssl/blank_page.html")); | 490 https_server->TestServerPage("files/ssl/blank_page.html")); |
489 | 491 |
490 TabContents* tab1 = browser()->GetSelectedTabContents(); | 492 TabContents* tab1 = browser()->GetSelectedTabContents(); |
491 | 493 |
492 // This tab should be fine. | 494 // This tab should be fine. |
493 CheckAuthenticatedState(tab1, false); | 495 CheckAuthenticatedState(tab1, false); |
494 | 496 |
495 // Create a new tab. | 497 // Create a new tab. |
496 GURL url = https_server->TestServerPage( | 498 GURL url = https_server->TestServerPage( |
497 "files/ssl/page_displays_insecure_content.html"); | 499 "files/ssl/page_displays_insecure_content.html"); |
498 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), | 500 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), |
499 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, | 501 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, |
500 tab1->GetSiteInstance(), std::string()); | 502 tab1->GetSiteInstance(), std::string()); |
501 ui_test_utils::WaitForNavigation(&(tab2->controller())); | 503 ui_test_utils::WaitForNavigation(&(tab2->controller())); |
502 | 504 |
503 // The new tab has insecure content. | 505 // The new tab has insecure content. |
504 CheckAuthenticatedState(tab2, true); | 506 CheckAuthenticatedState(tab2, true); |
505 | 507 |
506 // The original tab should not be contaminated. | 508 // The original tab should not be contaminated. |
507 CheckAuthenticatedState(tab1, false); | 509 CheckAuthenticatedState(tab1, false); |
508 } | 510 } |
509 | 511 |
510 // Visits two pages from the same origin: one that runs insecure content and one | 512 // Visits two pages from the same origin: one that runs insecure content and one |
511 // that doesn't. The test checks that we propagate the insecure content state | 513 // that doesn't. The test checks that we propagate the insecure content state |
512 // from one to the other. | 514 // from one to the other. |
513 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { | 515 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { |
514 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 516 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
515 ASSERT_TRUE(https_server.get() != NULL); | 517 ASSERT_TRUE(https_server.get() != NULL); |
516 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 518 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
517 ASSERT_TRUE(http_server.get() != NULL); | 519 ASSERT_TRUE(http_server.get() != NULL); |
518 | 520 |
519 ui_test_utils::NavigateToURL(browser(), | 521 ui_test_utils::NavigateToURL(browser(), |
520 https_server->TestServerPage("files/ssl/blank_page.html")); | 522 https_server->TestServerPage("files/ssl/blank_page.html")); |
521 | 523 |
522 TabContents* tab1 = browser()->GetSelectedTabContents(); | 524 TabContents* tab1 = browser()->GetSelectedTabContents(); |
523 | 525 |
524 // This tab should be fine. | 526 // This tab should be fine. |
525 CheckAuthenticatedState(tab1, false); | 527 CheckAuthenticatedState(tab1, false); |
526 | 528 |
(...skipping 10 matching lines...) Expand all Loading... |
537 | 539 |
538 // Which means the origin for the first tab has also been contaminated with | 540 // Which means the origin for the first tab has also been contaminated with |
539 // insecure content. | 541 // insecure content. |
540 CheckAuthenticationBrokenState(tab1, 0, true, false); | 542 CheckAuthenticationBrokenState(tab1, 0, true, false); |
541 } | 543 } |
542 | 544 |
543 // Visits a page with an image over http. Visits another page over https | 545 // Visits a page with an image over http. Visits another page over https |
544 // referencing that same image over http (hoping it is coming from the webcore | 546 // referencing that same image over http (hoping it is coming from the webcore |
545 // memory cache). | 547 // memory cache). |
546 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { | 548 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { |
547 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 549 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
548 ASSERT_TRUE(https_server.get() != NULL); | 550 ASSERT_TRUE(https_server.get() != NULL); |
549 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 551 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
550 ASSERT_TRUE(http_server.get() != NULL); | 552 ASSERT_TRUE(http_server.get() != NULL); |
551 | 553 |
552 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage( | 554 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage( |
553 "files/ssl/page_displays_insecure_content.html")); | 555 "files/ssl/page_displays_insecure_content.html")); |
554 TabContents* tab = browser()->GetSelectedTabContents(); | 556 TabContents* tab = browser()->GetSelectedTabContents(); |
555 CheckUnauthenticatedState(tab); | 557 CheckUnauthenticatedState(tab); |
556 | 558 |
557 // Load again but over SSL. It should be marked as displaying insecure | 559 // Load again but over SSL. It should be marked as displaying insecure |
558 // content (even though the image comes from the WebCore memory cache). | 560 // content (even though the image comes from the WebCore memory cache). |
559 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( | 561 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( |
560 "files/ssl/page_displays_insecure_content.html")); | 562 "files/ssl/page_displays_insecure_content.html")); |
561 CheckAuthenticatedState(tab, true); | 563 CheckAuthenticatedState(tab, true); |
562 } | 564 } |
563 | 565 |
564 // Visits a page with script over http. Visits another page over https | 566 // Visits a page with script over http. Visits another page over https |
565 // referencing that same script over http (hoping it is coming from the webcore | 567 // referencing that same script over http (hoping it is coming from the webcore |
566 // memory cache). | 568 // memory cache). |
567 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsCachedInsecureContent) { | 569 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsCachedInsecureContent) { |
568 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 570 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
569 ASSERT_TRUE(https_server.get() != NULL); | 571 ASSERT_TRUE(https_server.get() != NULL); |
570 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 572 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
571 ASSERT_TRUE(http_server.get() != NULL); | 573 ASSERT_TRUE(http_server.get() != NULL); |
572 | 574 |
573 ui_test_utils::NavigateToURL(browser(), | 575 ui_test_utils::NavigateToURL(browser(), |
574 http_server->TestServerPage("files/ssl/page_runs_insecure_content.html")); | 576 http_server->TestServerPage("files/ssl/page_runs_insecure_content.html")); |
575 TabContents* tab = browser()->GetSelectedTabContents(); | 577 TabContents* tab = browser()->GetSelectedTabContents(); |
576 CheckUnauthenticatedState(tab); | 578 CheckUnauthenticatedState(tab); |
577 | 579 |
578 // Load again but over SSL. It should be marked as displaying insecure | 580 // Load again but over SSL. It should be marked as displaying insecure |
579 // content (even though the image comes from the WebCore memory cache). | 581 // content (even though the image comes from the WebCore memory cache). |
580 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( | 582 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage( |
581 "files/ssl/page_runs_insecure_content.html")); | 583 "files/ssl/page_runs_insecure_content.html")); |
582 CheckAuthenticationBrokenState(tab, 0, true, false); | 584 CheckAuthenticationBrokenState(tab, 0, true, false); |
583 } | 585 } |
584 | 586 |
585 #if defined(OS_WIN) | 587 #if defined(OS_WIN) |
586 // See http://crbug.com/47170 | 588 // See http://crbug.com/47170 |
587 #define MAYBE_TestCNInvalidStickiness FLAKY_TestCNInvalidStickiness | 589 #define MAYBE_TestCNInvalidStickiness FLAKY_TestCNInvalidStickiness |
588 #else | 590 #else |
589 #define MAYBE_TestCNInvalidStickiness TestCNInvalidStickiness | 591 #define MAYBE_TestCNInvalidStickiness TestCNInvalidStickiness |
590 #endif | 592 #endif |
591 | 593 |
592 // This test ensures the CN invalid status does not 'stick' to a certificate | 594 // This test ensures the CN invalid status does not 'stick' to a certificate |
593 // (see bug #1044942) and that it depends on the host-name. | 595 // (see bug #1044942) and that it depends on the host-name. |
594 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestCNInvalidStickiness) { | 596 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestCNInvalidStickiness) { |
595 const std::string kLocalHost = "localhost"; | 597 const std::string kLocalHost = "localhost"; |
596 scoped_refptr<HTTPSTestServer> https_server = | 598 scoped_refptr<net::HTTPSTestServer> https_server = |
597 HTTPSTestServer::CreateMismatchedServer(kDocRoot); | 599 net::HTTPSTestServer::CreateMismatchedServer(kDocRoot); |
598 ASSERT_TRUE(https_server.get() != NULL); | 600 ASSERT_TRUE(https_server.get() != NULL); |
599 | 601 |
600 // First we hit the server with hostname, this generates an invalid policy | 602 // First we hit the server with hostname, this generates an invalid policy |
601 // error. | 603 // error. |
602 ui_test_utils::NavigateToURL(browser(), | 604 ui_test_utils::NavigateToURL(browser(), |
603 https_server->TestServerPage("files/ssl/google.html")); | 605 https_server->TestServerPage("files/ssl/google.html")); |
604 | 606 |
605 // We get an interstitial page as a result. | 607 // We get an interstitial page as a result. |
606 TabContents* tab = browser()->GetSelectedTabContents(); | 608 TabContents* tab = browser()->GetSelectedTabContents(); |
607 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 609 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
(...skipping 24 matching lines...) Expand all Loading... |
632 ui_test_utils::NavigateToURL(browser(), | 634 ui_test_utils::NavigateToURL(browser(), |
633 https_server->TestServerPage("files/ssl/google.html")); | 635 https_server->TestServerPage("files/ssl/google.html")); |
634 | 636 |
635 // Since we OKed the interstitial last time, we get right to the page. | 637 // Since we OKed the interstitial last time, we get right to the page. |
636 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 638 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
637 false, false); // No interstitial showing. | 639 false, false); // No interstitial showing. |
638 } | 640 } |
639 | 641 |
640 // Test that navigating to a #ref does not change a bad security state. | 642 // Test that navigating to a #ref does not change a bad security state. |
641 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { | 643 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
642 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 644 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
643 ASSERT_TRUE(bad_https_server.get() != NULL); | 645 ASSERT_TRUE(bad_https_server.get() != NULL); |
644 | 646 |
645 ui_test_utils::NavigateToURL(browser(), | 647 ui_test_utils::NavigateToURL(browser(), |
646 bad_https_server->TestServerPage("files/ssl/page_with_refs.html")); | 648 bad_https_server->TestServerPage("files/ssl/page_with_refs.html")); |
647 | 649 |
648 TabContents* tab = browser()->GetSelectedTabContents(); | 650 TabContents* tab = browser()->GetSelectedTabContents(); |
649 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 651 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
650 true); // Interstitial showing. | 652 true); // Interstitial showing. |
651 | 653 |
652 ProceedThroughInterstitial(tab); | 654 ProceedThroughInterstitial(tab); |
653 | 655 |
654 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 656 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
655 false); // No interstitial showing. | 657 false); // No interstitial showing. |
656 | 658 |
657 // Now navigate to a ref in the page, the security state should not have | 659 // Now navigate to a ref in the page, the security state should not have |
658 // changed. | 660 // changed. |
659 ui_test_utils::NavigateToURL(browser(), | 661 ui_test_utils::NavigateToURL(browser(), |
660 bad_https_server->TestServerPage("files/ssl/page_with_refs.html#jp")); | 662 bad_https_server->TestServerPage("files/ssl/page_with_refs.html#jp")); |
661 | 663 |
662 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 664 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
663 false); // No interstitial showing. | 665 false); // No interstitial showing. |
664 } | 666 } |
665 | 667 |
666 // Tests that closing a page that has a unsafe pop-up does not crash the | 668 // Tests that closing a page that has a unsafe pop-up does not crash the |
667 // browser (bug #1966). | 669 // browser (bug #1966). |
668 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not | 670 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not |
669 // opened as it is not initiated by a user gesture. | 671 // opened as it is not initiated by a user gesture. |
670 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { | 672 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { |
671 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 673 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
672 ASSERT_TRUE(http_server.get() != NULL); | 674 ASSERT_TRUE(http_server.get() != NULL); |
673 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 675 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
674 ASSERT_TRUE(bad_https_server.get() != NULL); | 676 ASSERT_TRUE(bad_https_server.get() != NULL); |
675 | 677 |
676 ui_test_utils::NavigateToURL(browser(), | 678 ui_test_utils::NavigateToURL(browser(), |
677 http_server->TestServerPage("files/ssl/page_with_unsafe_popup.html")); | 679 http_server->TestServerPage("files/ssl/page_with_unsafe_popup.html")); |
678 | 680 |
679 TabContents* tab1 = browser()->GetSelectedTabContents(); | 681 TabContents* tab1 = browser()->GetSelectedTabContents(); |
680 // It is probably overkill to add a notification for a popup-opening, let's | 682 // It is probably overkill to add a notification for a popup-opening, let's |
681 // just poll. | 683 // just poll. |
682 for (int i = 0; i < 10; i++) { | 684 for (int i = 0; i < 10; i++) { |
683 if (static_cast<int>(tab1->constrained_window_count()) > 0) | 685 if (static_cast<int>(tab1->constrained_window_count()) > 0) |
(...skipping 12 matching lines...) Expand all Loading... |
696 std::string()); | 698 std::string()); |
697 ui_test_utils::WaitForNavigation(&(tab2->controller())); | 699 ui_test_utils::WaitForNavigation(&(tab2->controller())); |
698 | 700 |
699 // Close the first tab. | 701 // Close the first tab. |
700 browser()->CloseTabContents(tab1); | 702 browser()->CloseTabContents(tab1); |
701 } | 703 } |
702 | 704 |
703 // Visit a page over bad https that is a redirect to a page with good https. | 705 // Visit a page over bad https that is a redirect to a page with good https. |
704 // Marked as flaky, see bug 40932. | 706 // Marked as flaky, see bug 40932. |
705 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { | 707 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { |
706 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 708 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
707 ASSERT_TRUE(good_https_server.get() != NULL); | 709 ASSERT_TRUE(good_https_server.get() != NULL); |
708 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 710 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
709 ASSERT_TRUE(bad_https_server.get() != NULL); | 711 ASSERT_TRUE(bad_https_server.get() != NULL); |
710 | 712 |
711 GURL url1 = bad_https_server->TestServerPage("server-redirect?"); | 713 GURL url1 = bad_https_server->TestServerPage("server-redirect?"); |
712 GURL url2 = good_https_server->TestServerPage("files/ssl/google.html"); | 714 GURL url2 = good_https_server->TestServerPage("files/ssl/google.html"); |
713 | 715 |
714 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 716 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
715 | 717 |
716 TabContents* tab = browser()->GetSelectedTabContents(); | 718 TabContents* tab = browser()->GetSelectedTabContents(); |
717 | 719 |
718 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 720 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
719 true); // Interstitial showing. | 721 true); // Interstitial showing. |
720 | 722 |
721 ProceedThroughInterstitial(tab); | 723 ProceedThroughInterstitial(tab); |
722 | 724 |
723 // We have been redirected to the good page. | 725 // We have been redirected to the good page. |
724 CheckAuthenticatedState(tab, false); | 726 CheckAuthenticatedState(tab, false); |
725 } | 727 } |
726 | 728 |
727 // Visit a page over good https that is a redirect to a page with bad https. | 729 // Visit a page over good https that is a redirect to a page with bad https. |
728 // Marked as flaky, see bug 40932. | 730 // Marked as flaky, see bug 40932. |
729 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { | 731 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { |
730 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 732 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
731 ASSERT_TRUE(good_https_server.get() != NULL); | 733 ASSERT_TRUE(good_https_server.get() != NULL); |
732 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 734 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
733 ASSERT_TRUE(bad_https_server.get() != NULL); | 735 ASSERT_TRUE(bad_https_server.get() != NULL); |
734 | 736 |
735 GURL url1 = good_https_server->TestServerPage("server-redirect?"); | 737 GURL url1 = good_https_server->TestServerPage("server-redirect?"); |
736 GURL url2 = bad_https_server->TestServerPage("files/ssl/google.html"); | 738 GURL url2 = bad_https_server->TestServerPage("files/ssl/google.html"); |
737 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 739 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
738 | 740 |
739 TabContents* tab = browser()->GetSelectedTabContents(); | 741 TabContents* tab = browser()->GetSelectedTabContents(); |
740 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 742 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
741 true); // Interstitial showing. | 743 true); // Interstitial showing. |
742 | 744 |
743 ProceedThroughInterstitial(tab); | 745 ProceedThroughInterstitial(tab); |
744 | 746 |
745 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 747 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
746 false); // No interstitial showing. | 748 false); // No interstitial showing. |
747 } | 749 } |
748 | 750 |
749 // Visit a page over http that is a redirect to a page with good HTTPS. | 751 // Visit a page over http that is a redirect to a page with good HTTPS. |
750 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { | 752 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { |
751 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 753 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
752 ASSERT_TRUE(http_server.get() != NULL); | 754 ASSERT_TRUE(http_server.get() != NULL); |
753 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 755 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
754 ASSERT_TRUE(good_https_server.get() != NULL); | 756 ASSERT_TRUE(good_https_server.get() != NULL); |
755 | 757 |
756 TabContents* tab = browser()->GetSelectedTabContents(); | 758 TabContents* tab = browser()->GetSelectedTabContents(); |
757 | 759 |
758 // HTTP redirects to good HTTPS. | 760 // HTTP redirects to good HTTPS. |
759 GURL http_url = http_server->TestServerPage("server-redirect?"); | 761 GURL http_url = http_server->TestServerPage("server-redirect?"); |
760 GURL good_https_url = | 762 GURL good_https_url = |
761 good_https_server->TestServerPage("files/ssl/google.html"); | 763 good_https_server->TestServerPage("files/ssl/google.html"); |
762 | 764 |
763 ui_test_utils::NavigateToURL(browser(), | 765 ui_test_utils::NavigateToURL(browser(), |
764 GURL(http_url.spec() + good_https_url.spec())); | 766 GURL(http_url.spec() + good_https_url.spec())); |
765 CheckAuthenticatedState(tab, false); | 767 CheckAuthenticatedState(tab, false); |
766 } | 768 } |
767 | 769 |
768 // Visit a page over http that is a redirect to a page with bad HTTPS. | 770 // Visit a page over http that is a redirect to a page with bad HTTPS. |
769 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { | 771 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { |
770 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 772 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
771 ASSERT_TRUE(http_server.get() != NULL); | 773 ASSERT_TRUE(http_server.get() != NULL); |
772 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 774 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
773 ASSERT_TRUE(bad_https_server.get() != NULL); | 775 ASSERT_TRUE(bad_https_server.get() != NULL); |
774 | 776 |
775 TabContents* tab = browser()->GetSelectedTabContents(); | 777 TabContents* tab = browser()->GetSelectedTabContents(); |
776 | 778 |
777 GURL http_url = http_server->TestServerPage("server-redirect?"); | 779 GURL http_url = http_server->TestServerPage("server-redirect?"); |
778 GURL bad_https_url = | 780 GURL bad_https_url = |
779 bad_https_server->TestServerPage("files/ssl/google.html"); | 781 bad_https_server->TestServerPage("files/ssl/google.html"); |
780 ui_test_utils::NavigateToURL(browser(), | 782 ui_test_utils::NavigateToURL(browser(), |
781 GURL(http_url.spec() + bad_https_url.spec())); | 783 GURL(http_url.spec() + bad_https_url.spec())); |
782 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 784 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
783 true); // Interstitial showing. | 785 true); // Interstitial showing. |
784 | 786 |
785 ProceedThroughInterstitial(tab); | 787 ProceedThroughInterstitial(tab); |
786 | 788 |
787 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 789 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
788 false); // No interstitial showing. | 790 false); // No interstitial showing. |
789 } | 791 } |
790 | 792 |
791 // Visit a page over https that is a redirect to a page with http (to make sure | 793 // Visit a page over https that is a redirect to a page with http (to make sure |
792 // we don't keep the secure state). | 794 // we don't keep the secure state). |
793 // Marked as flaky, see bug 40932. | 795 // Marked as flaky, see bug 40932. |
794 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { | 796 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { |
795 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 797 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
796 ASSERT_TRUE(http_server.get() != NULL); | 798 ASSERT_TRUE(http_server.get() != NULL); |
797 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 799 scoped_refptr<net::HTTPSTestServer> https_server = GoodCertServer(); |
798 ASSERT_TRUE(https_server.get() != NULL); | 800 ASSERT_TRUE(https_server.get() != NULL); |
799 | 801 |
800 GURL https_url = https_server->TestServerPage("server-redirect?"); | 802 GURL https_url = https_server->TestServerPage("server-redirect?"); |
801 GURL http_url = http_server->TestServerPage("files/ssl/google.html"); | 803 GURL http_url = http_server->TestServerPage("files/ssl/google.html"); |
802 | 804 |
803 ui_test_utils::NavigateToURL(browser(), | 805 ui_test_utils::NavigateToURL(browser(), |
804 GURL(https_url.spec() + http_url.spec())); | 806 GURL(https_url.spec() + http_url.spec())); |
805 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 807 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); |
806 } | 808 } |
807 | 809 |
(...skipping 12 matching lines...) Expand all Loading... |
820 // Frame navigation | 822 // Frame navigation |
821 // | 823 // |
822 | 824 |
823 // From a good HTTPS top frame: | 825 // From a good HTTPS top frame: |
824 // - navigate to an OK HTTPS frame | 826 // - navigate to an OK HTTPS frame |
825 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 827 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
826 // back | 828 // back |
827 // - navigate to HTTP (expect insecure content), then back | 829 // - navigate to HTTP (expect insecure content), then back |
828 // Disabled, http://crbug.com/18626. | 830 // Disabled, http://crbug.com/18626. |
829 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) { | 831 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) { |
830 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 832 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
831 ASSERT_TRUE(http_server.get() != NULL); | 833 ASSERT_TRUE(http_server.get() != NULL); |
832 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 834 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
833 ASSERT_TRUE(good_https_server.get() != NULL); | 835 ASSERT_TRUE(good_https_server.get() != NULL); |
834 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 836 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
835 ASSERT_TRUE(bad_https_server.get() != NULL); | 837 ASSERT_TRUE(bad_https_server.get() != NULL); |
836 | 838 |
837 TabContents* tab = browser()->GetSelectedTabContents(); | 839 TabContents* tab = browser()->GetSelectedTabContents(); |
838 ui_test_utils::NavigateToURL(browser(), | 840 ui_test_utils::NavigateToURL(browser(), |
839 good_https_server->TestServerPage("files/ssl/top_frame.html")); | 841 good_https_server->TestServerPage("files/ssl/top_frame.html")); |
840 | 842 |
841 CheckAuthenticatedState(tab, false); | 843 CheckAuthenticatedState(tab, false); |
842 | 844 |
843 bool success = false; | 845 bool success = false; |
844 // Now navigate inside the frame. | 846 // Now navigate inside the frame. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 // Go back, our state should be unchanged. | 894 // Go back, our state should be unchanged. |
893 tab->controller().GoBack(); | 895 tab->controller().GoBack(); |
894 ui_test_utils::WaitForNavigation(&tab->controller()); | 896 ui_test_utils::WaitForNavigation(&tab->controller()); |
895 CheckAuthenticatedState(tab, true); | 897 CheckAuthenticatedState(tab, true); |
896 } | 898 } |
897 | 899 |
898 // From a bad HTTPS top frame: | 900 // From a bad HTTPS top frame: |
899 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 901 // - navigate to an OK HTTPS frame (expected to be still authentication broken). |
900 // Marked as flaky, see bug 40932. | 902 // Marked as flaky, see bug 40932. |
901 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { | 903 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { |
902 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 904 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
903 ASSERT_TRUE(good_https_server.get() != NULL); | 905 ASSERT_TRUE(good_https_server.get() != NULL); |
904 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 906 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
905 ASSERT_TRUE(bad_https_server.get() != NULL); | 907 ASSERT_TRUE(bad_https_server.get() != NULL); |
906 | 908 |
907 TabContents* tab = browser()->GetSelectedTabContents(); | 909 TabContents* tab = browser()->GetSelectedTabContents(); |
908 ui_test_utils::NavigateToURL(browser(), | 910 ui_test_utils::NavigateToURL(browser(), |
909 bad_https_server->TestServerPage("files/ssl/top_frame.html")); | 911 bad_https_server->TestServerPage("files/ssl/top_frame.html")); |
910 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 912 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
911 true); // Interstitial showing | 913 true); // Interstitial showing |
912 | 914 |
913 ProceedThroughInterstitial(tab); | 915 ProceedThroughInterstitial(tab); |
914 | 916 |
(...skipping 16 matching lines...) Expand all Loading... |
931 #if defined(OS_WIN) | 933 #if defined(OS_WIN) |
932 // Disabled, flakily exceeds test timeout, http://crbug.com/43437. | 934 // Disabled, flakily exceeds test timeout, http://crbug.com/43437. |
933 #define MAYBE_TestUnauthenticatedFrameNavigation \ | 935 #define MAYBE_TestUnauthenticatedFrameNavigation \ |
934 DISABLED_TestUnauthenticatedFrameNavigation | 936 DISABLED_TestUnauthenticatedFrameNavigation |
935 #else | 937 #else |
936 // Marked as flaky, see bug 40932. | 938 // Marked as flaky, see bug 40932. |
937 #define MAYBE_TestUnauthenticatedFrameNavigation \ | 939 #define MAYBE_TestUnauthenticatedFrameNavigation \ |
938 FLAKY_TestUnauthenticatedFrameNavigation | 940 FLAKY_TestUnauthenticatedFrameNavigation |
939 #endif | 941 #endif |
940 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestUnauthenticatedFrameNavigation) { | 942 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestUnauthenticatedFrameNavigation) { |
941 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 943 scoped_refptr<net::HTTPTestServer> http_server = PlainServer(); |
942 ASSERT_TRUE(http_server.get() != NULL); | 944 ASSERT_TRUE(http_server.get() != NULL); |
943 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 945 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
944 ASSERT_TRUE(good_https_server.get() != NULL); | 946 ASSERT_TRUE(good_https_server.get() != NULL); |
945 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 947 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
946 ASSERT_TRUE(bad_https_server.get() != NULL); | 948 ASSERT_TRUE(bad_https_server.get() != NULL); |
947 | 949 |
948 TabContents* tab = browser()->GetSelectedTabContents(); | 950 TabContents* tab = browser()->GetSelectedTabContents(); |
949 ui_test_utils::NavigateToURL(browser(), | 951 ui_test_utils::NavigateToURL(browser(), |
950 http_server->TestServerPage("files/ssl/top_frame.html")); | 952 http_server->TestServerPage("files/ssl/top_frame.html")); |
951 CheckUnauthenticatedState(tab); | 953 CheckUnauthenticatedState(tab); |
952 | 954 |
953 // Now navigate inside the frame to a secure HTTPS frame. | 955 // Now navigate inside the frame to a secure HTTPS frame. |
954 bool success = false; | 956 bool success = false; |
955 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 957 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
(...skipping 23 matching lines...) Expand all Loading... |
979 std::wstring is_evil_js(L"window.domAutomationController.send(" | 981 std::wstring is_evil_js(L"window.domAutomationController.send(" |
980 L"document.getElementById('evilDiv') != null);"); | 982 L"document.getElementById('evilDiv') != null);"); |
981 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 983 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
982 tab->render_view_host(), content_frame_xpath, is_evil_js, | 984 tab->render_view_host(), content_frame_xpath, is_evil_js, |
983 &is_content_evil)); | 985 &is_content_evil)); |
984 EXPECT_FALSE(is_content_evil); | 986 EXPECT_FALSE(is_content_evil); |
985 } | 987 } |
986 | 988 |
987 // Marked as flaky, see bug 40932. | 989 // Marked as flaky, see bug 40932. |
988 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorkerFiltered) { | 990 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorkerFiltered) { |
989 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 991 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
990 ASSERT_TRUE(good_https_server.get() != NULL); | 992 ASSERT_TRUE(good_https_server.get() != NULL); |
991 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 993 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
992 ASSERT_TRUE(bad_https_server.get() != NULL); | 994 ASSERT_TRUE(bad_https_server.get() != NULL); |
993 | 995 |
994 // This page will spawn a Worker which will try to load content from | 996 // This page will spawn a Worker which will try to load content from |
995 // BadCertServer. | 997 // BadCertServer. |
996 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage( | 998 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage( |
997 "files/ssl/page_with_unsafe_worker.html")); | 999 "files/ssl/page_with_unsafe_worker.html")); |
998 TabContents* tab = browser()->GetSelectedTabContents(); | 1000 TabContents* tab = browser()->GetSelectedTabContents(); |
999 // Expect Worker not to load insecure content. | 1001 // Expect Worker not to load insecure content. |
1000 CheckWorkerLoadResult(tab, false); | 1002 CheckWorkerLoadResult(tab, false); |
1001 // The bad content is filtered, expect the state to be authenticated. | 1003 // The bad content is filtered, expect the state to be authenticated. |
1002 CheckAuthenticatedState(tab, false); | 1004 CheckAuthenticatedState(tab, false); |
1003 } | 1005 } |
1004 | 1006 |
1005 // Marked as flaky, see bug 40932. | 1007 // Marked as flaky, see bug 40932. |
1006 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { | 1008 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { |
1007 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); | 1009 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
1008 ASSERT_TRUE(good_https_server.get() != NULL); | 1010 ASSERT_TRUE(good_https_server.get() != NULL); |
1009 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 1011 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
1010 ASSERT_TRUE(bad_https_server.get() != NULL); | 1012 ASSERT_TRUE(bad_https_server.get() != NULL); |
1011 | 1013 |
1012 // Navigate to an unsafe site. Proceed with interstitial page to indicate | 1014 // Navigate to an unsafe site. Proceed with interstitial page to indicate |
1013 // the user approves the bad certificate. | 1015 // the user approves the bad certificate. |
1014 ui_test_utils::NavigateToURL(browser(), | 1016 ui_test_utils::NavigateToURL(browser(), |
1015 bad_https_server->TestServerPage("files/ssl/blank_page.html")); | 1017 bad_https_server->TestServerPage("files/ssl/blank_page.html")); |
1016 TabContents* tab = browser()->GetSelectedTabContents(); | 1018 TabContents* tab = browser()->GetSelectedTabContents(); |
1017 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1019 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1018 true); // Interstitial showing | 1020 true); // Interstitial showing |
1019 ProceedThroughInterstitial(tab); | 1021 ProceedThroughInterstitial(tab); |
(...skipping 13 matching lines...) Expand all Loading... |
1033 | 1035 |
1034 // Visit a page over https that contains a frame with a redirect. | 1036 // Visit a page over https that contains a frame with a redirect. |
1035 | 1037 |
1036 // XMLHttpRequest insecure content in synchronous mode. | 1038 // XMLHttpRequest insecure content in synchronous mode. |
1037 | 1039 |
1038 // XMLHttpRequest insecure content in asynchronous mode. | 1040 // XMLHttpRequest insecure content in asynchronous mode. |
1039 | 1041 |
1040 // XMLHttpRequest over bad ssl in synchronous mode. | 1042 // XMLHttpRequest over bad ssl in synchronous mode. |
1041 | 1043 |
1042 // XMLHttpRequest over OK ssl in synchronous mode. | 1044 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |