OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 12 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
13 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 13 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.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 "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 using base::ASCIIToUTF16; | 21 using base::ASCIIToUTF16; |
21 | 22 |
22 class BookmarkNodeDataTest : public testing::Test { | 23 class BookmarkNodeDataTest : public testing::Test { |
23 public: | 24 public: |
24 BookmarkNodeDataTest() : model_(NULL) {} | 25 BookmarkNodeDataTest() : model_(NULL) {} |
25 | 26 |
26 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() OVERRIDE { |
| 28 event_source_ = ui::PlatformEventSource::CreateDefault(); |
27 profile_.reset(new TestingProfile); | 29 profile_.reset(new TestingProfile); |
28 profile_->SetID(L"id"); | 30 profile_->SetID(L"id"); |
29 profile_->CreateBookmarkModel(false); | 31 profile_->CreateBookmarkModel(false); |
30 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 32 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
31 test::WaitForBookmarkModelToLoad(model_); | 33 test::WaitForBookmarkModelToLoad(model_); |
32 } | 34 } |
33 | 35 |
34 virtual void TearDown() OVERRIDE { | 36 virtual void TearDown() OVERRIDE { |
35 profile_.reset(); | 37 profile_.reset(); |
| 38 event_source_.reset(); |
36 } | 39 } |
37 | 40 |
38 Profile* profile() { return profile_.get(); } | 41 Profile* profile() { return profile_.get(); } |
39 | 42 |
40 BookmarkModel* model() { return model_; } | 43 BookmarkModel* model() { return model_; } |
41 | 44 |
42 private: | 45 private: |
43 content::TestBrowserThreadBundle thread_bundle_; | 46 content::TestBrowserThreadBundle thread_bundle_; |
44 scoped_ptr<TestingProfile> profile_; | 47 scoped_ptr<TestingProfile> profile_; |
45 BookmarkModel* model_; | 48 BookmarkModel* model_; |
| 49 scoped_ptr<ui::PlatformEventSource> event_source_; |
46 | 50 |
47 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); | 51 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); |
48 }; | 52 }; |
49 | 53 |
50 namespace { | 54 namespace { |
51 | 55 |
52 ui::OSExchangeData::Provider* CloneProvider(const ui::OSExchangeData& data) { | 56 ui::OSExchangeData::Provider* CloneProvider(const ui::OSExchangeData& data) { |
53 return data.provider().Clone(); | 57 return data.provider().Clone(); |
54 } | 58 } |
55 | 59 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 EXPECT_TRUE(read_data.Read(data2)); | 282 EXPECT_TRUE(read_data.Read(data2)); |
279 EXPECT_TRUE(read_data.is_valid()); | 283 EXPECT_TRUE(read_data.is_valid()); |
280 ASSERT_EQ(1u, read_data.elements.size()); | 284 ASSERT_EQ(1u, read_data.elements.size()); |
281 | 285 |
282 // Verify that the read data contains the same meta info. | 286 // Verify that the read data contains the same meta info. |
283 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; | 287 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; |
284 EXPECT_EQ(2u, meta_info_map.size()); | 288 EXPECT_EQ(2u, meta_info_map.size()); |
285 EXPECT_EQ("somevalue", meta_info_map["somekey"]); | 289 EXPECT_EQ("somevalue", meta_info_map["somekey"]); |
286 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); | 290 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); |
287 } | 291 } |
OLD | NEW |