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_utils.h" | 5 #include "components/bookmarks/browser/bookmark_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 ExpectGroupedChangeCount(1, 1); | 308 ExpectGroupedChangeCount(1, 1); |
309 | 309 |
310 // And make sure we can paste from the clipboard. | 310 // And make sure we can paste from the clipboard. |
311 EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->other_node())); | 311 EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->other_node())); |
312 } | 312 } |
313 | 313 |
314 TEST_F(BookmarkUtilsTest, PasteNonEditableNodes) { | 314 TEST_F(BookmarkUtilsTest, PasteNonEditableNodes) { |
315 test::TestBookmarkClient client; | 315 test::TestBookmarkClient client; |
316 // Load a model with an extra node that is not editable. | 316 // Load a model with an extra node that is not editable. |
317 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); | 317 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); |
318 bookmarks::BookmarkPermanentNodeList extra_nodes; | 318 BookmarkPermanentNodeList extra_nodes; |
319 extra_nodes.push_back(extra_node); | 319 extra_nodes.push_back(extra_node); |
320 client.SetExtraNodesToLoad(extra_nodes.Pass()); | 320 client.SetExtraNodesToLoad(extra_nodes.Pass()); |
321 | 321 |
322 scoped_ptr<BookmarkModel> model(client.CreateModel(false)); | 322 scoped_ptr<BookmarkModel> model(client.CreateModel(false)); |
323 const BookmarkNode* node = model->AddURL(model->other_node(), | 323 const BookmarkNode* node = model->AddURL(model->other_node(), |
324 0, | 324 0, |
325 ASCIIToUTF16("foo bar"), | 325 ASCIIToUTF16("foo bar"), |
326 GURL("http://www.google.com")); | 326 GURL("http://www.google.com")); |
327 | 327 |
328 // Copy a node to the clipboard. | 328 // Copy a node to the clipboard. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 EXPECT_TRUE(clone->GetMetaInfo("somekey", &value)); | 411 EXPECT_TRUE(clone->GetMetaInfo("somekey", &value)); |
412 EXPECT_EQ("somevalue", value); | 412 EXPECT_EQ("somevalue", value); |
413 EXPECT_TRUE(clone->GetMetaInfo("someotherkey", &value)); | 413 EXPECT_TRUE(clone->GetMetaInfo("someotherkey", &value)); |
414 EXPECT_EQ("someothervalue", value); | 414 EXPECT_EQ("someothervalue", value); |
415 } | 415 } |
416 | 416 |
417 TEST_F(BookmarkUtilsTest, RemoveAllBookmarks) { | 417 TEST_F(BookmarkUtilsTest, RemoveAllBookmarks) { |
418 test::TestBookmarkClient client; | 418 test::TestBookmarkClient client; |
419 // Load a model with an extra node that is not editable. | 419 // Load a model with an extra node that is not editable. |
420 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); | 420 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); |
421 bookmarks::BookmarkPermanentNodeList extra_nodes; | 421 BookmarkPermanentNodeList extra_nodes; |
422 extra_nodes.push_back(extra_node); | 422 extra_nodes.push_back(extra_node); |
423 client.SetExtraNodesToLoad(extra_nodes.Pass()); | 423 client.SetExtraNodesToLoad(extra_nodes.Pass()); |
424 | 424 |
425 scoped_ptr<BookmarkModel> model(client.CreateModel(false)); | 425 scoped_ptr<BookmarkModel> model(client.CreateModel(false)); |
426 EXPECT_TRUE(model->bookmark_bar_node()->empty()); | 426 EXPECT_TRUE(model->bookmark_bar_node()->empty()); |
427 EXPECT_TRUE(model->other_node()->empty()); | 427 EXPECT_TRUE(model->other_node()->empty()); |
428 EXPECT_TRUE(model->mobile_node()->empty()); | 428 EXPECT_TRUE(model->mobile_node()->empty()); |
429 EXPECT_TRUE(extra_node->empty()); | 429 EXPECT_TRUE(extra_node->empty()); |
430 | 430 |
431 const base::string16 title = base::ASCIIToUTF16("Title"); | 431 const base::string16 title = base::ASCIIToUTF16("Title"); |
(...skipping 13 matching lines...) Expand all Loading... |
445 model->GetNodesByURL(url, &nodes); | 445 model->GetNodesByURL(url, &nodes); |
446 ASSERT_EQ(1u, nodes.size()); | 446 ASSERT_EQ(1u, nodes.size()); |
447 EXPECT_TRUE(model->bookmark_bar_node()->empty()); | 447 EXPECT_TRUE(model->bookmark_bar_node()->empty()); |
448 EXPECT_TRUE(model->other_node()->empty()); | 448 EXPECT_TRUE(model->other_node()->empty()); |
449 EXPECT_TRUE(model->mobile_node()->empty()); | 449 EXPECT_TRUE(model->mobile_node()->empty()); |
450 EXPECT_EQ(1, extra_node->child_count()); | 450 EXPECT_EQ(1, extra_node->child_count()); |
451 } | 451 } |
452 | 452 |
453 } // namespace | 453 } // namespace |
454 } // namespace bookmarks | 454 } // namespace bookmarks |
OLD | NEW |