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

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

Issue 10834109: Consistently decorate pref values sent to the settings UI code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Silly me, made a CrOS-only change and tested it on a desktop build... Created 8 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_PREFERENCES_BROWSERTEST_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_PREFERENCES_BROWSERTEST_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/policy/mock_configuration_policy_provider.h"
14 #include "chrome/browser/policy/policy_constants.h"
15 #include "chrome/test/base/in_process_browser_test.h"
16
17 namespace base {
18 class DictionaryValue;
19 class Value;
20 }
21
22 namespace content {
23 class RenderViewHost;
24 }
25
26 // Tests verifying that the JavaScript Preferences class, the underlying C++
27 // CoreOptionsHandler and the specialized classes handling Chrome OS device and
28 // proxy prefs behave correctly.
29 class PreferencesBrowserTest : public InProcessBrowserTest {
30 public:
31 PreferencesBrowserTest();
32
33 // InProcessBrowserTest implementation:
34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
35 virtual void SetUpOnMainThread() OVERRIDE;
36
37 protected:
38 // Verifies that a dictionary contains a (key, value) pair. Takes ownership of
39 // |expected|.
40 void VerifyValue(const base::DictionaryValue* dict,
41 const std::string& key,
42 base::Value* expected);
43 // Verifies that a pref value has been decorated correctly.
44 void VerifyDict(const base::DictionaryValue* dict,
45 const base::Value* value,
46 const std::string& controlledBy,
47 bool disabled);
48 // Verifies that a dictionary contains a given pref and that its value has
49 // been decorated correctly.
50 void VerifyPref(const base::DictionaryValue* prefs,
51 const std::string& name,
52 const base::Value* value,
53 const std::string& controlledBy,
54 bool disabled);
55 // Verifies that a dictionary contains a given list of prefs and that their
56 // values have been decorated correctly.
57 void VerifyPrefs(const base::DictionaryValue* prefs,
58 const std::vector<std::string>& names,
59 const std::vector<base::Value*>& values,
60 const std::string& controlledBy,
61 bool disabled);
62 // Sets a pref value from JavaScript, waits for an observer callback to fire
63 // and returns the decorated value received.
64 void VerifySetPref(const std::string& name,
65 const std::string& type,
66 base::Value* set_value,
67 base::Value* expected_value);
68
69 // Requests a list of pref values from JavaScript, waits for a callback to
70 // fire and returns the decorated values received.
71 void FetchPrefs(const std::vector<std::string>& names,
72 base::DictionaryValue** prefs);
73
74 // Sets user policies through the mock policy provider.
75 void SetUserPolicies(const std::vector<std::string>& names,
76 const std::vector<base::Value*>& values,
77 policy::PolicyLevel level);
78
79 // Helper deleting a vector of values.
80 void DeleteValues(std::vector<base::Value*>& values);
81
82 // The current tab's render view host, required to inject JavaScript code into
83 // the tab.
84 content::RenderViewHost* render_view_host_;
85
86 // Mock user policy provider.
87 policy::MockConfigurationPolicyProvider policy_provider_;
88
89 private:
90 DISALLOW_COPY_AND_ASSIGN(PreferencesBrowserTest);
91 };
92
93 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_PREFERENCES_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698