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

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

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed GYP file. Created 6 years, 3 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) 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" 14 #include "chrome/browser/chromeos/ownership/owner_settings_service.h"
15 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" 15 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h"
16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
17 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 17 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
18 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h"
19 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
19 #include "components/ownership/mock_owner_key_util.h"
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 #include "components/policy/core/common/cloud/cloud_policy_validator.h" 21 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
22 #include "components/policy/core/common/cloud/policy_builder.h" 22 #include "components/policy/core/common/cloud/policy_builder.h"
23 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
24 #include "crypto/rsa_private_key.h" 24 #include "crypto/rsa_private_key.h"
25 #include "policy/proto/device_management_backend.pb.h" 25 #include "policy/proto/device_management_backend.pb.h"
26 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 namespace em = enterprise_management; 29 namespace em = enterprise_management;
30 30
31 using testing::Mock; 31 using testing::Mock;
32 using testing::_; 32 using testing::_;
33 33
34 namespace chromeos { 34 namespace chromeos {
35 35
36 class SessionManagerOperationTest : public testing::Test { 36 class SessionManagerOperationTest : public testing::Test {
37 public: 37 public:
38 SessionManagerOperationTest() 38 SessionManagerOperationTest()
39 : ui_thread_(content::BrowserThread::UI, &message_loop_), 39 : ui_thread_(content::BrowserThread::UI, &message_loop_),
40 file_thread_(content::BrowserThread::FILE, &message_loop_), 40 file_thread_(content::BrowserThread::FILE, &message_loop_),
41 owner_key_util_(new MockOwnerKeyUtil()), 41 owner_key_util_(new ownership::MockOwnerKeyUtil()),
42 validated_(false) {} 42 validated_(false) {}
43 43
44 virtual void SetUp() OVERRIDE { 44 virtual void SetUp() OVERRIDE {
45 policy_.payload().mutable_pinned_apps()->add_app_id("fake-app"); 45 policy_.payload().mutable_pinned_apps()->add_app_id("fake-app");
46 policy_.Build(); 46 policy_.Build();
47 47
48 profile_.reset(new TestingProfile()); 48 profile_.reset(new TestingProfile());
49 OwnerSettingsService::SetOwnerKeyUtilForTesting(owner_key_util_); 49 OwnerSettingsService::SetOwnerKeyUtilForTesting(owner_key_util_);
50 service_ = OwnerSettingsServiceFactory::GetForProfile(profile_.get()); 50 service_ = OwnerSettingsServiceFactory::GetForProfile(profile_.get());
51 } 51 }
(...skipping 20 matching lines...) Expand all
72 EXPECT_EQ(public_key, op->public_key()->data()); 72 EXPECT_EQ(public_key, op->public_key()->data());
73 } 73 }
74 74
75 protected: 75 protected:
76 base::MessageLoop message_loop_; 76 base::MessageLoop message_loop_;
77 content::TestBrowserThread ui_thread_; 77 content::TestBrowserThread ui_thread_;
78 content::TestBrowserThread file_thread_; 78 content::TestBrowserThread file_thread_;
79 79
80 policy::DevicePolicyBuilder policy_; 80 policy::DevicePolicyBuilder policy_;
81 DeviceSettingsTestHelper device_settings_test_helper_; 81 DeviceSettingsTestHelper device_settings_test_helper_;
82 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; 82 scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util_;
83 83
84 scoped_ptr<TestingProfile> profile_; 84 scoped_ptr<TestingProfile> profile_;
85 OwnerSettingsService* service_; 85 OwnerSettingsService* service_;
86 86
87 bool validated_; 87 bool validated_;
88 88
89 private: 89 private:
90 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperationTest); 90 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperationTest);
91 }; 91 };
92 92
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 message_loop_.RunUntilIdle(); 266 message_loop_.RunUntilIdle();
267 EXPECT_TRUE(validated_); 267 EXPECT_TRUE(validated_);
268 268
269 // Loaded device settings should match what the operation received. 269 // Loaded device settings should match what the operation received.
270 ASSERT_TRUE(op.device_settings().get()); 270 ASSERT_TRUE(op.device_settings().get());
271 EXPECT_EQ(policy_.payload().SerializeAsString(), 271 EXPECT_EQ(policy_.payload().SerializeAsString(),
272 op.device_settings()->SerializeAsString()); 272 op.device_settings()->SerializeAsString());
273 } 273 }
274 274
275 } // namespace chromeos 275 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/session_manager_operation.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698