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

Side by Side Diff: chrome/browser/chromeos/settings/session_manager_operation_unittest.cc

Issue 824683002: UserManager stack refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixed. Created 5 years, 10 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
OLDNEW
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 "chrome/browser/chromeos/settings/session_manager_operation.h" 5 #include "chrome/browser/chromeos/settings/session_manager_operation.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 17 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 18 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" 19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
21 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 20 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 21 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
23 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
24 #include "components/ownership/mock_owner_key_util.h" 23 #include "components/ownership/mock_owner_key_util.h"
25 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 24 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
26 #include "components/policy/core/common/cloud/cloud_policy_validator.h" 25 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
27 #include "components/policy/core/common/cloud/policy_builder.h" 26 #include "components/policy/core/common/cloud/policy_builder.h"
27 #include "components/user_manager/fake_user_manager.h"
28 #include "content/public/test/test_browser_thread.h" 28 #include "content/public/test/test_browser_thread.h"
29 #include "content/public/test/test_utils.h" 29 #include "content/public/test/test_utils.h"
30 #include "crypto/rsa_private_key.h" 30 #include "crypto/rsa_private_key.h"
31 #include "policy/proto/device_management_backend.pb.h" 31 #include "policy/proto/device_management_backend.pb.h"
32 #include "testing/gmock/include/gmock/gmock.h" 32 #include "testing/gmock/include/gmock/gmock.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 34
35 namespace em = enterprise_management; 35 namespace em = enterprise_management;
36 36
37 using testing::Mock; 37 using testing::Mock;
38 using testing::_; 38 using testing::_;
39 39
40 namespace chromeos { 40 namespace chromeos {
41 41
42 class SessionManagerOperationTest : public testing::Test { 42 class SessionManagerOperationTest : public testing::Test {
43 public: 43 public:
44 SessionManagerOperationTest() 44 SessionManagerOperationTest()
45 : ui_thread_(content::BrowserThread::UI, &message_loop_), 45 : ui_thread_(content::BrowserThread::UI, &message_loop_),
46 file_thread_(content::BrowserThread::FILE, &message_loop_), 46 file_thread_(content::BrowserThread::FILE, &message_loop_),
47 owner_key_util_(new ownership::MockOwnerKeyUtil()), 47 owner_key_util_(new ownership::MockOwnerKeyUtil()),
48 user_manager_(new FakeUserManager()), 48 user_manager_(new user_manager::FakeUserManager()),
49 user_manager_enabler_(user_manager_), 49 user_manager_enabler_(user_manager_),
50 validated_(false) { 50 validated_(false) {
51 OwnerSettingsServiceChromeOSFactory::GetInstance() 51 OwnerSettingsServiceChromeOSFactory::GetInstance()
52 ->SetOwnerKeyUtilForTesting(owner_key_util_); 52 ->SetOwnerKeyUtilForTesting(owner_key_util_);
53 } 53 }
54 54
55 virtual void SetUp() override { 55 virtual void SetUp() override {
56 policy_.payload().mutable_user_whitelist()->add_user_whitelist( 56 policy_.payload().mutable_user_whitelist()->add_user_whitelist(
57 "fake-whitelist"); 57 "fake-whitelist");
58 policy_.Build(); 58 policy_.Build();
(...skipping 25 matching lines...) Expand all
84 84
85 protected: 85 protected:
86 base::MessageLoop message_loop_; 86 base::MessageLoop message_loop_;
87 content::TestBrowserThread ui_thread_; 87 content::TestBrowserThread ui_thread_;
88 content::TestBrowserThread file_thread_; 88 content::TestBrowserThread file_thread_;
89 89
90 policy::DevicePolicyBuilder policy_; 90 policy::DevicePolicyBuilder policy_;
91 DeviceSettingsTestHelper device_settings_test_helper_; 91 DeviceSettingsTestHelper device_settings_test_helper_;
92 scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util_; 92 scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util_;
93 93
94 FakeUserManager* user_manager_; 94 user_manager::FakeUserManager* user_manager_;
95 ScopedUserManagerEnabler user_manager_enabler_; 95 ScopedUserManagerEnabler user_manager_enabler_;
96 96
97 scoped_ptr<TestingProfile> profile_; 97 scoped_ptr<TestingProfile> profile_;
98 OwnerSettingsServiceChromeOS* service_; 98 OwnerSettingsServiceChromeOS* service_;
99 99
100 bool validated_; 100 bool validated_;
101 101
102 private: 102 private:
103 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperationTest); 103 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperationTest);
104 }; 104 };
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 policy_.GetBlob()); 218 policy_.GetBlob());
219 ASSERT_TRUE(op.policy_data().get()); 219 ASSERT_TRUE(op.policy_data().get());
220 EXPECT_EQ(policy_.policy_data().SerializeAsString(), 220 EXPECT_EQ(policy_.policy_data().SerializeAsString(),
221 op.policy_data()->SerializeAsString()); 221 op.policy_data()->SerializeAsString());
222 ASSERT_TRUE(op.device_settings().get()); 222 ASSERT_TRUE(op.device_settings().get());
223 EXPECT_EQ(policy_.payload().SerializeAsString(), 223 EXPECT_EQ(policy_.payload().SerializeAsString(),
224 op.device_settings()->SerializeAsString()); 224 op.device_settings()->SerializeAsString());
225 } 225 }
226 226
227 } // namespace chromeos 227 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698