| 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..b24f8edbb82deed41217404a753e703aebc32213
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ui/context_menu/context_menu_wrangler_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_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"
|
| +
|
| +// Fixture to test ContextMenuWrangler.
|
| +class ContextMenuWranglerTest : public PlatformTest {
|
| + public:
|
| + ContextMenuWranglerTest() {
|
| + window_.reset(
|
| + [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
|
| + [window_ makeKeyAndVisible];
|
| + }
|
| +
|
| + protected:
|
| + base::scoped_nsobject<ContextMenuWrangler> menu_wrangler_;
|
| + base::scoped_nsobject<UIWindow> window_;
|
| +};
|
| +
|
| +// Tests the context menu reports as visible after presenting.
|
| +TEST_F(ContextMenuWranglerTest, DisplayContextMenu) {
|
| + web::ContextMenuParams params;
|
| + params.location = CGPointZero;
|
| + params.view.reset([window_ retain]);
|
| + menu_wrangler_.reset(
|
| + [[ContextMenuWrangler alloc] initWithContextMenuParams:params]);
|
| +
|
| + [menu_wrangler_ addItemWithTitle:@"foo" action:nil];
|
| + [menu_wrangler_ addItemWithTitle:@"bar"
|
| + action:^{
|
| + }];
|
| +
|
| + [menu_wrangler_ start];
|
| +
|
| + EXPECT_TRUE([menu_wrangler_ isVisible]);
|
| +}
|
|
|