| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/context_menu/context_menu_wrangler.h" |
| 6 |
| 7 #import <UIKit/UIKit.h> |
| 8 |
| 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "ios/web/public/web_state/context_menu_params.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" |
| 13 |
| 14 // Fixture to test ContextMenuWrangler. |
| 15 class ContextMenuWranglerTest : public PlatformTest { |
| 16 public: |
| 17 ContextMenuWranglerTest() { |
| 18 window_.reset( |
| 19 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]); |
| 20 [window_ makeKeyAndVisible]; |
| 21 } |
| 22 |
| 23 protected: |
| 24 base::scoped_nsobject<ContextMenuWrangler> menu_wrangler_; |
| 25 base::scoped_nsobject<UIWindow> window_; |
| 26 }; |
| 27 |
| 28 // Tests the context menu reports as visible after presenting. |
| 29 TEST_F(ContextMenuWranglerTest, DisplayContextMenu) { |
| 30 web::ContextMenuParams params; |
| 31 params.location = CGPointZero; |
| 32 params.view.reset([window_ retain]); |
| 33 menu_wrangler_.reset( |
| 34 [[ContextMenuWrangler alloc] initWithContextMenuParams:params]); |
| 35 |
| 36 [menu_wrangler_ addItemWithTitle:@"foo" action:nil]; |
| 37 [menu_wrangler_ addItemWithTitle:@"bar" |
| 38 action:^{ |
| 39 }]; |
| 40 |
| 41 [menu_wrangler_ start]; |
| 42 |
| 43 EXPECT_TRUE([menu_wrangler_ isVisible]); |
| 44 } |
| OLD | NEW |