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(
@interface TranslateInfobarTestCase : WebHttpServerChromeTestCase
@end
@implementation TranslateInfobarTestCase {
}
@implementation TranslateInfobarTestCase
- (void)setUp {
[super setUp];
// Set up the fake URL for the translate script to hit the mock HTTP server.
GURL translateScriptURL = web::test::HttpServer::MakeUrl(
base::StringPrintf("http://%s", kTranslateScriptPath));
......
......@@ -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
// in landscape.
- (void)tearDown {
[EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait
error:nil];
[EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait error:nil];
[super tearDown];
}
......
......@@ -18,7 +18,6 @@
#include "ios/web/public/test/element_selector.h"
#include "net/base/mac/url_conversions.h"
using base::test::ios::kWaitForActionTimeout;
using base::test::ios::kWaitForJSCompletionTimeout;
using base::test::ios::kWaitForPageLoadTimeout;
......@@ -86,8 +85,7 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
}
- (BOOL)isKeyboardShownWithError:(NSError**)error {
return
[EarlGrey isKeyboardShownWithError:error];
return [EarlGrey isKeyboardShownWithError:error];
}
- (BOOL)isIPadIdiom {
......
......@@ -111,11 +111,6 @@ void ResetAuthentication() {
void RemoveInfoBarsAndPresentedState() {
[ChromeTestCaseAppInterface removeInfoBarsAndPresentedState];
}
UIDeviceOrientation GetCurrentDeviceOrientation() {
return [[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] orientation];
}
} // namespace
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] 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
// attempt to run in other orientations.
[ChromeEarlGrey rotateDeviceToOrientation:_originalOrientation error:nil];
......@@ -365,7 +361,8 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface)
gIsMockAuthenticationDisabled = NO;
_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
......
......@@ -10,14 +10,6 @@
#error "This file requires ARC support."
#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()
: saved_eg_synchronization_enabled_value_(GetEgSynchronizationEnabled()) {
SetEgSynchronizationEnabled(NO);
......@@ -28,11 +20,12 @@ ScopedSynchronizationDisabler::~ScopedSynchronizationDisabler() {
}
bool ScopedSynchronizationDisabler::GetEgSynchronizationEnabled() {
return [GetSharedGREYConfiguration()
return [[GREYConfiguration sharedConfiguration]
boolValueForConfigKey:kGREYConfigKeySynchronizationEnabled];
}
void ScopedSynchronizationDisabler::SetEgSynchronizationEnabled(BOOL flag) {
[GetSharedGREYConfiguration() setValue:@(flag)
forConfigKey:kGREYConfigKeySynchronizationEnabled];
[[GREYConfiguration sharedConfiguration]
setValue:@(flag)
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