diff options
| author | paulmeyer <paulmeyer@chromium.org> | 2015-02-11 13:51:59 -0800 | 
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2015-02-11 21:52:43 +0000 | 
| commit | bcc6ad206157d40f39a8023eb1d19e0dc443cb0d (patch) | |
| tree | e63719e74bb197b1756c56748cabfe6a964f74fb | |
| parent | 04de1b4d91ee03a315814a1afc3d3893f220c47c (diff) | |
| download | chromium_src-bcc6ad206157d40f39a8023eb1d19e0dc443cb0d.zip chromium_src-bcc6ad206157d40f39a8023eb1d19e0dc443cb0d.tar.gz chromium_src-bcc6ad206157d40f39a8023eb1d19e0dc443cb0d.tar.bz2 | |
Chromium-side patch to rename "--dump-render-tree" to "--run-layout-test".
At this point, "--run-layout-test" is the flag that is actually functional, and using "--dump-render-tree" simply causes the "--run-layout-test" to be appended to the command line.
A subsequent Blink patch will change the scripts in Blink to use "--run-layout-test" instead of "--dump-render-tree".
This patch was originally uploaded here and then reverted: https://codereview.chromium.org/899103002/ . This patch introduces fixes for the issues that led to the original being reverted.
BUG=453252
Review URL: https://codereview.chromium.org/891903006
Cr-Commit-Position: refs/heads/master@{#315840}
13 files changed, 47 insertions, 29 deletions
| diff --git a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java index b73d479..44a854c 100644 --- a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java +++ b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java @@ -57,6 +57,9 @@ public abstract class ContentSwitches {      // Native switch - shell_switches::kDumpRenderTree      public static final String DUMP_RENDER_TREE = "dump-render-tree"; +    // Native switch - shell_switches::kRunLayoutTest +    public static final String RUN_LAYOUT_TEST = "run-layout-test"; +      // Native switch - chrome_switches::kDisablePopupBlocking      public static final String DISABLE_POPUP_BLOCKING = "disable-popup-blocking"; diff --git a/content/public/test/content_browser_test.cc b/content/public/test/content_browser_test.cc index 0408c8a..a6802124 100644 --- a/content/public/test/content_browser_test.cc +++ b/content/public/test/content_browser_test.cc @@ -74,7 +74,7 @@ void ContentBrowserTest::SetUp() {      // setting a global that may be used after ContentBrowserTest is      // destroyed.      ContentRendererClient* old_client = -        command_line->HasSwitch(switches::kDumpRenderTree) +        command_line->HasSwitch(switches::kRunLayoutTest)              ? SetRendererClientForTesting(new LayoutTestContentRendererClient)              : SetRendererClientForTesting(new ShellContentRendererClient);      // No-one should have set this value before we did. @@ -117,7 +117,7 @@ void ContentBrowserTest::TearDown() {  void ContentBrowserTest::RunTestOnMainThreadLoop() {    if (!base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) { +          switches::kRunLayoutTest)) {      CHECK_EQ(Shell::windows().size(), 1u);      shell_ = Shell::windows()[0];    } diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java index 2d94b12..6053798 100644 --- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java +++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java @@ -83,7 +83,8 @@ public class ContentShellActivity extends Activity {              mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));          } -        if (CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) { +        if (CommandLine.getInstance().hasSwitch(ContentSwitches.RUN_LAYOUT_TEST) +                || CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) {              try {                  BrowserStartupController.get(this).startBrowserProcessesSync(false);              } catch (ProcessInitException e) { diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc index de0b758..1ef486c 100644 --- a/content/shell/app/shell_main_delegate.cc +++ b/content/shell/app/shell_main_delegate.cc @@ -114,6 +114,14 @@ ShellMainDelegate::~ShellMainDelegate() {  }  bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { +  base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); + +  // "dump-render-tree" has been renamed to "run-layout-test", but the old +  // flag name is still used in some places, so this check will remain until +  // it is phased out entirely. +  if (command_line.HasSwitch(switches::kDumpRenderTree)) +    command_line.AppendSwitch(switches::kRunLayoutTest); +  #if defined(OS_WIN)    // Enable trace control and transport through event tracing for Windows.    logging::LogEventProvider::Initialize(kContentShellProviderName); @@ -129,7 +137,6 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {  #endif  // OS_MACOSX    InitLogging(); -  base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();    if (command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)) {      // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we      // continue and try to load the fonts in BlinkTestPlatformInitialize @@ -141,7 +148,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {      }    } -  if (command_line.HasSwitch(switches::kDumpRenderTree)) { +  if (command_line.HasSwitch(switches::kRunLayoutTest)) {      EnableBrowserLayoutTestMode();      command_line.AppendSwitch(switches::kProcessPerTab); @@ -262,7 +269,7 @@ int ShellMainDelegate::RunProcess(    browser_runner_.reset(BrowserMainRunner::Create());    base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); -  return command_line.HasSwitch(switches::kDumpRenderTree) || +  return command_line.HasSwitch(switches::kRunLayoutTest) ||                   command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)               ? LayoutTestBrowserMain(main_function_params, browser_runner_)               : ShellBrowserMain(main_function_params, browser_runner_); @@ -318,7 +325,7 @@ void ShellMainDelegate::InitializeResourceBundle() {  ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {    browser_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( -                            switches::kDumpRenderTree) +                            switches::kRunLayoutTest)                              ? new LayoutTestContentBrowserClient                              : new ShellContentBrowserClient); @@ -327,7 +334,7 @@ ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {  ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() {    renderer_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( -                             switches::kDumpRenderTree) +                             switches::kRunLayoutTest)                               ? new LayoutTestContentRendererClient                               : new ShellContentRendererClient); diff --git a/content/shell/app/shell_main_delegate_mac.mm b/content/shell/app/shell_main_delegate_mac.mm index 319171f..bba20a1 100644 --- a/content/shell/app/shell_main_delegate_mac.mm +++ b/content/shell/app/shell_main_delegate_mac.mm @@ -29,7 +29,7 @@ void EnsureCorrectResolutionSettings() {            initWithContentsOfFile:base::mac::FilePathToNSString(info_plist)]);    bool running_layout_tests = base::CommandLine::ForCurrentProcess()->HasSwitch( -      switches::kDumpRenderTree); +      switches::kRunLayoutTest);    bool not_high_resolution_capable =        [info_dict objectForKey:kHighResolutionCapable] &&        [[info_dict objectForKey:kHighResolutionCapable] isEqualToNumber:@(NO)]; diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index 546e5e3..bdd44fd 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc @@ -86,7 +86,7 @@ Shell::Shell(WebContents* web_contents)        headless_(false) {    const base::CommandLine& command_line =        *base::CommandLine::ForCurrentProcess(); -  if (command_line.HasSwitch(switches::kDumpRenderTree)) +  if (command_line.HasSwitch(switches::kRunLayoutTest))      headless_ = true;    windows_.push_back(this); @@ -127,7 +127,7 @@ Shell* Shell::CreateShell(WebContents* web_contents,    shell->PlatformResizeSubViews();    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) { +          switches::kRunLayoutTest)) {      web_contents->GetMutableRendererPrefs()->use_custom_colors = false;      web_contents->GetRenderViewHost()->SyncRendererPrefs();    } @@ -218,7 +218,7 @@ void Shell::AddNewContents(WebContents* source,                             bool* was_blocked) {    CreateShell(new_contents, AdjustWindowSize(initial_rect.size()));    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      NotifyDoneForwarder::CreateForWebContents(new_contents);  } @@ -317,7 +317,7 @@ void Shell::ToggleFullscreenModeForTab(WebContents* web_contents,    PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen);  #endif    if (!base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    if (is_fullscreen_ != enter_fullscreen) {      is_fullscreen_ = enter_fullscreen; @@ -360,7 +360,7 @@ JavaScriptDialogManager* Shell::GetJavaScriptDialogManager(    if (!dialog_manager_) {      const base::CommandLine& command_line =          *base::CommandLine::ForCurrentProcess(); -    dialog_manager_.reset(command_line.HasSwitch(switches::kDumpRenderTree) +    dialog_manager_.reset(command_line.HasSwitch(switches::kRunLayoutTest)          ? new LayoutTestJavaScriptDialogManager          : new ShellJavaScriptDialogManager);    } @@ -373,12 +373,12 @@ bool Shell::AddMessageToConsole(WebContents* source,                                  int32 line_no,                                  const base::string16& source_id) {    return base::CommandLine::ForCurrentProcess()->HasSwitch( -      switches::kDumpRenderTree); +      switches::kRunLayoutTest);  }  void Shell::RendererUnresponsive(WebContents* source) {    if (!base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    WebKitTestController::Get()->RendererUnresponsive();  } @@ -393,7 +393,7 @@ void Shell::DeactivateContents(WebContents* contents) {  void Shell::WorkerCrashed(WebContents* source) {    if (!base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    WebKitTestController::Get()->WorkerCrashed();  } diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 9b8a2f4..89572d5 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -139,7 +139,7 @@ ShellContentBrowserClient::~ShellContentBrowserClient() {  BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(      const MainFunctionParams& parameters) {    shell_browser_main_parts_ = base::CommandLine::ForCurrentProcess()->HasSwitch( -                                  switches::kDumpRenderTree) +                                  switches::kRunLayoutTest)                                    ? new LayoutTestBrowserMainParts(parameters)                                    : new ShellBrowserMainParts(parameters);    return shell_browser_main_parts_; @@ -203,8 +203,8 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(      base::CommandLine* command_line,      int child_process_id) {    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) -    command_line->AppendSwitch(switches::kDumpRenderTree); +          switches::kRunLayoutTest)) +    command_line->AppendSwitch(switches::kRunLayoutTest);    if (base::CommandLine::ForCurrentProcess()->HasSwitch(            switches::kEnableFontAntialiasing))      command_line->AppendSwitch(switches::kEnableFontAntialiasing); @@ -249,7 +249,7 @@ void ShellContentBrowserClient::OverrideWebkitPrefs(      const GURL& url,      WebPreferences* prefs) {    if (!base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    WebKitTestController::Get()->OverrideWebkitPrefs(prefs);  } @@ -257,7 +257,7 @@ void ShellContentBrowserClient::OverrideWebkitPrefs(  void ShellContentBrowserClient::ResourceDispatcherHostCreated() {    resource_dispatcher_host_delegate_.reset(        base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree) +          switches::kRunLayoutTest)            ? new LayoutTestResourceDispatcherHostDelegate            : new ShellResourceDispatcherHostDelegate);    ResourceDispatcherHost::Get()->SetDelegate( diff --git a/content/shell/browser/shell_web_contents_view_delegate_mac.mm b/content/shell/browser/shell_web_contents_view_delegate_mac.mm index 78ffc27..5d8ecdd 100644 --- a/content/shell/browser/shell_web_contents_view_delegate_mac.mm +++ b/content/shell/browser/shell_web_contents_view_delegate_mac.mm @@ -96,7 +96,7 @@ void ShellWebContentsViewDelegate::ShowContextMenu(      RenderFrameHost* render_frame_host,      const ContextMenuParams& params) {    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    params_ = params; diff --git a/content/shell/browser/shell_web_contents_view_delegate_win.cc b/content/shell/browser/shell_web_contents_view_delegate_win.cc index 672791b..757cb40 100644 --- a/content/shell/browser/shell_web_contents_view_delegate_win.cc +++ b/content/shell/browser/shell_web_contents_view_delegate_win.cc @@ -73,7 +73,7 @@ void ShellWebContentsViewDelegate::ShowContextMenu(      RenderFrameHost* render_frame_host,      const ContextMenuParams& params) {    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) +          switches::kRunLayoutTest))      return;    params_ = params; diff --git a/content/shell/common/shell_content_client.cc b/content/shell/common/shell_content_client.cc index db521d4..f9d4591 100644 --- a/content/shell/common/shell_content_client.cc +++ b/content/shell/common/shell_content_client.cc @@ -35,7 +35,7 @@ std::string ShellContentClient::GetUserAgent() const {  base::string16 ShellContentClient::GetLocalizedString(int message_id) const {    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) { +          switches::kRunLayoutTest)) {      switch (message_id) {        case IDS_FORM_OTHER_DATE_LABEL:          return base::ASCIIToUTF16("<<OtherDateLabel>>"); @@ -62,7 +62,7 @@ base::StringPiece ShellContentClient::GetDataResource(      int resource_id,      ui::ScaleFactor scale_factor) const {    if (base::CommandLine::ForCurrentProcess()->HasSwitch( -          switches::kDumpRenderTree)) { +          switches::kRunLayoutTest)) {      switch (resource_id) {        case IDR_BROKENIMAGE:  #if defined(OS_MACOSX) diff --git a/content/shell/common/shell_switches.cc b/content/shell/common/shell_switches.cc index 6a7a48b..d2f0a29 100644 --- a/content/shell/common/shell_switches.cc +++ b/content/shell/common/shell_switches.cc @@ -25,7 +25,9 @@ const char kCrashDumpsDir[] = "crash-dumps-dir";  // causes the leak detector to cause immediate crash when found leak.  const char kCrashOnFailure[] = "crash-on-failure"; -// Request pages to be dumped as text once they finished loading. +// Request the render trees of pages to be dumped as text once they have +// finished loading. Note that this switch has been deprecated, and the +// identically functioning |kRunLayoutTest| switch should be used instead.  const char kDumpRenderTree[] = "dump-render-tree";  // Expose window.ipcTester object for testing @@ -53,9 +55,13 @@ const char kExposeInternalsForTesting[] = "expose-internals-for-testing";  // with a semicolon (;).  const char kRegisterFontFiles[] = "register-font-files"; +// Request the render trees of pages to be dumped as text once they have +// finished loading. +const char kRunLayoutTest[] = "run-layout-test"; +  // This makes us disable some web-platform runtime features so that we test  // content_shell as if it was a stable release. It is only followed when -// kDumpRenderTree is set. For the features' level, see +// kRunLayoutTest is set. For the features' level, see  // http://dev.chromium.org/blink/runtime-enabled-features.  const char kStableReleaseMode[] = "stable-release-mode"; diff --git a/content/shell/common/shell_switches.h b/content/shell/common/shell_switches.h index 48dccbb..8ebbc98 100644 --- a/content/shell/common/shell_switches.h +++ b/content/shell/common/shell_switches.h @@ -23,6 +23,7 @@ extern const char kEnableLeakDetection[];  extern const char kEncodeBinary[];  extern const char kExposeInternalsForTesting[];  extern const char kRegisterFontFiles[]; +extern const char kRunLayoutTest[];  extern const char kStableReleaseMode[];  extern const char kContentShellHostWindowSize[]; diff --git a/content/shell/tools/breakpad_integration_test.py b/content/shell/tools/breakpad_integration_test.py index cfb0312..1e5d4ba 100755 --- a/content/shell/tools/breakpad_integration_test.py +++ b/content/shell/tools/breakpad_integration_test.py @@ -75,7 +75,7 @@ def main():      print "# Run content_shell and make it crash."      cmd = [options.binary, -           '--dump-render-tree', +           '--run-layout-test',             'chrome://crash',             '--enable-crash-reporter',             '--crash-dumps-dir=%s' % crash_dir] | 
