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

Unified Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 2913343002: Start removing deprecated Options UI code (Closed)
Patch Set: thestig@ review Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/flag_descriptions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client_browsertest.cc
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc
index e0e82fe9c19754ffaeb78f27bb4aea892b343468..ede5c9cedeee18e59d1b46fb8ffac053ea7c8caa 100644
--- a/chrome/browser/chrome_content_browser_client_browsertest.cc
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -2,20 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/chrome_content_browser_client.h"
+
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/test/scoped_feature_list.h"
-#include "build/build_config.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "components/prefs/pref_service.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
@@ -25,129 +20,34 @@
namespace content {
-class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
- public:
- // Returns the last committed navigation entry of the first tab. May be NULL
- // if there is no such entry.
- NavigationEntry* GetLastCommittedEntry() {
- return browser()->tab_strip_model()->GetWebContentsAt(0)->
- GetController().GetLastCommittedEntry();
- }
-
- void SetUpInProcessBrowserTestFixture() override {
- disable_md_settings_.InitAndDisableFeature(
- features::kMaterialDesignSettings);
- }
-
-#if defined(OS_CHROMEOS)
- void SetUpCommandLine(base::CommandLine* command_line) override {
- command_line->AppendSwitch(switches::kDisableSettingsWindow);
- }
-#endif
-
- private:
- base::test::ScopedFeatureList disable_md_settings_;
-};
-
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
- UberURLHandler_SettingsPage) {
- const GURL url_short("chrome://settings/");
- const GURL url_long("chrome://chrome/settings/");
-
- ui_test_utils::NavigateToURL(browser(), url_short);
- NavigationEntry* entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_EQ(url_long, entry->GetURL());
- EXPECT_EQ(url_short, entry->GetVirtualURL());
-}
-
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
- UberURLHandler_ContentSettingsPage) {
- const GURL url_short("chrome://settings/content");
- const GURL url_long("chrome://chrome/settings/content");
-
- ui_test_utils::NavigateToURL(browser(), url_short);
- NavigationEntry* entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_EQ(url_long, entry->GetURL());
- EXPECT_EQ(url_short, entry->GetVirtualURL());
-}
-
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
- UberURLHandler_AboutPage) {
- const GURL url("chrome://chrome/");
-
- ui_test_utils::NavigateToURL(browser(), url);
- NavigationEntry* entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_EQ(url, entry->GetURL());
- EXPECT_EQ(url, entry->GetVirtualURL());
-}
-
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
- UberURLHandler_NewTabPageOverride) {
- PrefService* prefs = browser()->profile()->GetPrefs();
- static const char kOverrideUrl[] = "http://override.com";
- prefs->SetString(prefs::kNewTabPageLocationOverride, kOverrideUrl);
- const GURL ntp_url(chrome::kChromeUINewTabURL);
-
- ui_test_utils::NavigateToURL(browser(), ntp_url);
- NavigationEntry* entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_TRUE(entry->GetVirtualURL().is_valid());
- EXPECT_EQ(GURL(kOverrideUrl), entry->GetVirtualURL());
-
- prefs->SetString(prefs::kNewTabPageLocationOverride, "");
-
- ui_test_utils::NavigateToURL(browser(), ntp_url);
- entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_TRUE(entry->GetVirtualURL().is_valid());
- EXPECT_EQ(ntp_url, entry->GetVirtualURL());
-}
-
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
- UberURLHandler_EmptyHost) {
- const GURL url("chrome://chrome//foo");
-
- ui_test_utils::NavigateToURL(browser(), url);
- NavigationEntry* entry = GetLastCommittedEntry();
-
- ASSERT_TRUE(entry != NULL);
- EXPECT_TRUE(entry->GetVirtualURL().is_valid());
- EXPECT_EQ(url, entry->GetVirtualURL());
-}
-
// Use a test class with SetUpCommandLine to ensure the flag is sent to the
// first renderer process.
-class ChromeContentBrowserClientSitePerProcessTest
- : public ChromeContentBrowserClientBrowserTest {
+class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
public:
- ChromeContentBrowserClientSitePerProcessTest() {}
+ ChromeContentBrowserClientBrowserTest() {}
void SetUpCommandLine(base::CommandLine* command_line) override {
- content::IsolateAllSitesForTesting(command_line);
+ IsolateAllSitesForTesting(command_line);
}
private:
- DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientSitePerProcessTest);
+ DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientBrowserTest);
};
// Test that a basic navigation works in --site-per-process mode. This prevents
// regressions when that mode calls out into the ChromeContentBrowserClient,
// such as http://crbug.com/164223.
-IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientSitePerProcessTest,
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
SitePerProcessNavigation) {
ASSERT_TRUE(embedded_test_server()->Start());
const GURL url(embedded_test_server()->GetURL("/title1.html"));
ui_test_utils::NavigateToURL(browser(), url);
- NavigationEntry* entry = GetLastCommittedEntry();
+ NavigationEntry* entry = browser()
+ ->tab_strip_model()
+ ->GetWebContentsAt(0)
+ ->GetController()
+ .GetLastCommittedEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_EQ(url, entry->GetURL());
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/flag_descriptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698