OLD | NEW |
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 Loading... |
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 | |
263 void SetUpOnMainThread() override { | 258 void SetUpOnMainThread() override { |
| 259 scoped_feature_list_.InitAndEnableFeature(features::kTopDocumentIsolation); |
264 HostedAppTest::SetUpOnMainThread(); | 260 HostedAppTest::SetUpOnMainThread(); |
265 ASSERT_TRUE(embedded_test_server()->Start()); | 261 ASSERT_TRUE(embedded_test_server()->Start()); |
266 } | 262 } |
267 | 263 |
268 private: | 264 private: |
| 265 base::test::ScopedFeatureList scoped_feature_list_; |
| 266 |
269 DISALLOW_COPY_AND_ASSIGN(HostedAppVsTdiTest); | 267 DISALLOW_COPY_AND_ASSIGN(HostedAppVsTdiTest); |
270 }; | 268 }; |
271 | 269 |
272 // Tests that even with --top-document-isolation, app.site.com (covered by app's | 270 // Tests that even with --top-document-isolation, app.site.com (covered by app's |
273 // web extent) main frame and foo.site.com (not covered by app's web extent) | 271 // web extent) main frame and foo.site.com (not covered by app's web extent) |
274 // share the same renderer process. See also https://crbug.com/679011. | 272 // share the same renderer process. See also https://crbug.com/679011. |
275 // | 273 // |
276 // Relevant frames in the test: | 274 // Relevant frames in the test: |
277 // - |app| - app.site.com/frame_tree/cross_origin_but_same_site_frames.html | 275 // - |app| - app.site.com/frame_tree/cross_origin_but_same_site_frames.html |
278 // Main frame, launch URL of the hosted app (i.e. app.launch.web_url). | 276 // 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 Loading... |
471 // app's web extent should use the isolated origin's SiteInstance and not the | 469 // app's web extent should use the isolated origin's SiteInstance and not the |
472 // app's. | 470 // app's. |
473 ui_test_utils::NavigateToURL(browser(), isolated_url); | 471 ui_test_utils::NavigateToURL(browser(), isolated_url); |
474 content::WebContents* web_contents = | 472 content::WebContents* web_contents = |
475 browser()->tab_strip_model()->GetActiveWebContents(); | 473 browser()->tab_strip_model()->GetActiveWebContents(); |
476 EXPECT_EQ(isolated_url.GetOrigin(), | 474 EXPECT_EQ(isolated_url.GetOrigin(), |
477 web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL()); | 475 web_contents->GetMainFrame()->GetSiteInstance()->GetSiteURL()); |
478 EXPECT_NE(web_contents->GetMainFrame()->GetSiteInstance(), | 476 EXPECT_NE(web_contents->GetMainFrame()->GetSiteInstance(), |
479 app->GetSiteInstance()); | 477 app->GetSiteInstance()); |
480 } | 478 } |
OLD | NEW |