| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const GURL url("chrome://chrome//foo"); | 75 const GURL url("chrome://chrome//foo"); |
| 76 | 76 |
| 77 ui_test_utils::NavigateToURL(browser(), url); | 77 ui_test_utils::NavigateToURL(browser(), url); |
| 78 NavigationEntry* entry = GetLastCommittedEntry(); | 78 NavigationEntry* entry = GetLastCommittedEntry(); |
| 79 | 79 |
| 80 ASSERT_TRUE(entry != NULL); | 80 ASSERT_TRUE(entry != NULL); |
| 81 EXPECT_TRUE(entry->GetVirtualURL().is_valid()); | 81 EXPECT_TRUE(entry->GetVirtualURL().is_valid()); |
| 82 EXPECT_EQ(url, entry->GetVirtualURL()); | 82 EXPECT_EQ(url, entry->GetVirtualURL()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Use a test class with SetUpCommandLine to ensure the flag is sent to the |
| 86 // first renderer process. |
| 87 class ChromeContentBrowserClientSitePerProcessTest |
| 88 : public ChromeContentBrowserClientBrowserTest { |
| 89 public: |
| 90 ChromeContentBrowserClientSitePerProcessTest() {} |
| 91 |
| 92 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 93 content::IsolateAllSitesForTesting(command_line); |
| 94 } |
| 95 |
| 96 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientSitePerProcessTest); |
| 98 }; |
| 99 |
| 85 // Test that a basic navigation works in --site-per-process mode. This prevents | 100 // Test that a basic navigation works in --site-per-process mode. This prevents |
| 86 // regressions when that mode calls out into the ChromeContentBrowserClient, | 101 // regressions when that mode calls out into the ChromeContentBrowserClient, |
| 87 // such as http://crbug.com/164223. | 102 // such as http://crbug.com/164223. |
| 88 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, | 103 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientSitePerProcessTest, |
| 89 SitePerProcessNavigation) { | 104 SitePerProcessNavigation) { |
| 90 content::IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); | |
| 91 ASSERT_TRUE(test_server()->Start()); | 105 ASSERT_TRUE(test_server()->Start()); |
| 92 const GURL url(test_server()->GetURL("files/title1.html")); | 106 const GURL url(test_server()->GetURL("files/title1.html")); |
| 93 | 107 |
| 94 ui_test_utils::NavigateToURL(browser(), url); | 108 ui_test_utils::NavigateToURL(browser(), url); |
| 95 NavigationEntry* entry = GetLastCommittedEntry(); | 109 NavigationEntry* entry = GetLastCommittedEntry(); |
| 96 | 110 |
| 97 ASSERT_TRUE(entry != NULL); | 111 ASSERT_TRUE(entry != NULL); |
| 98 EXPECT_EQ(url, entry->GetURL()); | 112 EXPECT_EQ(url, entry->GetURL()); |
| 99 EXPECT_EQ(url, entry->GetVirtualURL()); | 113 EXPECT_EQ(url, entry->GetVirtualURL()); |
| 100 } | 114 } |
| 101 | 115 |
| 102 } // namespace content | 116 } // namespace content |
| OLD | NEW |