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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 268543008: Cross-process iframe accessibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 88d04041b14e6a1ac1ddf90dd68425ee1a36e410..bc29b5e78c8c260577b45ec14e61651468f239aa 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "content/browser/site_per_process_browsertest.h"
+
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
@@ -16,13 +18,11 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/dns/mock_host_resolver.h"
-#include "url/gurl.h"
namespace content {
@@ -149,52 +149,50 @@ void RedirectNotificationObserver::Observe(
running_ = false;
}
-class SitePerProcessBrowserTest : public ContentBrowserTest {
- public:
- SitePerProcessBrowserTest() {}
-
- protected:
- // Start at a data URL so each extra navigation creates a navigation entry.
- // (The first navigation will silently be classified as AUTO_SUBFRAME.)
- // TODO(creis): This won't be necessary when we can wait for LOAD_STOP.
- void StartFrameAtDataURL() {
- std::string data_url_script =
+//
+// SitePerProcessBrowserTest
+//
+
+SitePerProcessBrowserTest::SitePerProcessBrowserTest() {
+};
+
+void SitePerProcessBrowserTest::StartFrameAtDataURL() {
+ std::string data_url_script =
"var iframes = document.getElementById('test');iframes.src="
"'data:text/html,dataurl';";
- ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script));
- }
+ ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script));
+}
- bool NavigateIframeToURL(Shell* window,
- const GURL& url,
- std::string iframe_id) {
- // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe
- // navigations generate extra DidStartLoading and DidStopLoading messages.
- // Until we replace swappedout:// with frame proxies, we need to listen for
- // something else. For now, we trigger NEW_SUBFRAME navigations and listen
- // for commit.
- std::string script = base::StringPrintf(
- "setTimeout(\""
- "var iframes = document.getElementById('%s');iframes.src='%s';"
- "\",0)",
- iframe_id.c_str(), url.spec().c_str());
- WindowedNotificationObserver load_observer(
- NOTIFICATION_NAV_ENTRY_COMMITTED,
- Source<NavigationController>(
- &window->web_contents()->GetController()));
- bool result = ExecuteScript(window->web_contents(), script);
- load_observer.Wait();
- return result;
- }
+bool SitePerProcessBrowserTest::NavigateIframeToURL(Shell* window,
+ const GURL& url,
+ std::string iframe_id) {
+ // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe
+ // navigations generate extra DidStartLoading and DidStopLoading messages.
+ // Until we replace swappedout:// with frame proxies, we need to listen for
+ // something else. For now, we trigger NEW_SUBFRAME navigations and listen
+ // for commit.
+ std::string script = base::StringPrintf(
+ "setTimeout(\""
+ "var iframes = document.getElementById('%s');iframes.src='%s';"
+ "\",0)",
+ iframe_id.c_str(), url.spec().c_str());
+ WindowedNotificationObserver load_observer(
+ NOTIFICATION_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(
+ &window->web_contents()->GetController()));
+ bool result = ExecuteScript(window->web_contents(), script);
+ load_observer.Wait();
+ return result;
+}
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- command_line->AppendSwitch(switches::kSitePerProcess);
- }
+void SitePerProcessBrowserTest::SetUpCommandLine(CommandLine* command_line) {
+ command_line->AppendSwitch(switches::kSitePerProcess);
};
// Ensure that we can complete a cross-process subframe navigation.
// Crashes ChromeOS bot, but the bug is probably present on other platforms
// also. http://crbug.com/399775
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) {
Charlie Reis 2014/08/25 20:58:44 Ah, you might need to rebase past Nasko's CL at so
dmazzoni 2014/08/26 23:31:03 Yes, it works again now.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) {
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(test_server()->Start());
GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
@@ -301,7 +299,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) {
// See http://crbug.com/338508.
// TODO(creis): Disabled for flakiness; see http://crbug.com/405582.
// TODO(creis): Enable this on Android when we can kill the process there.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) {
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) {
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(test_server()->Start());
GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
@@ -361,7 +359,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) {
// TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run
// on Android (http://crbug.com/187570).
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
- DISABLED_CrossSiteIframeRedirectOnce) {
Charlie Reis 2014/08/25 20:58:43 These probably shouldn't be re-enabled.
dmazzoni 2014/08/26 23:31:03 Oops, forgot I left these in.
+ CrossSiteIframeRedirectOnce) {
ASSERT_TRUE(test_server()->Start());
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS,
@@ -487,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run
// on Android (http://crbug.com/187570).
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
- DISABLED_CrossSiteIframeRedirectTwice) {
+ CrossSiteIframeRedirectTwice) {
ASSERT_TRUE(test_server()->Start());
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS,

Powered by Google App Engine
This is Rietveld 408576698