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

Unified Diff: chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm

Issue 6542013: Get rid of browser_prefs::RegisterAllPrefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix metrics_log_unittest.cc Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm b/chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm
index 54110226f28e5791720861c02871ac3d6a336807..6e57e2cfa274e097b1ce10ed07b292b085fee49c 100644
--- a/chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/options/preferences_window_controller_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,11 +7,14 @@
#import <Cocoa/Cocoa.h>
#import "base/scoped_nsobject.h"
+#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/ui/cocoa/browser_test_helper.h"
#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/options/custom_home_pages_model.h"
#include "chrome/browser/ui/options/options_window.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/testing_browser_process.h"
+#include "chrome/test/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
@@ -37,11 +40,9 @@ class PrefsControllerTest : public CocoaTest {
public:
virtual void SetUp() {
CocoaTest::SetUp();
- // The metrics reporting pref is registerd on the local state object in
- // real builds, but we don't have one of those for unit tests. Register
- // it on prefs so we'll find it when we go looking.
- PrefService* prefs = browser_helper_.profile()->GetPrefs();
- prefs->RegisterBooleanPref(prefs::kMetricsReportingEnabled, false);
+ browser::RegisterLocalState(&local_state_);
+ local_state_.RegisterBooleanPref(prefs::kMetricsReportingEnabled, false);
+ browser_process_.get()->SetPrefService(&local_state_);
Paweł Hajdan Jr. 2011/02/18 17:03:43 Just use g_browser_process here.
Mattias Nissler (ping if slow) 2011/02/18 17:08:04 That won't work, since the SetPrefService is a spe
pref_controller_ = [[PreferencesWindowController alloc]
initWithProfile:browser_helper_.profile()
@@ -54,6 +55,8 @@ class PrefsControllerTest : public CocoaTest {
CocoaTest::TearDown();
}
+ ScopedTestingBrowserProcess browser_process_;
+ TestingPrefService local_state_;
BrowserTestHelper browser_helper_;
PreferencesWindowController* pref_controller_;
};

Powered by Google App Engine
This is Rietveld 408576698