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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_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 (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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 run_loop->QuitClosure()))); 1272 run_loop->QuitClosure())));
1273 fetcher_factory->SetFakeResponse(GURL(kExternalDataURL), 1273 fetcher_factory->SetFakeResponse(GURL(kExternalDataURL),
1274 kExternalData, 1274 kExternalData,
1275 net::HTTP_OK, 1275 net::HTTP_OK,
1276 net::URLRequestStatus::SUCCESS); 1276 net::URLRequestStatus::SUCCESS);
1277 1277
1278 // Specify an external data reference for the key::kUserAvatarImage policy. 1278 // Specify an external data reference for the key::kUserAvatarImage policy.
1279 scoped_ptr<base::DictionaryValue> metadata = 1279 scoped_ptr<base::DictionaryValue> metadata =
1280 test::ConstructExternalDataReference(kExternalDataURL, kExternalData); 1280 test::ConstructExternalDataReference(kExternalDataURL, kExternalData);
1281 std::string policy; 1281 std::string policy;
1282 base::JSONWriter::Write(metadata.get(), &policy); 1282 base::JSONWriter::Write(*metadata, &policy);
1283 device_local_account_policy_.payload().mutable_useravatarimage()->set_value( 1283 device_local_account_policy_.payload().mutable_useravatarimage()->set_value(
1284 policy); 1284 policy);
1285 UploadAndInstallDeviceLocalAccountPolicy(); 1285 UploadAndInstallDeviceLocalAccountPolicy();
1286 policy::BrowserPolicyConnectorChromeOS* connector = 1286 policy::BrowserPolicyConnectorChromeOS* connector =
1287 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1287 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1288 DeviceLocalAccountPolicyBroker* broker = 1288 DeviceLocalAccountPolicyBroker* broker =
1289 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser( 1289 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser(
1290 user_id_1_); 1290 user_id_1_);
1291 ASSERT_TRUE(broker); 1291 ASSERT_TRUE(broker);
1292 broker->core()->store()->Load(); 1292 broker->core()->store()->Load();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 WaitForPolicy(); 1355 WaitForPolicy();
1356 1356
1357 base::FilePath test_dir; 1357 base::FilePath test_dir;
1358 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 1358 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
1359 std::string image_data; 1359 std::string image_data;
1360 ASSERT_TRUE(base::ReadFileToString( 1360 ASSERT_TRUE(base::ReadFileToString(
1361 test_dir.Append(chromeos::test::kUserAvatarImage1RelativePath), 1361 test_dir.Append(chromeos::test::kUserAvatarImage1RelativePath),
1362 &image_data)); 1362 &image_data));
1363 1363
1364 std::string policy; 1364 std::string policy;
1365 base::JSONWriter::Write(test::ConstructExternalDataReference( 1365 base::JSONWriter::Write(
1366 embedded_test_server()->GetURL(std::string("/") + 1366 *test::ConstructExternalDataReference(
1367 chromeos::test::kUserAvatarImage1RelativePath).spec(), 1367 embedded_test_server()
1368 image_data).get(), 1368 ->GetURL(std::string("/") +
1369 chromeos::test::kUserAvatarImage1RelativePath)
1370 .spec(),
1371 image_data),
1369 &policy); 1372 &policy);
1370 device_local_account_policy_.payload().mutable_useravatarimage()->set_value( 1373 device_local_account_policy_.payload().mutable_useravatarimage()->set_value(
1371 policy); 1374 policy);
1372 UploadAndInstallDeviceLocalAccountPolicy(); 1375 UploadAndInstallDeviceLocalAccountPolicy();
1373 policy::BrowserPolicyConnectorChromeOS* connector = 1376 policy::BrowserPolicyConnectorChromeOS* connector =
1374 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1377 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1375 DeviceLocalAccountPolicyBroker* broker = 1378 DeviceLocalAccountPolicyBroker* broker =
1376 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser( 1379 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser(
1377 user_id_1_); 1380 user_id_1_);
1378 ASSERT_TRUE(broker); 1381 ASSERT_TRUE(broker);
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 ASSERT_TRUE(content::ExecuteScript(contents_, 2336 ASSERT_TRUE(content::ExecuteScript(contents_,
2334 "$('tos-accept-button').click();")); 2337 "$('tos-accept-button').click();"));
2335 2338
2336 WaitForSessionStart(); 2339 WaitForSessionStart();
2337 } 2340 }
2338 2341
2339 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, 2342 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance,
2340 TermsOfServiceDownloadTest, testing::Bool()); 2343 TermsOfServiceDownloadTest, testing::Bool());
2341 2344
2342 } // namespace policy 2345 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698