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

Side by Side Diff: chrome/browser/extensions/extension_pref_store_unittest.cc

Issue 4876002: Create additional PrefStore for Device Management policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback Created 10 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/net/chrome_url_request_context_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 using testing::Mock; 336 using testing::Mock;
337 337
338 TestExtensionPrefStore* eps = new TestExtensionPrefStore; 338 TestExtensionPrefStore* eps = new TestExtensionPrefStore;
339 DefaultPrefStore* dps = new DefaultPrefStore; 339 DefaultPrefStore* dps = new DefaultPrefStore;
340 ASSERT_TRUE(eps->ext1 != NULL); 340 ASSERT_TRUE(eps->ext1 != NULL);
341 341
342 // The PrefValueStore takes ownership of the PrefStores; in this case, that's 342 // The PrefValueStore takes ownership of the PrefStores; in this case, that's
343 // only an ExtensionPrefStore. Likewise, the PrefService takes ownership of 343 // only an ExtensionPrefStore. Likewise, the PrefService takes ownership of
344 // the PrefValueStore and PrefNotifier. 344 // the PrefValueStore and PrefNotifier.
345 PrefValueStore* value_store = new TestingPrefService::TestingPrefValueStore( 345 PrefValueStore* value_store = new TestingPrefService::TestingPrefValueStore(
346 NULL, eps, NULL, NULL, NULL, dps); 346 NULL, NULL, eps, NULL, NULL, NULL, dps);
347 scoped_ptr<MockPrefService> pref_service(new MockPrefService(value_store)); 347 scoped_ptr<MockPrefService> pref_service(new MockPrefService(value_store));
348 MockPrefNotifier* pref_notifier = new MockPrefNotifier(pref_service.get(), 348 MockPrefNotifier* pref_notifier = new MockPrefNotifier(pref_service.get(),
349 value_store); 349 value_store);
350 pref_service->SetPrefNotifier(pref_notifier); 350 pref_service->SetPrefNotifier(pref_notifier);
351 351
352 eps->SetPrefService(pref_service.get()); 352 eps->SetPrefService(pref_service.get());
353 pref_service->RegisterStringPref(kPref1, std::string()); 353 pref_service->RegisterStringPref(kPref1, std::string());
354 354
355 EXPECT_CALL(*pref_notifier, FireObservers(kPref1)); 355 EXPECT_CALL(*pref_notifier, FireObservers(kPref1));
356 eps->InstallExtensionPref(eps->ext1, kPref1, 356 eps->InstallExtensionPref(eps->ext1, kPref1,
357 Value::CreateStringValue("https://www.chromium.org")); 357 Value::CreateStringValue("https://www.chromium.org"));
358 Mock::VerifyAndClearExpectations(pref_notifier); 358 Mock::VerifyAndClearExpectations(pref_notifier);
359 359
360 EXPECT_CALL(*pref_notifier, FireObservers(kPref1)).Times(0); 360 EXPECT_CALL(*pref_notifier, FireObservers(kPref1)).Times(0);
361 eps->InstallExtensionPref(eps->ext1, kPref1, 361 eps->InstallExtensionPref(eps->ext1, kPref1,
362 Value::CreateStringValue("https://www.chromium.org")); 362 Value::CreateStringValue("https://www.chromium.org"));
363 Mock::VerifyAndClearExpectations(pref_notifier); 363 Mock::VerifyAndClearExpectations(pref_notifier);
364 364
365 EXPECT_CALL(*pref_notifier, FireObservers(kPref1)).Times(2); 365 EXPECT_CALL(*pref_notifier, FireObservers(kPref1)).Times(2);
366 eps->InstallExtensionPref(eps->ext1, kPref1, 366 eps->InstallExtensionPref(eps->ext1, kPref1,
367 Value::CreateStringValue("chrome://newtab")); 367 Value::CreateStringValue("chrome://newtab"));
368 eps->UninstallExtension(eps->ext1); 368 eps->UninstallExtension(eps->ext1);
369 } 369 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_url_request_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698