| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace bookmarks { | 22 namespace bookmarks { |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class BookmarkUtilsTest : public testing::Test, | 25 class BookmarkUtilsTest : public testing::Test, |
| 26 public BaseBookmarkModelObserver { | 26 public BaseBookmarkModelObserver { |
| 27 public: | 27 public: |
| 28 BookmarkUtilsTest() | 28 BookmarkUtilsTest() |
| 29 : grouped_changes_beginning_count_(0), | 29 : grouped_changes_beginning_count_(0), |
| 30 grouped_changes_ended_count_(0) {} | 30 grouped_changes_ended_count_(0) {} |
| 31 virtual ~BookmarkUtilsTest() {} | 31 ~BookmarkUtilsTest() override {} |
| 32 | 32 |
| 33 // Copy and paste is not yet supported on iOS. http://crbug.com/228147 | 33 // Copy and paste is not yet supported on iOS. http://crbug.com/228147 |
| 34 #if !defined(OS_IOS) | 34 #if !defined(OS_IOS) |
| 35 virtual void TearDown() override { | 35 void TearDown() override { |
| 36 ui::Clipboard::DestroyClipboardForCurrentThread(); | 36 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 37 } | 37 } |
| 38 #endif // !defined(OS_IOS) | 38 #endif // !defined(OS_IOS) |
| 39 | 39 |
| 40 // Certain user actions require multiple changes to the bookmark model, | 40 // Certain user actions require multiple changes to the bookmark model, |
| 41 // however these modifications need to be atomic for the undo framework. The | 41 // however these modifications need to be atomic for the undo framework. The |
| 42 // BaseBookmarkModelObserver is used to inform the boundaries of the user | 42 // BaseBookmarkModelObserver is used to inform the boundaries of the user |
| 43 // action. For example, when multiple bookmarks are cut to the clipboard we | 43 // action. For example, when multiple bookmarks are cut to the clipboard we |
| 44 // expect one call each to GroupedBookmarkChangesBeginning/Ended. | 44 // expect one call each to GroupedBookmarkChangesBeginning/Ended. |
| 45 void ExpectGroupedChangeCount(int expected_beginning_count, | 45 void ExpectGroupedChangeCount(int expected_beginning_count, |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 model->GetNodesByURL(url, &nodes); | 553 model->GetNodesByURL(url, &nodes); |
| 554 ASSERT_EQ(1u, nodes.size()); | 554 ASSERT_EQ(1u, nodes.size()); |
| 555 EXPECT_TRUE(model->bookmark_bar_node()->empty()); | 555 EXPECT_TRUE(model->bookmark_bar_node()->empty()); |
| 556 EXPECT_TRUE(model->other_node()->empty()); | 556 EXPECT_TRUE(model->other_node()->empty()); |
| 557 EXPECT_TRUE(model->mobile_node()->empty()); | 557 EXPECT_TRUE(model->mobile_node()->empty()); |
| 558 EXPECT_EQ(1, extra_node->child_count()); | 558 EXPECT_EQ(1, extra_node->child_count()); |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace | 561 } // namespace |
| 562 } // namespace bookmarks | 562 } // namespace bookmarks |
| OLD | NEW |