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" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 EXPECT_TRUE(read_data.elements[0].date_folder_modified.is_null()); | 119 EXPECT_TRUE(read_data.elements[0].date_folder_modified.is_null()); |
120 EXPECT_TRUE(read_data.GetFirstNode(profile()) == node); | 120 EXPECT_TRUE(read_data.GetFirstNode(profile()) == node); |
121 | 121 |
122 // Make sure asking for the node with a different profile returns NULL. | 122 // Make sure asking for the node with a different profile returns NULL. |
123 TestingProfile profile2; | 123 TestingProfile profile2; |
124 EXPECT_TRUE(read_data.GetFirstNode(&profile2) == NULL); | 124 EXPECT_TRUE(read_data.GetFirstNode(&profile2) == NULL); |
125 | 125 |
126 // Writing should also put the URL and title on the clipboard. | 126 // Writing should also put the URL and title on the clipboard. |
127 GURL read_url; | 127 GURL read_url; |
128 base::string16 read_title; | 128 base::string16 read_title; |
129 EXPECT_TRUE(data2.GetURLAndTitle(&read_url, &read_title)); | 129 EXPECT_TRUE(data2.GetURLAndTitle( |
| 130 ui::OSExchangeData::CONVERT_FILENAMES, &read_url, &read_title)); |
130 EXPECT_EQ(url, read_url); | 131 EXPECT_EQ(url, read_url); |
131 EXPECT_EQ(title, read_title); | 132 EXPECT_EQ(title, read_title); |
132 } | 133 } |
133 | 134 |
134 // Tests writing a folder to the clipboard. | 135 // Tests writing a folder to the clipboard. |
135 TEST_F(BookmarkNodeDataTest, Folder) { | 136 TEST_F(BookmarkNodeDataTest, Folder) { |
136 const BookmarkNode* root = model()->bookmark_bar_node(); | 137 const BookmarkNode* root = model()->bookmark_bar_node(); |
137 const BookmarkNode* g1 = model()->AddFolder(root, 0, ASCIIToUTF16("g1")); | 138 const BookmarkNode* g1 = model()->AddFolder(root, 0, ASCIIToUTF16("g1")); |
138 model()->AddFolder(g1, 0, ASCIIToUTF16("g11")); | 139 model()->AddFolder(g1, 0, ASCIIToUTF16("g11")); |
139 const BookmarkNode* g12 = model()->AddFolder(g1, 0, ASCIIToUTF16("g12")); | 140 const BookmarkNode* g12 = model()->AddFolder(g1, 0, ASCIIToUTF16("g12")); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 EXPECT_TRUE(read_data.Read(data2)); | 276 EXPECT_TRUE(read_data.Read(data2)); |
276 EXPECT_TRUE(read_data.is_valid()); | 277 EXPECT_TRUE(read_data.is_valid()); |
277 ASSERT_EQ(1u, read_data.elements.size()); | 278 ASSERT_EQ(1u, read_data.elements.size()); |
278 | 279 |
279 // Verify that the read data contains the same meta info. | 280 // Verify that the read data contains the same meta info. |
280 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; | 281 BookmarkNode::MetaInfoMap meta_info_map = read_data.elements[0].meta_info_map; |
281 EXPECT_EQ(2u, meta_info_map.size()); | 282 EXPECT_EQ(2u, meta_info_map.size()); |
282 EXPECT_EQ("somevalue", meta_info_map["somekey"]); | 283 EXPECT_EQ("somevalue", meta_info_map["somekey"]); |
283 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); | 284 EXPECT_EQ("someothervalue", meta_info_map["someotherkey"]); |
284 } | 285 } |
OLD | NEW |