| Index: chrome/browser/external_protocol/external_protocol_handler_unittest.cc
|
| diff --git a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
|
| index 62e4c31f4c3201accb7c763a9e3540e27050483f..e0c29f4d714b3dbbe6c3d7de2c6551cd9a6bd33d 100644
|
| --- a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
|
| +++ b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
|
| @@ -6,11 +6,6 @@
|
|
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| -#include "chrome/browser/prefs/browser_prefs.h"
|
| -#include "chrome/common/pref_names.h"
|
| -#include "chrome/test/base/testing_browser_process.h"
|
| -#include "chrome/test/base/testing_profile.h"
|
| -#include "components/prefs/testing_pref_service.h"
|
| #include "content/public/test/test_browser_thread.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -57,8 +52,8 @@
|
| return new FakeExternalProtocolHandlerWorker(callback, protocol, os_state_);
|
| }
|
|
|
| - ExternalProtocolHandler::BlockState GetBlockState(const std::string& scheme,
|
| - Profile* profile) override {
|
| + ExternalProtocolHandler::BlockState GetBlockState(
|
| + const std::string& scheme) override {
|
| return block_state_;
|
| }
|
|
|
| @@ -116,19 +111,11 @@
|
| : ui_thread_(BrowserThread::UI, base::MessageLoop::current()),
|
| file_thread_(BrowserThread::FILE) {}
|
|
|
| - void SetUp() override {
|
| - file_thread_.Start();
|
| - local_state_.reset(new TestingPrefServiceSimple);
|
| - profile_.reset(new TestingProfile());
|
| - chrome::RegisterLocalState(local_state_->registry());
|
| - TestingBrowserProcess::GetGlobal()->SetLocalState(local_state_.get());
|
| - }
|
| + void SetUp() override { file_thread_.Start(); }
|
|
|
| void TearDown() override {
|
| // Ensure that g_accept_requests gets set back to true after test execution.
|
| ExternalProtocolHandler::PermitLaunchUrl();
|
| - TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr);
|
| - local_state_.reset();
|
| }
|
|
|
| void DoTest(ExternalProtocolHandler::BlockState block_state,
|
| @@ -158,9 +145,6 @@
|
| content::TestBrowserThread file_thread_;
|
|
|
| FakeExternalProtocolHandlerDelegate delegate_;
|
| -
|
| - std::unique_ptr<TestingPrefServiceSimple> local_state_;
|
| - std::unique_ptr<TestingProfile> profile_;
|
| };
|
|
|
| TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeBlockedChromeDefault) {
|
| @@ -207,56 +191,3 @@
|
| DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT,
|
| true, false, false);
|
| }
|
| -
|
| -TEST_F(ExternalProtocolHandlerTest, TestGetBlockStateUnknown) {
|
| - ExternalProtocolHandler::BlockState block_state =
|
| - ExternalProtocolHandler::GetBlockState("tel", profile_.get());
|
| - ASSERT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
|
| - ASSERT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| - ASSERT_FALSE(
|
| - profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| -}
|
| -
|
| -TEST_F(ExternalProtocolHandlerTest, TestGetBlockStateDefaultBlock) {
|
| - ExternalProtocolHandler::BlockState block_state =
|
| - ExternalProtocolHandler::GetBlockState("afp", profile_.get());
|
| - ASSERT_EQ(ExternalProtocolHandler::BLOCK, block_state);
|
| - ASSERT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| - ASSERT_FALSE(
|
| - profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| -}
|
| -
|
| -TEST_F(ExternalProtocolHandlerTest, TestGetBlockStateDefaultDontBlock) {
|
| - ExternalProtocolHandler::BlockState block_state =
|
| - ExternalProtocolHandler::GetBlockState("mailto", profile_.get());
|
| - ASSERT_EQ(ExternalProtocolHandler::DONT_BLOCK, block_state);
|
| - ASSERT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| - ASSERT_FALSE(
|
| - profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| -}
|
| -
|
| -TEST_F(ExternalProtocolHandlerTest,
|
| - TestGetBlockStateLocalBlockStateCopiedAndResetOnProfilePref) {
|
| - base::DictionaryValue prefs_local;
|
| - prefs_local.SetBoolean("tel", true);
|
| - local_state_->Set(prefs::kExcludedSchemes, prefs_local);
|
| - ExternalProtocolHandler::BlockState block_state =
|
| - ExternalProtocolHandler::GetBlockState("tel", profile_.get());
|
| - ASSERT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
|
| - ASSERT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| - ASSERT_FALSE(
|
| - profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| -}
|
| -
|
| -TEST_F(ExternalProtocolHandlerTest,
|
| - TestGetBlockStateLocalDontBlockCopiedAsIsToProfilePref) {
|
| - base::DictionaryValue prefs_local;
|
| - prefs_local.SetBoolean("tel", false);
|
| - local_state_->Set(prefs::kExcludedSchemes, prefs_local);
|
| - ExternalProtocolHandler::BlockState block_state =
|
| - ExternalProtocolHandler::GetBlockState("tel", profile_.get());
|
| - ASSERT_EQ(ExternalProtocolHandler::DONT_BLOCK, block_state);
|
| - ASSERT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| - ASSERT_FALSE(
|
| - profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
|
| -}
|
|
|