Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: chrome/browser/ui/webui/options/preferences_browsertest.h

Issue 16045005: Migrate auto_tests about proxy configuration to browser_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 27 matching lines...) Expand all
38 ~PreferencesBrowserTest(); 38 ~PreferencesBrowserTest();
39 39
40 // InProcessBrowserTest implementation: 40 // InProcessBrowserTest implementation:
41 virtual void SetUpOnMainThread() OVERRIDE; 41 virtual void SetUpOnMainThread() OVERRIDE;
42 42
43 void OnPreferenceChanged(const std::string& pref_name); 43 void OnPreferenceChanged(const std::string& pref_name);
44 44
45 protected: 45 protected:
46 MOCK_METHOD1(OnCommit, void(const PrefService::Preference*)); 46 MOCK_METHOD1(OnCommit, void(const PrefService::Preference*));
47 47
48 void SetUpPrefs();
49
48 // InProcessBrowserTest implementation: 50 // InProcessBrowserTest implementation:
49 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 51 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
50 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; 52 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE;
51 53
52 // Sets user policies through the mock policy provider. 54 // Sets user policies through the mock policy provider.
53 void SetUserPolicies(const std::vector<std::string>& names, 55 void SetUserPolicies(const std::vector<std::string>& names,
54 const std::vector<base::Value*>& values, 56 const std::vector<base::Value*>& values,
55 policy::PolicyLevel level); 57 policy::PolicyLevel level);
56 // Clears user policies. 58 // Clears user policies.
57 void ClearUserPolicies(); 59 void ClearUserPolicies();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Sets up the expectation that the JavaScript Preferences class will clear a 103 // Sets up the expectation that the JavaScript Preferences class will clear a
102 // user-modified pref value in the C++ backend. 104 // user-modified pref value in the C++ backend.
103 void ExpectClearCommit(const std::string& name); 105 void ExpectClearCommit(const std::string& name);
104 // Verifies that previously set expectations are met and clears them. 106 // Verifies that previously set expectations are met and clears them.
105 void VerifyAndClearExpectations(); 107 void VerifyAndClearExpectations();
106 108
107 // Sets up the JavaScript part of the test environment. 109 // Sets up the JavaScript part of the test environment.
108 void SetupJavaScriptTestEnvironment( 110 void SetupJavaScriptTestEnvironment(
109 const std::vector<std::string>& pref_names, 111 const std::vector<std::string>& pref_names,
110 std::string* observed_json) const; 112 std::string* observed_json) const;
113
114 // Sets a value through the JavaScript Preferences class as if the user had
115 // modified it. Returns the observation which can be verified using the
116 // VerifyObserved* methods.
117 void SetPref(const std::string& name,
118 const std::string& type,
119 const base::Value* value,
120 bool commit,
121 std::string* observed_json);
122
111 // Verifies that setting a user-modified pref value through the JavaScript 123 // Verifies that setting a user-modified pref value through the JavaScript
112 // Preferences class fires the correct notification in JavaScript and does 124 // Preferences class fires the correct notification in JavaScript and commits
113 // respectively does not cause the change to be committed to the C++ backend. 125 // the change to C++ if |commit| is true.
114 void VerifySetPref(const std::string& name, 126 void VerifySetPref(const std::string& name,
115 const std::string& type, 127 const std::string& type,
116 const base::Value* value, 128 const base::Value* value,
117 bool commit); 129 bool commit);
118 // Verifies that clearing a user-modified pref value through the JavaScript 130 // Verifies that clearing a user-modified pref value through the JavaScript
119 // Preferences class fires the correct notification in JavaScript and does 131 // Preferences class fires the correct notification in JavaScript and does
120 // respectively does not cause the change to be committed to the C++ backend. 132 // respectively does not cause the change to be committed to the C++ backend.
121 void VerifyClearPref(const std::string& name, 133 void VerifyClearPref(const std::string& name,
122 const base::Value* value, 134 const base::Value* value,
123 bool commit); 135 bool commit);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 std::vector<std::string> pref_names_; 187 std::vector<std::string> pref_names_;
176 std::vector<std::string> policy_names_; 188 std::vector<std::string> policy_names_;
177 std::vector<base::Value*> default_values_; 189 std::vector<base::Value*> default_values_;
178 std::vector<base::Value*> non_default_values_; 190 std::vector<base::Value*> non_default_values_;
179 191
180 private: 192 private:
181 DISALLOW_COPY_AND_ASSIGN(PreferencesBrowserTest); 193 DISALLOW_COPY_AND_ASSIGN(PreferencesBrowserTest);
182 }; 194 };
183 195
184 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_ 196 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PREFERENCES_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698