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

Side by Side Diff: components/bookmarks/browser/bookmark_codec_unittest.cc

Issue 889473002: bookmarks: Cleanup - remove unused variables left behind after refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bookmarks/browser/bookmark_codec.h" 5 #include "components/bookmarks/browser/bookmark_codec.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 scoped_ptr<base::Value> model_value2(encoder2.Encode(decoded_model.get())); 348 scoped_ptr<base::Value> model_value2(encoder2.Encode(decoded_model.get()));
349 349
350 scoped_ptr<BookmarkModel> decoded_model2(client_.CreateModel()); 350 scoped_ptr<BookmarkModel> decoded_model2(client_.CreateModel());
351 BookmarkCodec decoder2; 351 BookmarkCodec decoder2;
352 ASSERT_TRUE(Decode(&decoder2, decoded_model2.get(), *model_value2.get())); 352 ASSERT_TRUE(Decode(&decoder2, decoded_model2.get(), *model_value2.get()));
353 ASSERT_NO_FATAL_FAILURE( 353 ASSERT_NO_FATAL_FAILURE(
354 AssertModelsEqual(decoded_model.get(), decoded_model2.get())); 354 AssertModelsEqual(decoded_model.get(), decoded_model2.get()));
355 } 355 }
356 356
357 TEST_F(BookmarkCodecTest, CanDecodeModelWithoutMobileBookmarks) { 357 TEST_F(BookmarkCodecTest, CanDecodeModelWithoutMobileBookmarks) {
358 base::FilePath test_data_directory;
359 base::FilePath test_file = 358 base::FilePath test_file =
360 GetTestDataDir().AppendASCII("bookmarks/model_without_sync.json"); 359 GetTestDataDir().AppendASCII("bookmarks/model_without_sync.json");
361 ASSERT_TRUE(base::PathExists(test_file)); 360 ASSERT_TRUE(base::PathExists(test_file));
362 361
363 JSONFileValueSerializer serializer(test_file); 362 JSONFileValueSerializer serializer(test_file);
364 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); 363 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL));
365 364
366 scoped_ptr<BookmarkModel> decoded_model(client_.CreateModel()); 365 scoped_ptr<BookmarkModel> decoded_model(client_.CreateModel());
367 BookmarkCodec decoder; 366 BookmarkCodec decoder;
368 ASSERT_TRUE(Decode(&decoder, decoded_model.get(), *root.get())); 367 ASSERT_TRUE(Decode(&decoder, decoded_model.get(), *root.get()));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 EXPECT_EQ(1, model->root_node()->sync_transaction_version()); 434 EXPECT_EQ(1, model->root_node()->sync_transaction_version());
436 bbn = model->bookmark_bar_node(); 435 bbn = model->bookmark_bar_node();
437 EXPECT_EQ(42, bbn->GetChild(1)->sync_transaction_version()); 436 EXPECT_EQ(42, bbn->GetChild(1)->sync_transaction_version());
438 EXPECT_EQ(BookmarkNode::kInvalidSyncTransactionVersion, 437 EXPECT_EQ(BookmarkNode::kInvalidSyncTransactionVersion,
439 bbn->GetChild(0)->sync_transaction_version()); 438 bbn->GetChild(0)->sync_transaction_version());
440 } 439 }
441 440
442 // Verifies that we can still decode the old codec format after changing the 441 // Verifies that we can still decode the old codec format after changing the
443 // way meta info is stored. 442 // way meta info is stored.
444 TEST_F(BookmarkCodecTest, CanDecodeMetaInfoAsString) { 443 TEST_F(BookmarkCodecTest, CanDecodeMetaInfoAsString) {
445 base::FilePath test_data_directory;
446 base::FilePath test_file = 444 base::FilePath test_file =
447 GetTestDataDir().AppendASCII("bookmarks/meta_info_as_string.json"); 445 GetTestDataDir().AppendASCII("bookmarks/meta_info_as_string.json");
448 ASSERT_TRUE(base::PathExists(test_file)); 446 ASSERT_TRUE(base::PathExists(test_file));
449 447
450 JSONFileValueSerializer serializer(test_file); 448 JSONFileValueSerializer serializer(test_file);
451 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); 449 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL));
452 450
453 scoped_ptr<BookmarkModel> model(client_.CreateModel()); 451 scoped_ptr<BookmarkModel> model(client_.CreateModel());
454 BookmarkCodec decoder; 452 BookmarkCodec decoder;
455 ASSERT_TRUE(Decode(&decoder, model.get(), *root.get())); 453 ASSERT_TRUE(Decode(&decoder, model.get(), *root.get()));
(...skipping 14 matching lines...) Expand all
470 bbn->GetChild(1)->GetMetaInfo(kSyncTransactionVersionKey, &meta_value)); 468 bbn->GetChild(1)->GetMetaInfo(kSyncTransactionVersionKey, &meta_value));
471 EXPECT_TRUE(bbn->GetChild(0)->GetMetaInfo(kNormalKey, &meta_value)); 469 EXPECT_TRUE(bbn->GetChild(0)->GetMetaInfo(kNormalKey, &meta_value));
472 EXPECT_EQ("value", meta_value); 470 EXPECT_EQ("value", meta_value);
473 EXPECT_TRUE(bbn->GetChild(1)->GetMetaInfo(kNormalKey, &meta_value)); 471 EXPECT_TRUE(bbn->GetChild(1)->GetMetaInfo(kNormalKey, &meta_value));
474 EXPECT_EQ("value2", meta_value); 472 EXPECT_EQ("value2", meta_value);
475 EXPECT_TRUE(bbn->GetChild(0)->GetMetaInfo(kNestedKey, &meta_value)); 473 EXPECT_TRUE(bbn->GetChild(0)->GetMetaInfo(kNestedKey, &meta_value));
476 EXPECT_EQ("value3", meta_value); 474 EXPECT_EQ("value3", meta_value);
477 } 475 }
478 476
479 } // namespace bookmarks 477 } // namespace bookmarks
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698