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

Unified Diff: components/history/core/browser/typed_url_sync_metadata_database_unittest.cc

Issue 2901093009: [USS] Implement GetAllData and GetStorageKey. (Closed)
Patch Set: brettw review and rebase Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/history/core/browser/typed_url_sync_metadata_database.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/typed_url_sync_metadata_database_unittest.cc
diff --git a/components/history/core/browser/typed_url_sync_metadata_database_unittest.cc b/components/history/core/browser/typed_url_sync_metadata_database_unittest.cc
index c37bf3eeb7ec19d2ea3f094dbb74b0e7741a4123..ec0f22f11dad3d94b66ce887bd8e8d70f5e46df0 100644
--- a/components/history/core/browser/typed_url_sync_metadata_database_unittest.cc
+++ b/components/history/core/browser/typed_url_sync_metadata_database_unittest.cc
@@ -4,8 +4,10 @@
#include "components/history/core/browser/typed_url_sync_metadata_database.h"
+#include "base/big_endian.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
+#include "components/history/core/browser/url_row.h"
#include "components/sync/protocol/model_type_state.pb.h"
#include "sql/statement.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,6 +19,16 @@ using syncer::MetadataBatch;
namespace history {
+namespace {
+
+std::string IntToStorageKey(int i) {
+ std::string storage_key(sizeof(URLID), 0);
+ base::WriteBigEndian<URLID>(&storage_key[0], i);
+ return storage_key;
+}
+
+} // namespace
+
class TypedURLSyncMetadataDatabaseTest : public testing::Test,
public TypedURLSyncMetadataDatabase {
public:
@@ -60,8 +72,8 @@ TEST_F(TypedURLSyncMetadataDatabaseTest, TypedURLNoMetadata) {
TEST_F(TypedURLSyncMetadataDatabaseTest, TypedURLGetAllSyncMetadata) {
EntityMetadata metadata;
- std::string storage_key = "1";
- std::string storage_key2 = "2";
+ std::string storage_key = IntToStorageKey(1);
+ std::string storage_key2 = IntToStorageKey(2);
metadata.set_sequence_number(1);
EXPECT_TRUE(UpdateSyncMetadata(syncer::TYPED_URLS, storage_key, metadata));
@@ -96,7 +108,7 @@ TEST_F(TypedURLSyncMetadataDatabaseTest, TypedURLGetAllSyncMetadata) {
TEST_F(TypedURLSyncMetadataDatabaseTest, TypedURLWriteThenDeleteSyncMetadata) {
EntityMetadata metadata;
MetadataBatch metadata_batch;
- std::string storage_key = "1";
+ std::string storage_key = IntToStorageKey(1);
ModelTypeState model_type_state;
model_type_state.set_initial_sync_done(true);
« no previous file with comments | « components/history/core/browser/typed_url_sync_metadata_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698