Commit 60ad0231 authored by tsepez@chromium.org's avatar tsepez@chromium.org

Re-enable SSL UI tests after providing browser that once again allows

insecure content.  While I'm here, it would be a shame not to add cases
covering the opposite situation, where the browser blocks everything.

BUG=85475
TEST=browser_tests
Review URL: http://codereview.chromium.org/7044091

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88590 0039d316-1c4b-4281-b951-d872f2087c98
parent fe2e851f
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h"
#include "base/time.h" #include "base/time.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/in_process_browser_test.h" #include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h" #include "chrome/test/ui_test_utils.h"
#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host.h"
...@@ -34,6 +36,11 @@ class SSLUITest : public InProcessBrowserTest { ...@@ -34,6 +36,11 @@ class SSLUITest : public InProcessBrowserTest {
EnableDOMAutomation(); EnableDOMAutomation();
} }
// Browser will both run and display insecure content.
virtual void SetUpCommandLine(CommandLine* command_line) {
command_line->AppendSwitch(switches::kAllowRunningInsecureContent);
}
void CheckAuthenticatedState(TabContents* tab, void CheckAuthenticatedState(TabContents* tab,
bool displayed_insecure_content) { bool displayed_insecure_content) {
NavigationEntry* entry = tab->controller().GetActiveEntry(); NavigationEntry* entry = tab->controller().GetActiveEntry();
...@@ -197,6 +204,16 @@ class SSLUITest : public InProcessBrowserTest { ...@@ -197,6 +204,16 @@ class SSLUITest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(SSLUITest); DISALLOW_COPY_AND_ASSIGN(SSLUITest);
}; };
class SSLUITestBlock : public SSLUITest {
public:
SSLUITestBlock() : SSLUITest() {}
// Browser will neither run nor display insecure content.
virtual void SetUpCommandLine(CommandLine* command_line) {
command_line->AppendSwitch(switches::kNoDisplayingInsecureContent);
}
};
// Visits a regular page over http. // Visits a regular page over http.
IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
...@@ -455,9 +472,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { ...@@ -455,9 +472,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) {
// Visits a page that runs insecure content and tries to suppress the insecure // Visits a page that runs insecure content and tries to suppress the insecure
// content warnings by randomizing location.hash. // content warnings by randomizing location.hash.
// Based on http://crbug.com/8706 // Based on http://crbug.com/8706
// Disabled, http://crbug.com/85475.
IN_PROC_BROWSER_TEST_F(SSLUITest, IN_PROC_BROWSER_TEST_F(SSLUITest,
DISABLED_TestRunsInsecuredContentRandomizeHash) { TestRunsInsecuredContentRandomizeHash) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
ASSERT_TRUE(https_server_.Start()); ASSERT_TRUE(https_server_.Start());
...@@ -580,8 +596,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { ...@@ -580,8 +596,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
// Visits two pages from the same origin: one that runs insecure content and one // Visits two pages from the same origin: one that runs insecure content and one
// that doesn't. The test checks that we propagate the insecure content state // that doesn't. The test checks that we propagate the insecure content state
// from one to the other. // from one to the other.
// Disabled, http://crbug.com/85475. IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestRunsInsecureContentTwoTabs) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
ASSERT_TRUE(https_server_.Start()); ASSERT_TRUE(https_server_.Start());
...@@ -647,9 +662,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { ...@@ -647,9 +662,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) {
#define MAYBE_TestRunsCachedInsecureContent \ #define MAYBE_TestRunsCachedInsecureContent \
DISABLED_TestRunsCachedInsecureContent DISABLED_TestRunsCachedInsecureContent
#else #else
// Disabled, http://crbug.com/85475. #define MAYBE_TestRunsCachedInsecureContent TestRunsCachedInsecureContent
#define MAYBE_TestRunsCachedInsecureContent \
DISABLED_TestRunsCachedInsecureContent
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
// Visits a page with script over http. Visits another page over https // Visits a page with script over http. Visits another page over https
...@@ -1120,6 +1133,45 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { ...@@ -1120,6 +1133,45 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) {
CheckAuthenticationBrokenState(tab, 0, true, false); CheckAuthenticationBrokenState(tab, 0, true, false);
} }
// Test that when the browser blocks displaying insecure content, the
// indicator shows a secure page, because the blocking made the otherwise
// unsafe page safe (the notification of this state is handled by other means).
IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureContent) {
ASSERT_TRUE(test_server()->Start());
ASSERT_TRUE(https_server_.Start());
std::string replacement_path;
ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
"files/ssl/page_displays_insecure_content.html",
test_server()->host_port_pair(),
&replacement_path));
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL(replacement_path));
CheckAuthenticatedState(browser()->GetSelectedTabContents(), false);
}
// Test that when the browser blocks running insecure content, the
// indicator shows a secure page, because the blocking made the otherwise
// unsafe page safe (the notification of this state is handled by other means).
IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) {
ASSERT_TRUE(test_server()->Start());
ASSERT_TRUE(https_server_.Start());
std::string replacement_path;
ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
"files/ssl/page_runs_insecure_content.html",
test_server()->host_port_pair(),
&replacement_path));
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL(replacement_path));
CheckAuthenticatedState(browser()->GetSelectedTabContents(), false);
}
// TODO(jcampan): more tests to do below. // TODO(jcampan): more tests to do below.
// Visit a page over https that contains a frame with a redirect. // Visit a page over https that contains a frame with a redirect.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment