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

Side by Side Diff: chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc

Issue 189443008: Use TestingProfile::Builder::AddTestingFactory at ChromeRenderViewHostTestHarness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 TestingProfile::Builder builder; 174 TestingProfile::Builder builder;
175 builder.SetPrefService(scoped_ptr<PrefServiceSyncable>(prefs.Pass())); 175 builder.SetPrefService(scoped_ptr<PrefServiceSyncable>(prefs.Pass()));
176 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 176 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
177 SigninManagerFake::Build); 177 SigninManagerFake::Build);
178 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 178 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
179 FakeProfileOAuth2TokenServiceWrapper::Build); 179 FakeProfileOAuth2TokenServiceWrapper::Build);
180 180
181 profile_ = builder.Build().Pass(); 181 profile_ = builder.Build().Pass();
182 url_factory_.set_remove_fetcher_on_delete(true); 182 url_factory_.set_remove_fetcher_on_delete(true);
183 183
184 // Make sure the UserPolicySigninService has been created for this Profile.
185 UserPolicySigninServiceFactory::GetInstance()->RemoveTestingFactory(
Andrew T Wilson (Slow) 2014/03/10 12:30:45 Having RemoveTestingFactory() override ServiceIsNU
186 profile_.get());
187 ASSERT_TRUE(UserPolicySigninServiceFactory::GetForProfile(profile_.get()));
188
184 signin_manager_ = static_cast<SigninManagerFake*>( 189 signin_manager_ = static_cast<SigninManagerFake*>(
185 SigninManagerFactory::GetForProfile(profile_.get())); 190 SigninManagerFactory::GetForProfile(profile_.get()));
186 // Tests are responsible for freeing the UserCloudPolicyManager instances 191 // Tests are responsible for freeing the UserCloudPolicyManager instances
187 // they inject. 192 // they inject.
188 manager_.reset(UserCloudPolicyManagerFactory::GetForBrowserContext( 193 manager_.reset(UserCloudPolicyManagerFactory::GetForBrowserContext(
189 profile_.get())); 194 profile_.get()));
190 manager_->Init(&schema_registry_); 195 manager_->Init(&schema_registry_);
191 mock_store_ = static_cast<MockUserCloudPolicyStore*>( 196 mock_store_ = static_cast<MockUserCloudPolicyStore*>(
192 manager_->core()->store()); 197 manager_->core()->store());
193 DCHECK(mock_store_); 198 DCHECK(mock_store_);
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 base::RunLoop().RunUntilIdle(); 810 base::RunLoop().RunUntilIdle();
806 EXPECT_FALSE(manager_->IsClientRegistered()); 811 EXPECT_FALSE(manager_->IsClientRegistered());
807 #if !defined(OS_ANDROID) 812 #if !defined(OS_ANDROID)
808 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); 813 EXPECT_FALSE(signin_manager_->IsSignoutProhibited());
809 #endif 814 #endif
810 } 815 }
811 816
812 } // namespace 817 } // namespace
813 818
814 } // namespace policy 819 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698