| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 #import <XCTest/XCTest.h> | 8 #import <XCTest/XCTest.h> |
| 9 | 9 |
| 10 #import "base/ios/block_types.h" | 10 #import "base/ios/block_types.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #import "ios/testing/earl_grey/disabled_test_macros.h" | 12 #import "ios/testing/earl_grey/disabled_test_macros.h" |
| 13 #import "ios/testing/earl_grey/matchers.h" | 13 #import "ios/testing/earl_grey/matchers.h" |
| 14 #import "ios/web/public/test/http_server.h" | 14 #import "ios/web/public/test/http_server.h" |
| 15 #include "ios/web/public/test/http_server_util.h" | 15 #include "ios/web/public/test/http_server_util.h" |
| 16 #import "ios/web/public/test/web_view_interaction_test_util.h" | 16 #import "ios/web/public/test/web_view_interaction_test_util.h" |
| 17 #import "ios/web/shell/test/app/web_shell_test_util.h" | 17 #import "ios/web/shell/test/app/web_shell_test_util.h" |
| 18 #include "ios/web/shell/test/app/web_view_interaction_test_util.h" | 18 #include "ios/web/shell/test/app/web_view_interaction_test_util.h" |
| 19 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" | |
| 20 #import "ios/web/shell/test/earl_grey/shell_actions.h" | 19 #import "ios/web/shell/test/earl_grey/shell_actions.h" |
| 21 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" | 20 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" |
| 22 #import "ios/web/shell/test/earl_grey/shell_matchers.h" | 21 #import "ios/web/shell/test/earl_grey/shell_matchers.h" |
| 22 #import "ios/web/shell/test/earl_grey/web_shell_test_case.h" |
| 23 | 23 |
| 24 #if !defined(__has_feature) || !__has_feature(objc_arc) | 24 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 25 #error "This file requires ARC support." | 25 #error "This file requires ARC support." |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 using testing::ContextMenuItemWithText; | 28 using testing::ContextMenuItemWithText; |
| 29 using testing::ElementToDismissContextMenu; | 29 using testing::ElementToDismissContextMenu; |
| 30 using web::WebViewContainingText; | 30 using web::WebViewContainingText; |
| 31 | 31 |
| 32 // Context menu test cases for the web shell. | 32 // Context menu test cases for the web shell. |
| 33 @interface ContextMenuTestCase : ShellBaseTestCase | 33 @interface ContextMenuTestCase : WebShellTestCase |
| 34 @end | 34 @end |
| 35 | 35 |
| 36 @implementation ContextMenuTestCase | 36 @implementation ContextMenuTestCase |
| 37 | 37 |
| 38 // Tests context menu appears on a regular link. | 38 // Tests context menu appears on a regular link. |
| 39 - (void)testContextMenu { | 39 - (void)testContextMenu { |
| 40 // Create map of canned responses and set up the test HTML server. | 40 // Create map of canned responses and set up the test HTML server. |
| 41 std::map<GURL, std::string> responses; | 41 std::map<GURL, std::string> responses; |
| 42 GURL initialURL = web::test::HttpServer::MakeUrl("http://contextMenuOpen"); | 42 GURL initialURL = web::test::HttpServer::MakeUrl("http://contextMenuOpen"); |
| 43 GURL destinationURL = web::test::HttpServer::MakeUrl("http://destination"); | 43 GURL destinationURL = web::test::HttpServer::MakeUrl("http://destination"); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 // Dismiss the context menu. | 178 // Dismiss the context menu. |
| 179 [[EarlGrey selectElementWithMatcher:ElementToDismissContextMenu(@"Cancel")] | 179 [[EarlGrey selectElementWithMatcher:ElementToDismissContextMenu(@"Cancel")] |
| 180 performAction:grey_tap()]; | 180 performAction:grey_tap()]; |
| 181 | 181 |
| 182 // Context menu should go away after the tap. | 182 // Context menu should go away after the tap. |
| 183 [[EarlGrey selectElementWithMatcher:copyItem] assertWithMatcher:grey_nil()]; | 183 [[EarlGrey selectElementWithMatcher:copyItem] assertWithMatcher:grey_nil()]; |
| 184 } | 184 } |
| 185 | 185 |
| 186 @end | 186 @end |
| OLD | NEW |