Home | History | Annotate | Download | only in base
      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.
      4 
      5 #include "chrome/test/base/scoped_testing_local_state.h"
      6 
      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"
     10 
     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_);
     17 }
     18 
     19 ScopedTestingLocalState::~ScopedTestingLocalState() {
     20   EXPECT_EQ(&local_state_, browser_process_->local_state());
     21   browser_process_->SetLocalState(NULL);
     22 }
     23