From fe083b305a95370de0877e17aec60fabebacbb96 Mon Sep 17 00:00:00 2001 From: justincohen Date: Fri, 25 Mar 2016 17:03:09 -0700 Subject: Web shell integration test suite. Integration test suite for the web shell, based on EarlGrey. This includes the suite and gyp configurations to build and run two sample tests. build/common.gypi change is a revert of https://codereview.chromium.org/1538973002, TBRed BUG=583736 TBR=dpranke@chromium.org Review URL: https://codereview.chromium.org/1828143007 Cr-Commit-Position: refs/heads/master@{#383414} --- build/common.gypi | 24 +- ios/ios.gyp | 3 +- ios/third_party/earl_grey/earl_grey.gyp | 308 ++++++++++++++++++++++ ios/third_party/ochamcrest/ochamcrest.gyp | 143 +++++----- ios/web/DEPS | 1 + ios/web/ios_web_shell.gyp | 9 +- ios/web/ios_web_shell_exported_symbols_list | 3 + ios/web/ios_web_shell_tests.gyp | 63 +++++ ios/web/shell/test/web_shell_navigation_egtest.mm | 65 +++++ 9 files changed, 527 insertions(+), 92 deletions(-) create mode 100644 ios/third_party/earl_grey/earl_grey.gyp create mode 100644 ios/web/ios_web_shell_exported_symbols_list create mode 100644 ios/web/ios_web_shell_tests.gyp create mode 100644 ios/web/shell/test/web_shell_navigation_egtest.mm diff --git a/build/common.gypi b/build/common.gypi index aea53b9..7c4e60e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -5071,6 +5071,7 @@ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', 'GCC_OBJC_CALL_CXX_CDTORS': 'YES', # -fobjc-call-cxx-cdtors + 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', @@ -5159,29 +5160,6 @@ }], ], }], - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden - }, - }], - ['OS=="ios"', { - 'configurations': { - 'Debug': { - 'xcode_settings': { - # XCTests inject a dynamic library into the application. If - # fvisibility is set to hidden, then some symbols needed by - # XCTests are not available. Disable this setting for - # Debug configuration. - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden - }, - }, - }, - }], ], 'target_conditions': [ ['_type!="static_library"', { diff --git a/ios/ios.gyp b/ios/ios.gyp index ba0c326..851dcaa 100644 --- a/ios/ios.gyp +++ b/ios/ios.gyp @@ -23,11 +23,10 @@ 'provider/ios_provider_chrome.gyp:*', 'provider/ios_provider_web.gyp:*', 'testing/ios_testing.gyp:*', - 'third_party/fishhook/fishhook.gyp:*', - 'third_party/ochamcrest/ochamcrest.gyp:*', 'web/ios_web.gyp:*', 'web/ios_web_inttests.gyp:*', 'web/ios_web_shell.gyp:*', + 'web/ios_web_shell_tests.gyp:*', 'web/ios_web_unittests.gyp:*', ], }, diff --git a/ios/third_party/earl_grey/earl_grey.gyp b/ios/third_party/earl_grey/earl_grey.gyp new file mode 100644 index 0000000..ba01c50 --- /dev/null +++ b/ios/third_party/earl_grey/earl_grey.gyp @@ -0,0 +1,308 @@ +# Copyright 2016 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. + +{ + 'targets': [ + { + 'target_name': 'EarlGrey', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ + 'src/EarlGrey/Action/GREYAction.h', + 'src/EarlGrey/Action/GREYActionBlock.h', + 'src/EarlGrey/Action/GREYActionBlock.m', + 'src/EarlGrey/Action/GREYActions.h', + 'src/EarlGrey/Action/GREYActions.m', + 'src/EarlGrey/Action/GREYBaseAction.m', + 'src/EarlGrey/Action/GREYChangeStepperAction.h', + 'src/EarlGrey/Action/GREYChangeStepperAction.m', + 'src/EarlGrey/Action/GREYPathGestureUtils.h', + 'src/EarlGrey/Action/GREYPathGestureUtils.m', + 'src/EarlGrey/Action/GREYPickerAction.h', + 'src/EarlGrey/Action/GREYPickerAction.m', + 'src/EarlGrey/Action/GREYScrollAction.h', + 'src/EarlGrey/Action/GREYScrollAction.m', + 'src/EarlGrey/Action/GREYScrollActionError.m', + 'src/EarlGrey/Action/GREYScrollToContentEdgeAction.h', + 'src/EarlGrey/Action/GREYScrollToContentEdgeAction.m', + 'src/EarlGrey/Action/GREYSlideAction.h', + 'src/EarlGrey/Action/GREYSlideAction.m', + 'src/EarlGrey/Action/GREYSwipeAction.h', + 'src/EarlGrey/Action/GREYSwipeAction.m', + 'src/EarlGrey/Action/GREYTapAction.h', + 'src/EarlGrey/Action/GREYTapAction.m', + 'src/EarlGrey/Action/GREYTapper.h', + 'src/EarlGrey/Action/GREYTapper.m', + 'src/EarlGrey/Additions/__NSCFLocalDataTask_GREYAdditions.h', + 'src/EarlGrey/Additions/__NSCFLocalDataTask_GREYAdditions.m', + 'src/EarlGrey/Additions/_UIGestureRecognizerFailureMap_GREYAdditions.h', + 'src/EarlGrey/Additions/_UIGestureRecognizerFailureMap_GREYAdditions.m', + 'src/EarlGrey/Additions/_UIModalItemsPresentingViewController_GREYAdditions.h', + 'src/EarlGrey/Additions/_UIModalItemsPresentingViewController_GREYAdditions.m', + 'src/EarlGrey/Additions/CAAnimation+GREYAdditions.h', + 'src/EarlGrey/Additions/CAAnimation+GREYAdditions.m', + 'src/EarlGrey/Additions/CALayer+GREYAdditions.h', + 'src/EarlGrey/Additions/CALayer+GREYAdditions.m', + 'src/EarlGrey/Additions/CGGeometry+GREYAdditions.h', + 'src/EarlGrey/Additions/CGGeometry+GREYAdditions.m', + 'src/EarlGrey/Additions/NSError+GREYAdditions.h', + 'src/EarlGrey/Additions/NSError+GREYAdditions.m', + 'src/EarlGrey/Additions/NSObject+GREYAdditions.h', + 'src/EarlGrey/Additions/NSObject+GREYAdditions.m', + 'src/EarlGrey/Additions/NSRunLoop+GREYAdditions.h', + 'src/EarlGrey/Additions/NSRunLoop+GREYAdditions.m', + 'src/EarlGrey/Additions/NSString+GREYAdditions.h', + 'src/EarlGrey/Additions/NSString+GREYAdditions.m', + 'src/EarlGrey/Additions/NSTimer+GREYAdditions.h', + 'src/EarlGrey/Additions/NSTimer+GREYAdditions.m', + 'src/EarlGrey/Additions/NSURL+GREYAdditions.h', + 'src/EarlGrey/Additions/NSURL+GREYAdditions.m', + 'src/EarlGrey/Additions/NSURLConnection+GREYAdditions.h', + 'src/EarlGrey/Additions/NSURLConnection+GREYAdditions.m', + 'src/EarlGrey/Additions/UIAnimation+GREYAdditions.h', + 'src/EarlGrey/Additions/UIAnimation+GREYAdditions.m', + 'src/EarlGrey/Additions/UIApplication+GREYAdditions.h', + 'src/EarlGrey/Additions/UIApplication+GREYAdditions.m', + 'src/EarlGrey/Additions/UIScrollView+GREYAdditions.h', + 'src/EarlGrey/Additions/UIScrollView+GREYAdditions.m', + 'src/EarlGrey/Additions/UISwitch+GREYAdditions.h', + 'src/EarlGrey/Additions/UISwitch+GREYAdditions.m', + 'src/EarlGrey/Additions/UITouch+GREYAdditions.h', + 'src/EarlGrey/Additions/UITouch+GREYAdditions.m', + 'src/EarlGrey/Additions/UIView+GREYAdditions.h', + 'src/EarlGrey/Additions/UIView+GREYAdditions.m', + 'src/EarlGrey/Additions/UIViewController+GREYAdditions.h', + 'src/EarlGrey/Additions/UIViewController+GREYAdditions.m', + 'src/EarlGrey/Additions/UIWebView+GREYAdditions.h', + 'src/EarlGrey/Additions/UIWebView+GREYAdditions.m', + 'src/EarlGrey/Additions/UIWindow+GREYAdditions.h', + 'src/EarlGrey/Additions/UIWindow+GREYAdditions.m', + 'src/EarlGrey/Additions/XCTestCase+GREYAdditions.h', + 'src/EarlGrey/Additions/XCTestCase+GREYAdditions.m', + 'src/EarlGrey/AppSupport/GREYIdlingResource.h', + 'src/EarlGrey/Assertion/GREYAssertion.h', + 'src/EarlGrey/Assertion/GREYAssertionBlock.h', + 'src/EarlGrey/Assertion/GREYAssertionBlock.m', + 'src/EarlGrey/Assertion/GREYAssertionDefines.h', + 'src/EarlGrey/Assertion/GREYAssertions.h', + 'src/EarlGrey/Assertion/GREYAssertions.m', + 'src/EarlGrey/Common/GREYAnalytics.h', + 'src/EarlGrey/Common/GREYAnalytics.m', + 'src/EarlGrey/Common/GREYConfiguration.h', + 'src/EarlGrey/Common/GREYConfiguration.m', + 'src/EarlGrey/Common/GREYConstants.h', + 'src/EarlGrey/Common/GREYConstants.m', + 'src/EarlGrey/Common/GREYDefines.h', + 'src/EarlGrey/Common/GREYElementHierarchy.h', + 'src/EarlGrey/Common/GREYElementHierarchy.m', + 'src/EarlGrey/Common/GREYExposed.h', + 'src/EarlGrey/Common/GREYPrivate.h', + 'src/EarlGrey/Common/GREYScreenshotUtil.h', + 'src/EarlGrey/Common/GREYScreenshotUtil.m', + 'src/EarlGrey/Common/GREYSwizzler.h', + 'src/EarlGrey/Common/GREYSwizzler.m', + 'src/EarlGrey/Common/GREYVisibilityChecker.h', + 'src/EarlGrey/Common/GREYVisibilityChecker.m', + 'src/EarlGrey/Core/GREYElementFinder.h', + 'src/EarlGrey/Core/GREYElementFinder.m', + 'src/EarlGrey/Core/GREYElementInteraction.h', + 'src/EarlGrey/Core/GREYElementInteraction.m', + 'src/EarlGrey/Core/GREYInteractionDataSource.h', + 'src/EarlGrey/Core/GREYKeyboard.h', + 'src/EarlGrey/Core/GREYKeyboard.m', + 'src/EarlGrey/Delegate/GREYCAAnimationDelegate.h', + 'src/EarlGrey/Delegate/GREYCAAnimationDelegate.m', + 'src/EarlGrey/Delegate/GREYNSURLConnectionDelegate.h', + 'src/EarlGrey/Delegate/GREYNSURLConnectionDelegate.m', + 'src/EarlGrey/Delegate/GREYSurrogateDelegate.h', + 'src/EarlGrey/Delegate/GREYSurrogateDelegate.m', + 'src/EarlGrey/Delegate/GREYUIWebViewDelegate.h', + 'src/EarlGrey/Delegate/GREYUIWebViewDelegate.m', + 'src/EarlGrey/EarlGrey.h', + 'src/EarlGrey/EarlGrey.m', + 'src/EarlGrey/Event/GREYSingleSequenceTouchInjector.h', + 'src/EarlGrey/Event/GREYSingleSequenceTouchInjector.m', + 'src/EarlGrey/Event/GREYSyntheticEvents.h', + 'src/EarlGrey/Event/GREYSyntheticEvents.m', + 'src/EarlGrey/Exception/GREYDefaultFailureHandler.h', + 'src/EarlGrey/Exception/GREYDefaultFailureHandler.m', + 'src/EarlGrey/Exception/GREYFailureHandler.h', + 'src/EarlGrey/Exception/GREYFrameworkException.h', + 'src/EarlGrey/Exception/GREYFrameworkException.m', + 'src/EarlGrey/Matcher/GREYAllOf.h', + 'src/EarlGrey/Matcher/GREYAllOf.m', + 'src/EarlGrey/Matcher/GREYAnyOf.h', + 'src/EarlGrey/Matcher/GREYAnyOf.m', + 'src/EarlGrey/Matcher/GREYBaseMatcher.h', + 'src/EarlGrey/Matcher/GREYBaseMatcher.m', + 'src/EarlGrey/Matcher/GREYDescription.h', + 'src/EarlGrey/Matcher/GREYElementMatcherBlock.h', + 'src/EarlGrey/Matcher/GREYElementMatcherBlock.m', + 'src/EarlGrey/Matcher/GREYHCMatcher.h', + 'src/EarlGrey/Matcher/GREYHCMatcher.m', + 'src/EarlGrey/Matcher/GREYLayoutConstraint.h', + 'src/EarlGrey/Matcher/GREYLayoutConstraint.m', + 'src/EarlGrey/Matcher/GREYMatcher.h', + 'src/EarlGrey/Matcher/GREYMatchers.h', + 'src/EarlGrey/Matcher/GREYMatchers.m', + 'src/EarlGrey/Matcher/GREYNot.h', + 'src/EarlGrey/Matcher/GREYNot.m', + 'src/EarlGrey/Matcher/GREYStringDescription.h', + 'src/EarlGrey/Matcher/GREYStringDescription.m', + 'src/EarlGrey/Provider/GREYDataEnumerator.h', + 'src/EarlGrey/Provider/GREYDataEnumerator.m', + 'src/EarlGrey/Provider/GREYElementProvider.h', + 'src/EarlGrey/Provider/GREYElementProvider.m', + 'src/EarlGrey/Provider/GREYProvider.h', + 'src/EarlGrey/Provider/GREYUIWindowProvider.h', + 'src/EarlGrey/Provider/GREYUIWindowProvider.m', + 'src/EarlGrey/Synchronization/GREYAppStateTracker.h', + 'src/EarlGrey/Synchronization/GREYAppStateTracker.m', + 'src/EarlGrey/Synchronization/GREYBeaconImageProtocol.h', + 'src/EarlGrey/Synchronization/GREYBeaconImageProtocol.m', + 'src/EarlGrey/Synchronization/GREYCondition.h', + 'src/EarlGrey/Synchronization/GREYCondition.m', + 'src/EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m', + 'src/EarlGrey/Synchronization/GREYNSTimerIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYNSTimerIdlingResource.m', + 'src/EarlGrey/Synchronization/GREYOperationQueueIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYOperationQueueIdlingResource.m', + 'src/EarlGrey/Synchronization/GREYSyncAPI.h', + 'src/EarlGrey/Synchronization/GREYSyncAPI.m', + 'src/EarlGrey/Synchronization/GREYTimedIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYTimedIdlingResource.m', + 'src/EarlGrey/Synchronization/GREYUIThreadExecutor.h', + 'src/EarlGrey/Synchronization/GREYUIThreadExecutor.m', + 'src/EarlGrey/Synchronization/GREYUIWebViewIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYUIWebViewIdlingResource.m', + ], + 'mac_framework_headers': [ + 'src/EarlGrey/EarlGrey.h', + 'src/EarlGrey/Action/GREYAction.h', + 'src/EarlGrey/Action/GREYActionBlock.h', + 'src/EarlGrey/Action/GREYActions.h', + 'src/EarlGrey/Action/GREYBaseAction.h', + 'src/EarlGrey/Action/GREYScrollActionError.h', + 'src/EarlGrey/AppSupport/GREYIdlingResource.h', + 'src/EarlGrey/Assertion/GREYAssertion.h', + 'src/EarlGrey/Assertion/GREYAssertionBlock.h', + 'src/EarlGrey/Assertion/GREYAssertionDefines.h', + 'src/EarlGrey/Assertion/GREYAssertions.h', + 'src/EarlGrey/Common/GREYConfiguration.h', + 'src/EarlGrey/Common/GREYConstants.h', + 'src/EarlGrey/Common/GREYDefines.h', + 'src/EarlGrey/Common/GREYElementHierarchy.h', + 'src/EarlGrey/Common/GREYScreenshotUtil.h', + 'src/EarlGrey/Core/GREYElementFinder.h', + 'src/EarlGrey/Core/GREYElementInteraction.h', + 'src/EarlGrey/Core/GREYInteraction.h', + 'src/EarlGrey/Exception/GREYFailureHandler.h', + 'src/EarlGrey/Exception/GREYFrameworkException.h', + 'src/EarlGrey/Matcher/GREYAllOf.h', + 'src/EarlGrey/Matcher/GREYAnyOf.h', + 'src/EarlGrey/Matcher/GREYBaseMatcher.h', + 'src/EarlGrey/Matcher/GREYDescription.h', + 'src/EarlGrey/Matcher/GREYElementMatcherBlock.h', + 'src/EarlGrey/Matcher/GREYLayoutConstraint.h', + 'src/EarlGrey/Matcher/GREYMatcher.h', + 'src/EarlGrey/Matcher/GREYMatchers.h', + 'src/EarlGrey/Matcher/GREYNot.h', + 'src/EarlGrey/Provider/GREYDataEnumerator.h', + 'src/EarlGrey/Provider/GREYProvider.h', + 'src/EarlGrey/Synchronization/GREYNSTimerIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYOperationQueueIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.h', + 'src/EarlGrey/Synchronization/GREYSyncAPI.h', + 'src/EarlGrey/Synchronization/GREYCondition.h', + 'src/EarlGrey/Synchronization/GREYUIThreadExecutor.h', + ], + 'mac_framework_private_headers': [ + 'src/EarlGrey/Action/GREYPathGestureUtils.h', + 'src/EarlGrey/Action/GREYScrollAction.h', + 'src/EarlGrey/Action/GREYSwipeAction.h', + 'src/EarlGrey/Action/GREYTapAction.h', + 'src/EarlGrey/Additions/__NSCFLocalDataTask_GREYAdditions.h', + 'src/EarlGrey/Additions/_UIGestureRecognizerFailureMap_GREYAdditions.h', + 'src/EarlGrey/Additions/_UIModalItemsPresentingViewController_GREYAdditions.h', + 'src/EarlGrey/Additions/CAAnimation+GREYAdditions.h', + 'src/EarlGrey/Additions/CALayer+GREYAdditions.h', + 'src/EarlGrey/Additions/CGGeometry+GREYAdditions.h', + 'src/EarlGrey/Additions/NSError+GREYAdditions.h', + 'src/EarlGrey/Additions/NSRunLoop+GREYAdditions.h', + 'src/EarlGrey/Additions/NSString+GREYAdditions.h', + 'src/EarlGrey/Additions/NSTimer+GREYAdditions.h', + 'src/EarlGrey/Additions/NSURL+GREYAdditions.h', + 'src/EarlGrey/Additions/NSURLConnection+GREYAdditions.h', + 'src/EarlGrey/Additions/UIAnimation+GREYAdditions.h', + 'src/EarlGrey/Additions/UIApplication+GREYAdditions.h', + 'src/EarlGrey/Additions/UIScrollView+GREYAdditions.h', + 'src/EarlGrey/Additions/UISwitch+GREYAdditions.h', + 'src/EarlGrey/Additions/UITouch+GREYAdditions.h', + 'src/EarlGrey/Additions/UIView+GREYAdditions.h', + 'src/EarlGrey/Additions/UIViewController+GREYAdditions.h', + 'src/EarlGrey/Additions/UIWebView+GREYAdditions.h', + 'src/EarlGrey/Additions/UIWindow+GREYAdditions.h', + 'src/EarlGrey/Additions/XCTestCase+GREYAdditions.h', + 'src/EarlGrey/Common/GREYExposed.h', + 'src/EarlGrey/Common/GREYPrivate.h', + 'src/EarlGrey/Common/GREYSwizzler.h', + 'src/EarlGrey/Common/GREYVisibilityChecker.h', + 'src/EarlGrey/Delegate/GREYCAAnimationDelegate.h', + 'src/EarlGrey/Delegate/GREYNSURLConnectionDelegate.h', + 'src/EarlGrey/Delegate/GREYSurrogateDelegate.h', + 'src/EarlGrey/Delegate/GREYUIWebViewDelegate.h', + 'src/EarlGrey/Event/GREYSingleSequenceTouchInjector.h', + 'src/EarlGrey/Event/GREYSyntheticEvents.h', + 'src/EarlGrey/Provider/GREYElementProvider.h', + 'src/EarlGrey/Provider/GREYUIWindowProvider.h', + 'src/EarlGrey/Synchronization/GREYAppStateTracker.h', + 'src/EarlGrey/Synchronization/GREYTimedIdlingResource.h', + ], + 'dependencies': [ + '../../../third_party/google_toolbox_for_mac/google_toolbox_for_mac.gyp:google_toolbox_for_mac', + '../fishhook/fishhook.gyp:fishhook', + '../ochamcrest/ochamcrest.gyp:OCHamcrest', + ], + 'xcode_settings': { + 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', + 'USE_HEADERMAP': 'YES', + 'CLANG_ENABLE_OBJC_ARC': 'YES', + }, + 'link_settings': { + 'libraries': [ + 'CoreGraphics.framework', + 'Foundation.framework', + 'IOKit.framework', + 'QuartzCore.framework', + 'UIKit.framework', + 'XCTest.framework', + ], + }, + 'include_dirs': [ + 'src', + 'src/EarlGrey', + ], + 'export_dependent_settings': [ + '../ochamcrest/ochamcrest.gyp:OCHamcrest', + ], + 'mac_framework_dirs': [ + '$(SDKROOT)/../../Library/Frameworks', + '<(PRODUCT_DIR)' + ], + 'direct_dependent_settings': { + 'include_dirs': [ + 'src/EarlGrey', + ], + 'mac_framework_dirs': [ + # EarlGrey and its dependencies need to link to XCTest.framework + # which is not under SDKROOT. + '$(SDKROOT)/../../Library/Frameworks', + '<(PRODUCT_DIR)' + ], + }, + }, + ], +} + diff --git a/ios/third_party/ochamcrest/ochamcrest.gyp b/ios/third_party/ochamcrest/ochamcrest.gyp index 95d5a6c..5fcfa7a 100644 --- a/ios/third_party/ochamcrest/ochamcrest.gyp +++ b/ios/third_party/ochamcrest/ochamcrest.gyp @@ -4,9 +4,12 @@ { 'chromium_sources': 0, - 'variables': { - 'ochamcrest_copy_dir': '<(SHARED_INTERMEDIATE_DIR)/ios/third_party/ochamcrest', - 'ochamcrest_sources': [ + 'targets': [ + { + 'target_name': 'OCHamcrest', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'src/Source/Core/HCAssertThat.h', 'src/Source/Core/HCAssertThat.m', 'src/Source/Core/HCBaseDescription.h', @@ -159,75 +162,83 @@ 'src/Source/Library/Text/HCSubstringMatcher.h', 'src/Source/Library/Text/HCSubstringMatcher.m', 'src/Source/OCHamcrest.h', - ], - }, - 'targets': [ - # OCHamcrest sources contains import rules using relative file names - # ("HCAssertThat.h") and other using paths in an installed framework - # (). In order to build, copy all the sources - # to <(SHARED_INTERMEDIATE_DIR)/ios/third_party/ochmacrest/OCHamcrest - # so that both type of import work (another option considered was to - # build forwarding headers but this required duplicating the list of - # files in GN build and was ruled out). - # - # To avoid ODR violation, direct import of ios/third_party/ochamcrest - # is forbidden in ios/DEPS and code should instead use import as if - # OCHamcrest was in a framework (i.e. #import ). - { - 'target_name': 'ochamcrest_copy_sources', - 'hard_dependency': 1, - 'type': 'none', - 'actions': [ - { - 'action_name': 'copy_ochamcrest_sources', - 'inputs': [ - '../../chrome/tools/build/ios_copy_files.py', - '<@(ochamcrest_sources)', - ], - 'outputs': [ - ' +#import + +#import + +#import "ios/web/shell/view_controller.h" + +@interface CRWWebShellNavigationTest : XCTestCase + +@end + +@implementation CRWWebShellNavigationTest + +// Sample test to load a live URL, go back and then forward. +- (void)testExternalURLBackAndForward { + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellAddressFieldAccessibilityLabel)] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Clear text")] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellAddressFieldAccessibilityLabel)] + performAction:grey_typeText(@"http://browsingtest.appspot.com\n")]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellBackButtonAccessibilityLabel)] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellForwardButtonAccessibilityLabel)] + performAction:grey_tap()]; +} + +// Sample test to load a live URL, go back, forward, and then back again. +- (void)testExternalURLBackAndForwardAndBack { + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellAddressFieldAccessibilityLabel)] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Clear text")] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellAddressFieldAccessibilityLabel)] + performAction:grey_typeText(@"http://browsingtest.appspot.com\n")]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellBackButtonAccessibilityLabel)] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellForwardButtonAccessibilityLabel)] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + kWebShellBackButtonAccessibilityLabel)] + performAction:grey_tap()]; +} +@end -- cgit v1.1