Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm

Issue 1972013003: Add ContextMenuCoordinator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename ContextMenuWrangler to coordinator. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/context_menu/context_menu_coordinator.mm ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
diff --git a/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm b/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e81f2e106b2046d038cc7d1b6ac03268d18394cf
--- /dev/null
+++ b/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
@@ -0,0 +1,44 @@
+// 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_coordinator.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"
+
+// Fixture to test ContextMenuCoordinator.
+class ContextMenuCoordinatorTest : public PlatformTest {
+ public:
+ ContextMenuCoordinatorTest() {
+ window_.reset(
+ [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
+ [window_ makeKeyAndVisible];
+ }
+
+ protected:
+ base::scoped_nsobject<ContextMenuCoordinator> menu_coordinator_;
+ base::scoped_nsobject<UIWindow> window_;
+};
+
+// Tests the context menu reports as visible after presenting.
+TEST_F(ContextMenuCoordinatorTest, DisplayContextMenu) {
+ web::ContextMenuParams params;
+ params.location = CGPointZero;
+ params.view.reset([window_ retain]);
+ menu_coordinator_.reset(
+ [[ContextMenuCoordinator alloc] initWithContextMenuParams:params]);
Eugene But (OOO till 7-30) 2016/05/19 19:00:06 initWithViewController: ?
michaeldo 2016/05/20 16:34:24 This didn't get updated before. Fixed now with imp
+
+ [menu_coordinator_ addItemWithTitle:@"foo" action:nil];
+ [menu_coordinator_ addItemWithTitle:@"bar"
+ action:^{
Jackie Quinn 2016/05/19 15:39:28 Why one nil action and one ^{} action? Also, would
michaeldo 2016/05/19 15:57:30 The nil vs block (even though it's empty) are simp
Eugene But (OOO till 7-30) 2016/05/19 19:00:06 Now when your class takes view controller you can
michaeldo 2016/05/20 16:34:24 You're definitely right, I've improved the unittes
+ }];
+
+ [menu_coordinator_ start];
+
+ EXPECT_TRUE([menu_coordinator_ isVisible]);
+}
« no previous file with comments | « ios/chrome/browser/ui/context_menu/context_menu_coordinator.mm ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698