Chromium Code Reviews| Index: chrome/browser/ssl/ssl_browser_tests.cc |
| diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc |
| index 68405e7ac23441f6e9ff6804f8be9396d2d9aecd..b35b860e71dd22cbcff8abac99cfbf0434da76c5 100644 |
| --- a/chrome/browser/ssl/ssl_browser_tests.cc |
| +++ b/chrome/browser/ssl/ssl_browser_tests.cc |
| @@ -154,7 +154,10 @@ enum AuthStateFlags { |
| DISPLAYED_INSECURE_CONTENT = 1 << 0, |
| RAN_INSECURE_CONTENT = 1 << 1, |
| SHOWING_INTERSTITIAL = 1 << 2, |
| - SHOWING_ERROR = 1 << 3 |
| + SHOWING_ERROR = 1 << 3, |
| + // Useful when a favicon load may or may not have finised loading, to avoid |
|
estark
2016/08/04 04:31:17
nit: typo, finised -> finished
jam
2016/08/04 17:41:53
Done.
|
| + // checking if a page displayed insecure content. |
| + DONT_CHECK_DISPLAYED_INSECURE_CONTENT = 1 << 4, |
|
estark
2016/08/04 04:31:17
Just a note for posterity, this shouldn't be neces
jam
2016/08/04 17:41:53
Done.
|
| }; |
| void Check(const NavigationEntry& entry, int expected_authentication_state) { |
| @@ -168,11 +171,16 @@ void Check(const NavigationEntry& entry, int expected_authentication_state) { |
| entry.GetPageType()); |
| } |
| - bool displayed_insecure_content = |
| - !!(entry.GetSSL().content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT); |
| - EXPECT_EQ( |
| - !!(expected_authentication_state & AuthState::DISPLAYED_INSECURE_CONTENT), |
| - displayed_insecure_content); |
| + if (!(expected_authentication_state & |
| + AuthState::DONT_CHECK_DISPLAYED_INSECURE_CONTENT)) { |
| + bool displayed_insecure_content = |
| + !!(entry.GetSSL().content_status & |
| + SSLStatus::DISPLAYED_INSECURE_CONTENT); |
| + EXPECT_EQ( |
| + !!(expected_authentication_state & |
| + AuthState::DISPLAYED_INSECURE_CONTENT), |
| + displayed_insecure_content); |
| + } |
| bool ran_insecure_content = |
| !!(entry.GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT); |
| @@ -1831,7 +1839,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) { |
| #endif |
| // Test that navigating to a #ref does not change a bad security state. |
| -IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
| +IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestRefNavigation) { |
|
estark
2016/08/04 04:31:17
That's odd -- if MAYBE_ wasn't here before, maybe
jam
2016/08/04 17:41:53
true, I should have checked flakiness results.
ht
|
| ASSERT_TRUE(https_server_expired_.Start()); |
| ui_test_utils::NavigateToURL( |
| @@ -1851,7 +1859,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
| browser(), https_server_expired_.GetURL("/ssl/page_with_refs.html#jp")); |
| CheckAuthenticationBrokenState( |
| - tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); |
| + tab, net::CERT_STATUS_DATE_INVALID, |
| + AuthState::DONT_CHECK_DISPLAYED_INSECURE_CONTENT); |
| } |
| // Tests that closing a page that opened a pop-up with an interstitial does not |
| @@ -2169,7 +2178,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { |
| // We should still be authentication broken. |
| CheckAuthenticationBrokenState( |
| - tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); |
| + tab, net::CERT_STATUS_DATE_INVALID, |
| + AuthState::DONT_CHECK_DISPLAYED_INSECURE_CONTENT); |
| } |
| // From an HTTP top frame, navigate to good and bad HTTPS (security state should |
| @@ -2284,8 +2294,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorkerWithUserException) { |
| ui_test_utils::NavigateToURL( |
| browser(), https_server_.GetURL(page_with_unsafe_worker_path)); |
| CheckWorkerLoadResult(tab, true); // Worker loads insecure content |
| - CheckAuthenticationBrokenState(tab, CertError::NONE, |
| - AuthState::RAN_INSECURE_CONTENT); |
| + CheckAuthenticationBrokenState( |
| + tab, CertError::NONE, |
| + AuthState::RAN_INSECURE_CONTENT | |
| + AuthState::DONT_CHECK_DISPLAYED_INSECURE_CONTENT); |
| } |
| // Visits a page with unsafe content and makes sure that if a user exception to |
| @@ -2324,8 +2336,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) { |
| EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| tab, "window.domAutomationController.send(IsFooSet());", &js_result)); |
| EXPECT_TRUE(js_result); |
| - CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| - AuthState::NONE); |
| + CheckAuthenticationBrokenState( |
| + tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| + AuthState::DONT_CHECK_DISPLAYED_INSECURE_CONTENT); |
| } |
| // Like the test above, but only displaying inactive content (an image). |