Index: ios/chrome/browser/ui/context_menu/context_menu_wrangler_unittest.mm |
diff --git a/ios/chrome/browser/ui/context_menu/context_menu_wrangler_unittest.mm b/ios/chrome/browser/ui/context_menu/context_menu_wrangler_unittest.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..639e52a2339d3c50380388e28ba1aeb0fa610b52 |
--- /dev/null |
+++ b/ios/chrome/browser/ui/context_menu/context_menu_wrangler_unittest.mm |
@@ -0,0 +1,46 @@ |
+// Copyright 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/chrome/browser/ui/context_menu/context_menu_wrangler.h" |
+ |
+#import <UIKit/UIKit.h> |
+ |
+#include "base/mac/scoped_nsobject.h" |
+#import "ios/web/public/web_state/context_menu_params.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "testing/platform_test.h" |
+ |
+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.
|
+ |
+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.
|
+ public: |
+ ContextMenuWranglerTest() { |
+ _window.reset( |
+ [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]); |
+ [_window makeKeyAndVisible]; |
+ } |
+ |
+ protected: |
+ base::scoped_nsobject<ContextMenuWrangler> _menuWrangler; |
+ base::scoped_nsobject<UIWindow> _window; |
+}; |
+ |
+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.
|
+ web::ContextMenuParams params; |
+ params.location = CGPointZero; |
+ params.view.reset([_window retain]); |
+ _menuWrangler.reset( |
+ [[ContextMenuWrangler alloc] initWithContextMenuParams:params]); |
+ |
+ [_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.
|
+ [_menuWrangler appendItemWithTitle:@"bar" |
+ action:^{ |
+ }]; |
+ |
+ [_menuWrangler present]; |
+ |
+ EXPECT_TRUE([_menuWrangler isVisible]); |
+} |
+ |
+} // namespace |