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 "chrome/browser/bookmarks/chrome_bookmark_client.h" | 5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
13 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 13 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
14 #include "chrome/test/base/testing_pref_service_syncable.h" | 14 #include "chrome/test/base/testing_pref_service_syncable.h" |
15 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
16 #include "components/bookmarks/browser/bookmark_model.h" | 16 #include "components/bookmarks/browser/bookmark_model.h" |
17 #include "components/bookmarks/browser/bookmark_node.h" | 17 #include "components/bookmarks/browser/bookmark_node.h" |
18 #include "components/bookmarks/common/bookmark_pref_names.h" | 18 #include "components/bookmarks/common/bookmark_pref_names.h" |
19 #include "components/bookmarks/test/bookmark_test_helpers.h" | 19 #include "components/bookmarks/test/bookmark_test_helpers.h" |
20 #include "components/bookmarks/test/mock_bookmark_model_observer.h" | 20 #include "components/bookmarks/test/mock_bookmark_model_observer.h" |
21 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
22 #include "grit/components_strings.h" | 22 #include "grit/components_strings.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 | 26 |
27 using bookmarks::BookmarkModel; | 27 using bookmarks::BookmarkModel; |
| 28 using bookmarks::BookmarkNode; |
28 using testing::Mock; | 29 using testing::Mock; |
29 using testing::_; | 30 using testing::_; |
30 | 31 |
31 class ChromeBookmarkClientTest : public testing::Test { | 32 class ChromeBookmarkClientTest : public testing::Test { |
32 public: | 33 public: |
33 ChromeBookmarkClientTest() : client_(NULL), model_(NULL) {} | 34 ChromeBookmarkClientTest() : client_(NULL), model_(NULL) {} |
34 ~ChromeBookmarkClientTest() override {} | 35 ~ChromeBookmarkClientTest() override {} |
35 | 36 |
36 void SetUp() override { | 37 void SetUp() override { |
37 prefs_ = profile_.GetTestingPrefService(); | 38 prefs_ = profile_.GetTestingPrefService(); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 const BookmarkNode* managed_node = client_->managed_node()->GetChild(0); | 279 const BookmarkNode* managed_node = client_->managed_node()->GetChild(0); |
279 ASSERT_TRUE(managed_node); | 280 ASSERT_TRUE(managed_node); |
280 | 281 |
281 std::vector<const BookmarkNode*> nodes; | 282 std::vector<const BookmarkNode*> nodes; |
282 EXPECT_FALSE(client_->HasDescendantsOfManagedNode(nodes)); | 283 EXPECT_FALSE(client_->HasDescendantsOfManagedNode(nodes)); |
283 nodes.push_back(user_node); | 284 nodes.push_back(user_node); |
284 EXPECT_FALSE(client_->HasDescendantsOfManagedNode(nodes)); | 285 EXPECT_FALSE(client_->HasDescendantsOfManagedNode(nodes)); |
285 nodes.push_back(managed_node); | 286 nodes.push_back(managed_node); |
286 EXPECT_TRUE(client_->HasDescendantsOfManagedNode(nodes)); | 287 EXPECT_TRUE(client_->HasDescendantsOfManagedNode(nodes)); |
287 } | 288 } |
OLD | NEW |