| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 EnableDOMAutomation(); | 39 EnableDOMAutomation(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Browser will both run and display insecure content. | 42 // Browser will both run and display insecure content. |
| 43 virtual void SetUpCommandLine(CommandLine* command_line) { | 43 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 44 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 44 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CheckAuthenticatedState(TabContents* tab, | 47 void CheckAuthenticatedState(TabContents* tab, |
| 48 bool displayed_insecure_content) { | 48 bool displayed_insecure_content) { |
| 49 ASSERT_FALSE(tab->is_crashed()); | 49 ASSERT_FALSE(tab->IsCrashed()); |
| 50 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 50 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 51 ASSERT_TRUE(entry); | 51 ASSERT_TRUE(entry); |
| 52 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->page_type()); | 52 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->page_type()); |
| 53 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, | 53 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, |
| 54 entry->ssl().security_style()); | 54 entry->ssl().security_style()); |
| 55 EXPECT_EQ(0U, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); | 55 EXPECT_EQ(0U, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); |
| 56 EXPECT_EQ(displayed_insecure_content, | 56 EXPECT_EQ(displayed_insecure_content, |
| 57 entry->ssl().displayed_insecure_content()); | 57 entry->ssl().displayed_insecure_content()); |
| 58 EXPECT_FALSE(entry->ssl().ran_insecure_content()); | 58 EXPECT_FALSE(entry->ssl().ran_insecure_content()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CheckUnauthenticatedState(TabContents* tab) { | 61 void CheckUnauthenticatedState(TabContents* tab) { |
| 62 ASSERT_FALSE(tab->is_crashed()); | 62 ASSERT_FALSE(tab->IsCrashed()); |
| 63 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 63 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 64 ASSERT_TRUE(entry); | 64 ASSERT_TRUE(entry); |
| 65 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->page_type()); | 65 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->page_type()); |
| 66 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, | 66 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, |
| 67 entry->ssl().security_style()); | 67 entry->ssl().security_style()); |
| 68 EXPECT_EQ(0U, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); | 68 EXPECT_EQ(0U, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); |
| 69 EXPECT_FALSE(entry->ssl().displayed_insecure_content()); | 69 EXPECT_FALSE(entry->ssl().displayed_insecure_content()); |
| 70 EXPECT_FALSE(entry->ssl().ran_insecure_content()); | 70 EXPECT_FALSE(entry->ssl().ran_insecure_content()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void CheckAuthenticationBrokenState(TabContents* tab, | 73 void CheckAuthenticationBrokenState(TabContents* tab, |
| 74 net::CertStatus error, | 74 net::CertStatus error, |
| 75 bool ran_insecure_content, | 75 bool ran_insecure_content, |
| 76 bool interstitial) { | 76 bool interstitial) { |
| 77 ASSERT_FALSE(tab->is_crashed()); | 77 ASSERT_FALSE(tab->IsCrashed()); |
| 78 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 78 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 79 ASSERT_TRUE(entry); | 79 ASSERT_TRUE(entry); |
| 80 EXPECT_EQ(interstitial ? | 80 EXPECT_EQ(interstitial ? |
| 81 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, | 81 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, |
| 82 entry->page_type()); | 82 entry->page_type()); |
| 83 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | 83 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, |
| 84 entry->ssl().security_style()); | 84 entry->ssl().security_style()); |
| 85 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style | 85 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style |
| 86 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. | 86 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. |
| 87 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); | 87 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 | 1323 |
| 1324 // Visit a page over https that contains a frame with a redirect. | 1324 // Visit a page over https that contains a frame with a redirect. |
| 1325 | 1325 |
| 1326 // XMLHttpRequest insecure content in synchronous mode. | 1326 // XMLHttpRequest insecure content in synchronous mode. |
| 1327 | 1327 |
| 1328 // XMLHttpRequest insecure content in asynchronous mode. | 1328 // XMLHttpRequest insecure content in asynchronous mode. |
| 1329 | 1329 |
| 1330 // XMLHttpRequest over bad ssl in synchronous mode. | 1330 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1331 | 1331 |
| 1332 // XMLHttpRequest over OK ssl in synchronous mode. | 1332 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |