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/policy/core/browser/managed_bookmarks_tracker.h" | 5 #include "components/policy/core/browser/managed_bookmarks_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/testing_pref_service.h" | 12 #include "base/prefs/testing_pref_service.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "components/bookmarks/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
15 #include "components/bookmarks/browser/bookmark_model_observer.h" | 15 #include "components/bookmarks/browser/bookmark_model_observer.h" |
16 #include "components/bookmarks/browser/bookmark_node.h" | 16 #include "components/bookmarks/browser/bookmark_node.h" |
17 #include "components/bookmarks/common/bookmark_pref_names.h" | 17 #include "components/bookmarks/common/bookmark_pref_names.h" |
18 #include "components/bookmarks/test/bookmark_test_helpers.h" | 18 #include "components/bookmarks/test/bookmark_test_helpers.h" |
19 #include "components/bookmarks/test/mock_bookmark_model_observer.h" | 19 #include "components/bookmarks/test/mock_bookmark_model_observer.h" |
20 #include "components/bookmarks/test/test_bookmark_client.h" | 20 #include "components/bookmarks/test/test_bookmark_client.h" |
21 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 using bookmarks::BookmarkModel; | 27 using bookmarks::BookmarkModel; |
| 28 using bookmarks::BookmarkNode; |
| 29 using bookmarks::BookmarkPermanentNode; |
28 using testing::Mock; | 30 using testing::Mock; |
29 using testing::_; | 31 using testing::_; |
30 | 32 |
31 namespace policy { | 33 namespace policy { |
32 | 34 |
33 class ManagedBookmarksTrackerTest : public testing::Test { | 35 class ManagedBookmarksTrackerTest : public testing::Test { |
34 public: | 36 public: |
35 ManagedBookmarksTrackerTest() : managed_node_(NULL) {} | 37 ManagedBookmarksTrackerTest() : managed_node_(NULL) {} |
36 ~ManagedBookmarksTrackerTest() override {} | 38 ~ManagedBookmarksTrackerTest() override {} |
37 | 39 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 Mock::VerifyAndClearExpectations(&observer_); | 316 Mock::VerifyAndClearExpectations(&observer_); |
315 | 317 |
316 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); | 318 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); |
317 model_->RemoveAllUserBookmarks(); | 319 model_->RemoveAllUserBookmarks(); |
318 EXPECT_EQ(2, managed_node()->child_count()); | 320 EXPECT_EQ(2, managed_node()->child_count()); |
319 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); | 321 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); |
320 Mock::VerifyAndClearExpectations(&observer_); | 322 Mock::VerifyAndClearExpectations(&observer_); |
321 } | 323 } |
322 | 324 |
323 } // namespace policy | 325 } // namespace policy |
OLD | NEW |