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

Side by Side Diff: chrome/browser/ui/extensions/hosted_app_browsertest.cc

Issue 2946113002: Use FrameIsAd to decide whether to isolate a frame in TopDocumentIsolation mode. (Closed)
Patch Set: Use FOR_EACH_TDI_MODE(V) macro. Created 3 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/test/scoped_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 subframe, "window.domAutomationController.send(document.body.innerText);", 248 subframe, "window.domAutomationController.send(document.body.innerText);",
249 &result)); 249 &result));
250 EXPECT_EQ("This page has no title.", result); 250 EXPECT_EQ("This page has no title.", result);
251 } 251 }
252 252
253 class HostedAppVsTdiTest : public HostedAppTest { 253 class HostedAppVsTdiTest : public HostedAppTest {
254 public: 254 public:
255 HostedAppVsTdiTest() {} 255 HostedAppVsTdiTest() {}
256 ~HostedAppVsTdiTest() override {} 256 ~HostedAppVsTdiTest() override {}
257 257
258 void SetUpCommandLine(base::CommandLine* command_line) override {
259 HostedAppTest::SetUpCommandLine(command_line);
260 content::EnableTopDocumentIsolationForTesting(command_line);
261 }
262
258 void SetUpOnMainThread() override { 263 void SetUpOnMainThread() override {
259 scoped_feature_list_.InitAndEnableFeature(features::kTopDocumentIsolation);
260 HostedAppTest::SetUpOnMainThread(); 264 HostedAppTest::SetUpOnMainThread();
261 ASSERT_TRUE(embedded_test_server()->Start()); 265 ASSERT_TRUE(embedded_test_server()->Start());
262 } 266 }
263 267
264 private: 268 private:
265 base::test::ScopedFeatureList scoped_feature_list_;
266
267 DISALLOW_COPY_AND_ASSIGN(HostedAppVsTdiTest); 269 DISALLOW_COPY_AND_ASSIGN(HostedAppVsTdiTest);
268 }; 270 };
269 271
270 // Tests that even with --top-document-isolation, app.site.com (covered by app's 272 // Tests that even with --top-document-isolation, app.site.com (covered by app's
271 // web extent) main frame and foo.site.com (not covered by app's web extent) 273 // web extent) main frame and foo.site.com (not covered by app's web extent)
272 // share the same renderer process. See also https://crbug.com/679011. 274 // share the same renderer process. See also https://crbug.com/679011.
273 // 275 //
274 // Relevant frames in the test: 276 // Relevant frames in the test:
275 // - |app| - app.site.com/frame_tree/cross_origin_but_same_site_frames.html 277 // - |app| - app.site.com/frame_tree/cross_origin_but_same_site_frames.html
276 // Main frame, launch URL of the hosted app (i.e. app.launch.web_url). 278 // Main frame, launch URL of the hosted app (i.e. app.launch.web_url).
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // app's web extent should use the isolated origin's SiteInstance and not the 471 // app's web extent should use the isolated origin's SiteInstance and not the
470 // app's. 472 // app's.
471 ui_test_utils::NavigateToURL(browser(), isolated_url); 473 ui_test_utils::NavigateToURL(browser(), isolated_url);
472 content::WebContents* web_contents = 474 content::WebContents* web_contents =
473 browser()->tab_strip_model()->GetActiveWebContents(); 475 browser()->tab_strip_model()->GetActiveWebContents();
474 EXPECT_EQ(isolated_url.GetOrigin(), 476 EXPECT_EQ(isolated_url.GetOrigin(),
475 web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL()); 477 web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL());
476 EXPECT_NE(web_contents->GetMainFrame()->GetSiteInstance(), 478 EXPECT_NE(web_contents->GetMainFrame()->GetSiteInstance(),
477 app->GetSiteInstance()); 479 app->GetSiteInstance());
478 } 480 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698