| 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 22 matching lines...) Expand all Loading... |
| 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 "chrome/common/chrome_paths.h" |
| 43 #include "chromeos/chromeos_paths.h" |
| 43 #include "chromeos/dbus/mock_cryptohome_client.h" | 44 #include "chromeos/dbus/mock_cryptohome_client.h" |
| 44 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 45 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
| 45 #include "chromeos/dbus/mock_session_manager_client.h" | 46 #include "chromeos/dbus/mock_session_manager_client.h" |
| 46 #include "chromeos/dbus/mock_update_engine_client.h" | 47 #include "chromeos/dbus/mock_update_engine_client.h" |
| 47 #else | 48 #else |
| 48 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 49 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 49 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 50 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 50 #include "chrome/browser/signin/signin_manager.h" | 51 #include "chrome/browser/signin/signin_manager.h" |
| 51 #include "chrome/browser/signin/signin_manager_factory.h" | 52 #include "chrome/browser/signin/signin_manager_factory.h" |
| 52 #endif | 53 #endif |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 177 |
| 177 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); | 178 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); |
| 178 ASSERT_TRUE(test_server_->Start()); | 179 ASSERT_TRUE(test_server_->Start()); |
| 179 | 180 |
| 180 std::string url = test_server_->GetServiceURL().spec(); | 181 std::string url = test_server_->GetServiceURL().spec(); |
| 181 | 182 |
| 182 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 183 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); | 184 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); |
| 184 | 185 |
| 185 #if defined(OS_CHROMEOS) | 186 #if defined(OS_CHROMEOS) |
| 186 PathService::Override(chrome::DIR_USER_POLICY_KEYS, user_policy_key_dir()); | 187 ASSERT_TRUE(PathService::Override(chromeos::DIR_USER_POLICY_KEYS, |
| 188 user_policy_key_dir())); |
| 187 | 189 |
| 188 mock_dbus_thread_manager_ = new chromeos::MockDBusThreadManager(); | 190 mock_dbus_thread_manager_ = new chromeos::MockDBusThreadManager(); |
| 189 chromeos::DBusThreadManager::InitializeForTesting( | 191 chromeos::DBusThreadManager::InitializeForTesting( |
| 190 mock_dbus_thread_manager_); | 192 mock_dbus_thread_manager_); |
| 191 EXPECT_CALL(*mock_dbus_thread_manager_->mock_cryptohome_client(), | 193 EXPECT_CALL(*mock_dbus_thread_manager_->mock_cryptohome_client(), |
| 192 GetSanitizedUsername(_, _)) | 194 GetSanitizedUsername(_, _)) |
| 193 .WillRepeatedly(GetSanitizedUsername()); | 195 .WillRepeatedly(GetSanitizedUsername()); |
| 194 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), | 196 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), |
| 195 StoreUserPolicy(_, _)) | 197 StoreUserPolicy(_, _)) |
| 196 .WillRepeatedly(StoreUserPolicy(&session_manager_user_policy_, | 198 .WillRepeatedly(StoreUserPolicy(&session_manager_user_policy_, |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 402 |
| 401 // They should now serialize to the same bytes. | 403 // They should now serialize to the same bytes. |
| 402 std::string chrome_settings_serialized; | 404 std::string chrome_settings_serialized; |
| 403 std::string cloud_policy_serialized; | 405 std::string cloud_policy_serialized; |
| 404 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 406 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
| 405 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 407 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
| 406 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 408 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
| 407 } | 409 } |
| 408 | 410 |
| 409 } // namespace policy | 411 } // namespace policy |
| OLD | NEW |