blob: e2915e5589863b05da2eb18cf09fe01675b1dead (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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_.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);
}
|