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 namespace { | |
|
Eugene But (OOO till 7-30)
2016/05/12 22:27:49
NIT: No need to put tests into anonymous namespace
michaeldo
2016/05/12 23:32:43
Done.
| |
| 15 | |
| 16 class ContextMenuWranglerTest : public PlatformTest { | |
|
Eugene But (OOO till 7-30)
2016/05/12 22:27:49
Needs comment
michaeldo
2016/05/12 23:32:43
Done.
| |
| 17 public: | |
| 18 ContextMenuWranglerTest() { | |
| 19 _window.reset( | |
| 20 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]); | |
| 21 [_window makeKeyAndVisible]; | |
| 22 } | |
| 23 | |
| 24 protected: | |
| 25 base::scoped_nsobject<ContextMenuWrangler> _menuWrangler; | |
| 26 base::scoped_nsobject<UIWindow> _window; | |
| 27 }; | |
| 28 | |
| 29 TEST_F(ContextMenuWranglerTest, DisplayContextMenu) { | |
|
Eugene But (OOO till 7-30)
2016/05/12 22:27:49
Every test needs comments
michaeldo
2016/05/12 23:32:43
Done.
| |
| 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 appendItemWithTitle:@"foo" action:NULL]; | |
|
Eugene But (OOO till 7-30)
2016/05/12 22:27:49
s/NULL/nil or nullptr
michaeldo
2016/05/12 23:32:43
Done.
| |
| 37 [_menuWrangler appendItemWithTitle:@"bar" | |
| 38 action:^{ | |
| 39 }]; | |
| 40 | |
| 41 [_menuWrangler present]; | |
| 42 | |
| 43 EXPECT_TRUE([_menuWrangler isVisible]); | |
| 44 } | |
| 45 | |
| 46 } // namespace | |
| OLD | NEW |