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

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

Issue 17068004: Revert 207755 "Add device policies to control accessibility sett..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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 "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 <string>
8 #include <vector> 7 #include <vector>
9 8
10 #include "base/file_util.h" 9 #include "base/file_util.h"
11 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
12 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
13 #include "base/path_service.h" 12 #include "base/path_service.h"
14 #include "base/stl_util.h" 13 #include "base/stl_util.h"
15 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 14 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
16 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
17 #include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h"
18 #include "chromeos/chromeos_paths.h" 15 #include "chromeos/chromeos_paths.h"
19 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" 16 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
20 #include "crypto/rsa_private_key.h" 17 #include "crypto/rsa_private_key.h"
21 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
23 20
24 using ::testing::_; 21 using ::testing::_;
25 using ::testing::AnyNumber; 22 using ::testing::AnyNumber;
26 using ::testing::Return; 23 using ::testing::Return;
27 24
28 namespace policy { 25 namespace policy {
29 26
30 // static
31 void DevicePolicyCrosBrowserTest::MarkAsEnterpriseOwned(
32 base::ScopedTempDir* temp_dir) {
33 cryptohome::SerializedInstallAttributes install_attrs_proto;
34 cryptohome::SerializedInstallAttributes::Attribute* attribute = NULL;
35
36 attribute = install_attrs_proto.add_attributes();
37 attribute->set_name(EnterpriseInstallAttributes::kAttrEnterpriseOwned);
38 attribute->set_value("true");
39
40 attribute = install_attrs_proto.add_attributes();
41 attribute->set_name(EnterpriseInstallAttributes::kAttrEnterpriseUser);
42 attribute->set_value(DevicePolicyBuilder::kFakeUsername);
43
44 base::FilePath install_attrs_file =
45 temp_dir->path().AppendASCII("install_attributes.pb");
46 const std::string install_attrs_blob(
47 install_attrs_proto.SerializeAsString());
48 ASSERT_EQ(static_cast<int>(install_attrs_blob.size()),
49 file_util::WriteFile(install_attrs_file,
50 install_attrs_blob.c_str(),
51 install_attrs_blob.size()));
52 ASSERT_TRUE(PathService::Override(chromeos::FILE_INSTALL_ATTRIBUTES,
53 install_attrs_file));
54 }
55
56 DevicePolicyCrosBrowserTest::DevicePolicyCrosBrowserTest() 27 DevicePolicyCrosBrowserTest::DevicePolicyCrosBrowserTest()
57 : mock_dbus_thread_manager_( 28 : mock_dbus_thread_manager_(
58 new chromeos::MockDBusThreadManagerWithoutGMock) { 29 new chromeos::MockDBusThreadManagerWithoutGMock) {
59 } 30 }
60 31
61 DevicePolicyCrosBrowserTest::~DevicePolicyCrosBrowserTest() { 32 DevicePolicyCrosBrowserTest::~DevicePolicyCrosBrowserTest() {
62 } 33 }
63 34
64 void DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture() { 35 void DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture() {
65 chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager_); 36 chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager_);
(...skipping 29 matching lines...) Expand all
95 session_manager_client()->set_device_policy(device_policy_.GetBlob()); 66 session_manager_client()->set_device_policy(device_policy_.GetBlob());
96 session_manager_client()->OnPropertyChangeComplete(true); 67 session_manager_client()->OnPropertyChangeComplete(true);
97 } 68 }
98 69
99 void DevicePolicyCrosBrowserTest::TearDownInProcessBrowserTestFixture() { 70 void DevicePolicyCrosBrowserTest::TearDownInProcessBrowserTestFixture() {
100 CrosInProcessBrowserTest::TearDownInProcessBrowserTestFixture(); 71 CrosInProcessBrowserTest::TearDownInProcessBrowserTestFixture();
101 chromeos::DBusThreadManager::Shutdown(); 72 chromeos::DBusThreadManager::Shutdown();
102 } 73 }
103 74
104 } // namespace policy 75 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698