12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/test/base/scoped_testing_local_state.h" 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/prefs/browser_prefs.h" 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/test/base/testing_browser_process.h" 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ScopedTestingLocalState::ScopedTestingLocalState( 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) TestingBrowserProcess* browser_process) 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) : browser_process_(browser_process) { 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) chrome::RegisterLocalState(local_state_.registry()); 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_FALSE(browser_process->local_state()); 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) browser_process->SetLocalState(&local_state_); 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ScopedTestingLocalState::~ScopedTestingLocalState() { 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(&local_state_, browser_process_->local_state()); 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) browser_process_->SetLocalState(NULL); 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 23