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

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

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <Windows.h> 5 #include <Windows.h>
6 #include <Wincrypt.h> 6 #include <Wincrypt.h>
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/common/filter_policy.h" 10 #include "chrome/common/filter_policy.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/test/automation/browser_proxy.h" 12 #include "chrome/test/automation/browser_proxy.h"
13 #include "chrome/test/automation/tab_proxy.h" 13 #include "chrome/test/automation/tab_proxy.h"
14 #include "chrome/test/ui/ui_test.h" 14 #include "chrome/test/ui/ui_test.h"
15 #include "net/base/ssl_test_util.h" 15 #include "net/base/ssl_test_util.h"
16 #include "net/url_request/url_request_unittest.h" 16 #include "net/url_request/url_request_unittest.h"
17 17
18 namespace { 18 namespace {
19 19
20 const wchar_t kDocRoot[] = L"chrome/test/data"; 20 const wchar_t kDocRoot[] = L"chrome/test/data";
21 21
22 class SSLUITest : public UITest { 22 class SSLUITest : public UITest {
23 protected: 23 protected:
24 SSLUITest() { 24 SSLUITest() {
25 dom_automation_enabled_ = true; 25 dom_automation_enabled_ = true;
26 } 26 }
27 27
28 TabProxy* GetActiveTabProxy() { 28 scoped_refptr<TabProxy> GetActiveTabProxy() {
29 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 29 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)) ;
30 EXPECT_TRUE(browser_proxy.get()); 30 EXPECT_TRUE(browser_proxy.get());
31 return browser_proxy->GetActiveTab(); 31 return browser_proxy->GetActiveTab();
32 } 32 }
33 33
34 void NavigateTab(TabProxy* tab_proxy, const GURL& url) { 34 void NavigateTab(TabProxy* tab_proxy, const GURL& url) {
35 ASSERT_TRUE(tab_proxy->NavigateToURL(url)); 35 ASSERT_TRUE(tab_proxy->NavigateToURL(url));
36 } 36 }
37 37
38 void AppendTab(const GURL& url) { 38 void AppendTab(const GURL& url) {
39 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 39 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)) ;
40 EXPECT_TRUE(browser_proxy.get()); 40 EXPECT_TRUE(browser_proxy.get());
41 EXPECT_TRUE(browser_proxy->AppendTab(url)); 41 EXPECT_TRUE(browser_proxy->AppendTab(url));
42 } 42 }
43 43
44 // Before using returned value you should check that the assertion below 44 // Before using returned value you should check that the assertion below
45 // didn't fail. To do so, use HasFailure(). 45 // didn't fail. To do so, use HasFailure().
46 scoped_refptr<HTTPTestServer> PlainServer() { 46 scoped_refptr<HTTPTestServer> PlainServer() {
47 scoped_refptr<HTTPTestServer> server( 47 scoped_refptr<HTTPTestServer> server(
48 HTTPTestServer::CreateServer(kDocRoot, NULL)); 48 HTTPTestServer::CreateServer(kDocRoot, NULL));
49 EXPECT_TRUE(server.get()); 49 EXPECT_TRUE(server.get());
(...skipping 23 matching lines...) Expand all
73 }; 73 };
74 74
75 } // namespace 75 } // namespace
76 76
77 // Visits a regular page over http. 77 // Visits a regular page over http.
78 TEST_F(SSLUITest, TestHTTP) { 78 TEST_F(SSLUITest, TestHTTP) {
79 scoped_refptr<HTTPTestServer> server = PlainServer(); 79 scoped_refptr<HTTPTestServer> server = PlainServer();
80 if (HasFailure()) 80 if (HasFailure())
81 return; 81 return;
82 82
83 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 83 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
84 NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html")); 84 NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html"));
85 85
86 NavigationEntry::PageType page_type; 86 NavigationEntry::PageType page_type;
87 EXPECT_TRUE(tab->GetPageType(&page_type)); 87 EXPECT_TRUE(tab->GetPageType(&page_type));
88 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 88 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
89 89
90 SecurityStyle security_style; 90 SecurityStyle security_style;
91 int cert_status; 91 int cert_status;
92 int mixed_content_state; 92 int mixed_content_state;
93 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 93 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
94 &mixed_content_state)); 94 &mixed_content_state));
95 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); 95 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style);
96 EXPECT_EQ(0, cert_status); 96 EXPECT_EQ(0, cert_status);
97 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 97 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
98 } 98 }
99 99
100 // Visits a page over http which includes broken https resources (status should 100 // Visits a page over http which includes broken https resources (status should
101 // be OK). 101 // be OK).
102 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { 102 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
103 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 103 scoped_refptr<HTTPTestServer> http_server = PlainServer();
104 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 104 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
105 if (HasFailure()) 105 if (HasFailure())
106 return; 106 return;
107 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 107 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
108 108
109 NavigateTab( 109 NavigateTab(
110 tab.get(), 110 tab.get(),
111 http_server->TestServerPageW( 111 http_server->TestServerPageW(
112 L"files/ssl/page_with_unsafe_contents.html")); 112 L"files/ssl/page_with_unsafe_contents.html"));
113 113
114 SecurityStyle security_style; 114 SecurityStyle security_style;
115 int cert_status; 115 int cert_status;
116 int mixed_content_state; 116 int mixed_content_state;
117 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 117 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
118 &mixed_content_state)); 118 &mixed_content_state));
119 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); 119 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style);
120 EXPECT_EQ(0, cert_status); 120 EXPECT_EQ(0, cert_status);
121 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 121 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
122 } 122 }
123 123
124 // Visits a page over OK https: 124 // Visits a page over OK https:
125 TEST_F(SSLUITest, TestOKHTTPS) { 125 TEST_F(SSLUITest, TestOKHTTPS) {
126 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 126 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
127 if (HasFailure()) 127 if (HasFailure())
128 return; 128 return;
129 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 129 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
130 NavigateTab(tab.get(), 130 NavigateTab(tab.get(),
131 https_server->TestServerPageW(L"files/ssl/google.html")); 131 https_server->TestServerPageW(L"files/ssl/google.html"));
132 132
133 NavigationEntry::PageType page_type; 133 NavigationEntry::PageType page_type;
134 EXPECT_TRUE(tab->GetPageType(&page_type)); 134 EXPECT_TRUE(tab->GetPageType(&page_type));
135 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 135 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
136 136
137 SecurityStyle security_style; 137 SecurityStyle security_style;
138 int cert_status; 138 int cert_status;
139 int mixed_content_state; 139 int mixed_content_state;
140 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 140 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
141 &mixed_content_state)); 141 &mixed_content_state));
142 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 142 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
143 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 143 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
144 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 144 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
145 } 145 }
146 146
147 // Visits a page with https error and proceed: 147 // Visits a page with https error and proceed:
148 TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { 148 TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) {
149 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 149 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
150 if (HasFailure()) 150 if (HasFailure())
151 return; 151 return;
152 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 152 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
153 NavigateTab(tab.get(), 153 NavigateTab(tab.get(),
154 bad_https_server->TestServerPageW(L"files/ssl/google.html")); 154 bad_https_server->TestServerPageW(L"files/ssl/google.html"));
155 155
156 NavigationEntry::PageType page_type; 156 NavigationEntry::PageType page_type;
157 EXPECT_TRUE(tab->GetPageType(&page_type)); 157 EXPECT_TRUE(tab->GetPageType(&page_type));
158 EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, page_type); 158 EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, page_type);
159 159
160 SecurityStyle security_style; 160 SecurityStyle security_style;
161 int cert_status; 161 int cert_status;
162 int mixed_content_state; 162 int mixed_content_state;
(...skipping 16 matching lines...) Expand all
179 } 179 }
180 180
181 // Visits a page with https error and don't proceed (and ensure we can still 181 // Visits a page with https error and don't proceed (and ensure we can still
182 // navigate at that point): 182 // navigate at that point):
183 TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) { 183 TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) {
184 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 184 scoped_refptr<HTTPTestServer> http_server = PlainServer();
185 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 185 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
186 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 186 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
187 if (HasFailure()) 187 if (HasFailure())
188 return; 188 return;
189 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 189 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
190 190
191 // First navigate to an OK page. 191 // First navigate to an OK page.
192 NavigateTab(tab.get(), 192 NavigateTab(tab.get(),
193 good_https_server->TestServerPageW(L"files/ssl/google.html")); 193 good_https_server->TestServerPageW(L"files/ssl/google.html"));
194 194
195 GURL cross_site_url = 195 GURL cross_site_url =
196 bad_https_server->TestServerPageW(L"files/ssl/google.html"); 196 bad_https_server->TestServerPageW(L"files/ssl/google.html");
197 // Change the host name from 127.0.0.1 to localhost so it triggers a 197 // Change the host name from 127.0.0.1 to localhost so it triggers a
198 // cross-site navigation so we can test http://crbug.com/5800 is gone. 198 // cross-site navigation so we can test http://crbug.com/5800 is gone.
199 ASSERT_EQ("127.0.0.1", cross_site_url.host()); 199 ASSERT_EQ("127.0.0.1", cross_site_url.host());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 // Visits a page with mixed content. 245 // Visits a page with mixed content.
246 TEST_F(SSLUITest, TestMixedContents) { 246 TEST_F(SSLUITest, TestMixedContents) {
247 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 247 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
248 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 248 scoped_refptr<HTTPTestServer> http_server = PlainServer();
249 if (HasFailure()) 249 if (HasFailure())
250 return; 250 return;
251 251
252 // Load a page with mixed-content, the default behavior is to show the mixed 252 // Load a page with mixed-content, the default behavior is to show the mixed
253 // content. 253 // content.
254 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 254 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
255 NavigateTab( 255 NavigateTab(
256 tab.get(), 256 tab.get(),
257 https_server->TestServerPageW( 257 https_server->TestServerPageW(
258 L"files/ssl/page_with_mixed_contents.html")); 258 L"files/ssl/page_with_mixed_contents.html"));
259 NavigationEntry::PageType page_type; 259 NavigationEntry::PageType page_type;
260 EXPECT_TRUE(tab->GetPageType(&page_type)); 260 EXPECT_TRUE(tab->GetPageType(&page_type));
261 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 261 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
262 262
263 SecurityStyle security_style; 263 SecurityStyle security_style;
264 int cert_status; 264 int cert_status;
265 int mixed_content_state; 265 int mixed_content_state;
266 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 266 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
267 &mixed_content_state)); 267 &mixed_content_state));
268 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 268 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
269 EXPECT_EQ(0, 269 EXPECT_EQ(0,
270 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected. 270 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected.
271 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); 271 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state);
272 } 272 }
273 273
274 // Visits a page with mixed content. 274 // Visits a page with mixed content.
275 TEST_F(SSLUITest, TestMixedContentsFilterAll) { 275 TEST_F(SSLUITest, TestMixedContentsFilterAll) {
276 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 276 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
277 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 277 scoped_refptr<HTTPTestServer> http_server = PlainServer();
278 if (HasFailure()) 278 if (HasFailure())
279 return; 279 return;
280 280
281 // Now select the block mixed-content pref and reload the page. 281 // Now select the block mixed-content pref and reload the page.
282 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 282 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
283 EXPECT_TRUE(browser_proxy.get()); 283 EXPECT_TRUE(browser_proxy.get());
284 EXPECT_TRUE(browser_proxy->SetIntPreference(prefs::kMixedContentFiltering, 284 EXPECT_TRUE(browser_proxy->SetIntPreference(prefs::kMixedContentFiltering,
285 FilterPolicy::FILTER_ALL)); 285 FilterPolicy::FILTER_ALL));
286 286
287 // Load a page with mixed-content, we've overridden our filtering policy so 287 // Load a page with mixed-content, we've overridden our filtering policy so
288 // we won't load the mixed content by default. 288 // we won't load the mixed content by default.
289 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 289 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
290 NavigateTab( 290 NavigateTab(
291 tab.get(), 291 tab.get(),
292 https_server->TestServerPageW( 292 https_server->TestServerPageW(
293 L"files/ssl/page_with_mixed_contents.html")); 293 L"files/ssl/page_with_mixed_contents.html"));
294 NavigationEntry::PageType page_type; 294 NavigationEntry::PageType page_type;
295 EXPECT_TRUE(tab->GetPageType(&page_type)); 295 EXPECT_TRUE(tab->GetPageType(&page_type));
296 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 296 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
297 297
298 // The image should be filtered. 298 // The image should be filtered.
299 int img_width; 299 int img_width;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 // Visits a page with an http script that tries to suppress our mixed content 340 // Visits a page with an http script that tries to suppress our mixed content
341 // warnings by randomize location.hash. 341 // warnings by randomize location.hash.
342 // Based on http://crbug.com/8706 342 // Based on http://crbug.com/8706
343 TEST_F(SSLUITest, TestMixedContentsRandomizeHash) { 343 TEST_F(SSLUITest, TestMixedContentsRandomizeHash) {
344 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 344 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
345 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 345 scoped_refptr<HTTPTestServer> http_server = PlainServer();
346 if (HasFailure()) 346 if (HasFailure())
347 return; 347 return;
348 348
349 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 349 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
350 NavigateTab( 350 NavigateTab(
351 tab.get(), 351 tab.get(),
352 https_server->TestServerPageW( 352 https_server->TestServerPageW(
353 L"files/ssl/page_with_http_script.html")); 353 L"files/ssl/page_with_http_script.html"));
354 NavigationEntry::PageType page_type; 354 NavigationEntry::PageType page_type;
355 EXPECT_TRUE(tab->GetPageType(&page_type)); 355 EXPECT_TRUE(tab->GetPageType(&page_type));
356 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 356 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
357 357
358 SecurityStyle security_style; 358 SecurityStyle security_style;
359 int cert_status; 359 int cert_status;
360 int mixed_content_state; 360 int mixed_content_state;
361 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 361 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
362 &mixed_content_state)); 362 &mixed_content_state));
363 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 363 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
364 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 364 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
365 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); 365 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state);
366 } 366 }
367 367
368 // Visits a page with unsafe content and make sure that: 368 // Visits a page with unsafe content and make sure that:
369 // - frames content is replaced with warning 369 // - frames content is replaced with warning
370 // - images and scripts are filtered out entirely 370 // - images and scripts are filtered out entirely
371 TEST_F(SSLUITest, TestUnsafeContents) { 371 TEST_F(SSLUITest, TestUnsafeContents) {
372 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 372 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
373 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 373 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
374 if (HasFailure()) 374 if (HasFailure())
375 return; 375 return;
376 376
377 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 377 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
378 NavigateTab(tab.get(), 378 NavigateTab(tab.get(),
379 good_https_server->TestServerPageW( 379 good_https_server->TestServerPageW(
380 L"files/ssl/page_with_unsafe_contents.html")); 380 L"files/ssl/page_with_unsafe_contents.html"));
381 NavigationEntry::PageType page_type; 381 NavigationEntry::PageType page_type;
382 EXPECT_TRUE(tab->GetPageType(&page_type)); 382 EXPECT_TRUE(tab->GetPageType(&page_type));
383 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 383 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
384 384
385 SecurityStyle security_style; 385 SecurityStyle security_style;
386 int cert_status; 386 int cert_status;
387 int mixed_content_state; 387 int mixed_content_state;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 EXPECT_FALSE(js_result); 419 EXPECT_FALSE(js_result);
420 } 420 }
421 421
422 // Visits a page with mixed content loaded by JS (after the initial page load). 422 // Visits a page with mixed content loaded by JS (after the initial page load).
423 TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) { 423 TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) {
424 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 424 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
425 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 425 scoped_refptr<HTTPTestServer> http_server = PlainServer();
426 if (HasFailure()) 426 if (HasFailure())
427 return; 427 return;
428 428
429 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 429 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
430 NavigateTab(tab.get(), https_server->TestServerPageW( 430 NavigateTab(tab.get(), https_server->TestServerPageW(
431 L"files/ssl/page_with_dynamic_mixed_contents.html")); 431 L"files/ssl/page_with_dynamic_mixed_contents.html"));
432 NavigationEntry::PageType page_type; 432 NavigationEntry::PageType page_type;
433 EXPECT_TRUE(tab->GetPageType(&page_type)); 433 EXPECT_TRUE(tab->GetPageType(&page_type));
434 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 434 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
435 SecurityStyle security_style; 435 SecurityStyle security_style;
436 int cert_status; 436 int cert_status;
437 int mixed_content_state; 437 int mixed_content_state;
438 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 438 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
439 &mixed_content_state)); 439 &mixed_content_state));
(...skipping 21 matching lines...) Expand all
461 // Visits two pages from the same origin: one with mixed content and one 461 // Visits two pages from the same origin: one with mixed content and one
462 // without. The test checks that we don't propagate the mixed content state 462 // without. The test checks that we don't propagate the mixed content state
463 // from one process to another process. This test is expected to fail in 463 // from one process to another process. This test is expected to fail in
464 // single process mode. 464 // single process mode.
465 TEST_F(SSLUITest, TestMixedContentsTwoTabs) { 465 TEST_F(SSLUITest, TestMixedContentsTwoTabs) {
466 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 466 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
467 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 467 scoped_refptr<HTTPTestServer> http_server = PlainServer();
468 if (HasFailure()) 468 if (HasFailure())
469 return; 469 return;
470 470
471 scoped_ptr<TabProxy> tab1(GetActiveTabProxy()); 471 scoped_refptr<TabProxy> tab1(GetActiveTabProxy());
472 NavigateTab( 472 NavigateTab(
473 tab1.get(), 473 tab1.get(),
474 https_server->TestServerPageW( 474 https_server->TestServerPageW(
475 L"files/ssl/blank_page.html")); 475 L"files/ssl/blank_page.html"));
476 NavigationEntry::PageType page_type; 476 NavigationEntry::PageType page_type;
477 EXPECT_TRUE(tab1->GetPageType(&page_type)); 477 EXPECT_TRUE(tab1->GetPageType(&page_type));
478 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 478 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
479 479
480 // This tab should be fine. 480 // This tab should be fine.
481 SecurityStyle security_style; 481 SecurityStyle security_style;
482 int cert_status; 482 int cert_status;
483 int mixed_content_state; 483 int mixed_content_state;
484 EXPECT_TRUE(tab1->GetSecurityState(&security_style, &cert_status, 484 EXPECT_TRUE(tab1->GetSecurityState(&security_style, &cert_status,
485 &mixed_content_state)); 485 &mixed_content_state));
486 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 486 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
487 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 487 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
488 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 488 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
489 489
490 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 490 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
491 EXPECT_TRUE(browser_proxy.get()); 491 EXPECT_TRUE(browser_proxy.get());
492 EXPECT_TRUE(browser_proxy->AppendTab( 492 EXPECT_TRUE(browser_proxy->AppendTab(
493 https_server->TestServerPageW(L"files/ssl/page_with_http_script.html"))); 493 https_server->TestServerPageW(L"files/ssl/page_with_http_script.html")));
494 494
495 scoped_ptr<TabProxy> tab2(GetActiveTabProxy()); 495 scoped_refptr<TabProxy> tab2(GetActiveTabProxy());
496 EXPECT_TRUE(tab2->GetPageType(&page_type)); 496 EXPECT_TRUE(tab2->GetPageType(&page_type));
497 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 497 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
498 498
499 // The new tab has mixed content. 499 // The new tab has mixed content.
500 EXPECT_TRUE(tab2->GetSecurityState(&security_style, &cert_status, 500 EXPECT_TRUE(tab2->GetSecurityState(&security_style, &cert_status,
501 &mixed_content_state)); 501 &mixed_content_state));
502 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 502 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
503 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 503 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
504 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); 504 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state);
505 505
506 // The origin for the first tab has not been contaminated with 506 // The origin for the first tab has not been contaminated with
507 // mixed content because its in a separate process. 507 // mixed content because its in a separate process.
508 EXPECT_TRUE(tab1->GetSecurityState(&security_style, &cert_status, 508 EXPECT_TRUE(tab1->GetSecurityState(&security_style, &cert_status,
509 &mixed_content_state)); 509 &mixed_content_state));
510 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 510 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
511 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 511 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
512 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 512 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
513 } 513 }
514 514
515 // Visits a page with an image over http. Visits another page over https 515 // Visits a page with an image over http. Visits another page over https
516 // referencing that same image over http (hoping it is coming from the webcore 516 // referencing that same image over http (hoping it is coming from the webcore
517 // memory cache). 517 // memory cache).
518 TEST_F(SSLUITest, TestCachedMixedContents) { 518 TEST_F(SSLUITest, TestCachedMixedContents) {
519 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 519 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
520 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 520 scoped_refptr<HTTPTestServer> http_server = PlainServer();
521 if (HasFailure()) 521 if (HasFailure())
522 return; 522 return;
523 523
524 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 524 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
525 NavigateTab(tab.get(), http_server->TestServerPageW( 525 NavigateTab(tab.get(), http_server->TestServerPageW(
526 L"files/ssl/page_with_mixed_contents.html")); 526 L"files/ssl/page_with_mixed_contents.html"));
527 527
528 NavigationEntry::PageType page_type; 528 NavigationEntry::PageType page_type;
529 EXPECT_TRUE(tab->GetPageType(&page_type)); 529 EXPECT_TRUE(tab->GetPageType(&page_type));
530 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); 530 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
531 SecurityStyle security_style; 531 SecurityStyle security_style;
532 int cert_status; 532 int cert_status;
533 int mixed_content_state; 533 int mixed_content_state;
534 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 534 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
(...skipping 22 matching lines...) Expand all
557 // (see bug #1044942) and that it depends on the host-name. 557 // (see bug #1044942) and that it depends on the host-name.
558 // TODO(jcampan): this test is flacky and fails sometimes (bug #1065095) 558 // TODO(jcampan): this test is flacky and fails sometimes (bug #1065095)
559 TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) { 559 TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) {
560 const std::string kLocalHost = "localhost"; 560 const std::string kLocalHost = "localhost";
561 scoped_refptr<HTTPSTestServer> https_server = 561 scoped_refptr<HTTPSTestServer> https_server =
562 HTTPSTestServer::CreateMismatchedServer(kDocRoot); 562 HTTPSTestServer::CreateMismatchedServer(kDocRoot);
563 ASSERT_TRUE(NULL != https_server.get()); 563 ASSERT_TRUE(NULL != https_server.get());
564 564
565 // First we hit the server with hostname, this generates an invalid policy 565 // First we hit the server with hostname, this generates an invalid policy
566 // error. 566 // error.
567 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 567 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
568 NavigateTab(tab.get(), https_server->TestServerPageW( 568 NavigateTab(tab.get(), https_server->TestServerPageW(
569 L"files/ssl/google.html")); 569 L"files/ssl/google.html"));
570 570
571 // We get an interstitial page as a result. 571 // We get an interstitial page as a result.
572 NavigationEntry::PageType page_type; 572 NavigationEntry::PageType page_type;
573 EXPECT_TRUE(tab->GetPageType(&page_type)); 573 EXPECT_TRUE(tab->GetPageType(&page_type));
574 EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, page_type); 574 EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, page_type);
575 575
576 SecurityStyle security_style; 576 SecurityStyle security_style;
577 int cert_status; 577 int cert_status;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 EXPECT_EQ(net::CERT_STATUS_COMMON_NAME_INVALID, 622 EXPECT_EQ(net::CERT_STATUS_COMMON_NAME_INVALID,
623 cert_status & net::CERT_STATUS_ALL_ERRORS); 623 cert_status & net::CERT_STATUS_ALL_ERRORS);
624 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 624 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
625 } 625 }
626 626
627 // Test that navigating to a #ref does not change a bad security state. 627 // Test that navigating to a #ref does not change a bad security state.
628 TEST_F(SSLUITest, TestRefNavigation) { 628 TEST_F(SSLUITest, TestRefNavigation) {
629 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 629 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
630 if (HasFailure()) 630 if (HasFailure())
631 return; 631 return;
632 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 632 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
633 NavigateTab( 633 NavigateTab(
634 tab.get(), 634 tab.get(),
635 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html")); 635 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html"));
636 636
637 NavigationEntry::PageType page_type; 637 NavigationEntry::PageType page_type;
638 EXPECT_TRUE(tab->GetPageType(&page_type)); 638 EXPECT_TRUE(tab->GetPageType(&page_type));
639 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE); 639 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE);
640 640
641 SecurityStyle security_style; 641 SecurityStyle security_style;
642 int cert_status; 642 int cert_status;
(...skipping 27 matching lines...) Expand all
670 670
671 // Tests that closing a page that has a unsafe pop-up does not crash the browser 671 // Tests that closing a page that has a unsafe pop-up does not crash the browser
672 // (bug #1966). 672 // (bug #1966).
673 // Disabled because flaky (bug #2136). 673 // Disabled because flaky (bug #2136).
674 TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { 674 TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
675 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 675 scoped_refptr<HTTPTestServer> http_server = PlainServer();
676 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 676 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
677 if (HasFailure()) 677 if (HasFailure())
678 return; 678 return;
679 679
680 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 680 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
681 NavigateTab(tab.get(), 681 NavigateTab(tab.get(),
682 http_server->TestServerPageW( 682 http_server->TestServerPageW(
683 L"files/ssl/page_with_unsafe_popup.html")); 683 L"files/ssl/page_with_unsafe_popup.html"));
684 684
685 int popup_count = 0; 685 int popup_count = 0;
686 EXPECT_TRUE(tab->GetConstrainedWindowCount(&popup_count)); 686 EXPECT_TRUE(tab->GetConstrainedWindowCount(&popup_count));
687 EXPECT_EQ(1, popup_count); 687 EXPECT_EQ(1, popup_count);
688 688
689 // Let's add another tab to make sure the browser does not exit when we close 689 // Let's add another tab to make sure the browser does not exit when we close
690 // the first tab. 690 // the first tab.
691 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 691 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
692 EXPECT_TRUE(browser_proxy.get()); 692 EXPECT_TRUE(browser_proxy.get());
693 browser_proxy->AppendTab( 693 browser_proxy->AppendTab(
694 http_server->TestServerPageW(L"files/ssl/google.html")); 694 http_server->TestServerPageW(L"files/ssl/google.html"));
695 695
696 // Close the first tab. 696 // Close the first tab.
697 tab->Close(); 697 tab->Close();
698 } 698 }
699 699
700 // Visit a page over bad https that is a redirect to a page with good https. 700 // Visit a page over bad https that is a redirect to a page with good https.
701 TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { 701 TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) {
702 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 702 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
703 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 703 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
704 if (HasFailure()) 704 if (HasFailure())
705 return; 705 return;
706 706
707 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 707 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
708 GURL url1 = bad_https_server->TestServerPageW(L"server-redirect?"); 708 GURL url1 = bad_https_server->TestServerPageW(L"server-redirect?");
709 GURL url2 = good_https_server->TestServerPageW(L"files/ssl/google.html"); 709 GURL url2 = good_https_server->TestServerPageW(L"files/ssl/google.html");
710 NavigateTab(tab.get(), GURL(url1.spec() + url2.spec())); 710 NavigateTab(tab.get(), GURL(url1.spec() + url2.spec()));
711 711
712 NavigationEntry::PageType page_type; 712 NavigationEntry::PageType page_type;
713 EXPECT_TRUE(tab->GetPageType(&page_type)); 713 EXPECT_TRUE(tab->GetPageType(&page_type));
714 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE); 714 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE);
715 715
716 SecurityStyle security_style; 716 SecurityStyle security_style;
717 int cert_status; 717 int cert_status;
(...skipping 14 matching lines...) Expand all
732 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 732 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
733 } 733 }
734 734
735 // Visit a page over good https that is a redirect to a page with bad https. 735 // Visit a page over good https that is a redirect to a page with bad https.
736 TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { 736 TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) {
737 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 737 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
738 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 738 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
739 if (HasFailure()) 739 if (HasFailure())
740 return; 740 return;
741 741
742 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 742 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
743 GURL url1 = good_https_server->TestServerPageW(L"server-redirect?"); 743 GURL url1 = good_https_server->TestServerPageW(L"server-redirect?");
744 GURL url2 = bad_https_server->TestServerPageW(L"files/ssl/google.html"); 744 GURL url2 = bad_https_server->TestServerPageW(L"files/ssl/google.html");
745 NavigateTab(tab.get(), GURL(url1.spec() + url2.spec())); 745 NavigateTab(tab.get(), GURL(url1.spec() + url2.spec()));
746 746
747 NavigationEntry::PageType page_type; 747 NavigationEntry::PageType page_type;
748 EXPECT_TRUE(tab->GetPageType(&page_type)); 748 EXPECT_TRUE(tab->GetPageType(&page_type));
749 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE); 749 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE);
750 750
751 EXPECT_TRUE(tab->TakeActionOnSSLBlockingPage(true)); 751 EXPECT_TRUE(tab->TakeActionOnSSLBlockingPage(true));
752 752
(...skipping 11 matching lines...) Expand all
764 // Visit a page over http that is a redirect to a page with https (good and 764 // Visit a page over http that is a redirect to a page with https (good and
765 // bad). 765 // bad).
766 TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) { 766 TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) {
767 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 767 scoped_refptr<HTTPTestServer> http_server = PlainServer();
768 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 768 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
769 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 769 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
770 if (HasFailure()) 770 if (HasFailure())
771 return; 771 return;
772 772
773 // HTTP redirects to good HTTPS. 773 // HTTP redirects to good HTTPS.
774 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 774 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
775 GURL http_url = http_server->TestServerPageW(L"server-redirect?"); 775 GURL http_url = http_server->TestServerPageW(L"server-redirect?");
776 GURL good_https_url = 776 GURL good_https_url =
777 good_https_server->TestServerPageW(L"files/ssl/google.html"); 777 good_https_server->TestServerPageW(L"files/ssl/google.html");
778 NavigateTab(tab.get(), GURL(http_url.spec() + good_https_url.spec())); 778 NavigateTab(tab.get(), GURL(http_url.spec() + good_https_url.spec()));
779 779
780 SecurityStyle security_style; 780 SecurityStyle security_style;
781 int cert_status; 781 int cert_status;
782 int mixed_content_state; 782 int mixed_content_state;
783 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 783 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
784 &mixed_content_state)); 784 &mixed_content_state));
(...skipping 22 matching lines...) Expand all
807 } 807 }
808 808
809 // Visit a page over https that is a redirect to a page with http (to make sure 809 // Visit a page over https that is a redirect to a page with http (to make sure
810 // we don't keep the secure state). 810 // we don't keep the secure state).
811 TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { 811 TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) {
812 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 812 scoped_refptr<HTTPTestServer> http_server = PlainServer();
813 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); 813 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
814 if (HasFailure()) 814 if (HasFailure())
815 return; 815 return;
816 816
817 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 817 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
818 GURL https_url = https_server->TestServerPageW(L"server-redirect?"); 818 GURL https_url = https_server->TestServerPageW(L"server-redirect?");
819 GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html"); 819 GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html");
820 NavigateTab(tab.get(), GURL(https_url.spec() + http_url.spec())); 820 NavigateTab(tab.get(), GURL(https_url.spec() + http_url.spec()));
821 821
822 SecurityStyle security_style; 822 SecurityStyle security_style;
823 int cert_status; 823 int cert_status;
824 int mixed_content_state; 824 int mixed_content_state;
825 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 825 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
826 &mixed_content_state)); 826 &mixed_content_state));
827 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); 827 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style);
828 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 828 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
829 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); 829 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
830 } 830 }
831 831
832 // Visits a page to which we could not connect (bad port) over http and https 832 // Visits a page to which we could not connect (bad port) over http and https
833 // and make sure the security style is correct. 833 // and make sure the security style is correct.
834 TEST_F(SSLUITest, TestConnectToBadPort) { 834 TEST_F(SSLUITest, TestConnectToBadPort) {
835 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 835 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
836 836
837 GURL http_url("http://localhost:17"); 837 GURL http_url("http://localhost:17");
838 NavigateTab(tab.get(), http_url); 838 NavigateTab(tab.get(), http_url);
839 839
840 SecurityStyle security_style; 840 SecurityStyle security_style;
841 int cert_status; 841 int cert_status;
842 int mixed_content_state; 842 int mixed_content_state;
843 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 843 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
844 &mixed_content_state)); 844 &mixed_content_state));
845 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); 845 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style);
(...skipping 20 matching lines...) Expand all
866 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then 866 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then
867 // back 867 // back
868 // - navigate to HTTP (expect mixed content), then back 868 // - navigate to HTTP (expect mixed content), then back
869 TEST_F(SSLUITest, TestGoodFrameNavigation) { 869 TEST_F(SSLUITest, TestGoodFrameNavigation) {
870 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 870 scoped_refptr<HTTPTestServer> http_server = PlainServer();
871 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 871 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
872 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 872 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
873 if (HasFailure()) 873 if (HasFailure())
874 return; 874 return;
875 875
876 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 876 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
877 NavigateTab(tab.get(), 877 NavigateTab(tab.get(),
878 good_https_server->TestServerPageW(L"files/ssl/top_frame.html")); 878 good_https_server->TestServerPageW(L"files/ssl/top_frame.html"));
879 879
880 SecurityStyle security_style; 880 SecurityStyle security_style;
881 int cert_status; 881 int cert_status;
882 int mixed_content_state; 882 int mixed_content_state;
883 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 883 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
884 &mixed_content_state)); 884 &mixed_content_state));
885 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); 885 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style);
886 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 886 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 } 963 }
964 964
965 // From a bad HTTPS top frame: 965 // From a bad HTTPS top frame:
966 // - navigate to an OK HTTPS frame (expected to be still authentication broken). 966 // - navigate to an OK HTTPS frame (expected to be still authentication broken).
967 TEST_F(SSLUITest, TestBadFrameNavigation) { 967 TEST_F(SSLUITest, TestBadFrameNavigation) {
968 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 968 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
969 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 969 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
970 if (HasFailure()) 970 if (HasFailure())
971 return; 971 return;
972 972
973 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 973 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
974 NavigateTab(tab.get(), 974 NavigateTab(tab.get(),
975 bad_https_server->TestServerPageW(L"files/ssl/top_frame.html")); 975 bad_https_server->TestServerPageW(L"files/ssl/top_frame.html"));
976 976
977 SecurityStyle security_style; 977 SecurityStyle security_style;
978 int cert_status; 978 int cert_status;
979 int mixed_content_state; 979 int mixed_content_state;
980 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 980 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
981 &mixed_content_state)); 981 &mixed_content_state));
982 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); 982 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style);
983 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, 983 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID,
(...skipping 24 matching lines...) Expand all
1008 1008
1009 // From an HTTP top frame, navigate to good and bad HTTPS (security state should 1009 // From an HTTP top frame, navigate to good and bad HTTPS (security state should
1010 // stay unauthenticated). 1010 // stay unauthenticated).
1011 TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) { 1011 TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) {
1012 scoped_refptr<HTTPTestServer> http_server = PlainServer(); 1012 scoped_refptr<HTTPTestServer> http_server = PlainServer();
1013 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer(); 1013 scoped_refptr<HTTPSTestServer> good_https_server = GoodCertServer();
1014 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); 1014 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
1015 if (HasFailure()) 1015 if (HasFailure())
1016 return; 1016 return;
1017 1017
1018 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); 1018 scoped_refptr<TabProxy> tab(GetActiveTabProxy());
1019 NavigateTab(tab.get(), 1019 NavigateTab(tab.get(),
1020 http_server->TestServerPageW(L"files/ssl/top_frame.html")); 1020 http_server->TestServerPageW(L"files/ssl/top_frame.html"));
1021 1021
1022 SecurityStyle security_style; 1022 SecurityStyle security_style;
1023 int cert_status; 1023 int cert_status;
1024 int mixed_content_state; 1024 int mixed_content_state;
1025 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, 1025 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status,
1026 &mixed_content_state)); 1026 &mixed_content_state));
1027 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); 1027 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style);
1028 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS); 1028 EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 1077
1078 // Visit a page over https that contains a frame with a redirect. 1078 // Visit a page over https that contains a frame with a redirect.
1079 1079
1080 // XMLHttpRequest mixed in synchronous mode. 1080 // XMLHttpRequest mixed in synchronous mode.
1081 1081
1082 // XMLHttpRequest mixed in asynchronous mode. 1082 // XMLHttpRequest mixed in asynchronous mode.
1083 1083
1084 // XMLHttpRequest over bad ssl in synchronous mode. 1084 // XMLHttpRequest over bad ssl in synchronous mode.
1085 1085
1086 // XMLHttpRequest over OK ssl in synchronous mode. 1086 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore_uitest.cc ('k') | chrome/browser/tab_contents/view_source_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698