| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/bookmarks/browser/bookmark_model.h" | 11 #include "components/bookmarks/browser/bookmark_model.h" |
| 12 #include "components/bookmarks/browser/bookmark_node_data.h" | 12 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 13 #include "components/bookmarks/test/bookmark_test_helpers.h" | 13 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 14 #include "components/bookmarks/test/test_bookmark_client.h" | 14 #include "components/bookmarks/test/test_bookmark_client.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
| 17 #include "ui/base/dragdrop/os_exchange_data.h" | 17 #include "ui/base/dragdrop/os_exchange_data.h" |
| 18 #include "ui/events/platform/platform_event_source.h" | 18 #include "ui/events/platform/platform_event_source.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 using base::ASCIIToUTF16; | 21 using base::ASCIIToUTF16; |
| 22 | 22 |
| 23 namespace bookmarks { | 23 namespace bookmarks { |
| 24 | 24 |
| 25 class BookmarkNodeDataTest : public testing::Test { | 25 class BookmarkNodeDataTest : public testing::Test { |
| 26 public: | 26 public: |
| 27 BookmarkNodeDataTest() {} | 27 BookmarkNodeDataTest() {} |
| 28 | 28 |
| 29 virtual void SetUp() override { | 29 void SetUp() override { |
| 30 event_source_ = ui::PlatformEventSource::CreateDefault(); | 30 event_source_ = ui::PlatformEventSource::CreateDefault(); |
| 31 model_ = client_.CreateModel(); | 31 model_ = client_.CreateModel(); |
| 32 test::WaitForBookmarkModelToLoad(model_.get()); | 32 test::WaitForBookmarkModelToLoad(model_.get()); |
| 33 bool success = profile_dir_.CreateUniqueTempDir(); | 33 bool success = profile_dir_.CreateUniqueTempDir(); |
| 34 ASSERT_TRUE(success); | 34 ASSERT_TRUE(success); |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual void TearDown() override { | 37 void TearDown() override { |
| 38 model_.reset(); | 38 model_.reset(); |
| 39 event_source_.reset(); | 39 event_source_.reset(); |
| 40 bool success = profile_dir_.Delete(); | 40 bool success = profile_dir_.Delete(); |
| 41 ASSERT_TRUE(success); | 41 ASSERT_TRUE(success); |
| 42 ui::Clipboard::DestroyClipboardForCurrentThread(); | 42 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 const base::FilePath& GetProfilePath() const { return profile_dir_.path(); } | 45 const base::FilePath& GetProfilePath() const { return profile_dir_.path(); } |
| 46 | 46 |
| 47 BookmarkModel* model() { return model_.get(); } | 47 BookmarkModel* model() { return model_.get(); } |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 ASSERT_EQ(1u, read_data.elements.size()); | 397 ASSERT_EQ(1u, read_data.elements.size()); |
| 398 | 398 |
| 399 // Verify that the read data contains the same meta info. | 399 // Verify that the read data contains the same meta info. |
| 400 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; | 400 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; |
| 401 EXPECT_EQ(2u, meta_info_map.size()); | 401 EXPECT_EQ(2u, meta_info_map.size()); |
| 402 EXPECT_EQ("somevalue", meta_info_map["somekey"]); | 402 EXPECT_EQ("somevalue", meta_info_map["somekey"]); |
| 403 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); | 403 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace bookmarks | 406 } // namespace bookmarks |
| OLD | NEW |