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

Unified Diff: chrome/test/base/scoped_testing_local_state.cc

Issue 12223091: Split testing_pref_service.h/.cc into two parts, generic vs. Chrome-specific. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment. Created 7 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
« no previous file with comments | « chrome/test/base/scoped_testing_local_state.h ('k') | chrome/test/base/testing_pref_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/scoped_testing_local_state.cc
diff --git a/chrome/test/base/scoped_testing_local_state.cc b/chrome/test/base/scoped_testing_local_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2e5f904f439348c5fc319f06b7acd5e4cee5c703
--- /dev/null
+++ b/chrome/test/base/scoped_testing_local_state.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2013 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.
+
+#include "chrome/test/base/scoped_testing_local_state.h"
+
+#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/test/base/testing_browser_process.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+ScopedTestingLocalState::ScopedTestingLocalState(
+ TestingBrowserProcess* browser_process)
+ : browser_process_(browser_process) {
+ chrome::RegisterLocalState(&local_state_, local_state_.registry());
+ EXPECT_FALSE(browser_process->local_state());
+ browser_process->SetLocalState(&local_state_);
+}
+
+ScopedTestingLocalState::~ScopedTestingLocalState() {
+ EXPECT_EQ(&local_state_, browser_process_->local_state());
+ browser_process_->SetLocalState(NULL);
+}
« no previous file with comments | « chrome/test/base/scoped_testing_local_state.h ('k') | chrome/test/base/testing_pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698