
The size is set up for each test to have a different window size, which is not used. Remove it and use a constant. The browser also sends the size to the main frame widget in between each test through a visual properties sync. We don't need the renderer to do a synchronous resize between tests or when a new window is created. However on mac, the renderer lying about the size was required for it to "hear" about the window screen rect. The browser in headless mode does not resize an actual OS window, which means the browser doesn't end up hearing about the window's size or position. That results in the RenderWidgetHost telling the renderer the window screen rect is an empty rect. We fix this by subclassing the ShellPlatformDelegate for web tests (as the WebTestShellPlatformDelegate) and overriding the ResizeWebContent() method in headless web tests to tell the RenderWidgetHostViewMac directly, skipping past the OS notification cycle. This requires access to //content/browser which is why we must split it off into the web_test/ directory. While doing so, we move all headless code in ShellPlatformDelegate for mac over to the web test directory. We'd like to do this for all platforms and then the production code wouldn't need to know about headless, which is a web test feature. R=avi@chromium.org TBR=dcheng Bug: 866140 Change-Id: Ic18fb978c9f672ab124f631247cd549d663f20ce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2180920 Commit-Queue: danakj <danakj@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#768469}
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CONTENT_SHELL_BROWSER_WEB_TEST_WEB_TEST_BROWSER_MAIN_PARTS_H_
|
|
#define CONTENT_SHELL_BROWSER_WEB_TEST_WEB_TEST_BROWSER_MAIN_PARTS_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "base/macros.h"
|
|
#include "build/build_config.h"
|
|
#include "content/shell/browser/shell_browser_main_parts.h"
|
|
#include "ppapi/buildflags/buildflags.h"
|
|
|
|
namespace content {
|
|
|
|
class ShellPluginServiceFilter;
|
|
|
|
class WebTestBrowserMainParts : public ShellBrowserMainParts {
|
|
public:
|
|
explicit WebTestBrowserMainParts(const MainFunctionParams& parameters);
|
|
~WebTestBrowserMainParts() override;
|
|
|
|
private:
|
|
// ShellBrowserMainParts overrides.
|
|
void InitializeBrowserContexts() override;
|
|
void InitializeMessageLoopContext() override;
|
|
std::unique_ptr<ShellPlatformDelegate> CreateShellPlatformDelegate() override;
|
|
|
|
#if BUILDFLAG(ENABLE_PLUGINS)
|
|
std::unique_ptr<ShellPluginServiceFilter> plugin_service_filter_;
|
|
#endif
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WebTestBrowserMainParts);
|
|
};
|
|
|
|
} // namespace content
|
|
|
|
#endif // CONTENT_SHELL_BROWSER_WEB_TEST_WEB_TEST_BROWSER_MAIN_PARTS_H_
|