OLD | NEW |
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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
27 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 27 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
28 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 28 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/test/base/testing_profile.h" | 30 #include "chrome/test/base/testing_profile.h" |
31 #include "components/bookmarks/browser/bookmark_model.h" | 31 #include "components/bookmarks/browser/bookmark_model.h" |
32 #include "components/bookmarks/browser/bookmark_utils.h" | 32 #include "components/bookmarks/browser/bookmark_utils.h" |
33 #include "components/bookmarks/common/bookmark_pref_names.h" | 33 #include "components/bookmarks/common/bookmark_pref_names.h" |
34 #include "components/bookmarks/test/bookmark_test_helpers.h" | 34 #include "components/bookmarks/test/bookmark_test_helpers.h" |
35 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 35 #include "components/sync_preferences/testing_pref_service_syncable.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
37 #import "testing/gtest_mac.h" | 37 #import "testing/gtest_mac.h" |
38 #include "testing/platform_test.h" | 38 #include "testing/platform_test.h" |
39 #import "third_party/ocmock/OCMock/OCMock.h" | 39 #import "third_party/ocmock/OCMock/OCMock.h" |
40 #include "third_party/ocmock/gtest_support.h" | 40 #include "third_party/ocmock/gtest_support.h" |
41 #include "ui/base/cocoa/animation_utils.h" | 41 #include "ui/base/cocoa/animation_utils.h" |
42 #include "ui/base/material_design/material_design_controller.h" | 42 #include "ui/base/material_design/material_design_controller.h" |
43 #include "ui/base/theme_provider.h" | 43 #include "ui/base/theme_provider.h" |
44 #include "ui/events/test/cocoa_test_event_utils.h" | 44 #include "ui/events/test/cocoa_test_event_utils.h" |
45 #include "ui/gfx/color_utils.h" | 45 #include "ui/gfx/color_utils.h" |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 bookmarks::prefs::kShowAppsShortcutInBookmarkBar, false); | 1683 bookmarks::prefs::kShowAppsShortcutInBookmarkBar, false); |
1684 ASSERT_TRUE([bar_ appsPageShortcutButtonIsHidden]); | 1684 ASSERT_TRUE([bar_ appsPageShortcutButtonIsHidden]); |
1685 EXPECT_GT(apps_button_right, | 1685 EXPECT_GT(apps_button_right, |
1686 NSMinX([[[bar_ buttonView] noItemTextfield] frame])); | 1686 NSMinX([[[bar_ buttonView] noItemTextfield] frame])); |
1687 EXPECT_LE(NSMaxX([[[bar_ buttonView] noItemTextfield] frame]), | 1687 EXPECT_LE(NSMaxX([[[bar_ buttonView] noItemTextfield] frame]), |
1688 NSMinX([[[bar_ buttonView] importBookmarksButton] frame])); | 1688 NSMinX([[[bar_ buttonView] importBookmarksButton] frame])); |
1689 } | 1689 } |
1690 | 1690 |
1691 TEST_F(BookmarkBarControllerTest, ManagedShowAppsShortcutInBookmarksBar) { | 1691 TEST_F(BookmarkBarControllerTest, ManagedShowAppsShortcutInBookmarksBar) { |
1692 // By default the pref is not managed and the apps shortcut is shown. | 1692 // By default the pref is not managed and the apps shortcut is shown. |
1693 syncable_prefs::TestingPrefServiceSyncable* prefs = | 1693 sync_preferences::TestingPrefServiceSyncable* prefs = |
1694 profile()->GetTestingPrefService(); | 1694 profile()->GetTestingPrefService(); |
1695 EXPECT_FALSE(prefs->IsManagedPreference( | 1695 EXPECT_FALSE(prefs->IsManagedPreference( |
1696 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); | 1696 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); |
1697 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]); | 1697 EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]); |
1698 | 1698 |
1699 // Hide the apps shortcut by policy, via the managed pref. | 1699 // Hide the apps shortcut by policy, via the managed pref. |
1700 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, | 1700 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
1701 new base::FundamentalValue(false)); | 1701 new base::FundamentalValue(false)); |
1702 EXPECT_TRUE([bar_ appsPageShortcutButtonIsHidden]); | 1702 EXPECT_TRUE([bar_ appsPageShortcutButtonIsHidden]); |
1703 | 1703 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 "2f3b ] 4b "); | 2180 "2f3b ] 4b "); |
2181 actual = bookmarks::test::ModelStringFromNode(root); | 2181 actual = bookmarks::test::ModelStringFromNode(root); |
2182 EXPECT_EQ(expected, actual); | 2182 EXPECT_EQ(expected, actual); |
2183 | 2183 |
2184 // Verify that the other bookmark folder can't be deleted. | 2184 // Verify that the other bookmark folder can't be deleted. |
2185 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2185 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
2186 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2186 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
2187 } | 2187 } |
2188 | 2188 |
2189 } // namespace | 2189 } // namespace |
OLD | NEW |