OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/persisted_logs.h" | 5 #include "components/metrics/persisted_logs.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/scoped_user_pref_update.h" | 12 #include "base/prefs/scoped_user_pref_update.h" |
13 #include "base/prefs/testing_pref_service.h" | 13 #include "base/prefs/testing_pref_service.h" |
14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
15 #include "base/sha1.h" | 15 #include "base/sha1.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "components/compression/compression_utils.h" | |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "third_party/zlib/google/compression_utils.h" |
19 | 19 |
20 namespace metrics { | 20 namespace metrics { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const char kTestPrefName[] = "TestPref"; | 24 const char kTestPrefName[] = "TestPref"; |
25 const size_t kLogCountLimit = 3; | 25 const size_t kLogCountLimit = 3; |
26 const size_t kLogByteLimit = 1000; | 26 const size_t kLogByteLimit = 1000; |
27 | 27 |
28 // Compresses |log_data| and returns the result. | 28 // Compresses |log_data| and returns the result. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 TestPersistedLogs persisted_logs(&prefs_, kLogByteLimit); | 281 TestPersistedLogs persisted_logs(&prefs_, kLogByteLimit); |
282 persisted_logs.StoreLog(kFooText); | 282 persisted_logs.StoreLog(kFooText); |
283 persisted_logs.StageLog(); | 283 persisted_logs.StageLog(); |
284 | 284 |
285 EXPECT_EQ(Compress(kFooText), persisted_logs.staged_log()); | 285 EXPECT_EQ(Compress(kFooText), persisted_logs.staged_log()); |
286 EXPECT_EQ(foo_hash, persisted_logs.staged_log_hash()); | 286 EXPECT_EQ(foo_hash, persisted_logs.staged_log_hash()); |
287 } | 287 } |
288 | 288 |
289 } // namespace metrics | 289 } // namespace metrics |
OLD | NEW |