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

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

Issue 2901093009: [USS] Implement GetAllData and GetStorageKey. (Closed)
Patch Set: pavely code review update Created 3 years, 7 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
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..f79d9bc1cd569afb4ade107627bb1199e346d576 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(8, 0);
+ base::WriteBigEndian(&storage_key[0], static_cast<URLID>(i));
pavely 2017/06/01 20:49:18 nit: I think you can explicitly specify which vari
Gang Wu 2017/06/02 00:00:24 Done.
+ 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(0);
+ std::string storage_key2 = IntToStorageKey(1);
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);

Powered by Google App Engine
This is Rietveld 408576698