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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc

Issue 1598553003: Implement the Windows desktop search redirection feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build errors due to prefs being moved in components Created 4 years, 11 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/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc b/chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc
deleted file mode 100644
index 1821487dde26767b629d1ed849db1d2d3a27deed..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/startup/startup_browser_creator.h"
-
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/feature_list.h"
-#include "base/macros.h"
-#include "base/prefs/pref_service.h"
-#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/search_engines/template_url_service_factory_test_util.h"
-#include "chrome/test/base/testing_profile.h"
-#include "components/search_engines/desktop_search_win.h"
-#include "components/search_engines/util.h"
-#include "content/public/test/test_browser_thread_bundle.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-class StartupBrowserCreatorWinTest : public testing::Test {
- public:
- StartupBrowserCreatorWinTest() {}
-
- protected:
- void SetWindowsDesktopSearchFeatureEnabled(bool enabled) {
- base::FeatureList::ClearInstanceForTesting();
- scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
- if (enabled) {
- feature_list->InitializeFromCommandLine(
- kWindowsDesktopSearchRedirectionFeature.name, std::string());
- }
- base::FeatureList::SetInstance(std::move(feature_list));
- }
-
- private:
- content::TestBrowserThreadBundle thread_bundle_;
-
- DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorWinTest);
-};
-
-TEST_F(StartupBrowserCreatorWinTest,
- GetURLsFromCommandLineWithDesktopSearchURL) {
- const char kDesktopSearchURL[] =
- "https://www.bing.com/search?q=keyword&form=WNSGPH";
-
- TestingProfile profile;
- TemplateURLServiceFactoryTestUtil template_url_service_factory_test_util(
- &profile);
-
- base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- command_line.AppendArg(kDesktopSearchURL);
-
- // Expected vectors of URLs.
- const std::vector<GURL> desktop_search_url_vector({GURL(kDesktopSearchURL)});
- const std::vector<GURL> default_search_url_vector(
- {GetDefaultSearchURLForSearchTerms(
- TemplateURLServiceFactory::GetForProfile(&profile), L"keyword")});
-
- // Preference unset, feature enabled.
- SetWindowsDesktopSearchFeatureEnabled(true);
- EXPECT_EQ(desktop_search_url_vector,
- StartupBrowserCreator::GetURLsFromCommandLine(
- command_line, base::FilePath(), &profile));
-
- // Preference set to disabled, feature enabled.
- profile.GetPrefs()->SetBoolean(prefs::kWindowsDesktopSearchRedirectionPref,
- false);
- SetWindowsDesktopSearchFeatureEnabled(true);
- EXPECT_EQ(desktop_search_url_vector,
- StartupBrowserCreator::GetURLsFromCommandLine(
- command_line, base::FilePath(), &profile));
-
- // Preference set to enabled, feature enabled.
- profile.GetPrefs()->SetBoolean(prefs::kWindowsDesktopSearchRedirectionPref,
- true);
- SetWindowsDesktopSearchFeatureEnabled(true);
- EXPECT_EQ(default_search_url_vector,
- StartupBrowserCreator::GetURLsFromCommandLine(
- command_line, base::FilePath(), &profile));
-
- // Preference set to enabled, feature disabled.
- profile.GetPrefs()->SetBoolean(prefs::kWindowsDesktopSearchRedirectionPref,
- true);
- SetWindowsDesktopSearchFeatureEnabled(false);
- EXPECT_EQ(desktop_search_url_vector,
- StartupBrowserCreator::GetURLsFromCommandLine(
- command_line, base::FilePath(), &profile));
-}
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698