Commit d9c73a42 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Remove unnecessary use of IdentityTestEnvironmentProfileAdaptor

The test do not need to access IdentityManager, so remove the
use of IdentityTestEnvironmentProfileAdaptor as they are still
passing without it.

Bug: 984487
Change-Id: Ic065b287f23c0f7f77f619bd802c7a318275c507
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710324
Commit-Queue: Gayane Petrosyan <gayane@chromium.org>
Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681381}
parent 65294602
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/bind_test_util.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/search/search_ipc_router.h" #include "chrome/browser/ui/search/search_ipc_router.h"
#include "chrome/common/search/mock_embedded_search_client.h" #include "chrome/common/search/mock_embedded_search_client.h"
...@@ -51,8 +49,6 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { ...@@ -51,8 +49,6 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness {
void SetUp() override { void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp(); ChromeRenderViewHostTestHarness::SetUp();
identity_test_env_adaptor_ =
std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile());
SearchTabHelper::CreateForWebContents(web_contents()); SearchTabHelper::CreateForWebContents(web_contents());
auto* search_tab = SearchTabHelper::FromWebContents(web_contents()); auto* search_tab = SearchTabHelper::FromWebContents(web_contents());
auto factory = auto factory =
...@@ -63,32 +59,15 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { ...@@ -63,32 +59,15 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness {
.set_embedded_search_client_factory_for_testing(std::move(factory)); .set_embedded_search_client_factory_for_testing(std::move(factory));
} }
void TearDown() override {
// |identity_test_env_adaptor_| must be destroyed before profile().
identity_test_env_adaptor_.reset();
ChromeRenderViewHostTestHarness::TearDown();
}
content::BrowserContext* CreateBrowserContext() override { content::BrowserContext* CreateBrowserContext() override {
TestingProfile::TestingFactories factories = { TestingProfile::Builder builder;
{ProfileSyncServiceFactory::GetInstance(), builder.AddTestingFactory(
base::BindLambdaForTesting( ProfileSyncServiceFactory::GetInstance(),
[](content::BrowserContext*) -> std::unique_ptr<KeyedService> { base::BindRepeating(
return std::make_unique<syncer::TestSyncService>(); [](content::BrowserContext*) -> std::unique_ptr<KeyedService> {
})}}; return std::make_unique<syncer::TestSyncService>();
}));
// Per comments on content::RenderViewHostTestHarness, it takes ownership of return builder.Build().release();
// the returned object.
return IdentityTestEnvironmentProfileAdaptor::
CreateProfileForIdentityTestEnvironment(factories)
.release();
}
// Associates |email| with profile as the primary account. |email|
// should not be empty.
void SetUpAccount(const std::string& email) {
ASSERT_FALSE(email.empty());
identity_test_env()->SetPrimaryAccount(email);
} }
// Configure the account to |sync_history| or not. // Configure the account to |sync_history| or not.
...@@ -105,15 +84,8 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { ...@@ -105,15 +84,8 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness {
sync_service->SetPreferredDataTypes(types); sync_service->SetPreferredDataTypes(types);
} }
signin::IdentityTestEnvironment* identity_test_env() {
DCHECK(identity_test_env_adaptor_);
return identity_test_env_adaptor_->identity_test_env();
}
private: private:
NiceMock<MockEmbeddedSearchClient> mock_embedded_search_client_; NiceMock<MockEmbeddedSearchClient> mock_embedded_search_client_;
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_adaptor_;
}; };
TEST_F(SearchTabHelperTest, FileSelectedUpdatesLastSelectedDirectory) { TEST_F(SearchTabHelperTest, FileSelectedUpdatesLastSelectedDirectory) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment