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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_service_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/policy/cloud/cloud_policy_service.h" 5 #include "chrome/browser/policy/cloud/cloud_policy_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 9 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
10 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h" 10 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Store reloads policy, callback gets triggered. 111 // Store reloads policy, callback gets triggered.
112 store_.policy_.reset(new em::PolicyData()); 112 store_.policy_.reset(new em::PolicyData());
113 store_.policy_->set_request_token("token"); 113 store_.policy_->set_request_token("token");
114 store_.policy_->set_device_id("device-id"); 114 store_.policy_->set_device_id("device-id");
115 EXPECT_CALL(*this, OnPolicyRefresh(true)).Times(1); 115 EXPECT_CALL(*this, OnPolicyRefresh(true)).Times(1);
116 store_.NotifyStoreLoaded(); 116 store_.NotifyStoreLoaded();
117 } 117 }
118 118
119 TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { 119 TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) {
120 // Clear the token so the client is not registered. 120 // Clear the token so the client is not registered.
121 client_.SetDMToken(""); 121 client_.SetDMToken(std::string());
122 122
123 EXPECT_CALL(client_, FetchPolicy()).Times(0); 123 EXPECT_CALL(client_, FetchPolicy()).Times(0);
124 EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); 124 EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1);
125 service_.RefreshPolicy(base::Bind(&CloudPolicyServiceTest::OnPolicyRefresh, 125 service_.RefreshPolicy(base::Bind(&CloudPolicyServiceTest::OnPolicyRefresh,
126 base::Unretained(this))); 126 base::Unretained(this)));
127 } 127 }
128 128
129 TEST_F(CloudPolicyServiceTest, RefreshPolicyClientError) { 129 TEST_F(CloudPolicyServiceTest, RefreshPolicyClientError) {
130 testing::InSequence seq; 130 testing::InSequence seq;
131 131
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 testing::Mock::VerifyAndClearExpectations(&observer); 228 testing::Mock::VerifyAndClearExpectations(&observer);
229 229
230 // Now, the next time the store is loaded, the observer should not be called 230 // Now, the next time the store is loaded, the observer should not be called
231 // again. 231 // again.
232 EXPECT_CALL(observer, OnInitializationCompleted(&service_)).Times(0); 232 EXPECT_CALL(observer, OnInitializationCompleted(&service_)).Times(0);
233 store_.NotifyStoreLoaded(); 233 store_.NotifyStoreLoaded();
234 service_.RemoveObserver(&observer); 234 service_.RemoveObserver(&observer);
235 } 235 }
236 236
237 } // namespace policy 237 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698