Commit 18926aac authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Revert "Enable -Wunreachable-code in iOS builds (except for internal builds)."

This reverts commit a7b569e6.

Reason for revert: Closed the tree

Original change's description:
> Enable -Wunreachable-code in iOS builds (except for internal builds).
> 
> This requires replacing EARL_GREY_TEST_DISABLED with DISABLED_ prefixes
> in cases where the call to EARL_GREY_TEST_DISABLED is unconditional.
> earl_grey/disabled_test_macros.h, which defines EARL_GREY_TEST_DISABLED,
> says:
> 
>     This macro should be used when the configuration for which the
>     test should be disabled can only be determined at runtime.
>     Disabling at compile-time is always preferred.
> 
> So this matches the official guidance, and there are many
> egtests that use DISABLED_ already.
> 
> Bug: 346399
> Change-Id: Ibe51463ec0e6afbd1b3bef629406163118efa64c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2125878
> Auto-Submit: Nico Weber <thakis@chromium.org>
> Commit-Queue: Nico Weber <thakis@chromium.org>
> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#754468}

TBR=thakis@chromium.org,sdefresne@chromium.org

Change-Id: Ib0ccce331d5063a2f22ed9c25ebdf40bf3bd19d4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 346399
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2127487Reviewed-by: default avatarDominique Fauteux-Chapleau <domfc@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754470}
parent 763a1a19
......@@ -1591,8 +1591,7 @@ config("chromium_code") {
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if (!is_nacl && !use_libfuzzer &&
!(is_ios && ios_app_bundle_id_prefix != "org.chromium")) {
if (!is_nacl && !use_libfuzzer && target_os != "ios") {
cflags += [ "-Wunreachable-code" ]
}
......
......@@ -304,7 +304,9 @@ void V4GetHashProtocolManager::GetFullHashes(
// TODO(crbug.com/1028755): Enable full hash checks on iOS.
#if defined(OS_IOS)
std::move(callback).Run(cached_full_hash_infos);
#else
return;
#endif
net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("safe_browsing_v4_get_hash", R"(
semantics {
......@@ -359,7 +361,6 @@ void V4GetHashProtocolManager::GetFullHashes(
clock_->Now()));
UMA_HISTOGRAM_COUNTS_100("SafeBrowsing.V4GetHash.CountOfPrefixes",
prefixes_to_request.size());
#endif
}
void V4GetHashProtocolManager::GetFullHashesWithApis(
......
......@@ -200,13 +200,12 @@ void SignOut() {
// //chrome/browser/metrics/ukm_browsertest.cc
// Make sure that UKM is disabled while an incognito tab is open.
- (void)testRegularPlusIncognito {
#if defined(CHROME_EARL_GREY_1)
// TODO(crbug.com/1033726): EG1 Test fails on iOS 12.
#define MAYBE_testRegularPlusIncognito DISABLED_testRegularPlusIncognito
#else
#define MAYBE_testRegularPlusIncognito testRegularPlusIncognito
// TODO(crbug.com/1033726): EG1 Test fails on iOS 12.
EARL_GREY_TEST_DISABLED(@"EG1 Fails");
#endif
- (void)MAYBE_testRegularPlusIncognito {
uint64_t originalClientID = [MetricsAppInterface UKMClientID];
OpenNewIncognitoTab();
......@@ -236,13 +235,12 @@ void SignOut() {
}
// Make sure opening a real tab after Incognito doesn't enable UKM.
- (void)testIncognitoPlusRegular {
#if defined(CHROME_EARL_GREY_1)
// TODO(crbug.com/1033726): EG1 Test fails on iOS 12.
#define MAYBE_testIncognitoPlusRegular DISABLED_testIncognitoPlusRegular
#else
#define MAYBE_testIncognitoPlusRegular testIncognitoPlusRegular
// TODO(crbug.com/1033726): EG1 Test fails on iOS 12.
EARL_GREY_TEST_DISABLED(@"EG1 Fails");
#endif
- (void)MAYBE_testIncognitoPlusRegular {
uint64_t originalClientID = [MetricsAppInterface UKMClientID];
[ChromeEarlGrey closeAllTabs];
[ChromeEarlGrey waitForMainTabCount:0];
......
......@@ -1207,8 +1207,10 @@ void TestResponseProvider::GetLanguageResponse(
// Tests that "Never Translate ..." is automatically triggered only for a
// maximum number of times if refused by the user.
// TODO(crbug.com/945118): Re-enable when fixed.
- (void)DISABLED_testInfobarAutoNeverTranslateMaxTries {
- (void)testInfobarAutoNeverTranslateMaxTries {
// TODO(crbug.com/945118): Re-enable when fixed.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
// Start the HTTP server.
std::unique_ptr<web::DataResponseProvider> provider(new TestResponseProvider);
web::test::SetUpHttpServer(std::move(provider));
......
......@@ -240,19 +240,18 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
}
// Test that swiping left to right navigate back.
// TODO(crbug.com/768339): This test is faling on devices because
// grey_swipeFastInDirectionWithStartPoint does not work.
#if !TARGET_IPHONE_SIMULATOR
#define MAYBE_testNavigateBackWithGesture DISABLED_testNavigateBackWithGesture
#else
#define MAYBE_testNavigateBackWithGesture testNavigateBackWithGesture
#endif
- (void)MAYBE_testNavigateBackWithGesture {
- (void)testNavigateBackWithGesture {
// Disabled on iPad as there is not "navigate back" gesture.
if ([ChromeEarlGrey isIPadIdiom]) {
EARL_GREY_TEST_SKIPPED(@"Test not applicable for iPad");
}
// TODO(crbug.com/768339): This test is faling on devices because
// grey_swipeFastInDirectionWithStartPoint does not work.
#if !TARGET_IPHONE_SIMULATOR
EARL_GREY_TEST_DISABLED(@"Test disabled on devices.");
#endif
if (@available(iOS 13, *)) {
// Navigate back side swipe gesture does not work on iOS13 simulator. This
// is not specific to Bookmarks. The issue is that the gesture needs to
......
......@@ -532,9 +532,11 @@ void TapSuppressDialogsButton() {
}
// Tests that an alert is presented after displaying the share menu.
// TODO(crbug.com/747622): re-enable this test once earl grey can interact
// with the share menu.
- (void)DISABLED_testShowJavaScriptAfterShareMenu {
- (void)testShowJavaScriptAfterShareMenu {
// TODO(crbug.com/747622): re-enable this test once earl grey can interact
// with the share menu.
EARL_GREY_TEST_DISABLED(@"Disabled until EG can use share menu.");
// Load the blank test page.
const GURL kURL = self.testServer->GetURL(kAlertURLPath);
[ChromeEarlGrey loadURL:kURL];
......
......@@ -116,14 +116,11 @@ void AssertURLIs(const GURL& expectedURL) {
// Verifies that the toolbar is not hidden when scrolling a short pdf, as the
// entire document is visible without hiding the toolbar.
#if defined(CHROME_EARL_GREY_2)
- (void)testSmallWidePDFScroll {
// TODO(crbug.com/1022029): Enable this test.
#define MAYBE_testSmallWidePDFScroll DISABLED_testSmallWidePDFScroll
#else
#define MAYBE_testSmallWidePDFScroll testSmallWidePDFScroll
#endif
- (void)MAYBE_testSmallWidePDFScroll {
#if defined(CHROME_EARL_GREY_1)
#if defined(CHROME_EARL_GREY_2)
EARL_GREY_TEST_DISABLED(@"Fails with EG2");
#elif defined(CHROME_EARL_GREY_1)
// TODO(crbug.com/1036221): EG1 Test fails on iOS 12.
if (!base::ios::IsRunningOnIOS13OrLater()) {
EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12.");
......
......@@ -150,13 +150,10 @@ id<GREYMatcher> SearchCopiedTextButton() {
// Tests that the XClientData header is sent when navigating to
// https://google.com through the omnibox.
- (void)testXClientData {
#if defined(CHROME_EARL_GREY_1)
// Flaky on EG1.
#define MAYBE_testXClientData DISABLED_testXClientData
#else
#define MAYBE_testXClientData testXClientData
EARL_GREY_TEST_DISABLED(@"Flaky on EG1.");
#endif
- (void)MAYBE_testXClientData {
// Rewrite the google URL to localhost URL.
[OmniboxAppInterface rewriteGoogleURLToLocalhost];
......
......@@ -133,14 +133,16 @@ using chrome_test_util::SystemSelectionCalloutCopyButton;
// Tests whether input mode in an omnibox can be canceled via tapping the typing
// shield and asserts it doesn't commit the omnibox contents if the input is
// canceled.
// TODO(crbug.com/753098): Re-enable this test on iPad once grey_typeText
// works on iOS 11.
- (void)DISABLED_testToolbarOmniboxTypingShield {
- (void)testToolbarOmniboxTypingShield {
// Tablet only (handset keyboard does not have "hide keyboard" button).
if (![ChromeEarlGrey isIPadIdiom]) {
EARL_GREY_TEST_SKIPPED(@"Test not support on iPhone");
}
// TODO(crbug.com/753098): Re-enable this test on iPad once grey_typeText
// works on iOS 11.
EARL_GREY_TEST_DISABLED(@"Test disabled on iPad.");
const GURL URL = web::test::HttpServer::MakeUrl("http://origin");
[ChromeEarlGrey loadURL:URL];
......@@ -201,9 +203,11 @@ using chrome_test_util::SystemSelectionCalloutCopyButton;
}
// Verifies that copying and pasting a URL includes the hidden protocol prefix.
// TODO(crbug.com/834345): Enable this test when long press on the steady
// location bar is supported.
- (void)DISABLED_testCopyPasteURL {
- (void)testCopyPasteURL {
// TODO(crbug.com/834345): Enable this test when long press on the steady
// location bar is supported.
EARL_GREY_TEST_SKIPPED(@"Test not supported yet in UI Refresh.");
// Clear generalPasteboard before and after the test.
[UIPasteboard generalPasteboard].string = @"";
[self setTearDownHandler:^{
......
......@@ -18,11 +18,13 @@
namespace ios_web_view {
void InitializeGlobalState() {
#if defined(UNIT_TEST)
// Do not perform global state initialization in an unit test environment.
// 1. Not needed when unit testing.
// 2. The globals below will try to create other already created globals like
// AtExitManagers. This causes DCHECKs and prevents tests from completing.
#if !defined(UNIT_TEST)
return;
#endif // defined(UNIT_TEST)
static std::unique_ptr<ios_web_view::WebViewWebClient> web_client;
static std::unique_ptr<ios_web_view::WebViewWebMainDelegate>
web_main_delegate;
......@@ -49,7 +51,6 @@ void InitializeGlobalState() {
web_client.reset();
}];
});
#endif // defined(UNIT_TEST)
}
} // namespace ios_web_view
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