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

Side by Side Diff: chrome/browser/policy/user_policy_token_cache.cc

Issue 7345010: Tests for cloud policy UMA metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewed, rebased Created 9 years, 5 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
« no previous file with comments | « chrome/browser/policy/mock_device_management_service.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/user_policy_token_cache.h" 5 #include "chrome/browser/policy/user_policy_token_cache.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/policy/enterprise_metrics.h" 9 #include "chrome/browser/policy/enterprise_metrics.h"
10 #include "chrome/browser/policy/proto/device_management_local.pb.h" 10 #include "chrome/browser/policy/proto/device_management_local.pb.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 LOG(WARNING) << "Failed to create directory " 113 LOG(WARNING) << "Failed to create directory "
114 << cache_file_.DirName().value(); 114 << cache_file_.DirName().value();
115 SampleUMA(kMetricTokenStoreFailed); 115 SampleUMA(kMetricTokenStoreFailed);
116 return; 116 return;
117 } 117 }
118 118
119 int size = data.size(); 119 int size = data.size();
120 if (file_util::WriteFile(cache_file_, data.c_str(), size) != size) { 120 if (file_util::WriteFile(cache_file_, data.c_str(), size) != size) {
121 LOG(WARNING) << "Failed to write " << cache_file_.value(); 121 LOG(WARNING) << "Failed to write " << cache_file_.value();
122 SampleUMA(kMetricTokenStoreFailed); 122 SampleUMA(kMetricTokenStoreFailed);
123 return;
123 } 124 }
124 125
125 SampleUMA(kMetricTokenStoreSucceeded); 126 SampleUMA(kMetricTokenStoreSucceeded);
126 } 127 }
127 128
128 UserPolicyTokenCache::UserPolicyTokenCache( 129 UserPolicyTokenCache::UserPolicyTokenCache(
129 CloudPolicyDataStore* data_store, 130 CloudPolicyDataStore* data_store,
130 const FilePath& cache_file) 131 const FilePath& cache_file)
131 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 132 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
132 data_store_(data_store) { 133 data_store_(data_store) {
(...skipping 28 matching lines...) Expand all
161 162
162 token_ = new_token; 163 token_ = new_token;
163 loader_->Store(new_token, data_store_->device_id()); 164 loader_->Store(new_token, data_store_->device_id());
164 } 165 }
165 } 166 }
166 167
167 void UserPolicyTokenCache::OnCredentialsChanged() { 168 void UserPolicyTokenCache::OnCredentialsChanged() {
168 } 169 }
169 170
170 } // namespace policy 171 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/mock_device_management_service.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698