OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/history_report/usage_reports_buffer_backend.h" | 5 #include "chrome/browser/android/history_report/usage_reports_buffer_backend.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/android/history_report/usage_report_util.h" | 13 #include "chrome/browser/android/history_report/usage_report_util.h" |
11 #include "chrome/browser/android/proto/delta_file.pb.h" | 14 #include "chrome/browser/android/proto/delta_file.pb.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 | 16 |
14 namespace { | 17 namespace { |
15 void VerifyUsageReport(history_report::UsageReport& actual, | 18 void VerifyUsageReport(history_report::UsageReport& actual, |
16 const std::string& expected_id, | 19 const std::string& expected_id, |
17 int64 expected_timestamp_ms, | 20 int64_t expected_timestamp_ms, |
18 bool expected_typed_visit) { | 21 bool expected_typed_visit) { |
19 EXPECT_EQ(expected_id, actual.id()); | 22 EXPECT_EQ(expected_id, actual.id()); |
20 EXPECT_EQ(expected_timestamp_ms, actual.timestamp_ms()); | 23 EXPECT_EQ(expected_timestamp_ms, actual.timestamp_ms()); |
21 EXPECT_EQ(expected_typed_visit, actual.typed_visit()); | 24 EXPECT_EQ(expected_typed_visit, actual.typed_visit()); |
22 } | 25 } |
23 } // namespace | 26 } // namespace |
24 | 27 |
25 namespace history_report { | 28 namespace history_report { |
26 | 29 |
27 class UsageReportsBufferBackendTest : public testing::Test { | 30 class UsageReportsBufferBackendTest : public testing::Test { |
28 public: | 31 public: |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 buffer_.reset(new UsageReportsBufferBackend(temp_dir_.path())); | 190 buffer_.reset(new UsageReportsBufferBackend(temp_dir_.path())); |
188 EXPECT_TRUE(buffer_->Init()); | 191 EXPECT_TRUE(buffer_->Init()); |
189 | 192 |
190 result = buffer_->GetUsageReportsBatch(2); | 193 result = buffer_->GetUsageReportsBatch(2); |
191 EXPECT_TRUE(result.get() != NULL); | 194 EXPECT_TRUE(result.get() != NULL); |
192 EXPECT_EQ(1u, result->size()); | 195 EXPECT_EQ(1u, result->size()); |
193 VerifyUsageReport((*result)[0], "id", 7, true); | 196 VerifyUsageReport((*result)[0], "id", 7, true); |
194 } | 197 } |
195 | 198 |
196 } // namespace history_report | 199 } // namespace history_report |
OLD | NEW |