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)#ifndef CHROME_TEST_BASE_SCOPED_TESTING_LOCAL_STATE_H_
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define CHROME_TEST_BASE_SCOPED_TESTING_LOCAL_STATE_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/basictypes.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/testing_pref_service.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class TestingBrowserProcess;
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Helper class to temporarily set up a |local_state| in the global
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// TestingBrowserProcess (for most unit tests it's NULL).
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ScopedTestingLocalState {
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  explicit ScopedTestingLocalState(TestingBrowserProcess* browser_process);
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ~ScopedTestingLocalState();
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TestingPrefServiceSimple* Get() {
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return &local_state_;
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TestingBrowserProcess* browser_process_;
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TestingPrefServiceSimple local_state_;
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState);
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // CHROME_TEST_BASE_SCOPED_TESTING_LOCAL_STATE_H_
32