Chromium Code Reviews| 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> _menuWrangler; | |
|
Eugene But (OOO till 7-30)
2016/05/13 01:23:56
s/_menuWrangler/menu_wrangler_
michaeldo
2016/05/17 18:03:03
Done.
| |
| 25 base::scoped_nsobject<UIWindow> _window; | |
|
Eugene But (OOO till 7-30)
2016/05/13 01:23:56
s/_window/window_
michaeldo
2016/05/17 18:03:03
Done.
| |
| 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 _menuWrangler.reset( | |
| 34 [[ContextMenuWrangler alloc] initWithContextMenuParams:params]); | |
| 35 | |
| 36 [_menuWrangler addItemWithTitle:@"foo" action:nil]; | |
| 37 [_menuWrangler addItemWithTitle:@"bar" | |
| 38 action:^{ | |
| 39 }]; | |
| 40 | |
| 41 [_menuWrangler present]; | |
| 42 | |
| 43 EXPECT_TRUE([_menuWrangler isVisible]); | |
| 44 } | |
| OLD | NEW |