| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/prefs/public/pref_change_registrar.h" | 13 #include "base/prefs/public/pref_change_registrar.h" |
| 14 #include "base/prefs/public/pref_observer.h" |
| 14 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 15 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 15 #include "chrome/browser/policy/policy_types.h" | 16 #include "chrome/browser/policy/policy_types.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class DictionaryValue; | 23 class DictionaryValue; |
| 23 class Value; | 24 class Value; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 class NotificationDetails; | 28 class NotificationDetails; |
| 28 class NotificationSource; | 29 class NotificationSource; |
| 29 class RenderViewHost; | 30 class RenderViewHost; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // Tests verifying that the JavaScript Preferences class, the underlying C++ | 33 // Tests verifying that the JavaScript Preferences class, the underlying C++ |
| 33 // CoreOptionsHandler and the specialized classes handling Chrome OS device and | 34 // CoreOptionsHandler and the specialized classes handling Chrome OS device and |
| 34 // proxy prefs behave correctly. | 35 // proxy prefs behave correctly. |
| 35 class PreferencesBrowserTest : public InProcessBrowserTest, | 36 class PreferencesBrowserTest : public InProcessBrowserTest, |
| 36 public content::NotificationObserver { | 37 public PrefObserver { |
| 37 public: | 38 public: |
| 38 PreferencesBrowserTest(); | 39 PreferencesBrowserTest(); |
| 39 ~PreferencesBrowserTest(); | 40 ~PreferencesBrowserTest(); |
| 40 | 41 |
| 41 // InProcessBrowserTest implementation: | 42 // InProcessBrowserTest implementation: |
| 42 virtual void SetUpOnMainThread() OVERRIDE; | 43 virtual void SetUpOnMainThread() OVERRIDE; |
| 43 | 44 |
| 44 // content::NotificationObserver implementation: | 45 // PrefObserver implementation: |
| 45 virtual void Observe(int type, | 46 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 46 const content::NotificationSource& source, | 47 const std::string& pref_name) OVERRIDE; |
| 47 const content::NotificationDetails& details) OVERRIDE; | |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 MOCK_METHOD1(OnCommit, void(const PrefService::Preference*)); | 50 MOCK_METHOD1(OnCommit, void(const PrefService::Preference*)); |
| 51 | 51 |
| 52 // InProcessBrowserTest implementation: | 52 // InProcessBrowserTest implementation: |
| 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 54 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 54 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
| 55 | 55 |
| 56 // Sets user policies through the mock policy provider. | 56 // Sets user policies through the mock policy provider. |
| 57 void SetUserPolicies(const std::vector<std::string>& names, | 57 void SetUserPolicies(const std::vector<std::string>& names, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 std::vector<std::string> pref_names_; | 179 std::vector<std::string> pref_names_; |
| 180 std::vector<std::string> policy_names_; | 180 std::vector<std::string> policy_names_; |
| 181 std::vector<base::Value*> default_values_; | 181 std::vector<base::Value*> default_values_; |
| 182 std::vector<base::Value*> non_default_values_; | 182 std::vector<base::Value*> non_default_values_; |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 DISALLOW_COPY_AND_ASSIGN(PreferencesBrowserTest); | 185 DISALLOW_COPY_AND_ASSIGN(PreferencesBrowserTest); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ | 188 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ |
| OLD | NEW |