Commit dc70013d authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Support Mac headless download

Restore support of file download with headless Chrome on Mac. The feature
was previously disabled due to test failures. The cause of the failures
has been identified as https://crbug.com/1011000, which only affects
Chrome build with unusual combination of build flags (including commit
queue, but not normal releases).

Bug: chromedriver:2991
Change-Id: I8960f379ba0b536714bad47f72be59841da2ab9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838951
Commit-Queue: John Chen <johnchen@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702622}
parent 3ad99c1e
......@@ -5,7 +5,6 @@
#include "chrome/test/chromedriver/chrome/download_directory_override_manager.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/test/chromedriver/chrome/browser_info.h"
#include "chrome/test/chromedriver/chrome/devtools_client.h"
#include "chrome/test/chromedriver/chrome/status.h"
......@@ -34,14 +33,6 @@ Status DownloadDirectoryOverrideManager::OnConnected(DevToolsClient* client) {
}
Status DownloadDirectoryOverrideManager::ApplyOverride() {
// Currently whenever a Page.setDownloadBehavior gets sent
// in headless mode on OS_MACOSX, headless chrome crashes.
// Filed a bug with chromium that can be followed here:
// https://bugs.chromium.org/p/chromium/issues/detail?id=979847
#if defined(OS_MACOSX)
return Status(kOk);
#endif
base::DictionaryValue params;
params.SetString("behavior", "allow");
params.SetString("downloadPath", *download_directory_);
......
......@@ -4,7 +4,6 @@
#include "chrome/test/chromedriver/chrome/download_directory_override_manager.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/test/chromedriver/chrome/recorder_devtools_client.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -40,16 +39,6 @@ TEST(DownloadDirectoryOverrideManager, OverrideSendsCommand) {
manager.OverrideDownloadDirectoryWhenConnected(directory).code());
ASSERT_EQ(0u, client.commands_.size());
// Currently headless chrome download does not work
// for MAC_OSX so it is designed to always return
// true without sending a command. For more info:
// https://bugs.chromium.org/p/chromium/issues/detail?id=979847
#if defined(OS_MACOSX)
ASSERT_EQ(kOk, manager.OnConnected(&client).code());
ASSERT_EQ(0u, client.commands_.size());
return;
#endif
// On connected is called and the directory should now
// be overridden to 'download/directory'
ASSERT_EQ(kOk, manager.OnConnected(&client).code());
......
......@@ -190,6 +190,10 @@ class ChromeDriver(object):
assert type(chrome_switches) is list
options['args'] = chrome_switches
# TODO(crbug.com/1011000): Work around a bug with headless on Mac.
if util.GetPlatformName() == 'mac' and '--headless' in chrome_switches:
options['excludeSwitches'] = ['--enable-logging']
if mobile_emulation:
assert type(mobile_emulation) is dict
options['mobileEmulation'] = mobile_emulation
......
......@@ -107,9 +107,6 @@ _OS_SPECIFIC_FILTER['mac'] = [
'MobileEmulationCapabilityTest.testTapElement',
# https://bugs.chromium.org/p/chromium/issues/detail?id=946023
'ChromeDriverTest.testWindowFullScreen',
'ChromeDownloadDirTest.testFileDownloadAfterTabHeadless',
'ChromeDownloadDirTest.testFileDownloadWithClickHeadless',
'ChromeDownloadDirTest.testFileDownloadWithGetHeadless',
]
_DESKTOP_NEGATIVE_FILTER = [
......
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