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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 2394343002: Removing ShouldSwapProcessesForRedirect (using DoesSiteRequireDedicatedProcess).
Patch Set: Rebasing... Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 int closing_count() const { return closing_count_; } 199 int closing_count() const { return closing_count_; }
200 200
201 private: 201 private:
202 int closing_count_; 202 int closing_count_;
203 203
204 DISALLOW_COPY_AND_ASSIGN(MockTabStripModelObserver); 204 DISALLOW_COPY_AND_ASSIGN(MockTabStripModelObserver);
205 }; 205 };
206 206
207 // Causes the browser to swap processes on a redirect to an HTTPS URL. 207 // Causes the browser to ask for dedicated processes for HTTPS URL.
208 class TransferHttpsRedirectsContentBrowserClient 208 class TransferHttpsSitesContentBrowserClient
209 : public ChromeContentBrowserClient { 209 : public ChromeContentBrowserClient {
210 public: 210 public:
211 bool ShouldSwapProcessesForRedirect( 211 bool DoesSiteRequireDedicatedProcess(
212 content::BrowserContext* browser_context, 212 content::BrowserContext* browser_context,
213 const GURL& current_url, 213 const GURL& effective_site_url) override {
214 const GURL& new_url) override { 214 return effective_site_url.SchemeIs(url::kHttpsScheme);
215 return new_url.SchemeIs(url::kHttpsScheme);
216 } 215 }
217 }; 216 };
218 217
219 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. 218 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser.
220 void CloseWindowCallback(Browser* browser) { 219 void CloseWindowCallback(Browser* browser) {
221 chrome::CloseWindow(browser); 220 chrome::CloseWindow(browser);
222 } 221 }
223 222
224 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app 223 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app
225 // menu. 224 // menu.
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // http://crbug.com/243957. 775 // http://crbug.com/243957.
777 IN_PROC_BROWSER_TEST_F(BrowserTest, NoStopDuringTransferUntilCommit) { 776 IN_PROC_BROWSER_TEST_F(BrowserTest, NoStopDuringTransferUntilCommit) {
778 // Create HTTP and HTTPS servers for a cross-site transition. 777 // Create HTTP and HTTPS servers for a cross-site transition.
779 ASSERT_TRUE(embedded_test_server()->Start()); 778 ASSERT_TRUE(embedded_test_server()->Start());
780 net::EmbeddedTestServer https_test_server( 779 net::EmbeddedTestServer https_test_server(
781 net::EmbeddedTestServer::TYPE_HTTPS); 780 net::EmbeddedTestServer::TYPE_HTTPS);
782 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); 781 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
783 ASSERT_TRUE(https_test_server.Start()); 782 ASSERT_TRUE(https_test_server.Start());
784 783
785 // Temporarily replace ContentBrowserClient with one that will cause a 784 // Temporarily replace ContentBrowserClient with one that will cause a
786 // process swap on all redirects to HTTPS URLs. 785 // process swap for all HTTPS URLs.
787 TransferHttpsRedirectsContentBrowserClient new_client; 786 TransferHttpsSitesContentBrowserClient new_client;
788 content::ContentBrowserClient* old_client = 787 content::ContentBrowserClient* old_client =
789 SetBrowserClientForTesting(&new_client); 788 SetBrowserClientForTesting(&new_client);
790 789
791 GURL init_url(embedded_test_server()->GetURL("/title1.html")); 790 GURL init_url(embedded_test_server()->GetURL("/title1.html"));
792 ui_test_utils::NavigateToURL(browser(), init_url); 791 ui_test_utils::NavigateToURL(browser(), init_url);
793 792
794 // Navigate to a same-site page that redirects, causing a transfer. 793 // Navigate to a same-site page that redirects, causing a transfer.
795 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 794 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
796 795
797 // Create a RedirectObserver that goes away before we close the tab. 796 // Create a RedirectObserver that goes away before we close the tab.
(...skipping 29 matching lines...) Expand all
827 // handler to run once. 826 // handler to run once.
828 IN_PROC_BROWSER_TEST_F(BrowserTest, SingleBeforeUnloadAfterRedirect) { 827 IN_PROC_BROWSER_TEST_F(BrowserTest, SingleBeforeUnloadAfterRedirect) {
829 // Create HTTP and HTTPS servers for a cross-site transition. 828 // Create HTTP and HTTPS servers for a cross-site transition.
830 ASSERT_TRUE(embedded_test_server()->Start()); 829 ASSERT_TRUE(embedded_test_server()->Start());
831 net::EmbeddedTestServer https_test_server( 830 net::EmbeddedTestServer https_test_server(
832 net::EmbeddedTestServer::TYPE_HTTPS); 831 net::EmbeddedTestServer::TYPE_HTTPS);
833 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); 832 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
834 ASSERT_TRUE(https_test_server.Start()); 833 ASSERT_TRUE(https_test_server.Start());
835 834
836 // Temporarily replace ContentBrowserClient with one that will cause a 835 // Temporarily replace ContentBrowserClient with one that will cause a
837 // process swap on all redirects to HTTPS URLs. 836 // process swap for all HTTPS URLs.
838 TransferHttpsRedirectsContentBrowserClient new_client; 837 TransferHttpsSitesContentBrowserClient new_client;
839 content::ContentBrowserClient* old_client = 838 content::ContentBrowserClient* old_client =
840 SetBrowserClientForTesting(&new_client); 839 SetBrowserClientForTesting(&new_client);
841 840
842 // Navigate to a page with a beforeunload handler. 841 // Navigate to a page with a beforeunload handler.
843 GURL url(embedded_test_server()->GetURL("/beforeunload.html")); 842 GURL url(embedded_test_server()->GetURL("/beforeunload.html"));
844 ui_test_utils::NavigateToURL(browser(), url); 843 ui_test_utils::NavigateToURL(browser(), url);
845 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 844 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
846 content::PrepContentsForBeforeUnloadTest(contents); 845 content::PrepContentsForBeforeUnloadTest(contents);
847 846
848 // Navigate to a URL that redirects to another process and approve the 847 // Navigate to a URL that redirects to another process and approve the
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2875 Browser* browser = new Browser(params); 2874 Browser* browser = new Browser(params);
2876 gfx::Rect bounds = browser->window()->GetBounds(); 2875 gfx::Rect bounds = browser->window()->GetBounds();
2877 2876
2878 // Should be EXPECT_EQ, but this width is inconsistent across platforms. 2877 // Should be EXPECT_EQ, but this width is inconsistent across platforms.
2879 // See https://crbug.com/567925. 2878 // See https://crbug.com/567925.
2880 EXPECT_GE(bounds.width(), 100); 2879 EXPECT_GE(bounds.width(), 100);
2881 EXPECT_EQ(122, bounds.height()); 2880 EXPECT_EQ(122, bounds.height());
2882 browser->window()->Close(); 2881 browser->window()->Close();
2883 } 2882 }
2884 } 2883 }
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | content/browser/cross_site_transfer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698