Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/bookmarks/managed_bookmark_service_unittest.cc

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/managed/managed_bookmark_service.h" 5 #include "components/bookmarks/managed/managed_bookmark_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
16 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 16 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
17 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
18 #include "components/bookmarks/browser/bookmark_model.h" 18 #include "components/bookmarks/browser/bookmark_model.h"
19 #include "components/bookmarks/browser/bookmark_node.h" 19 #include "components/bookmarks/browser/bookmark_node.h"
20 #include "components/bookmarks/browser/bookmark_utils.h" 20 #include "components/bookmarks/browser/bookmark_utils.h"
21 #include "components/bookmarks/common/bookmark_pref_names.h" 21 #include "components/bookmarks/common/bookmark_pref_names.h"
22 #include "components/bookmarks/test/bookmark_test_helpers.h" 22 #include "components/bookmarks/test/bookmark_test_helpers.h"
23 #include "components/bookmarks/test/mock_bookmark_model_observer.h" 23 #include "components/bookmarks/test/mock_bookmark_model_observer.h"
24 #include "components/strings/grit/components_strings.h" 24 #include "components/strings/grit/components_strings.h"
25 #include "components/syncable_prefs/testing_pref_service_syncable.h" 25 #include "components/sync_preferences/testing_pref_service_syncable.h"
26 #include "content/public/test/test_browser_thread_bundle.h" 26 #include "content/public/test/test_browser_thread_bundle.h"
27 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 30
31 using bookmarks::BookmarkModel; 31 using bookmarks::BookmarkModel;
32 using bookmarks::BookmarkNode; 32 using bookmarks::BookmarkNode;
33 using bookmarks::ManagedBookmarkService; 33 using bookmarks::ManagedBookmarkService;
34 using testing::Mock; 34 using testing::Mock;
35 using testing::_; 35 using testing::_;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (!dict->GetString("url", &url) || node->url() != GURL(url)) 129 if (!dict->GetString("url", &url) || node->url() != GURL(url))
130 return false; 130 return false;
131 } else { 131 } else {
132 return false; 132 return false;
133 } 133 }
134 return true; 134 return true;
135 } 135 }
136 136
137 content::TestBrowserThreadBundle thread_bundle_; 137 content::TestBrowserThreadBundle thread_bundle_;
138 TestingProfile profile_; 138 TestingProfile profile_;
139 syncable_prefs::TestingPrefServiceSyncable* prefs_; 139 sync_preferences::TestingPrefServiceSyncable* prefs_;
140 bookmarks::MockBookmarkModelObserver observer_; 140 bookmarks::MockBookmarkModelObserver observer_;
141 ManagedBookmarkService* managed_; 141 ManagedBookmarkService* managed_;
142 BookmarkModel* model_; 142 BookmarkModel* model_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(ManagedBookmarkServiceTest); 144 DISALLOW_COPY_AND_ASSIGN(ManagedBookmarkServiceTest);
145 }; 145 };
146 146
147 TEST_F(ManagedBookmarkServiceTest, EmptyManagedNode) { 147 TEST_F(ManagedBookmarkServiceTest, EmptyManagedNode) {
148 // Verifies that the managed node is empty and invisible when the policy is 148 // Verifies that the managed node is empty and invisible when the policy is
149 // not set. 149 // not set.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 const BookmarkNode* managed_node = managed_->managed_node()->GetChild(0); 290 const BookmarkNode* managed_node = managed_->managed_node()->GetChild(0);
291 ASSERT_TRUE(managed_node); 291 ASSERT_TRUE(managed_node);
292 292
293 std::vector<const BookmarkNode*> nodes; 293 std::vector<const BookmarkNode*> nodes;
294 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); 294 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node()));
295 nodes.push_back(user_node); 295 nodes.push_back(user_node);
296 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); 296 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node()));
297 nodes.push_back(managed_node); 297 nodes.push_back(managed_node);
298 EXPECT_TRUE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); 298 EXPECT_TRUE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node()));
299 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698