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