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

Side by Side Diff: chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc

Issue 1452853002: Convert vector_as_array to vector::data in //chrome{,cast,os}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vector-data
Patch Set: Created 5 years, 1 month 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 "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 5 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/stl_util.h"
13 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 12 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
14 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 13 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
15 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
16 #include "chromeos/chromeos_paths.h" 15 #include "chromeos/chromeos_paths.h"
17 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
18 #include "chromeos/dbus/fake_session_manager_client.h" 17 #include "chromeos/dbus/fake_session_manager_client.h"
19 #include "crypto/rsa_private_key.h" 18 #include "crypto/rsa_private_key.h"
20 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
(...skipping 30 matching lines...) Expand all
53 } 52 }
54 53
55 void DevicePolicyCrosTestHelper::InstallOwnerKey() { 54 void DevicePolicyCrosTestHelper::InstallOwnerKey() {
56 OverridePaths(); 55 OverridePaths();
57 56
58 base::FilePath owner_key_file; 57 base::FilePath owner_key_file;
59 ASSERT_TRUE(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_file)); 58 ASSERT_TRUE(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_file));
60 std::vector<uint8> owner_key_bits; 59 std::vector<uint8> owner_key_bits;
61 ASSERT_TRUE( 60 ASSERT_TRUE(
62 device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits)); 61 device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits));
63 ASSERT_EQ(base::WriteFile( 62 ASSERT_EQ(base::WriteFile(owner_key_file, reinterpret_cast<const char*>(
64 owner_key_file, 63 owner_key_bits.data()),
65 reinterpret_cast<const char*>(vector_as_array(&owner_key_bits)), 64 owner_key_bits.size()),
66 owner_key_bits.size()), 65 static_cast<int>(owner_key_bits.size()));
67 static_cast<int>(owner_key_bits.size()));
68 } 66 }
69 67
70 // static 68 // static
71 void DevicePolicyCrosTestHelper::OverridePaths() { 69 void DevicePolicyCrosTestHelper::OverridePaths() {
72 // This is usually done by ChromeBrowserMainChromeOS, but some tests 70 // This is usually done by ChromeBrowserMainChromeOS, but some tests
73 // use the overridden paths before ChromeBrowserMain starts. Make sure that 71 // use the overridden paths before ChromeBrowserMain starts. Make sure that
74 // the paths are overridden before using them. 72 // the paths are overridden before using them.
75 base::FilePath user_data_dir; 73 base::FilePath user_data_dir;
76 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 74 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
77 chromeos::RegisterStubPathOverrides(user_data_dir); 75 chromeos::RegisterStubPathOverrides(user_data_dir);
(...skipping 27 matching lines...) Expand all
105 103
106 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { 104 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() {
107 // Reset the key to its original state. 105 // Reset the key to its original state.
108 device_policy()->SetDefaultSigningKey(); 106 device_policy()->SetDefaultSigningKey();
109 device_policy()->Build(); 107 device_policy()->Build();
110 session_manager_client()->set_device_policy(device_policy()->GetBlob()); 108 session_manager_client()->set_device_policy(device_policy()->GetBlob());
111 session_manager_client()->OnPropertyChangeComplete(true); 109 session_manager_client()->OnPropertyChangeComplete(true);
112 } 110 }
113 111
114 } // namespace policy 112 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/platform_keys/platform_keys_nss.cc ('k') | chrome/browser/copresence/chrome_whispernet_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698