| 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);
|
| +}
|
|
|