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

Side by Side Diff: components/metrics/data_use_tracker_unittest.cc

Issue 2605293002: Add WARN_UNUSED_RESULT to base::Time methods that return bool. (Closed)
Patch Set: Add comment to PexeDownloader::didReceiveResponse() Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/metrics/data_use_tracker.h" 5 #include "components/metrics/data_use_tracker.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "components/metrics/metrics_pref_names.h" 8 #include "components/metrics/metrics_pref_names.h"
9 #include "components/prefs/pref_registry_simple.h" 9 #include "components/prefs/pref_registry_simple.h"
10 #include "components/prefs/testing_pref_service.h" 10 #include "components/prefs/testing_pref_service.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return true; 44 return true;
45 } 45 }
46 46
47 bool GetUmaRatio(double* ratio) const override { 47 bool GetUmaRatio(double* ratio) const override {
48 *ratio = 0.05; 48 *ratio = 0.05;
49 return true; 49 return true;
50 } 50 }
51 51
52 base::Time GetCurrentMeasurementDate() const override { 52 base::Time GetCurrentMeasurementDate() const override {
53 base::Time today_for_test; 53 base::Time today_for_test;
54 base::Time::FromUTCString(kTodayStr, &today_for_test); 54 EXPECT_TRUE(base::Time::FromUTCString(kTodayStr, &today_for_test));
55 return today_for_test; 55 return today_for_test;
56 } 56 }
57 57
58 std::string GetCurrentMeasurementDateAsString() const override { 58 std::string GetCurrentMeasurementDateAsString() const override {
59 return kTodayStr; 59 return kTodayStr;
60 } 60 }
61 61
62 private: 62 private:
63 DISALLOW_COPY_AND_ASSIGN(FakeDataUseTracker); 63 DISALLOW_COPY_AND_ASSIGN(FakeDataUseTracker);
64 }; 64 };
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 can_upload = data_use_tracker.ShouldUploadLogOnCellular(100); 197 can_upload = data_use_tracker.ShouldUploadLogOnCellular(100);
198 EXPECT_TRUE(can_upload); 198 EXPECT_TRUE(can_upload);
199 // this is about 0.49% 199 // this is about 0.49%
200 can_upload = data_use_tracker.ShouldUploadLogOnCellular(200); 200 can_upload = data_use_tracker.ShouldUploadLogOnCellular(200);
201 EXPECT_TRUE(can_upload); 201 EXPECT_TRUE(can_upload);
202 can_upload = data_use_tracker.ShouldUploadLogOnCellular(300); 202 can_upload = data_use_tracker.ShouldUploadLogOnCellular(300);
203 EXPECT_FALSE(can_upload); 203 EXPECT_FALSE(can_upload);
204 } 204 }
205 205
206 } // namespace metrics 206 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698