| OLD | NEW |
| 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/enhanced_bookmarks/enhanced_bookmark_model.h" | 5 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 ASSERT_TRUE(result); | 362 ASSERT_TRUE(result); |
| 363 EXPECT_EQ(url, GURL("http://example.com/i.jpg")); | 363 EXPECT_EQ(url, GURL("http://example.com/i.jpg")); |
| 364 EXPECT_EQ(width, 33); | 364 EXPECT_EQ(width, 33); |
| 365 EXPECT_EQ(height, 44); | 365 EXPECT_EQ(height, 44); |
| 366 EXPECT_EQ("v1.0", GetVersion(node)); | 366 EXPECT_EQ("v1.0", GetVersion(node)); |
| 367 } | 367 } |
| 368 | 368 |
| 369 TEST_F(EnhancedBookmarkModelTest, TestRemoteId) { | 369 TEST_F(EnhancedBookmarkModelTest, TestRemoteId) { |
| 370 const BookmarkNode* node = AddBookmark(); | 370 const BookmarkNode* node = AddBookmark(); |
| 371 // Verify that the remote id starts with the correct prefix. | 371 // Verify that the remote id starts with the correct prefix. |
| 372 EXPECT_TRUE(base::StartsWithASCII(model_->GetRemoteId(node), "ebc_", true)); | 372 EXPECT_TRUE(base::StartsWith(model_->GetRemoteId(node), "ebc_", |
| 373 base::CompareCase::SENSITIVE)); |
| 373 | 374 |
| 374 // Getting the remote id for nodes that don't have them should return the | 375 // Getting the remote id for nodes that don't have them should return the |
| 375 // empty string. | 376 // empty string. |
| 376 const BookmarkNode* existing_node = | 377 const BookmarkNode* existing_node = |
| 377 bookmark_model_->AddURL(bookmark_model_->other_node(), | 378 bookmark_model_->AddURL(bookmark_model_->other_node(), |
| 378 0, | 379 0, |
| 379 base::ASCIIToUTF16("Title"), | 380 base::ASCIIToUTF16("Title"), |
| 380 GURL(GURL(BOOKMARK_URL))); | 381 GURL(GURL(BOOKMARK_URL))); |
| 381 EXPECT_TRUE(model_->GetRemoteId(existing_node).empty()); | 382 EXPECT_TRUE(model_->GetRemoteId(existing_node).empty()); |
| 382 | 383 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 EXPECT_FALSE(model_->GetOriginalImage(node, &url, &width, &height)); | 709 EXPECT_FALSE(model_->GetOriginalImage(node, &url, &width, &height)); |
| 709 EXPECT_FALSE(model_->GetThumbnailImage(node, &url, &width, &height)); | 710 EXPECT_FALSE(model_->GetThumbnailImage(node, &url, &width, &height)); |
| 710 | 711 |
| 711 std::string meta_info = GetMetaInfoField(node, "stars.imageData"); | 712 std::string meta_info = GetMetaInfoField(node, "stars.imageData"); |
| 712 std::string decoded; | 713 std::string decoded; |
| 713 ASSERT_TRUE(base::Base64Decode(meta_info, &decoded)); | 714 ASSERT_TRUE(base::Base64Decode(meta_info, &decoded)); |
| 714 image::collections::ImageData data; | 715 image::collections::ImageData data; |
| 715 ASSERT_TRUE(data.ParseFromString(decoded)); | 716 ASSERT_TRUE(data.ParseFromString(decoded)); |
| 716 EXPECT_TRUE(data.user_removed_image()); | 717 EXPECT_TRUE(data.user_removed_image()); |
| 717 } | 718 } |
| OLD | NEW |