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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 // Copy a node to the clipboard. | 436 // Copy a node to the clipboard. |
437 std::vector<const BookmarkNode*> nodes; | 437 std::vector<const BookmarkNode*> nodes; |
438 nodes.push_back(node); | 438 nodes.push_back(node); |
439 CopyToClipboard(model.get(), nodes, false); | 439 CopyToClipboard(model.get(), nodes, false); |
440 | 440 |
441 // And make sure we can paste a bookmark from the clipboard. | 441 // And make sure we can paste a bookmark from the clipboard. |
442 EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->bookmark_bar_node())); | 442 EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->bookmark_bar_node())); |
443 | 443 |
444 // But it can't be pasted into a non-editable folder. | 444 // But it can't be pasted into a non-editable folder. |
445 BookmarkClient* upcast = &client; | 445 EXPECT_FALSE(model->CanBeEditedByUser(extra_node)); |
446 EXPECT_FALSE(upcast->CanBeEditedByUser(extra_node)); | |
447 EXPECT_FALSE(CanPasteFromClipboard(model.get(), extra_node)); | 446 EXPECT_FALSE(CanPasteFromClipboard(model.get(), extra_node)); |
448 } | 447 } |
449 #endif // !defined(OS_IOS) | 448 #endif // !defined(OS_IOS) |
450 | 449 |
451 TEST_F(BookmarkUtilsTest, GetParentForNewNodes) { | 450 TEST_F(BookmarkUtilsTest, GetParentForNewNodes) { |
452 TestBookmarkClient client; | 451 TestBookmarkClient client; |
453 scoped_ptr<BookmarkModel> model(client.CreateModel()); | 452 scoped_ptr<BookmarkModel> model(client.CreateModel()); |
454 // This tests the case where selection contains one item and that item is a | 453 // This tests the case where selection contains one item and that item is a |
455 // folder. | 454 // folder. |
456 std::vector<const BookmarkNode*> nodes; | 455 std::vector<const BookmarkNode*> nodes; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 model->GetNodesByURL(url, &nodes); | 603 model->GetNodesByURL(url, &nodes); |
605 ASSERT_EQ(1u, nodes.size()); | 604 ASSERT_EQ(1u, nodes.size()); |
606 EXPECT_TRUE(model->bookmark_bar_node()->empty()); | 605 EXPECT_TRUE(model->bookmark_bar_node()->empty()); |
607 EXPECT_TRUE(model->other_node()->empty()); | 606 EXPECT_TRUE(model->other_node()->empty()); |
608 EXPECT_TRUE(model->mobile_node()->empty()); | 607 EXPECT_TRUE(model->mobile_node()->empty()); |
609 EXPECT_EQ(1, extra_node->child_count()); | 608 EXPECT_EQ(1, extra_node->child_count()); |
610 } | 609 } |
611 | 610 |
612 } // namespace | 611 } // namespace |
613 } // namespace bookmarks | 612 } // namespace bookmarks |
OLD | NEW |