OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
33 #include "policy/policy_constants.h" | 33 #include "policy/policy_constants.h" |
34 #include "policy/proto/chrome_settings.pb.h" | 34 #include "policy/proto/chrome_settings.pb.h" |
35 #include "policy/proto/cloud_policy.pb.h" | 35 #include "policy/proto/cloud_policy.pb.h" |
36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
38 | 38 |
39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
40 #include "chrome/browser/chromeos/login/user_manager.h" | 40 #include "chrome/browser/chromeos/login/user_manager.h" |
41 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 41 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
42 #include "chrome/common/chrome_paths.h" | 42 #include "chromeos/chromeos_paths.h" |
43 #include "chromeos/dbus/mock_cryptohome_client.h" | 43 #include "chromeos/dbus/mock_cryptohome_client.h" |
44 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 44 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
45 #include "chromeos/dbus/mock_session_manager_client.h" | 45 #include "chromeos/dbus/mock_session_manager_client.h" |
46 #include "chromeos/dbus/mock_update_engine_client.h" | 46 #include "chromeos/dbus/mock_update_engine_client.h" |
47 #else | 47 #else |
48 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 48 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
49 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 49 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
50 #include "chrome/browser/signin/signin_manager.h" | 50 #include "chrome/browser/signin/signin_manager.h" |
51 #include "chrome/browser/signin/signin_manager_factory.h" | 51 #include "chrome/browser/signin/signin_manager_factory.h" |
52 #endif | 52 #endif |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); | 177 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); |
178 ASSERT_TRUE(test_server_->Start()); | 178 ASSERT_TRUE(test_server_->Start()); |
179 | 179 |
180 std::string url = test_server_->GetServiceURL().spec(); | 180 std::string url = test_server_->GetServiceURL().spec(); |
181 | 181 |
182 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 182 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); | 183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); |
184 | 184 |
185 #if defined(OS_CHROMEOS) | 185 #if defined(OS_CHROMEOS) |
186 PathService::Override(chrome::DIR_USER_POLICY_KEYS, user_policy_key_dir()); | 186 ASSERT_TRUE(PathService::Override(chromeos::DIR_USER_POLICY_KEYS, |
| 187 user_policy_key_dir())); |
187 | 188 |
188 mock_dbus_thread_manager_ = new chromeos::MockDBusThreadManager(); | 189 mock_dbus_thread_manager_ = new chromeos::MockDBusThreadManager(); |
189 chromeos::DBusThreadManager::InitializeForTesting( | 190 chromeos::DBusThreadManager::InitializeForTesting( |
190 mock_dbus_thread_manager_); | 191 mock_dbus_thread_manager_); |
191 EXPECT_CALL(*mock_dbus_thread_manager_->mock_cryptohome_client(), | 192 EXPECT_CALL(*mock_dbus_thread_manager_->mock_cryptohome_client(), |
192 GetSanitizedUsername(_, _)) | 193 GetSanitizedUsername(_, _)) |
193 .WillRepeatedly(GetSanitizedUsername()); | 194 .WillRepeatedly(GetSanitizedUsername()); |
194 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), | 195 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), |
195 StoreUserPolicy(_, _)) | 196 StoreUserPolicy(_, _)) |
196 .WillRepeatedly(StoreUserPolicy(&session_manager_user_policy_, | 197 .WillRepeatedly(StoreUserPolicy(&session_manager_user_policy_, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 401 |
401 // They should now serialize to the same bytes. | 402 // They should now serialize to the same bytes. |
402 std::string chrome_settings_serialized; | 403 std::string chrome_settings_serialized; |
403 std::string cloud_policy_serialized; | 404 std::string cloud_policy_serialized; |
404 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 405 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
405 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 406 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
406 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 407 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
407 } | 408 } |
408 | 409 |
409 } // namespace policy | 410 } // namespace policy |
OLD | NEW |