Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 1814002: Remove deprecated things from net test suite: (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 private: 116 private:
117 DISALLOW_COPY_AND_ASSIGN(SSLUITest); 117 DISALLOW_COPY_AND_ASSIGN(SSLUITest);
118 }; 118 };
119 119
120 // Visits a regular page over http. 120 // Visits a regular page over http.
121 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { 121 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
122 scoped_refptr<HTTPTestServer> server = PlainServer(); 122 scoped_refptr<HTTPTestServer> server = PlainServer();
123 ASSERT_TRUE(server.get() != NULL); 123 ASSERT_TRUE(server.get() != NULL);
124 124
125 ui_test_utils::NavigateToURL(browser(), 125 ui_test_utils::NavigateToURL(browser(),
126 server->TestServerPageW(L"files/ssl/google.html")); 126 server->TestServerPage("files/ssl/google.html"));
127 127
128 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); 128 CheckUnauthenticatedState(browser()->GetSelectedTabContents());
129 } 129 }
130 130
131 // Visits a page over http which includes broken https resources (status should 131 // Visits a page over http which includes broken https resources (status should
132 // be OK). 132 // be OK).
133 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give 133 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give
134 // the secure cookies away!). 134 // the secure cookies away!).
135 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { 135 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
136 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 136 scoped_refptr<HTTPTestServer> http_server = PlainServer();
137 ASSERT_TRUE(http_server.get() != NULL); 137 ASSERT_TRUE(http_server.get() != NULL);
138 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 138 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
139 ASSERT_TRUE(bad_https_server.get() != NULL); 139 ASSERT_TRUE(bad_https_server.get() != NULL);
140 140
141 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 141 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
142 L"files/ssl/page_with_unsafe_contents.html")); 142 "files/ssl/page_with_unsafe_contents.html"));
143 143
144 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); 144 CheckUnauthenticatedState(browser()->GetSelectedTabContents());
145 } 145 }
146 146
147 // Visits a page over OK https: 147 // Visits a page over OK https:
148 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) { 148 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) {
149 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 149 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
150 ASSERT_TRUE(https_server.get() != NULL); 150 ASSERT_TRUE(https_server.get() != NULL);
151 151
152 ui_test_utils::NavigateToURL(browser(), 152 ui_test_utils::NavigateToURL(browser(),
153 https_server->TestServerPageW(L"files/ssl/google.html")); 153 https_server->TestServerPage("files/ssl/google.html"));
154 154
155 CheckAuthenticatedState(browser()->GetSelectedTabContents(), 155 CheckAuthenticatedState(browser()->GetSelectedTabContents(),
156 false, false); // No mixed/unsafe content. 156 false, false); // No mixed/unsafe content.
157 } 157 }
158 158
159 // Visits a page with https error and proceed: 159 // Visits a page with https error and proceed:
160 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { 160 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) {
161 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 161 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
162 ASSERT_TRUE(bad_https_server.get() != NULL); 162 ASSERT_TRUE(bad_https_server.get() != NULL);
163 163
164 ui_test_utils::NavigateToURL(browser(), 164 ui_test_utils::NavigateToURL(browser(),
165 bad_https_server->TestServerPageW(L"files/ssl/google.html")); 165 bad_https_server->TestServerPage("files/ssl/google.html"));
166 166
167 TabContents* tab = browser()->GetSelectedTabContents(); 167 TabContents* tab = browser()->GetSelectedTabContents();
168 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 168 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
169 true); // Interstitial showing 169 true); // Interstitial showing
170 170
171 ProceedThroughInterstitial(tab); 171 ProceedThroughInterstitial(tab);
172 172
173 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 173 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
174 false); // No interstitial showing 174 false); // No interstitial showing
175 } 175 }
176 176
177 // Visits a page with https error and don't proceed (and ensure we can still 177 // Visits a page with https error and don't proceed (and ensure we can still
178 // navigate at that point): 178 // navigate at that point):
179 // Marked as flaky, see bug 40932. 179 // Marked as flaky, see bug 40932.
180 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndDontProceed) { 180 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndDontProceed) {
181 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 181 scoped_refptr<HTTPTestServer> http_server = PlainServer();
182 ASSERT_TRUE(http_server.get() != NULL); 182 ASSERT_TRUE(http_server.get() != NULL);
183 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 183 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
184 ASSERT_TRUE(good_https_server.get() != NULL); 184 ASSERT_TRUE(good_https_server.get() != NULL);
185 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 185 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
186 ASSERT_TRUE(bad_https_server.get() != NULL); 186 ASSERT_TRUE(bad_https_server.get() != NULL);
187 187
188 // First navigate to an OK page. 188 // First navigate to an OK page.
189 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPageW( 189 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage(
190 L"files/ssl/google.html")); 190 "files/ssl/google.html"));
191 191
192 TabContents* tab = browser()->GetSelectedTabContents(); 192 TabContents* tab = browser()->GetSelectedTabContents();
193 NavigationEntry* entry = tab->controller().GetActiveEntry(); 193 NavigationEntry* entry = tab->controller().GetActiveEntry();
194 ASSERT_TRUE(entry); 194 ASSERT_TRUE(entry);
195 195
196 GURL cross_site_url = 196 GURL cross_site_url =
197 bad_https_server->TestServerPageW(L"files/ssl/google.html"); 197 bad_https_server->TestServerPage("files/ssl/google.html");
198 // Change the host name from 127.0.0.1 to localhost so it triggers a 198 // Change the host name from 127.0.0.1 to localhost so it triggers a
199 // cross-site navigation so we can test http://crbug.com/5800 is gone. 199 // cross-site navigation so we can test http://crbug.com/5800 is gone.
200 ASSERT_EQ("127.0.0.1", cross_site_url.host()); 200 ASSERT_EQ("127.0.0.1", cross_site_url.host());
201 GURL::Replacements replacements; 201 GURL::Replacements replacements;
202 std::string new_host("localhost"); 202 std::string new_host("localhost");
203 replacements.SetHostStr(new_host); 203 replacements.SetHostStr(new_host);
204 cross_site_url = cross_site_url.ReplaceComponents(replacements); 204 cross_site_url = cross_site_url.ReplaceComponents(replacements);
205 205
206 // Now go to a bad HTTPS page. 206 // Now go to a bad HTTPS page.
207 ui_test_utils::NavigateToURL(browser(), cross_site_url); 207 ui_test_utils::NavigateToURL(browser(), cross_site_url);
208 208
209 // An interstitial should be showing. 209 // An interstitial should be showing.
210 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 210 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
211 true); // Interstitial showing. 211 true); // Interstitial showing.
212 212
213 // Simulate user clicking "Take me back". 213 // Simulate user clicking "Take me back".
214 InterstitialPage* interstitial_page = tab->interstitial_page(); 214 InterstitialPage* interstitial_page = tab->interstitial_page();
215 ASSERT_TRUE(interstitial_page); 215 ASSERT_TRUE(interstitial_page);
216 interstitial_page->DontProceed(); 216 interstitial_page->DontProceed();
217 217
218 // We should be back to the original good page. 218 // We should be back to the original good page.
219 CheckAuthenticatedState(tab, false, false); 219 CheckAuthenticatedState(tab, false, false);
220 220
221 // Try to navigate to a new page. (to make sure bug 5800 is fixed). 221 // Try to navigate to a new page. (to make sure bug 5800 is fixed).
222 ui_test_utils::NavigateToURL(browser(), 222 ui_test_utils::NavigateToURL(browser(),
223 http_server->TestServerPageW(L"files/ssl/google.html")); 223 http_server->TestServerPage("files/ssl/google.html"));
224 CheckUnauthenticatedState(tab); 224 CheckUnauthenticatedState(tab);
225 } 225 }
226 226
227 // Visits a page with https error and then goes back using Browser::GoBack. 227 // Visits a page with https error and then goes back using Browser::GoBack.
228 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBackViaButton) { 228 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBackViaButton) {
229 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 229 scoped_refptr<HTTPTestServer> http_server = PlainServer();
230 ASSERT_TRUE(http_server.get() != NULL); 230 ASSERT_TRUE(http_server.get() != NULL);
231 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 231 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
232 ASSERT_TRUE(bad_https_server.get() != NULL); 232 ASSERT_TRUE(bad_https_server.get() != NULL);
233 233
234 // First navigate to an HTTP page. 234 // First navigate to an HTTP page.
235 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 235 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
236 L"files/ssl/google.html")); 236 "files/ssl/google.html"));
237 TabContents* tab = browser()->GetSelectedTabContents(); 237 TabContents* tab = browser()->GetSelectedTabContents();
238 NavigationEntry* entry = tab->controller().GetActiveEntry(); 238 NavigationEntry* entry = tab->controller().GetActiveEntry();
239 ASSERT_TRUE(entry); 239 ASSERT_TRUE(entry);
240 240
241 // Now go to a bad HTTPS page that shows an interstitial. 241 // Now go to a bad HTTPS page that shows an interstitial.
242 ui_test_utils::NavigateToURL(browser(), 242 ui_test_utils::NavigateToURL(browser(),
243 bad_https_server->TestServerPageW(L"files/ssl/google.html")); 243 bad_https_server->TestServerPage("files/ssl/google.html"));
244 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 244 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
245 true); // Interstitial showing 245 true); // Interstitial showing
246 246
247 // Simulate user clicking on back button (crbug.com/39248). 247 // Simulate user clicking on back button (crbug.com/39248).
248 browser()->GoBack(CURRENT_TAB); 248 browser()->GoBack(CURRENT_TAB);
249 249
250 // We should be back at the original good page. 250 // We should be back at the original good page.
251 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); 251 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
252 CheckUnauthenticatedState(tab); 252 CheckUnauthenticatedState(tab);
253 } 253 }
254 254
255 // Visits a page with https error and then goes back using GoToOffset. 255 // Visits a page with https error and then goes back using GoToOffset.
256 // Marked as flaky, see bug 40932. 256 // Marked as flaky, see bug 40932.
257 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { 257 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) {
258 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 258 scoped_refptr<HTTPTestServer> http_server = PlainServer();
259 ASSERT_TRUE(http_server.get() != NULL); 259 ASSERT_TRUE(http_server.get() != NULL);
260 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 260 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
261 ASSERT_TRUE(bad_https_server.get() != NULL); 261 ASSERT_TRUE(bad_https_server.get() != NULL);
262 262
263 // First navigate to an HTTP page. 263 // First navigate to an HTTP page.
264 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 264 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
265 L"files/ssl/google.html")); 265 "files/ssl/google.html"));
266 TabContents* tab = browser()->GetSelectedTabContents(); 266 TabContents* tab = browser()->GetSelectedTabContents();
267 NavigationEntry* entry = tab->controller().GetActiveEntry(); 267 NavigationEntry* entry = tab->controller().GetActiveEntry();
268 ASSERT_TRUE(entry); 268 ASSERT_TRUE(entry);
269 269
270 // Now go to a bad HTTPS page that shows an interstitial. 270 // Now go to a bad HTTPS page that shows an interstitial.
271 ui_test_utils::NavigateToURL(browser(), 271 ui_test_utils::NavigateToURL(browser(),
272 bad_https_server->TestServerPageW(L"files/ssl/google.html")); 272 bad_https_server->TestServerPage("files/ssl/google.html"));
273 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 273 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
274 true); // Interstitial showing 274 true); // Interstitial showing
275 275
276 // Simulate user clicking and holding on back button (crbug.com/37215). 276 // Simulate user clicking and holding on back button (crbug.com/37215).
277 tab->controller().GoToOffset(-1); 277 tab->controller().GoToOffset(-1);
278 278
279 // We should be back at the original good page. 279 // We should be back at the original good page.
280 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); 280 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
281 CheckUnauthenticatedState(tab); 281 CheckUnauthenticatedState(tab);
282 } 282 }
283 283
284 // Visits a page with https error and then goes forward using GoToOffset. 284 // Visits a page with https error and then goes forward using GoToOffset.
285 // Marked as flaky, see bug 40932. 285 // Marked as flaky, see bug 40932.
286 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { 286 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) {
287 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 287 scoped_refptr<HTTPTestServer> http_server = PlainServer();
288 ASSERT_TRUE(http_server.get() != NULL); 288 ASSERT_TRUE(http_server.get() != NULL);
289 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 289 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
290 ASSERT_TRUE(bad_https_server.get() != NULL); 290 ASSERT_TRUE(bad_https_server.get() != NULL);
291 291
292 // First navigate to two HTTP pages. 292 // First navigate to two HTTP pages.
293 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 293 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
294 L"files/ssl/google.html")); 294 "files/ssl/google.html"));
295 TabContents* tab = browser()->GetSelectedTabContents(); 295 TabContents* tab = browser()->GetSelectedTabContents();
296 NavigationEntry* entry1 = tab->controller().GetActiveEntry(); 296 NavigationEntry* entry1 = tab->controller().GetActiveEntry();
297 ASSERT_TRUE(entry1); 297 ASSERT_TRUE(entry1);
298 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 298 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
299 L"files/ssl/blank_page.html")); 299 "files/ssl/blank_page.html"));
300 NavigationEntry* entry2 = tab->controller().GetActiveEntry(); 300 NavigationEntry* entry2 = tab->controller().GetActiveEntry();
301 ASSERT_TRUE(entry2); 301 ASSERT_TRUE(entry2);
302 302
303 // Now go back so that a page is in the forward history. 303 // Now go back so that a page is in the forward history.
304 tab->controller().GoBack(); 304 tab->controller().GoBack();
305 ui_test_utils::WaitForNavigation(&(tab->controller())); 305 ui_test_utils::WaitForNavigation(&(tab->controller()));
306 ASSERT_TRUE(tab->controller().CanGoForward()); 306 ASSERT_TRUE(tab->controller().CanGoForward());
307 NavigationEntry* entry3 = tab->controller().GetActiveEntry(); 307 NavigationEntry* entry3 = tab->controller().GetActiveEntry();
308 ASSERT_TRUE(entry1 == entry3); 308 ASSERT_TRUE(entry1 == entry3);
309 309
310 // Now go to a bad HTTPS page that shows an interstitial. 310 // Now go to a bad HTTPS page that shows an interstitial.
311 ui_test_utils::NavigateToURL(browser(), 311 ui_test_utils::NavigateToURL(browser(),
312 bad_https_server->TestServerPageW(L"files/ssl/google.html")); 312 bad_https_server->TestServerPage("files/ssl/google.html"));
313 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 313 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
314 true); // Interstitial showing 314 true); // Interstitial showing
315 315
316 // Simulate user clicking and holding on forward button. 316 // Simulate user clicking and holding on forward button.
317 tab->controller().GoToOffset(1); 317 tab->controller().GoToOffset(1);
318 ui_test_utils::WaitForNavigation(&(tab->controller())); 318 ui_test_utils::WaitForNavigation(&(tab->controller()));
319 319
320 // We should be showing the second good page. 320 // We should be showing the second good page.
321 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page()); 321 EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
322 CheckUnauthenticatedState(tab); 322 CheckUnauthenticatedState(tab);
323 EXPECT_FALSE(tab->controller().CanGoForward()); 323 EXPECT_FALSE(tab->controller().CanGoForward());
324 NavigationEntry* entry4 = tab->controller().GetActiveEntry(); 324 NavigationEntry* entry4 = tab->controller().GetActiveEntry();
325 EXPECT_TRUE(entry2 == entry4); 325 EXPECT_TRUE(entry2 == entry4);
326 } 326 }
327 327
328 // Open a page with a HTTPS error in a tab with no prior navigation (through a 328 // Open a page with a HTTPS error in a tab with no prior navigation (through a
329 // link with a blank target). This is to test that the lack of navigation entry 329 // link with a blank target). This is to test that the lack of navigation entry
330 // does not cause any problems (it was causing a crasher, see 330 // does not cause any problems (it was causing a crasher, see
331 // http://crbug.com/19941). 331 // http://crbug.com/19941).
332 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { 332 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) {
333 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 333 scoped_refptr<HTTPTestServer> http_server = PlainServer();
334 ASSERT_TRUE(http_server.get() != NULL); 334 ASSERT_TRUE(http_server.get() != NULL);
335 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 335 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
336 ASSERT_TRUE(bad_https_server.get() != NULL); 336 ASSERT_TRUE(bad_https_server.get() != NULL);
337 337
338 // Load a page with a link that opens a new window (therefore with no history 338 // Load a page with a link that opens a new window (therefore with no history
339 // and no navigation entries). 339 // and no navigation entries).
340 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 340 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
341 L"files/ssl/page_with_blank_target.html")); 341 "files/ssl/page_with_blank_target.html"));
342 342
343 bool success = false; 343 bool success = false;
344 344
345 ui_test_utils::WindowedNotificationObserver<NavigationController> 345 ui_test_utils::WindowedNotificationObserver<NavigationController>
346 load_stop_signal(NotificationType::LOAD_STOP, NULL); 346 load_stop_signal(NotificationType::LOAD_STOP, NULL);
347 347
348 // Simulate clicking the link (and therefore navigating to that new page). 348 // Simulate clicking the link (and therefore navigating to that new page).
349 // This will causes a new tab to be created. 349 // This will causes a new tab to be created.
350 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 350 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
351 browser()->GetSelectedTabContents()->render_view_host(), L"", 351 browser()->GetSelectedTabContents()->render_view_host(), L"",
(...skipping 22 matching lines...) Expand all
374 374
375 // Visits a page with mixed content. 375 // Visits a page with mixed content.
376 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContents) { 376 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContents) {
377 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 377 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
378 ASSERT_TRUE(https_server.get() != NULL); 378 ASSERT_TRUE(https_server.get() != NULL);
379 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 379 scoped_refptr<HTTPTestServer> http_server = PlainServer();
380 ASSERT_TRUE(http_server.get() != NULL); 380 ASSERT_TRUE(http_server.get() != NULL);
381 381
382 // Load a page with mixed-content, the default behavior is to show the mixed 382 // Load a page with mixed-content, the default behavior is to show the mixed
383 // content. 383 // content.
384 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPageW( 384 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage(
385 L"files/ssl/page_with_mixed_contents.html")); 385 "files/ssl/page_with_mixed_contents.html"));
386 386
387 CheckAuthenticatedState(browser()->GetSelectedTabContents(), 387 CheckAuthenticatedState(browser()->GetSelectedTabContents(),
388 true /* mixed-content */, false); 388 true /* mixed-content */, false);
389 } 389 }
390 390
391 // Visits a page with an http script that tries to suppress our mixed content 391 // Visits a page with an http script that tries to suppress our mixed content
392 // warnings by randomize location.hash. 392 // warnings by randomize location.hash.
393 // Based on http://crbug.com/8706 393 // Based on http://crbug.com/8706
394 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContentsRandomizeHash) { 394 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContentsRandomizeHash) {
395 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 395 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
396 ASSERT_TRUE(https_server.get() != NULL); 396 ASSERT_TRUE(https_server.get() != NULL);
397 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 397 scoped_refptr<HTTPTestServer> http_server = PlainServer();
398 ASSERT_TRUE(http_server.get() != NULL); 398 ASSERT_TRUE(http_server.get() != NULL);
399 399
400 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPageW( 400 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage(
401 L"files/ssl/page_with_http_script.html")); 401 "files/ssl/page_with_http_script.html"));
402 402
403 CheckAuthenticatedState(browser()->GetSelectedTabContents(), 403 CheckAuthenticatedState(browser()->GetSelectedTabContents(),
404 true /* mixed-content */, false); 404 true /* mixed-content */, false);
405 } 405 }
406 406
407 // Visits a page with unsafe content and make sure that: 407 // Visits a page with unsafe content and make sure that:
408 // - frames content is replaced with warning 408 // - frames content is replaced with warning
409 // - images and scripts are filtered out entirely 409 // - images and scripts are filtered out entirely
410 // Marked as flaky, see bug 40932. 410 // Marked as flaky, see bug 40932.
411 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { 411 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) {
412 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 412 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
413 ASSERT_TRUE(good_https_server.get() != NULL); 413 ASSERT_TRUE(good_https_server.get() != NULL);
414 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 414 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
415 ASSERT_TRUE(bad_https_server.get() != NULL); 415 ASSERT_TRUE(bad_https_server.get() != NULL);
416 416
417 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPageW( 417 ui_test_utils::NavigateToURL(browser(), good_https_server->TestServerPage(
418 L"files/ssl/page_with_unsafe_contents.html")); 418 "files/ssl/page_with_unsafe_contents.html"));
419 419
420 TabContents* tab = browser()->GetSelectedTabContents(); 420 TabContents* tab = browser()->GetSelectedTabContents();
421 // When the bad content is filtered, the state is expected to be 421 // When the bad content is filtered, the state is expected to be
422 // authenticated. 422 // authenticated.
423 CheckAuthenticatedState(tab, false, false); 423 CheckAuthenticatedState(tab, false, false);
424 424
425 // Because of cross-frame scripting restrictions, we cannot access the iframe 425 // Because of cross-frame scripting restrictions, we cannot access the iframe
426 // content. So to know if the frame was loaded, we just check if a popup was 426 // content. So to know if the frame was loaded, we just check if a popup was
427 // opened (the iframe content opens one). 427 // opened (the iframe content opens one).
428 // Note: because of bug 1115868, no constrained window is opened right now. 428 // Note: because of bug 1115868, no constrained window is opened right now.
(...skipping 16 matching lines...) Expand all
445 EXPECT_FALSE(js_result); 445 EXPECT_FALSE(js_result);
446 } 446 }
447 447
448 // Visits a page with mixed content loaded by JS (after the initial page load). 448 // Visits a page with mixed content loaded by JS (after the initial page load).
449 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) { 449 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) {
450 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 450 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
451 ASSERT_TRUE(https_server.get() != NULL); 451 ASSERT_TRUE(https_server.get() != NULL);
452 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 452 scoped_refptr<HTTPTestServer> http_server = PlainServer();
453 ASSERT_TRUE(http_server.get() != NULL); 453 ASSERT_TRUE(http_server.get() != NULL);
454 454
455 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPageW( 455 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage(
456 L"files/ssl/page_with_dynamic_mixed_contents.html")); 456 "files/ssl/page_with_dynamic_mixed_contents.html"));
457 457
458 TabContents* tab = browser()->GetSelectedTabContents(); 458 TabContents* tab = browser()->GetSelectedTabContents();
459 CheckAuthenticatedState(tab, false, false); 459 CheckAuthenticatedState(tab, false, false);
460 460
461 // Load the insecure image. 461 // Load the insecure image.
462 bool js_result = false; 462 bool js_result = false;
463 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 463 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
464 tab->render_view_host(), L"", L"loadBadImage();", &js_result)); 464 tab->render_view_host(), L"", L"loadBadImage();", &js_result));
465 EXPECT_TRUE(js_result); 465 EXPECT_TRUE(js_result);
466 466
467 // We should now have mixed-contents. 467 // We should now have mixed-contents.
468 CheckAuthenticatedState(tab, true /* mixed-content */, false); 468 CheckAuthenticatedState(tab, true /* mixed-content */, false);
469 } 469 }
470 470
471 // Visits two pages from the same origin: one with mixed content and one 471 // Visits two pages from the same origin: one with mixed content and one
472 // without. The test checks that we propagate the mixed content state from one 472 // without. The test checks that we propagate the mixed content state from one
473 // to the other. 473 // to the other.
474 // TODO(jcampan): http://crbug.com/15072 this test fails. 474 // TODO(jcampan): http://crbug.com/15072 this test fails.
475 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestMixedContentsTwoTabs) { 475 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestMixedContentsTwoTabs) {
476 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 476 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
477 ASSERT_TRUE(https_server.get() != NULL); 477 ASSERT_TRUE(https_server.get() != NULL);
478 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 478 scoped_refptr<HTTPTestServer> http_server = PlainServer();
479 ASSERT_TRUE(http_server.get() != NULL); 479 ASSERT_TRUE(http_server.get() != NULL);
480 480
481 ui_test_utils::NavigateToURL(browser(), 481 ui_test_utils::NavigateToURL(browser(),
482 https_server->TestServerPageW(L"files/ssl/blank_page.html")); 482 https_server->TestServerPage("files/ssl/blank_page.html"));
483 483
484 TabContents* tab1 = browser()->GetSelectedTabContents(); 484 TabContents* tab1 = browser()->GetSelectedTabContents();
485 485
486 // This tab should be fine. 486 // This tab should be fine.
487 CheckAuthenticatedState(tab1, false, false); 487 CheckAuthenticatedState(tab1, false, false);
488 488
489 // Create a new tab. 489 // Create a new tab.
490 GURL url = 490 GURL url =
491 https_server->TestServerPageW(L"files/ssl/page_with_http_script.html"); 491 https_server->TestServerPage("files/ssl/page_with_http_script.html");
492 TabContents* tab2 = browser()->AddTabWithURL( 492 TabContents* tab2 = browser()->AddTabWithURL(
493 url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED, 493 url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED,
494 NULL, std::string()); 494 NULL, std::string());
495 ui_test_utils::WaitForNavigation(&(tab2->controller())); 495 ui_test_utils::WaitForNavigation(&(tab2->controller()));
496 496
497 // The new tab has mixed content. 497 // The new tab has mixed content.
498 CheckAuthenticatedState(tab2, true /* mixed-content */, false); 498 CheckAuthenticatedState(tab2, true /* mixed-content */, false);
499 499
500 // Which means the origin for the first tab has also been contaminated with 500 // Which means the origin for the first tab has also been contaminated with
501 // mixed content. 501 // mixed content.
502 CheckAuthenticatedState(tab1, true /* mixed-content */, false); 502 CheckAuthenticatedState(tab1, true /* mixed-content */, false);
503 } 503 }
504 504
505 // Visits a page with an image over http. Visits another page over https 505 // Visits a page with an image over http. Visits another page over https
506 // referencing that same image over http (hoping it is coming from the webcore 506 // referencing that same image over http (hoping it is coming from the webcore
507 // memory cache). 507 // memory cache).
508 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCachedMixedContents) { 508 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCachedMixedContents) {
509 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 509 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
510 ASSERT_TRUE(https_server.get() != NULL); 510 ASSERT_TRUE(https_server.get() != NULL);
511 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 511 scoped_refptr<HTTPTestServer> http_server = PlainServer();
512 ASSERT_TRUE(http_server.get() != NULL); 512 ASSERT_TRUE(http_server.get() != NULL);
513 513
514 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 514 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
515 L"files/ssl/page_with_mixed_contents.html")); 515 "files/ssl/page_with_mixed_contents.html"));
516 TabContents* tab = browser()->GetSelectedTabContents(); 516 TabContents* tab = browser()->GetSelectedTabContents();
517 CheckUnauthenticatedState(tab); 517 CheckUnauthenticatedState(tab);
518 518
519 // Load again but over SSL. It should have mixed-contents (even though the 519 // Load again but over SSL. It should have mixed-contents (even though the
520 // image comes from the WebCore memory cache). 520 // image comes from the WebCore memory cache).
521 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPageW( 521 ui_test_utils::NavigateToURL(browser(), https_server->TestServerPage(
522 L"files/ssl/page_with_mixed_contents.html")); 522 "files/ssl/page_with_mixed_contents.html"));
523 CheckAuthenticatedState(tab, true /* mixed-content */, false); 523 CheckAuthenticatedState(tab, true /* mixed-content */, false);
524 } 524 }
525 525
526 // This test ensures the CN invalid status does not 'stick' to a certificate 526 // This test ensures the CN invalid status does not 'stick' to a certificate
527 // (see bug #1044942) and that it depends on the host-name. 527 // (see bug #1044942) and that it depends on the host-name.
528 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { 528 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) {
529 const std::string kLocalHost = "localhost"; 529 const std::string kLocalHost = "localhost";
530 scoped_refptr<HTTPSTestServer> https_server = 530 scoped_refptr<HTTPSTestServer> https_server =
531 HTTPSTestServer::CreateMismatchedServer(kDocRoot); 531 HTTPSTestServer::CreateMismatchedServer(kDocRoot);
532 ASSERT_TRUE(https_server.get() != NULL); 532 ASSERT_TRUE(https_server.get() != NULL);
533 533
534 // First we hit the server with hostname, this generates an invalid policy 534 // First we hit the server with hostname, this generates an invalid policy
535 // error. 535 // error.
536 ui_test_utils::NavigateToURL(browser(), 536 ui_test_utils::NavigateToURL(browser(),
537 https_server->TestServerPageW(L"files/ssl/google.html")); 537 https_server->TestServerPage("files/ssl/google.html"));
538 538
539 // We get an interstitial page as a result. 539 // We get an interstitial page as a result.
540 TabContents* tab = browser()->GetSelectedTabContents(); 540 TabContents* tab = browser()->GetSelectedTabContents();
541 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 541 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
542 true); // Interstitial showing. 542 true); // Interstitial showing.
543 543
544 ProceedThroughInterstitial(tab); 544 ProceedThroughInterstitial(tab);
545 545
546 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 546 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
547 false); // No interstitial showing. 547 false); // No interstitial showing.
548 548
549 // Now we try again with the right host name this time. 549 // Now we try again with the right host name this time.
550 550
551 // Let's change the host-name in the url. 551 // Let's change the host-name in the url.
552 GURL url = https_server->TestServerPageW(L"files/ssl/google.html"); 552 GURL url = https_server->TestServerPage("files/ssl/google.html");
553 std::string::size_type hostname_index = url.spec().find(kLocalHost); 553 std::string::size_type hostname_index = url.spec().find(kLocalHost);
554 ASSERT_TRUE(hostname_index != std::string::npos); // Test sanity check. 554 ASSERT_TRUE(hostname_index != std::string::npos); // Test sanity check.
555 std::string new_url; 555 std::string new_url;
556 new_url.append(url.spec().substr(0, hostname_index)); 556 new_url.append(url.spec().substr(0, hostname_index));
557 new_url.append(net::TestServerLauncher::kHostName); 557 new_url.append(net::TestServerLauncher::kHostName);
558 new_url.append(url.spec().substr(hostname_index + kLocalHost.size())); 558 new_url.append(url.spec().substr(hostname_index + kLocalHost.size()));
559 559
560 ui_test_utils::NavigateToURL(browser(), GURL(new_url)); 560 ui_test_utils::NavigateToURL(browser(), GURL(new_url));
561 561
562 // Security state should be OK. 562 // Security state should be OK.
563 CheckAuthenticatedState(tab, false, false); 563 CheckAuthenticatedState(tab, false, false);
564 564
565 // Now try again the broken one to make sure it is still broken. 565 // Now try again the broken one to make sure it is still broken.
566 ui_test_utils::NavigateToURL(browser(), 566 ui_test_utils::NavigateToURL(browser(),
567 https_server->TestServerPageW(L"files/ssl/google.html")); 567 https_server->TestServerPage("files/ssl/google.html"));
568 568
569 // Since we OKed the interstitial last time, we get right to the page. 569 // Since we OKed the interstitial last time, we get right to the page.
570 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 570 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
571 false); // No interstitial showing. 571 false); // No interstitial showing.
572 } 572 }
573 573
574 // Test that navigating to a #ref does not change a bad security state. 574 // Test that navigating to a #ref does not change a bad security state.
575 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { 575 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) {
576 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 576 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
577 ASSERT_TRUE(bad_https_server.get() != NULL); 577 ASSERT_TRUE(bad_https_server.get() != NULL);
578 578
579 ui_test_utils::NavigateToURL(browser(), 579 ui_test_utils::NavigateToURL(browser(),
580 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html")); 580 bad_https_server->TestServerPage("files/ssl/page_with_refs.html"));
581 581
582 TabContents* tab = browser()->GetSelectedTabContents(); 582 TabContents* tab = browser()->GetSelectedTabContents();
583 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 583 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
584 true); // Interstitial showing. 584 true); // Interstitial showing.
585 585
586 ProceedThroughInterstitial(tab); 586 ProceedThroughInterstitial(tab);
587 587
588 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 588 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
589 false); // No interstitial showing. 589 false); // No interstitial showing.
590 590
591 // Now navigate to a ref in the page, the security state should not have 591 // Now navigate to a ref in the page, the security state should not have
592 // changed. 592 // changed.
593 ui_test_utils::NavigateToURL(browser(), 593 ui_test_utils::NavigateToURL(browser(),
594 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html#jp")); 594 bad_https_server->TestServerPage("files/ssl/page_with_refs.html#jp"));
595 595
596 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 596 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
597 false); // No interstitial showing. 597 false); // No interstitial showing.
598 } 598 }
599 599
600 // Tests that closing a page that has a unsafe pop-up does not crash the 600 // Tests that closing a page that has a unsafe pop-up does not crash the
601 // browser (bug #1966). 601 // browser (bug #1966).
602 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not 602 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not
603 // opened as it is not initiated by a user gesture. 603 // opened as it is not initiated by a user gesture.
604 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { 604 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
605 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 605 scoped_refptr<HTTPTestServer> http_server = PlainServer();
606 ASSERT_TRUE(http_server.get() != NULL); 606 ASSERT_TRUE(http_server.get() != NULL);
607 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 607 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
608 ASSERT_TRUE(bad_https_server.get() != NULL); 608 ASSERT_TRUE(bad_https_server.get() != NULL);
609 609
610 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( 610 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPage(
611 L"files/ssl/page_with_unsafe_popup.html")); 611 "files/ssl/page_with_unsafe_popup.html"));
612 612
613 TabContents* tab1 = browser()->GetSelectedTabContents(); 613 TabContents* tab1 = browser()->GetSelectedTabContents();
614 // It is probably overkill to add a notification for a popup-opening, let's 614 // It is probably overkill to add a notification for a popup-opening, let's
615 // just poll. 615 // just poll.
616 for (int i = 0; i < 10; i++) { 616 for (int i = 0; i < 10; i++) {
617 if (static_cast<int>(tab1->constrained_window_count()) > 0) 617 if (static_cast<int>(tab1->constrained_window_count()) > 0)
618 break; 618 break;
619 MessageLoop::current()->PostDelayedTask(FROM_HERE, 619 MessageLoop::current()->PostDelayedTask(FROM_HERE,
620 new MessageLoop::QuitTask(), 1000); 620 new MessageLoop::QuitTask(), 1000);
621 ui_test_utils::RunMessageLoop(); 621 ui_test_utils::RunMessageLoop();
622 } 622 }
623 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count())); 623 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count()));
624 624
625 // Let's add another tab to make sure the browser does not exit when we close 625 // Let's add another tab to make sure the browser does not exit when we close
626 // the first tab. 626 // the first tab.
627 GURL url = http_server->TestServerPageW(L"files/ssl/google.html"); 627 GURL url = http_server->TestServerPage("files/ssl/google.html");
628 TabContents* tab2 = browser()->AddTabWithURL( 628 TabContents* tab2 = browser()->AddTabWithURL(
629 url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED, NULL, 629 url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED, NULL,
630 std::string()); 630 std::string());
631 ui_test_utils::WaitForNavigation(&(tab2->controller())); 631 ui_test_utils::WaitForNavigation(&(tab2->controller()));
632 632
633 // Close the first tab. 633 // Close the first tab.
634 browser()->CloseTabContents(tab1); 634 browser()->CloseTabContents(tab1);
635 } 635 }
636 636
637 // Visit a page over bad https that is a redirect to a page with good https. 637 // Visit a page over bad https that is a redirect to a page with good https.
638 // Marked as flaky, see bug 40932. 638 // Marked as flaky, see bug 40932.
639 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { 639 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) {
640 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 640 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
641 ASSERT_TRUE(good_https_server.get() != NULL); 641 ASSERT_TRUE(good_https_server.get() != NULL);
642 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 642 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
643 ASSERT_TRUE(bad_https_server.get() != NULL); 643 ASSERT_TRUE(bad_https_server.get() != NULL);
644 644
645 GURL url1 = bad_https_server->TestServerPageW(L"server-redirect?"); 645 GURL url1 = bad_https_server->TestServerPage("server-redirect?");
646 GURL url2 = good_https_server->TestServerPageW(L"files/ssl/google.html"); 646 GURL url2 = good_https_server->TestServerPage("files/ssl/google.html");
647 647
648 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); 648 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
649 649
650 TabContents* tab = browser()->GetSelectedTabContents(); 650 TabContents* tab = browser()->GetSelectedTabContents();
651 651
652 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 652 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
653 true); // Interstitial showing. 653 true); // Interstitial showing.
654 654
655 ProceedThroughInterstitial(tab); 655 ProceedThroughInterstitial(tab);
656 656
657 // We have been redirected to the good page. 657 // We have been redirected to the good page.
658 CheckAuthenticatedState(tab, false, false); // No mixed/unsafe content. 658 CheckAuthenticatedState(tab, false, false); // No mixed/unsafe content.
659 } 659 }
660 660
661 // Visit a page over good https that is a redirect to a page with bad https. 661 // Visit a page over good https that is a redirect to a page with bad https.
662 // Marked as flaky, see bug 40932. 662 // Marked as flaky, see bug 40932.
663 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { 663 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) {
664 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 664 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
665 ASSERT_TRUE(good_https_server.get() != NULL); 665 ASSERT_TRUE(good_https_server.get() != NULL);
666 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 666 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
667 ASSERT_TRUE(bad_https_server.get() != NULL); 667 ASSERT_TRUE(bad_https_server.get() != NULL);
668 668
669 GURL url1 = good_https_server->TestServerPageW(L"server-redirect?"); 669 GURL url1 = good_https_server->TestServerPage("server-redirect?");
670 GURL url2 = bad_https_server->TestServerPageW(L"files/ssl/google.html"); 670 GURL url2 = bad_https_server->TestServerPage("files/ssl/google.html");
671 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); 671 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
672 672
673 TabContents* tab = browser()->GetSelectedTabContents(); 673 TabContents* tab = browser()->GetSelectedTabContents();
674 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 674 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
675 true); // Interstitial showing. 675 true); // Interstitial showing.
676 676
677 ProceedThroughInterstitial(tab); 677 ProceedThroughInterstitial(tab);
678 678
679 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 679 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
680 false); // No interstitial showing. 680 false); // No interstitial showing.
681 } 681 }
682 682
683 // Visit a page over http that is a redirect to a page with good HTTPS. 683 // Visit a page over http that is a redirect to a page with good HTTPS.
684 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { 684 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) {
685 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 685 scoped_refptr<HTTPTestServer> http_server = PlainServer();
686 ASSERT_TRUE(http_server.get() != NULL); 686 ASSERT_TRUE(http_server.get() != NULL);
687 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 687 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
688 ASSERT_TRUE(good_https_server.get() != NULL); 688 ASSERT_TRUE(good_https_server.get() != NULL);
689 689
690 TabContents* tab = browser()->GetSelectedTabContents(); 690 TabContents* tab = browser()->GetSelectedTabContents();
691 691
692 // HTTP redirects to good HTTPS. 692 // HTTP redirects to good HTTPS.
693 GURL http_url = http_server->TestServerPageW(L"server-redirect?"); 693 GURL http_url = http_server->TestServerPage("server-redirect?");
694 GURL good_https_url = 694 GURL good_https_url =
695 good_https_server->TestServerPageW(L"files/ssl/google.html"); 695 good_https_server->TestServerPage("files/ssl/google.html");
696 696
697 ui_test_utils::NavigateToURL(browser(), 697 ui_test_utils::NavigateToURL(browser(),
698 GURL(http_url.spec() + good_https_url.spec())); 698 GURL(http_url.spec() + good_https_url.spec()));
699 CheckAuthenticatedState(tab, false, false); // No mixed/unsafe content. 699 CheckAuthenticatedState(tab, false, false); // No mixed/unsafe content.
700 } 700 }
701 701
702 // Visit a page over http that is a redirect to a page with bad HTTPS. 702 // Visit a page over http that is a redirect to a page with bad HTTPS.
703 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { 703 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) {
704 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 704 scoped_refptr<HTTPTestServer> http_server = PlainServer();
705 ASSERT_TRUE(http_server.get() != NULL); 705 ASSERT_TRUE(http_server.get() != NULL);
706 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 706 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
707 ASSERT_TRUE(bad_https_server.get() != NULL); 707 ASSERT_TRUE(bad_https_server.get() != NULL);
708 708
709 TabContents* tab = browser()->GetSelectedTabContents(); 709 TabContents* tab = browser()->GetSelectedTabContents();
710 710
711 GURL http_url = http_server->TestServerPageW(L"server-redirect?"); 711 GURL http_url = http_server->TestServerPage("server-redirect?");
712 GURL bad_https_url = 712 GURL bad_https_url =
713 bad_https_server->TestServerPageW(L"files/ssl/google.html"); 713 bad_https_server->TestServerPage("files/ssl/google.html");
714 ui_test_utils::NavigateToURL(browser(), 714 ui_test_utils::NavigateToURL(browser(),
715 GURL(http_url.spec() + bad_https_url.spec())); 715 GURL(http_url.spec() + bad_https_url.spec()));
716 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 716 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
717 true); // Interstitial showing. 717 true); // Interstitial showing.
718 718
719 ProceedThroughInterstitial(tab); 719 ProceedThroughInterstitial(tab);
720 720
721 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 721 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
722 false); // No interstitial showing. 722 false); // No interstitial showing.
723 } 723 }
724 724
725 // Visit a page over https that is a redirect to a page with http (to make sure 725 // Visit a page over https that is a redirect to a page with http (to make sure
726 // we don't keep the secure state). 726 // we don't keep the secure state).
727 // Marked as flaky, see bug 40932. 727 // Marked as flaky, see bug 40932.
728 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { 728 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) {
729 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 729 scoped_refptr<HTTPTestServer> http_server = PlainServer();
730 ASSERT_TRUE(http_server.get() != NULL); 730 ASSERT_TRUE(http_server.get() != NULL);
731 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 731 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
732 ASSERT_TRUE(https_server.get() != NULL); 732 ASSERT_TRUE(https_server.get() != NULL);
733 733
734 GURL https_url = https_server->TestServerPageW(L"server-redirect?"); 734 GURL https_url = https_server->TestServerPage("server-redirect?");
735 GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html"); 735 GURL http_url = http_server->TestServerPage("files/ssl/google.html");
736 736
737 ui_test_utils::NavigateToURL(browser(), 737 ui_test_utils::NavigateToURL(browser(),
738 GURL(https_url.spec() + http_url.spec())); 738 GURL(https_url.spec() + http_url.spec()));
739 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); 739 CheckUnauthenticatedState(browser()->GetSelectedTabContents());
740 } 740 }
741 741
742 // Visits a page to which we could not connect (bad port) over http and https 742 // Visits a page to which we could not connect (bad port) over http and https
743 // and make sure the security style is correct. 743 // and make sure the security style is correct.
744 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { 744 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) {
745 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); 745 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17"));
(...skipping 17 matching lines...) Expand all
763 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 763 scoped_refptr<HTTPTestServer> http_server = PlainServer();
764 ASSERT_TRUE(http_server.get() != NULL); 764 ASSERT_TRUE(http_server.get() != NULL);
765 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 765 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
766 ASSERT_TRUE(good_https_server.get() != NULL); 766 ASSERT_TRUE(good_https_server.get() != NULL);
767 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 767 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
768 ASSERT_TRUE(bad_https_server.get() != NULL); 768 ASSERT_TRUE(bad_https_server.get() != NULL);
769 769
770 TabContents* tab = browser()->GetSelectedTabContents(); 770 TabContents* tab = browser()->GetSelectedTabContents();
771 ui_test_utils::NavigateToURL( 771 ui_test_utils::NavigateToURL(
772 browser(), 772 browser(),
773 good_https_server->TestServerPageW(L"files/ssl/top_frame.html")); 773 good_https_server->TestServerPage("files/ssl/top_frame.html"));
774 774
775 CheckAuthenticatedState(tab, false, false); 775 CheckAuthenticatedState(tab, false, false);
776 776
777 bool success = false; 777 bool success = false;
778 // Now navigate inside the frame. 778 // Now navigate inside the frame.
779 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 779 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
780 tab->render_view_host(), L"", 780 tab->render_view_host(), L"",
781 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", 781 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
782 &success)); 782 &success));
783 EXPECT_TRUE(success); 783 EXPECT_TRUE(success);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 // Marked as flaky, see bug 40932. 838 // Marked as flaky, see bug 40932.
839 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { 839 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) {
840 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 840 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
841 ASSERT_TRUE(good_https_server.get() != NULL); 841 ASSERT_TRUE(good_https_server.get() != NULL);
842 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 842 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
843 ASSERT_TRUE(bad_https_server.get() != NULL); 843 ASSERT_TRUE(bad_https_server.get() != NULL);
844 844
845 TabContents* tab = browser()->GetSelectedTabContents(); 845 TabContents* tab = browser()->GetSelectedTabContents();
846 ui_test_utils::NavigateToURL( 846 ui_test_utils::NavigateToURL(
847 browser(), 847 browser(),
848 bad_https_server->TestServerPageW(L"files/ssl/top_frame.html")); 848 bad_https_server->TestServerPage("files/ssl/top_frame.html"));
849 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 849 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
850 true); // Interstitial showing 850 true); // Interstitial showing
851 851
852 ProceedThroughInterstitial(tab); 852 ProceedThroughInterstitial(tab);
853 853
854 // Navigate to a good frame. 854 // Navigate to a good frame.
855 bool success = false; 855 bool success = false;
856 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 856 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
857 tab->render_view_host(), 857 tab->render_view_host(),
858 L"", 858 L"",
(...skipping 13 matching lines...) Expand all
872 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 872 scoped_refptr<HTTPTestServer> http_server = PlainServer();
873 ASSERT_TRUE(http_server.get() != NULL); 873 ASSERT_TRUE(http_server.get() != NULL);
874 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 874 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
875 ASSERT_TRUE(good_https_server.get() != NULL); 875 ASSERT_TRUE(good_https_server.get() != NULL);
876 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 876 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
877 ASSERT_TRUE(bad_https_server.get() != NULL); 877 ASSERT_TRUE(bad_https_server.get() != NULL);
878 878
879 TabContents* tab = browser()->GetSelectedTabContents(); 879 TabContents* tab = browser()->GetSelectedTabContents();
880 ui_test_utils::NavigateToURL( 880 ui_test_utils::NavigateToURL(
881 browser(), 881 browser(),
882 http_server->TestServerPageW(L"files/ssl/top_frame.html")); 882 http_server->TestServerPage("files/ssl/top_frame.html"));
883 CheckUnauthenticatedState(tab); 883 CheckUnauthenticatedState(tab);
884 884
885 // Now navigate inside the frame to a secure HTTPS frame. 885 // Now navigate inside the frame to a secure HTTPS frame.
886 bool success = false; 886 bool success = false;
887 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 887 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
888 tab->render_view_host(), L"", 888 tab->render_view_host(), L"",
889 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", 889 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
890 &success)); 890 &success));
891 EXPECT_TRUE(success); 891 EXPECT_TRUE(success);
892 ui_test_utils::WaitForNavigation(&tab->controller()); 892 ui_test_utils::WaitForNavigation(&tab->controller());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 966
967 // Visit a page over https that contains a frame with a redirect. 967 // Visit a page over https that contains a frame with a redirect.
968 968
969 // XMLHttpRequest mixed in synchronous mode. 969 // XMLHttpRequest mixed in synchronous mode.
970 970
971 // XMLHttpRequest mixed in asynchronous mode. 971 // XMLHttpRequest mixed in asynchronous mode.
972 972
973 // XMLHttpRequest over bad ssl in synchronous mode. 973 // XMLHttpRequest over bad ssl in synchronous mode.
974 974
975 // XMLHttpRequest over OK ssl in synchronous mode. 975 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698