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

Side by Side Diff: content/browser/web_contents/opened_by_dom_browsertest.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Attempt to fix compile. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 #include "content/public/browser/web_contents_delegate.h" 8 #include "content/public/browser/web_contents_delegate.h"
9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h" 9 #include "content/public/test/browser_test_utils.h"
11 #include "content/public/test/content_browser_test.h" 10 #include "content/public/test/content_browser_test.h"
12 #include "content/public/test/content_browser_test_utils.h" 11 #include "content/public/test/content_browser_test_utils.h"
13 #include "content/public/test/test_navigation_observer.h" 12 #include "content/public/test/test_navigation_observer.h"
14 #include "content/shell/browser/shell.h" 13 #include "content/shell/browser/shell.h"
15 #include "net/dns/mock_host_resolver.h" 14 #include "net/dns/mock_host_resolver.h"
16 #include "url/gurl.h" 15 #include "url/gurl.h"
17 16
18 namespace content { 17 namespace content {
19 18
(...skipping 17 matching lines...) Expand all
37 36
38 DISALLOW_COPY_AND_ASSIGN(CloseTrackingDelegate); 37 DISALLOW_COPY_AND_ASSIGN(CloseTrackingDelegate);
39 }; 38 };
40 39
41 } // namespace 40 } // namespace
42 41
43 class OpenedByDOMTest : public ContentBrowserTest { 42 class OpenedByDOMTest : public ContentBrowserTest {
44 protected: 43 protected:
45 void SetUpCommandLine(base::CommandLine* command_line) override { 44 void SetUpCommandLine(base::CommandLine* command_line) override {
46 // Use --site-per-process to force process swaps on cross-site navigations. 45 // Use --site-per-process to force process swaps on cross-site navigations.
47 command_line->AppendSwitch(switches::kSitePerProcess); 46 IsolateAllSitesForTesting(command_line);
48 } 47 }
49 48
50 bool AttemptCloseFromJavaScript(WebContents* web_contents) { 49 bool AttemptCloseFromJavaScript(WebContents* web_contents) {
51 CloseTrackingDelegate close_tracking_delegate; 50 CloseTrackingDelegate close_tracking_delegate;
52 WebContentsDelegate* old_delegate = web_contents->GetDelegate(); 51 WebContentsDelegate* old_delegate = web_contents->GetDelegate();
53 web_contents->SetDelegate(&close_tracking_delegate); 52 web_contents->SetDelegate(&close_tracking_delegate);
54 53
55 const char kCloseWindowScript[] = 54 const char kCloseWindowScript[] =
56 // Close the window. 55 // Close the window.
57 "window.close();" 56 "window.close();"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 url3 = url3.ReplaceComponents(replace_host); 128 url3 = url3.ReplaceComponents(replace_host);
130 129
131 NavigateToURL(shell(), url1); 130 NavigateToURL(shell(), url1);
132 131
133 Shell* popup = OpenWindowFromJavaScript(shell(), url2); 132 Shell* popup = OpenWindowFromJavaScript(shell(), url2);
134 NavigateToURL(popup, url3); 133 NavigateToURL(popup, url3);
135 EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents())); 134 EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents()));
136 } 135 }
137 136
138 } // namespace content 137 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698