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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: comments Created 3 years, 8 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 14 #include "base/run_loop.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/sys_string_conversions.h" 17 #include "base/strings/sys_string_conversions.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
19 #include "chrome/browser/extensions/test_extension_system.h" 20 #include "chrome/browser/extensions/test_extension_system.h"
20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h"
21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h"
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 TEST_F(BookmarkBarControllerTest, ManagedShowAppsShortcutInBookmarksBar) { 1685 TEST_F(BookmarkBarControllerTest, ManagedShowAppsShortcutInBookmarksBar) {
1685 // By default the pref is not managed and the apps shortcut is shown. 1686 // By default the pref is not managed and the apps shortcut is shown.
1686 sync_preferences::TestingPrefServiceSyncable* prefs = 1687 sync_preferences::TestingPrefServiceSyncable* prefs =
1687 profile()->GetTestingPrefService(); 1688 profile()->GetTestingPrefService();
1688 EXPECT_FALSE(prefs->IsManagedPreference( 1689 EXPECT_FALSE(prefs->IsManagedPreference(
1689 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); 1690 bookmarks::prefs::kShowAppsShortcutInBookmarkBar));
1690 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]); 1691 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]);
1691 1692
1692 // Hide the apps shortcut by policy, via the managed pref. 1693 // Hide the apps shortcut by policy, via the managed pref.
1693 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 1694 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
1694 new base::Value(false)); 1695 base::MakeUnique<base::Value>(false));
1695 EXPECT_TRUE([bar_ appsPageShortcutButtonIsHidden]); 1696 EXPECT_TRUE([bar_ appsPageShortcutButtonIsHidden]);
1696 1697
1697 // And try showing it via policy too. 1698 // And try showing it via policy too.
1698 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 1699 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
1699 new base::Value(true)); 1700 base::MakeUnique<base::Value>(true));
1700 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]); 1701 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]);
1701 } 1702 }
1702 1703
1703 class BookmarkBarControllerOpenAllTest : public BookmarkBarControllerTest { 1704 class BookmarkBarControllerOpenAllTest : public BookmarkBarControllerTest {
1704 public: 1705 public:
1705 void SetUp() override { 1706 void SetUp() override {
1706 BookmarkBarControllerTest::SetUp(); 1707 BookmarkBarControllerTest::SetUp();
1707 ASSERT_TRUE(profile()); 1708 ASSERT_TRUE(profile());
1708 1709
1709 resizeDelegate_.reset([[ViewResizerPong alloc] init]); 1710 resizeDelegate_.reset([[ViewResizerPong alloc] init]);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 "2f3b ] 4b "); 2174 "2f3b ] 4b ");
2174 actual = bookmarks::test::ModelStringFromNode(root); 2175 actual = bookmarks::test::ModelStringFromNode(root);
2175 EXPECT_EQ(expected, actual); 2176 EXPECT_EQ(expected, actual);
2176 2177
2177 // Verify that the other bookmark folder can't be deleted. 2178 // Verify that the other bookmark folder can't be deleted.
2178 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; 2179 BookmarkButton *otherButton = [bar_ otherBookmarksButton];
2179 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); 2180 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]);
2180 } 2181 }
2181 2182
2182 } // namespace 2183 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698