Commit 75801edb authored by edchin's avatar edchin Committed by Commit Bot

Revert "[iOS] Check SideSwipe location in window coordinates"

This reverts commit 92d8795b.

Reason for revert:

Failures on iOS 10 devices and simulator bots:
ipad10-device-x64
ipad10-simulator-x64

ios_chrome_ui_egtests (iPad Air iOS 10.3.3) on iOS-10.3.3


SideSwipeTestCase/testSideSwipeTopToolbar:
[0918/100933.388949:WARNING:embedded_test_server.cc(239)] Request not handled. Returning 404: /favicon.ico
../../ios/chrome/test/earl_grey/chrome_earl_grey.mm:188: error: -[SideSwipeTestCase testSideSwipeTopToolbar] : Exception: AssertionFailedException
Exception Name: AssertionFailedException
Exception Reason: (([condition waitWithTimeout:base::test::ios::kWaitForUIElementTimeout]) is true) failed
Exception Details: Failed waiting for web view containing Echo
Bundle ID: com.google.gtest.ios-chrome-ui-egtests
Stack Trace: (
	0   EarlGrey                            0x0000000105c58748 -[GREYDefaultFailureHandler handleException:details:] + 780
	1   ios_chrome_ui_egtests               0x0000000100a05cc8 +[ChromeEarlGrey waitForWebViewContainingText:] + 628
	2   ios_chrome_ui_egtests               0x0000000100a543fc -[SideSwipeTestCase checkSideSwipeOnToolbarClass:] + 1196
	3   CoreFoundation                      0x0000000187ea4e80 <redacted> + 144
	4   CoreFoundation                      0x0000000187d9a2c4 <redacted> + 292
	5   EarlGrey                            0x0000000105c495c8 -[GREYTestCaseInvocation invoke] + 84
	6   XCTest                              0x0000000105aacf3c __24-[XCTestCase invokeTest]_block_invoke_2.198 + 68
	7   XCTest                              0x0000000105b14560 -[XCTMemoryChecker _assertInvalidObjectsDeallocatedAfterScope:] + 68
	8   XCTest                              0x0000000105ab57c0 -[XCTestCase assertInvalidObjectsDeallocatedAfterScope:] + 112
	9   XCTest                              0x0000000105aacec4 __24-[XCTestCase invokeTest]_block_invoke.192 + 196
	10  XCTest                              0x0000000105b01710 -[XCTestCase(Failures) performFailableBlock:testCaseRun:shouldInterruptTest:] + 64
	11  XCTest                              0x0000000105b01628 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 108
	12  XCTest                              0x0000000105aacb38 __24-[XCTestCase invokeTest]_block_invoke + 812
	13  XCTest                              0x0000000105b07298 -[XCUITestContext performInScope:] + 264
	14  XCTest                              0x0000000105aac744 -[XCTestCase testContextPerformInScope:] + 100
	15  XCTest                              0x0000000105aac7f8 -[XCTestCase invokeTest] + 140
	16  EarlGrey                            0x0000000105c40e6c -[XCTestCase(GREYAdditions) grey_invokeTest] + 392
	17  XCTest                              0x0000000105aae39c __26-[XCTestCase performTest:]_block_invoke_2 + 44
	18  XCTest                              0x0000000105b01710 -[XCTestCase(Failures) performFailableBlock:testCaseRun:shouldInterruptTest:] + 64
	19  XCTest                              0x0000000105b01628 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 108
	20  XCTest                              0x0000000105aae2b4 __26-[XCTestCase performTest:]_block_invoke.337 + 96
	21  XCTest                              0x0000000105b11a58 +[XCTContext runInContextForTestCase:block:] + 216
	22  XCTest                              0x0000000105aada50 -[XCTestCase performTest:] + 648
	23  XCTest                              0x0000000105aee88c -[XCTest runTest] + 60
	24  XCTest                              0x0000000105aa8ec4 __27-[XCTestSuite performTest:]_block_invoke + 296
	25  XCTest                              0x0000000105aa87c4 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 68
	26  XCTest                              0x0000000105aa8a5c -[XCTestSuite performTest:] + 272
	27  XCTest                              0x0000000105aee88c -[XCTest runTest] + 60
	28  XCTest                              0x0000000105aa8ec4 __27-[XCTestSuite performTest:]_block_invoke + 296
	29  XCTest                              0x0000000105aa87c4 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 68
	30  XCTest                              0x0000000105aa8a5c -[XCTestSuite performTest:] + 272
	31  XCTest                              0x0000000105aee88c -[XCTest runTest] + 60
	32  XCTest                              0x0000000105aa8ec4 __27-[XCTestSuite performTest:]_block_invoke + 296
	33  XCTest                              0x0000000105aa87c4 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 68
	34  XCTest                              0x0000000105aa8a5c -[XCTestSuite performTest:] + 272
	35  XCTest                              0x0000000105aee88c -[XCTest runTest] + 60
	36  XCTest                              0x0000000105b1eb2c __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 176
	37  XCTest                              0x0000000105b1ec5c __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.80 + 60
	38  XCTest                              0x0000000105ac08fc -[XCTestObservationCenter _observeTestExecutionForBlock:] + 524
	39  XCTest                              0x0000000105b1e8ac -[XCTTestRunSession runTestsAndReturnError:] + 612
	40  XCTest                              0x0000000105a8dad4 -[XCTestDriver runTestsAndReturnError:] + 416
	41  XCTest                              0x0000000105b0e274 _XCTestMain + 1436
	42  libXCTestBundleInject.dylib         0x0000000105915724 __copy_helper_block_ + 0
	43  CoreFoundation                      0x0000000187e4d30c <redacted> + 20
	44  CoreFoundation                      0x0000000187e4cb28 <redacted> + 288
	45  CoreFoundation                      0x0000000187e4a998 <redacted> + 728
	46  CoreFoundation                      0x0000000187d7ada4 CFRunLoopRunSpecific + 424
	47  GraphicsServices                    0x00000001897e5074 GSEventRunModal + 100
	48  UIKit                               0x000000018e02ec9c UIApplicationMain + 208
	49  ios_chrome_ui_egtests               0x0000000100045618 main + 536
	50  libdyld.dylib                       0x0000000186d8959c <redacted> + 4
)
Screenshots: {
  "Screenshot At Failure":  "/var/mobile/Containers/Data/Application/8AE3CF5E-F002-4373-8F6F-826C6E868992/Documents/SideSwipeTestCase_testSideSwipeTopToolbar-AssertionFailedException-001584B5-0BD5-480A-BE35-237D1281481F/SideSwipeTestCase_testSideSwipeTopToolbar.png",
  "Visibility Checker Most Recent Before Image":  "/var/mobile/Containers/Data/Application/8AE3CF5E-F002-4373-8F6F-826C6E868992/Documents/SideSwipeTestCase_testSideSwipeTopToolbar-AssertionFailedException-001584B5-0BD5-480A-BE35-237D1281481F/SideSwipeTestCase_testSideSwipeTopToolbar_before.png",
  "Visibility Checker Most Recent Expected After Image":  "/var/mobile/Containers/Data/Application/8AE3CF5E-F002-4373-8F6F-826C6E868992/Documents/SideSwipeTestCase_testSideSwipeTopToolbar-AssertionFailedException-001584B5-0BD5-480A-BE35-237D1281481F/SideSwipeTestCase_testSideSwipeTopToolbar_after_expected.png",
  "Visibility Checker Most Recent Actual After Image":  "/var/mobile/Containers/Data/Application/8AE3CF5E-F002-4373-8F6F-826C6E868992/Documents/SideSwipeTestCase_testSideSwipeTopToolbar-AssertionFailedException-001584B5-0BD5-480A-BE35-237D1281481F/SideSwipeTestCase_testSideSwipeTopToolbar_after_actual.png"
}
UI hierarchy (ordered by window level, front to back as rendered):
Legend: {
  "[AX]":  "Accessibility",
  "[UIE]":  "User Interaction Enabled",
  "[Window 1]":  "Frontmost Window"
}





Original change's description:
> [iOS] Check SideSwipe location in window coordinates
> 
> This CL changes the way the SideSwipe is checking if the touch location
> is inside the toolbar frame or not by passing it in the window
> coordinates instead of in the gesture's view coordinates.
> This starts creating an issue as the toolbar frame is now contained in
> a container, changing its frame's origin.
> 
> Bug: 883694
> Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
> Change-Id: Iaf42b36ce01c47addd87ae71772abff605e75a1c
> Reviewed-on: https://chromium-review.googlesource.com/1224387
> Commit-Queue: Gauthier Ambard <gambard@chromium.org>
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Reviewed-by: Justin Cohen <justincohen@chromium.org>
> Reviewed-by: Kurt Horimoto <kkhorimoto@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#592014}

TBR=justincohen@chromium.org,eugenebut@chromium.org,kkhorimoto@chromium.org,gambard@chromium.org

Change-Id: I8ea07375dc2c910264e05ecd58ade762c99a582c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 883694
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/1231828Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592170}
parent 7140f23f
......@@ -62,25 +62,3 @@ source_set("unit_tests") {
"//third_party/ocmock",
]
}
source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"side_swipe_egtest.mm",
]
deps = [
":side_swipe",
"//base",
"//ios/chrome/browser",
"//ios/chrome/browser/ui:ui_util",
"//ios/chrome/browser/ui/toolbar/adaptive:adaptive_ui",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test/http_server",
]
libs = [ "XCTest.framework" ]
}
......@@ -242,8 +242,7 @@ const NSUInteger kIpadGreySwipeTabCount = 8;
// Since the toolbar and the contentView can overlap, check the toolbar frame
// first, and confirm the right gesture recognizer is firing.
if ([self.toolbarInteractionHandler
isInsideToolbar:[gesture.view convertPoint:location toView:nil]]) {
if ([self.toolbarInteractionHandler isInsideToolbar:location]) {
if (![gesture isEqual:panGestureRecognizer_]) {
return NO;
}
......
// Copyright 2018 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 <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h>
#import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.h"
#import "ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#include "ios/testing/earl_grey/disabled_test_macros.h"
#include "net/test/embedded_test_server/default_handlers.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// Integration tests for side swipe.
@interface SideSwipeTestCase : ChromeTestCase
@end
@implementation SideSwipeTestCase
#pragma mark - Tests
// Tests that swiping horizontally on the bottom toolbar is changing tab.
- (void)testSideSwipeBottomToolbar {
if (!IsSplitToolbarMode()) {
EARL_GREY_TEST_SKIPPED(
@"This tests should only be tested if the secondary toolbar is "
@"present");
}
[self checkSideSwipeOnToolbarClass:[SecondaryToolbarView class]];
}
// Tests that swiping horizontally on the top toolbar is changing tab.
- (void)testSideSwipeTopToolbar {
[self checkSideSwipeOnToolbarClass:[PrimaryToolbarView class]];
}
#pragma mark - Helpers
// Checks that side swipe on an element of class |klass| is working to change
// tab.
- (void)checkSideSwipeOnToolbarClass:(Class)klass {
// Setup the server.
net::test_server::RegisterDefaultHandlers(self.testServer);
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
// Load the first page.
[ChromeEarlGrey loadURL:self.testServer->GetURL("/echo")];
[ChromeEarlGrey waitForWebViewContainingText:"Echo"];
// Open a new Tab to have a tab to switch to.
[ChromeEarlGreyUI openNewTab];
// Load the second page in the new tab.
[ChromeEarlGrey loadURL:self.testServer->GetURL("/defaultresponse")];
[ChromeEarlGrey waitForWebViewContainingText:"Default response"];
// Side swipe on the toolbar.
[[EarlGrey selectElementWithMatcher:grey_kindOfClass(klass)]
performAction:grey_swipeSlowInDirection(kGREYDirectionRight)];
// Check that we swiped back to our web page.
[ChromeEarlGrey waitForWebViewContainingText:"Echo"];
}
@end
......@@ -64,9 +64,7 @@
// swipes from the right side.
CGRect toolbarFrame =
CGRectInset([coordinator viewController].view.frame, -1, -1);
CGRect frameInWindowCoordinates =
[[coordinator viewController].view convertRect:toolbarFrame toView:nil];
if (CGRectContainsPoint(frameInWindowCoordinates, point))
if (CGRectContainsPoint(toolbarFrame, point))
return YES;
}
return NO;
......
......@@ -10,8 +10,7 @@
// Protocol used by SideSwipe to interact with the toolbar.
@protocol SideSwipeToolbarInteracting
// Returns whether the |point| is inside a toolbar's frame. The |point| must be
// in the window coordinates.
// Returns whether the |point| is inside a toolbar's frame.
- (BOOL)isInsideToolbar:(CGPoint)point;
@end
......
......@@ -123,7 +123,6 @@ chrome_ios_eg_test("ios_chrome_ui_egtests") {
"//ios/chrome/browser/ui/sad_tab:eg_tests",
"//ios/chrome/browser/ui/safe_mode:eg_tests",
"//ios/chrome/browser/ui/settings/sync_utils:eg_tests",
"//ios/chrome/browser/ui/side_swipe:eg_tests",
"//ios/chrome/browser/ui/signin_interaction:eg_tests",
"//ios/chrome/browser/ui/stack_view:eg_tests",
"//ios/chrome/browser/ui/tab_switcher:eg_tests",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment