OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/cocoa/renderer_context_menu/render_view_context_menu
_mac.h" | 5 #include "chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu
_mac.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 base::scoped_nsobject<NSTextField> textField_; | 46 base::scoped_nsobject<NSTextField> textField_; |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMacBrowserTest); | 49 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMacBrowserTest); |
50 }; | 50 }; |
51 | 51 |
52 // Confirm that the private classes used to filter Safari's redundant Services | 52 // Confirm that the private classes used to filter Safari's redundant Services |
53 // items exist and implement the expected methods, and that the filtering code | 53 // items exist and implement the expected methods, and that the filtering code |
54 // successfully removes those Services items. | 54 // successfully removes those Services items. |
55 IN_PROC_BROWSER_TEST_F(RenderViewContextMenuMacBrowserTest, ServicesFiltering) { | 55 IN_PROC_BROWSER_TEST_F(RenderViewContextMenuMacBrowserTest, ServicesFiltering) { |
56 // Services filtering does not work on Snow Leopard. | |
57 if (base::mac::IsOSSnowLeopard()) | |
58 return; | |
59 | |
60 // Confirm that the _NSServicesMenuUpdater class exists and implements the | 56 // Confirm that the _NSServicesMenuUpdater class exists and implements the |
61 // method we expect it to. | 57 // method we expect it to. |
62 Class menuUpdaterClass = NSClassFromString(@"_NSServicesMenuUpdater"); | 58 Class menuUpdaterClass = NSClassFromString(@"_NSServicesMenuUpdater"); |
63 EXPECT_TRUE(menuUpdaterClass); | 59 EXPECT_TRUE(menuUpdaterClass); |
64 EXPECT_TRUE([menuUpdaterClass instancesRespondToSelector: | 60 EXPECT_TRUE([menuUpdaterClass instancesRespondToSelector: |
65 @selector(populateMenu:withServiceEntries:forDisplay:)]); | 61 @selector(populateMenu:withServiceEntries:forDisplay:)]); |
66 | 62 |
67 // Confirm that the _NSServiceEntry class exists and implements the | 63 // Confirm that the _NSServiceEntry class exists and implements the |
68 // method we expect it to. | 64 // method we expect it to. |
69 Class serviceEntryClass = NSClassFromString(@"_NSServiceEntry"); | 65 Class serviceEntryClass = NSClassFromString(@"_NSServiceEntry"); |
(...skipping 28 matching lines...) Expand all Loading... |
98 [NSMenu popUpContextMenu:popupMenu | 94 [NSMenu popUpContextMenu:popupMenu |
99 withEvent:[NSApp currentEvent] | 95 withEvent:[NSApp currentEvent] |
100 forView:firstResponder]; | 96 forView:firstResponder]; |
101 | 97 |
102 // Confirm that Services items were removed from the contextual menu. This | 98 // Confirm that Services items were removed from the contextual menu. This |
103 // check was failing on the 10.10 bot, for some reason. Most-important is | 99 // check was failing on the 10.10 bot, for some reason. Most-important is |
104 // making sure it continues to work as OS X evolves. | 100 // making sure it continues to work as OS X evolves. |
105 if (base::mac::IsOSElCapitanOrLater()) | 101 if (base::mac::IsOSElCapitanOrLater()) |
106 EXPECT_LT(0LU, [filteredItems_ count]); | 102 EXPECT_LT(0LU, [filteredItems_ count]); |
107 } | 103 } |
OLD | NEW |