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

Side by Side Diff: chrome/browser/history/web_history_service_unittest.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/history/core/browser/web_history_service.h" 5 #include "components/history/core/browser/web_history_service.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/history/web_history_service_factory.h" 9 #include "chrome/browser/history/web_history_service_factory.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 Request* request) { 188 Request* request) {
189 return expected_post_data_[request]; 189 return expected_post_data_[request];
190 } 190 }
191 191
192 std::string TestingWebHistoryService::GetExpectedAudioHistoryValue() { 192 std::string TestingWebHistoryService::GetExpectedAudioHistoryValue() {
193 if (expected_audio_history_value_) 193 if (expected_audio_history_value_)
194 return "true"; 194 return "true";
195 return "false"; 195 return "false";
196 } 196 }
197 197
198 static KeyedService* BuildWebHistoryService(content::BrowserContext* context) { 198 static scoped_ptr<KeyedService> BuildWebHistoryService(
199 content::BrowserContext* context) {
199 Profile* profile = static_cast<Profile*>(context); 200 Profile* profile = static_cast<Profile*>(context);
200 return new TestingWebHistoryService( 201 return make_scoped_ptr(new TestingWebHistoryService(
201 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 202 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
202 SigninManagerFactory::GetForProfile(profile), 203 SigninManagerFactory::GetForProfile(profile),
203 profile->GetRequestContext()); 204 profile->GetRequestContext()));
204 } 205 }
205 206
206 } // namespace 207 } // namespace
207 208
208 // A test class used for testing the WebHistoryService class. 209 // A test class used for testing the WebHistoryService class.
209 // In order for WebHistoryService to be valid, we must have a valid 210 // In order for WebHistoryService to be valid, we must have a valid
210 // ProfileSyncService. Using the ProfileSyncServiceMock class allows to 211 // ProfileSyncService. Using the ProfileSyncServiceMock class allows to
211 // assign specific return values as needed to make sure the web history 212 // assign specific return values as needed to make sure the web history
212 // service is available. 213 // service is available.
213 class WebHistoryServiceTest : public testing::Test { 214 class WebHistoryServiceTest : public testing::Test {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 " \"history_recording\": true\n" 420 " \"history_recording\": true\n"
420 "}")); 421 "}"));
421 scoped_ptr<base::DictionaryValue> response_value5; 422 scoped_ptr<base::DictionaryValue> response_value5;
422 // ReadResponse deletes the request 423 // ReadResponse deletes the request
423 response_value5 = TestingWebHistoryService::ReadResponse(request5.get()); 424 response_value5 = TestingWebHistoryService::ReadResponse(request5.get());
424 enabled_value = true; 425 enabled_value = true;
425 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled", 426 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled",
426 &enabled_value)); 427 &enabled_value));
427 EXPECT_TRUE(enabled_value); 428 EXPECT_TRUE(enabled_value);
428 } 429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698