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

Side by Side Diff: chrome/browser/ui/webui/policy_ui_browsertest.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include <vector> 5 #include <vector>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) { 191 IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) {
192 // Verifies that policy values are sent to the UI and processed there 192 // Verifies that policy values are sent to the UI and processed there
193 // correctly by setting the values of four known and one unknown policy and 193 // correctly by setting the values of four known and one unknown policy and
194 // checking that the policy table contains the policy names, values and 194 // checking that the policy table contains the policy names, values and
195 // metadata in the correct order. 195 // metadata in the correct order.
196 policy::PolicyMap values; 196 policy::PolicyMap values;
197 std::map<std::string, std::string> expected_values; 197 std::map<std::string, std::string> expected_values;
198 198
199 // Set the values of four existing policies. 199 // Set the values of four existing policies.
200 base::ListValue* restore_on_startup_urls = new base::ListValue; 200 base::ListValue* restore_on_startup_urls = new base::ListValue;
201 restore_on_startup_urls->Append(base::Value::CreateStringValue("aaa")); 201 restore_on_startup_urls->Append(new base::StringValue("aaa"));
202 restore_on_startup_urls->Append(base::Value::CreateStringValue("bbb")); 202 restore_on_startup_urls->Append(new base::StringValue("bbb"));
203 restore_on_startup_urls->Append(base::Value::CreateStringValue("ccc")); 203 restore_on_startup_urls->Append(new base::StringValue("ccc"));
204 values.Set(policy::key::kRestoreOnStartupURLs, 204 values.Set(policy::key::kRestoreOnStartupURLs,
205 policy::POLICY_LEVEL_MANDATORY, 205 policy::POLICY_LEVEL_MANDATORY,
206 policy::POLICY_SCOPE_USER, 206 policy::POLICY_SCOPE_USER,
207 restore_on_startup_urls, 207 restore_on_startup_urls,
208 NULL); 208 NULL);
209 expected_values[policy::key::kRestoreOnStartupURLs] = "aaa,bbb,ccc"; 209 expected_values[policy::key::kRestoreOnStartupURLs] = "aaa,bbb,ccc";
210 values.Set(policy::key::kHomepageLocation, 210 values.Set(policy::key::kHomepageLocation,
211 policy::POLICY_LEVEL_MANDATORY, 211 policy::POLICY_LEVEL_MANDATORY,
212 policy::POLICY_SCOPE_MACHINE, 212 policy::POLICY_SCOPE_MACHINE,
213 base::Value::CreateStringValue("http://google.com"), 213 new base::StringValue("http://google.com"),
214 NULL); 214 NULL);
215 expected_values[policy::key::kHomepageLocation] = "http://google.com"; 215 expected_values[policy::key::kHomepageLocation] = "http://google.com";
216 values.Set(policy::key::kRestoreOnStartup, 216 values.Set(policy::key::kRestoreOnStartup,
217 policy::POLICY_LEVEL_RECOMMENDED, 217 policy::POLICY_LEVEL_RECOMMENDED,
218 policy::POLICY_SCOPE_USER, 218 policy::POLICY_SCOPE_USER,
219 base::Value::CreateIntegerValue(4), 219 base::Value::CreateIntegerValue(4),
220 NULL); 220 NULL);
221 expected_values[policy::key::kRestoreOnStartup] = "4"; 221 expected_values[policy::key::kRestoreOnStartup] = "4";
222 values.Set(policy::key::kShowHomeButton, 222 values.Set(policy::key::kShowHomeButton,
223 policy::POLICY_LEVEL_RECOMMENDED, 223 policy::POLICY_LEVEL_RECOMMENDED,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 expected_policies.begin() + first_unset_position++, 260 expected_policies.begin() + first_unset_position++,
261 PopulateExpectedPolicy(kUnknownPolicy, 261 PopulateExpectedPolicy(kUnknownPolicy,
262 expected_values[kUnknownPolicy], 262 expected_values[kUnknownPolicy],
263 values.Get(kUnknownPolicy), 263 values.Get(kUnknownPolicy),
264 true)); 264 true));
265 265
266 // Retrieve the contents of the policy table from the UI and verify that it 266 // Retrieve the contents of the policy table from the UI and verify that it
267 // matches the expectation. 267 // matches the expectation.
268 VerifyPolicies(expected_policies); 268 VerifyPolicies(expected_policies);
269 } 269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698