| 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/delta_file_commons.h" | 5 #include "chrome/browser/android/history_report/delta_file_commons.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
| 7 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/history/core/browser/history_types.h" | 12 #include "components/history/core/browser/history_types.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 14 |
| 12 using bookmarks::BookmarkModel; | 15 using bookmarks::BookmarkModel; |
| 13 | 16 |
| 14 namespace history_report { | 17 namespace history_report { |
| 15 | 18 |
| 16 class DeltaFileEntryWithDataTest : public testing::Test { | 19 class DeltaFileEntryWithDataTest : public testing::Test { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DeltaFileEntry entry; | 204 DeltaFileEntry entry; |
| 202 entry.set_url(url.str()); | 205 entry.set_url(url.str()); |
| 203 DeltaFileEntryWithData data(entry); | 206 DeltaFileEntryWithData data(entry); |
| 204 | 207 |
| 205 EXPECT_NE(url.str(), data.Id()); | 208 EXPECT_NE(url.str(), data.Id()); |
| 206 EXPECT_TRUE(DeltaFileEntryWithData::IsValidId(data.Id())) | 209 EXPECT_TRUE(DeltaFileEntryWithData::IsValidId(data.Id())) |
| 207 << data.Id() << " is not a valid ID"; | 210 << data.Id() << " is not a valid ID"; |
| 208 | 211 |
| 209 std::stringstream expected_length_stream; | 212 std::stringstream expected_length_stream; |
| 210 expected_length_stream << std::setfill('0') << std::setw(8) | 213 expected_length_stream << std::setfill('0') << std::setw(8) |
| 211 << base::Uint64ToString(static_cast<uint64>(url.str().size())); | 214 << base::Uint64ToString( |
| 215 static_cast<uint64_t>(url.str().size())); |
| 212 std::string length = data.Id().substr(0, 8); | 216 std::string length = data.Id().substr(0, 8); |
| 213 EXPECT_EQ(expected_length_stream.str(), length); | 217 EXPECT_EQ(expected_length_stream.str(), length); |
| 214 | 218 |
| 215 std::string prefix = data.Id().substr(72); | 219 std::string prefix = data.Id().substr(72); |
| 216 std::string expected_prefix(url.str().substr(0, prefix.size())); | 220 std::string expected_prefix(url.str().substr(0, prefix.size())); |
| 217 EXPECT_EQ(expected_prefix, prefix); | 221 EXPECT_EQ(expected_prefix, prefix); |
| 218 } | 222 } |
| 219 | 223 |
| 220 } // namespace history_report | 224 } // namespace history_report |
| OLD | NEW |