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/bookmarks/browser/bookmark_node_data.h" | 5 #include "components/bookmarks/browser/bookmark_node_data.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "components/bookmarks/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
14 #include "components/bookmarks/test/bookmark_test_helpers.h" | 15 #include "components/bookmarks/test/bookmark_test_helpers.h" |
15 #include "components/bookmarks/test/test_bookmark_client.h" | 16 #include "components/bookmarks/test/test_bookmark_client.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/base/dragdrop/os_exchange_data.h" | 19 #include "ui/base/dragdrop/os_exchange_data.h" |
19 #include "ui/events/platform/platform_event_source.h" | 20 #include "ui/events/platform/platform_event_source.h" |
(...skipping 25 matching lines...) Expand all Loading... |
45 | 46 |
46 const base::FilePath& GetProfilePath() const { return profile_dir_.path(); } | 47 const base::FilePath& GetProfilePath() const { return profile_dir_.path(); } |
47 | 48 |
48 BookmarkModel* model() { return model_.get(); } | 49 BookmarkModel* model() { return model_.get(); } |
49 | 50 |
50 protected: | 51 protected: |
51 ui::Clipboard& clipboard() { return *ui::Clipboard::GetForCurrentThread(); } | 52 ui::Clipboard& clipboard() { return *ui::Clipboard::GetForCurrentThread(); } |
52 | 53 |
53 private: | 54 private: |
54 base::ScopedTempDir profile_dir_; | 55 base::ScopedTempDir profile_dir_; |
55 scoped_ptr<BookmarkModel> model_; | 56 std::unique_ptr<BookmarkModel> model_; |
56 scoped_ptr<ui::PlatformEventSource> event_source_; | 57 std::unique_ptr<ui::PlatformEventSource> event_source_; |
57 base::MessageLoopForUI loop_; | 58 base::MessageLoopForUI loop_; |
58 | 59 |
59 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); | 60 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); |
60 }; | 61 }; |
61 | 62 |
62 namespace { | 63 namespace { |
63 | 64 |
64 ui::OSExchangeData::Provider* CloneProvider(const ui::OSExchangeData& data) { | 65 ui::OSExchangeData::Provider* CloneProvider(const ui::OSExchangeData& data) { |
65 return data.provider().Clone(); | 66 return data.provider().Clone(); |
66 } | 67 } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 ASSERT_EQ(1u, read_data.size()); | 398 ASSERT_EQ(1u, read_data.size()); |
398 | 399 |
399 // Verify that the read data contains the same meta info. | 400 // Verify that the read data contains the same meta info. |
400 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; | 401 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; |
401 EXPECT_EQ(2u, meta_info_map.size()); | 402 EXPECT_EQ(2u, meta_info_map.size()); |
402 EXPECT_EQ("somevalue", meta_info_map["somekey"]); | 403 EXPECT_EQ("somevalue", meta_info_map["somekey"]); |
403 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); | 404 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); |
404 } | 405 } |
405 | 406 |
406 } // namespace bookmarks | 407 } // namespace bookmarks |
OLD | NEW |