1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/test/base/scoped_testing_local_state.h"
7 #include "chrome/browser/prefs/browser_prefs.h"
8 #include "chrome/test/base/testing_browser_process.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 ScopedTestingLocalState::ScopedTestingLocalState(
12 TestingBrowserProcess
* browser_process
)
13 : browser_process_(browser_process
) {
14 chrome::RegisterLocalState(local_state_
.registry());
15 EXPECT_FALSE(browser_process
->local_state());
16 browser_process
->SetLocalState(&local_state_
);
19 ScopedTestingLocalState::~ScopedTestingLocalState() {
20 EXPECT_EQ(&local_state_
, browser_process_
->local_state());
21 browser_process_
->SetLocalState(NULL
);