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

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

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 14 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chromeos/chromeos_paths.h" 17 #include "chromeos/chromeos_paths.h"
18 #include "chromeos/dbus/fake_dbus_thread_manager.h" 18 #include "chromeos/dbus/dbus_thread_manager.h"
19 #include "chromeos/dbus/fake_session_manager_client.h" 19 #include "chromeos/dbus/fake_session_manager_client.h"
20 #include "crypto/rsa_private_key.h" 20 #include "crypto/rsa_private_key.h"
21 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 using ::testing::_; 24 using ::testing::_;
25 using ::testing::AnyNumber; 25 using ::testing::AnyNumber;
26 using ::testing::Return; 26 using ::testing::Return;
27 27
28 namespace policy { 28 namespace policy {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void DevicePolicyCrosTestHelper::OverridePaths() { 66 void DevicePolicyCrosTestHelper::OverridePaths() {
67 // This is usually done by ChromeBrowserMainChromeOS, but some tests 67 // This is usually done by ChromeBrowserMainChromeOS, but some tests
68 // use the overridden paths before ChromeBrowserMain starts. Make sure that 68 // use the overridden paths before ChromeBrowserMain starts. Make sure that
69 // the paths are overridden before using them. 69 // the paths are overridden before using them.
70 base::FilePath user_data_dir; 70 base::FilePath user_data_dir;
71 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 71 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
72 chromeos::RegisterStubPathOverrides(user_data_dir); 72 chromeos::RegisterStubPathOverrides(user_data_dir);
73 } 73 }
74 74
75 DevicePolicyCrosBrowserTest::DevicePolicyCrosBrowserTest() 75 DevicePolicyCrosBrowserTest::DevicePolicyCrosBrowserTest()
76 : fake_dbus_thread_manager_(new chromeos::FakeDBusThreadManager), 76 : fake_session_manager_client_(new chromeos::FakeSessionManagerClient) {
77 fake_session_manager_client_(new chromeos::FakeSessionManagerClient) {
78 fake_dbus_thread_manager_->SetFakeClients();
79 fake_dbus_thread_manager_->SetSessionManagerClient(
80 scoped_ptr<chromeos::SessionManagerClient>(fake_session_manager_client_));
81 } 77 }
82 78
83 DevicePolicyCrosBrowserTest::~DevicePolicyCrosBrowserTest() { 79 DevicePolicyCrosBrowserTest::~DevicePolicyCrosBrowserTest() {
84 } 80 }
85 81
86 void DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture() { 82 void DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture() {
87 chromeos::DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager_); 83 dbus_setter_ = chromeos::DBusThreadManager::GetSetterForTesting();
84 dbus_setter_->SetSessionManagerClient(
85 scoped_ptr<chromeos::SessionManagerClient>(fake_session_manager_client_));
88 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); 86 InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
89 } 87 }
90 88
91 void DevicePolicyCrosBrowserTest::TearDownInProcessBrowserTestFixture() { 89 void DevicePolicyCrosBrowserTest::TearDownInProcessBrowserTestFixture() {
92 InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); 90 InProcessBrowserTest::TearDownInProcessBrowserTestFixture();
93 } 91 }
94 92
95 void DevicePolicyCrosBrowserTest::MarkAsEnterpriseOwned() { 93 void DevicePolicyCrosBrowserTest::MarkAsEnterpriseOwned() {
96 test_helper_.MarkAsEnterpriseOwned(); 94 test_helper_.MarkAsEnterpriseOwned();
97 } 95 }
98 96
99 void DevicePolicyCrosBrowserTest::InstallOwnerKey() { 97 void DevicePolicyCrosBrowserTest::InstallOwnerKey() {
100 test_helper_.InstallOwnerKey(); 98 test_helper_.InstallOwnerKey();
101 } 99 }
102 100
103 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { 101 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() {
104 // Reset the key to its original state. 102 // Reset the key to its original state.
105 device_policy()->SetDefaultSigningKey(); 103 device_policy()->SetDefaultSigningKey();
106 device_policy()->Build(); 104 device_policy()->Build();
107 session_manager_client()->set_device_policy(device_policy()->GetBlob()); 105 session_manager_client()->set_device_policy(device_policy()->GetBlob());
108 session_manager_client()->OnPropertyChangeComplete(true); 106 session_manager_client()->OnPropertyChangeComplete(true);
109 } 107 }
110 108
111 } // namespace policy 109 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698