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

Side by Side Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/desktop_background/desktop_background_controller.h" 8 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "ash/desktop_background/desktop_background_controller_observer.h" 9 #include "ash/desktop_background/desktop_background_controller_observer.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 } 214 }
215 215
216 std::string ConstructPolicy(const std::string& relative_path) const { 216 std::string ConstructPolicy(const std::string& relative_path) const {
217 std::string image_data; 217 std::string image_data;
218 if (!base::ReadFileToString(test_data_dir_.Append(relative_path), 218 if (!base::ReadFileToString(test_data_dir_.Append(relative_path),
219 &image_data)) { 219 &image_data)) {
220 ADD_FAILURE(); 220 ADD_FAILURE();
221 } 221 }
222 std::string policy; 222 std::string policy;
223 base::JSONWriter::Write(policy::test::ConstructExternalDataReference( 223 base::JSONWriter::Write(*policy::test::ConstructExternalDataReference(
224 embedded_test_server()->GetURL(std::string("/") + relative_path).spec(), 224 embedded_test_server()
225 image_data).get(), 225 ->GetURL(std::string("/") + relative_path)
226 &policy); 226 .spec(),
227 image_data),
228 &policy);
227 return policy; 229 return policy;
228 } 230 }
229 231
230 // Inject |filename| as wallpaper policy for test user |user_number|. Set 232 // Inject |filename| as wallpaper policy for test user |user_number|. Set
231 // empty |filename| to clear policy. 233 // empty |filename| to clear policy.
232 void InjectPolicy(int user_number, const std::string& filename) { 234 void InjectPolicy(int user_number, const std::string& filename) {
233 ASSERT_TRUE(user_number == 0 || user_number == 1); 235 ASSERT_TRUE(user_number == 0 || user_number == 1);
234 const std::string user_id = kTestUsers[user_number]; 236 const std::string user_id = kTestUsers[user_number];
235 policy::UserPolicyBuilder* builder = 237 policy::UserPolicyBuilder* builder =
236 user_policy_builders_[user_number].get(); 238 user_policy_builders_[user_number].get();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 398
397 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { 399 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) {
398 LoginUser(kTestUsers[0]); 400 LoginUser(kTestUsers[0]);
399 401
400 // Wait until wallpaper has been loaded. 402 // Wait until wallpaper has been loaded.
401 RunUntilWallpaperChangeCount(1); 403 RunUntilWallpaperChangeCount(1);
402 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); 404 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor());
403 } 405 }
404 406
405 } // namespace chromeos 407 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc ('k') | chrome/browser/chromeos/net/onc_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698