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

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

Issue 143183007: Update policy signature verification to include policy domain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trying again after mysterious chunk-mismatch error on last upload. Created 6 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 | 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/policy/user_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 23 matching lines...) Expand all
34 using testing::Return; 34 using testing::Return;
35 using testing::SaveArg; 35 using testing::SaveArg;
36 using testing::_; 36 using testing::_;
37 37
38 namespace policy { 38 namespace policy {
39 39
40 namespace { 40 namespace {
41 41
42 const char kLegacyDeviceId[] = "legacy-device-id"; 42 const char kLegacyDeviceId[] = "legacy-device-id";
43 const char kLegacyToken[] = "legacy-token"; 43 const char kLegacyToken[] = "legacy-token";
44 const char kSanitizedUsername[] = "0123456789ABCDEF0123456789ABCDEF012345678"; 44 const char kSanitizedUsername[] =
45 "0123456789ABCDEF0123456789ABCDEF012345678@example.com";
45 const char kDefaultHomepage[] = "http://chromium.org"; 46 const char kDefaultHomepage[] = "http://chromium.org";
46 47
47 ACTION_P2(SendSanitizedUsername, call_status, sanitized_username) { 48 ACTION_P2(SendSanitizedUsername, call_status, sanitized_username) {
48 base::MessageLoop::current()->PostTask( 49 base::MessageLoop::current()->PostTask(
49 FROM_HERE, base::Bind(arg1, call_status, sanitized_username)); 50 FROM_HERE, base::Bind(arg1, call_status, sanitized_username));
50 } 51 }
51 52
52 class UserCloudPolicyStoreChromeOSTest : public testing::Test { 53 class UserCloudPolicyStoreChromeOSTest : public testing::Test {
53 protected: 54 protected:
54 UserCloudPolicyStoreChromeOSTest() {} 55 UserCloudPolicyStoreChromeOSTest() {}
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, store_->status()); 593 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, store_->status());
593 } 594 }
594 595
595 TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoUserPolicyKey) { 596 TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoUserPolicyKey) {
596 EXPECT_CALL(observer_, OnStoreError(store_.get())); 597 EXPECT_CALL(observer_, OnStoreError(store_.get()));
597 EXPECT_CALL(session_manager_client_, 598 EXPECT_CALL(session_manager_client_,
598 BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername)) 599 BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
599 .WillOnce(Return(policy_.GetBlob())); 600 .WillOnce(Return(policy_.GetBlob()));
600 EXPECT_CALL(cryptohome_client_, 601 EXPECT_CALL(cryptohome_client_,
601 BlockingGetSanitizedUsername(PolicyBuilder::kFakeUsername)) 602 BlockingGetSanitizedUsername(PolicyBuilder::kFakeUsername))
602 .WillOnce(Return("wrong")); 603 .WillOnce(Return("wrong@example.com"));
603 604
604 EXPECT_FALSE(store_->policy()); 605 EXPECT_FALSE(store_->policy());
605 store_->LoadImmediately(); 606 store_->LoadImmediately();
606 Mock::VerifyAndClearExpectations(&observer_); 607 Mock::VerifyAndClearExpectations(&observer_);
607 Mock::VerifyAndClearExpectations(&session_manager_client_); 608 Mock::VerifyAndClearExpectations(&session_manager_client_);
608 Mock::VerifyAndClearExpectations(&cryptohome_client_); 609 Mock::VerifyAndClearExpectations(&cryptohome_client_);
609 610
610 EXPECT_FALSE(store_->policy()); 611 EXPECT_FALSE(store_->policy());
611 EXPECT_TRUE(store_->policy_map().empty()); 612 EXPECT_TRUE(store_->policy_map().empty());
612 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); 613 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status());
613 } 614 }
614 615
615 } // namespace 616 } // namespace
616 617
617 } // namespace policy 618 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698