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

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 30 matching lines...) Expand all
41 virtual void SetUpCommandLine(CommandLine* command_line) { 41 virtual void SetUpCommandLine(CommandLine* command_line) {
42 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); 42 command_line->AppendSwitch(switches::kAllowRunningInsecureContent);
43 } 43 }
44 44
45 void CheckAuthenticatedState(TabContents* tab, 45 void CheckAuthenticatedState(TabContents* tab,
46 bool displayed_insecure_content) { 46 bool displayed_insecure_content) {
47 NavigationEntry* entry = tab->controller().GetActiveEntry(); 47 NavigationEntry* entry = tab->controller().GetActiveEntry();
48 ASSERT_TRUE(entry); 48 ASSERT_TRUE(entry);
49 EXPECT_EQ(NORMAL_PAGE, entry->page_type()); 49 EXPECT_EQ(NORMAL_PAGE, entry->page_type());
50 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style()); 50 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style());
51 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); 51 EXPECT_EQ(net::CERT_STATUS_NO_ERROR,
52 entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
52 EXPECT_EQ(displayed_insecure_content, 53 EXPECT_EQ(displayed_insecure_content,
53 entry->ssl().displayed_insecure_content()); 54 entry->ssl().displayed_insecure_content());
54 EXPECT_FALSE(entry->ssl().ran_insecure_content()); 55 EXPECT_FALSE(entry->ssl().ran_insecure_content());
55 } 56 }
56 57
57 void CheckUnauthenticatedState(TabContents* tab) { 58 void CheckUnauthenticatedState(TabContents* tab) {
58 NavigationEntry* entry = tab->controller().GetActiveEntry(); 59 NavigationEntry* entry = tab->controller().GetActiveEntry();
59 ASSERT_TRUE(entry); 60 ASSERT_TRUE(entry);
60 EXPECT_EQ(NORMAL_PAGE, entry->page_type()); 61 EXPECT_EQ(NORMAL_PAGE, entry->page_type());
61 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style()); 62 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style());
62 EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); 63 EXPECT_EQ(net::CERT_STATUS_NO_ERROR,
64 entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
63 EXPECT_FALSE(entry->ssl().displayed_insecure_content()); 65 EXPECT_FALSE(entry->ssl().displayed_insecure_content());
64 EXPECT_FALSE(entry->ssl().ran_insecure_content()); 66 EXPECT_FALSE(entry->ssl().ran_insecure_content());
65 } 67 }
66 68
67 void CheckAuthenticationBrokenState(TabContents* tab, 69 void CheckAuthenticationBrokenState(TabContents* tab,
68 int error, 70 net::CertStatus error,
69 bool ran_insecure_content, 71 bool ran_insecure_content,
70 bool interstitial) { 72 bool interstitial) {
71 NavigationEntry* entry = tab->controller().GetActiveEntry(); 73 NavigationEntry* entry = tab->controller().GetActiveEntry();
72 ASSERT_TRUE(entry); 74 ASSERT_TRUE(entry);
73 EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE, 75 EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE,
74 entry->page_type()); 76 entry->page_type());
75 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, 77 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN,
76 entry->ssl().security_style()); 78 entry->ssl().security_style());
77 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style 79 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style
78 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. 80 // to SECURITY_STYLE_AUTHENTICATION_BROKEN.
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1242
1241 // Visit a page over https that contains a frame with a redirect. 1243 // Visit a page over https that contains a frame with a redirect.
1242 1244
1243 // XMLHttpRequest insecure content in synchronous mode. 1245 // XMLHttpRequest insecure content in synchronous mode.
1244 1246
1245 // XMLHttpRequest insecure content in asynchronous mode. 1247 // XMLHttpRequest insecure content in asynchronous mode.
1246 1248
1247 // XMLHttpRequest over bad ssl in synchronous mode. 1249 // XMLHttpRequest over bad ssl in synchronous mode.
1248 1250
1249 // XMLHttpRequest over OK ssl in synchronous mode. 1251 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698