Commit 4e43d3c3 authored by zhaoyangli's avatar zhaoyangli Committed by Commit Bot

[iOS] Remove unnecessary functions and re-format after EG1 code removal.

Removed unnecessary functions. Re-formatted incorrect code format after
removing EG1 & EG2 macros. Addressed unresolved comments from
crrev/c/2433584, except for header removals.

Bug: 1102995
Change-Id: Id16bc6ba05f4a13d0debc866264bbead7accb582
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454294Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815162}
parent 0692640e
...@@ -247,13 +247,11 @@ void TestResponseProvider::GetLanguageResponse( ...@@ -247,13 +247,11 @@ void TestResponseProvider::GetLanguageResponse(
@interface TranslateInfobarTestCase : WebHttpServerChromeTestCase @interface TranslateInfobarTestCase : WebHttpServerChromeTestCase
@end @end
@implementation TranslateInfobarTestCase { @implementation TranslateInfobarTestCase
}
- (void)setUp { - (void)setUp {
[super setUp]; [super setUp];
// Set up the fake URL for the translate script to hit the mock HTTP server. // Set up the fake URL for the translate script to hit the mock HTTP server.
GURL translateScriptURL = web::test::HttpServer::MakeUrl( GURL translateScriptURL = web::test::HttpServer::MakeUrl(
base::StringPrintf("http://%s", kTranslateScriptPath)); base::StringPrintf("http://%s", kTranslateScriptPath));
......
...@@ -33,8 +33,7 @@ const char kPDFURL[] = "http://ios/testing/data/http_server_files/testpage.pdf"; ...@@ -33,8 +33,7 @@ const char kPDFURL[] = "http://ios/testing/data/http_server_files/testpage.pdf";
// Rotate the device back to portrait if needed, since some tests attempt to run // Rotate the device back to portrait if needed, since some tests attempt to run
// in landscape. // in landscape.
- (void)tearDown { - (void)tearDown {
[EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait error:nil];
error:nil];
[super tearDown]; [super tearDown];
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "ios/web/public/test/element_selector.h" #include "ios/web/public/test/element_selector.h"
#include "net/base/mac/url_conversions.h" #include "net/base/mac/url_conversions.h"
using base::test::ios::kWaitForActionTimeout; using base::test::ios::kWaitForActionTimeout;
using base::test::ios::kWaitForJSCompletionTimeout; using base::test::ios::kWaitForJSCompletionTimeout;
using base::test::ios::kWaitForPageLoadTimeout; using base::test::ios::kWaitForPageLoadTimeout;
...@@ -86,8 +85,7 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface) ...@@ -86,8 +85,7 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
} }
- (BOOL)isKeyboardShownWithError:(NSError**)error { - (BOOL)isKeyboardShownWithError:(NSError**)error {
return return [EarlGrey isKeyboardShownWithError:error];
[EarlGrey isKeyboardShownWithError:error];
} }
- (BOOL)isIPadIdiom { - (BOOL)isIPadIdiom {
......
...@@ -111,11 +111,6 @@ void ResetAuthentication() { ...@@ -111,11 +111,6 @@ void ResetAuthentication() {
void RemoveInfoBarsAndPresentedState() { void RemoveInfoBarsAndPresentedState() {
[ChromeTestCaseAppInterface removeInfoBarsAndPresentedState]; [ChromeTestCaseAppInterface removeInfoBarsAndPresentedState];
} }
UIDeviceOrientation GetCurrentDeviceOrientation() {
return [[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] orientation];
}
} // namespace } // namespace
GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface)
...@@ -228,7 +223,8 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface) ...@@ -228,7 +223,8 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface)
[[self class] removeAnyOpenMenusAndInfoBars]; [[self class] removeAnyOpenMenusAndInfoBars];
[[self class] closeAllTabs]; [[self class] closeAllTabs];
if (GetCurrentDeviceOrientation() != _originalOrientation) { if ([[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] orientation] !=
_originalOrientation) {
// Rotate the device back to the original orientation, since some tests // Rotate the device back to the original orientation, since some tests
// attempt to run in other orientations. // attempt to run in other orientations.
[ChromeEarlGrey rotateDeviceToOrientation:_originalOrientation error:nil]; [ChromeEarlGrey rotateDeviceToOrientation:_originalOrientation error:nil];
...@@ -365,7 +361,8 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface) ...@@ -365,7 +361,8 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface)
gIsMockAuthenticationDisabled = NO; gIsMockAuthenticationDisabled = NO;
_tearDownHandler = nil; _tearDownHandler = nil;
_originalOrientation = GetCurrentDeviceOrientation(); _originalOrientation =
[[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] orientation];
} }
// Returns the method name, e.g. "testSomething" of the test that is currently // Returns the method name, e.g. "testSomething" of the test that is currently
......
...@@ -10,14 +10,6 @@ ...@@ -10,14 +10,6 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
namespace {
// EG1 and EG2 have different API to obtain shared GREYConfiguration object.
// This function abstracts the API access.
GREYConfiguration* GetSharedGREYConfiguration() {
return [GREYConfiguration sharedConfiguration];
}
} // namespace
ScopedSynchronizationDisabler::ScopedSynchronizationDisabler() ScopedSynchronizationDisabler::ScopedSynchronizationDisabler()
: saved_eg_synchronization_enabled_value_(GetEgSynchronizationEnabled()) { : saved_eg_synchronization_enabled_value_(GetEgSynchronizationEnabled()) {
SetEgSynchronizationEnabled(NO); SetEgSynchronizationEnabled(NO);
...@@ -28,11 +20,12 @@ ScopedSynchronizationDisabler::~ScopedSynchronizationDisabler() { ...@@ -28,11 +20,12 @@ ScopedSynchronizationDisabler::~ScopedSynchronizationDisabler() {
} }
bool ScopedSynchronizationDisabler::GetEgSynchronizationEnabled() { bool ScopedSynchronizationDisabler::GetEgSynchronizationEnabled() {
return [GetSharedGREYConfiguration() return [[GREYConfiguration sharedConfiguration]
boolValueForConfigKey:kGREYConfigKeySynchronizationEnabled]; boolValueForConfigKey:kGREYConfigKeySynchronizationEnabled];
} }
void ScopedSynchronizationDisabler::SetEgSynchronizationEnabled(BOOL flag) { void ScopedSynchronizationDisabler::SetEgSynchronizationEnabled(BOOL flag) {
[GetSharedGREYConfiguration() setValue:@(flag) [[GREYConfiguration sharedConfiguration]
setValue:@(flag)
forConfigKey:kGREYConfigKeySynchronizationEnabled]; forConfigKey:kGREYConfigKeySynchronizationEnabled];
} }
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