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

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

Issue 7819009: For the SSL cert status, convert anonymous enum that gives bit values into a typedefed uint32. Th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/tabs/tab_strip_model.h" 8 #include "chrome/browser/tabs/tab_strip_model.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 virtual void SetUpCommandLine(CommandLine* command_line) { 42 virtual void SetUpCommandLine(CommandLine* command_line) {
43 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); 43 command_line->AppendSwitch(switches::kAllowRunningInsecureContent);
44 } 44 }
45 45
46 void CheckAuthenticatedState(TabContents* tab, 46 void CheckAuthenticatedState(TabContents* tab,
47 bool displayed_insecure_content) { 47 bool displayed_insecure_content) {
48 NavigationEntry* entry = tab->controller().GetActiveEntry(); 48 NavigationEntry* entry = tab->controller().GetActiveEntry();
49 ASSERT_TRUE(entry); 49 ASSERT_TRUE(entry);
50 EXPECT_EQ(NORMAL_PAGE, entry->page_type()); 50 EXPECT_EQ(NORMAL_PAGE, entry->page_type());
51 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style()); 51 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style());
52 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); 52 EXPECT_EQ(net::CERT_STATUS_NO_ERROR,
53 entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
53 EXPECT_EQ(displayed_insecure_content, 54 EXPECT_EQ(displayed_insecure_content,
54 entry->ssl().displayed_insecure_content()); 55 entry->ssl().displayed_insecure_content());
55 EXPECT_FALSE(entry->ssl().ran_insecure_content()); 56 EXPECT_FALSE(entry->ssl().ran_insecure_content());
56 } 57 }
57 58
58 void CheckUnauthenticatedState(TabContents* tab) { 59 void CheckUnauthenticatedState(TabContents* tab) {
59 NavigationEntry* entry = tab->controller().GetActiveEntry(); 60 NavigationEntry* entry = tab->controller().GetActiveEntry();
60 ASSERT_TRUE(entry); 61 ASSERT_TRUE(entry);
61 EXPECT_EQ(NORMAL_PAGE, entry->page_type()); 62 EXPECT_EQ(NORMAL_PAGE, entry->page_type());
62 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style()); 63 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style());
63 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); 64 EXPECT_EQ(net::CERT_STATUS_NO_ERROR,
65 entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
64 EXPECT_FALSE(entry->ssl().displayed_insecure_content()); 66 EXPECT_FALSE(entry->ssl().displayed_insecure_content());
65 EXPECT_FALSE(entry->ssl().ran_insecure_content()); 67 EXPECT_FALSE(entry->ssl().ran_insecure_content());
66 } 68 }
67 69
68 void CheckAuthenticationBrokenState(TabContents* tab, 70 void CheckAuthenticationBrokenState(TabContents* tab,
69 int error, 71 net::CertStatus error,
70 bool ran_insecure_content, 72 bool ran_insecure_content,
71 bool interstitial) { 73 bool interstitial) {
72 NavigationEntry* entry = tab->controller().GetActiveEntry(); 74 NavigationEntry* entry = tab->controller().GetActiveEntry();
73 ASSERT_TRUE(entry); 75 ASSERT_TRUE(entry);
74 EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE, 76 EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE,
75 entry->page_type()); 77 entry->page_type());
76 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, 78 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN,
77 entry->ssl().security_style()); 79 entry->ssl().security_style());
78 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style 80 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style
79 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. 81 // to SECURITY_STYLE_AUTHENTICATION_BROKEN.
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 1287
1286 // Visit a page over https that contains a frame with a redirect. 1288 // Visit a page over https that contains a frame with a redirect.
1287 1289
1288 // XMLHttpRequest insecure content in synchronous mode. 1290 // XMLHttpRequest insecure content in synchronous mode.
1289 1291
1290 // XMLHttpRequest insecure content in asynchronous mode. 1292 // XMLHttpRequest insecure content in asynchronous mode.
1291 1293
1292 // XMLHttpRequest over bad ssl in synchronous mode. 1294 // XMLHttpRequest over bad ssl in synchronous mode.
1293 1295
1294 // XMLHttpRequest over OK ssl in synchronous mode. 1296 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698