| Index: content/shell/test_runner/test_runner.cc
|
| diff --git a/components/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc
|
| similarity index 94%
|
| rename from components/test_runner/test_runner.cc
|
| rename to content/shell/test_runner/test_runner.cc
|
| index 77fc4fb9381b16c53cbd9ca02969515d433589bb..bbee54dc0d5d1e32cb6e5fbc1e300168c2db5677 100644
|
| --- a/components/test_runner/test_runner.cc
|
| +++ b/content/shell/test_runner/test_runner.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/test_runner/test_runner.h"
|
| +#include "content/shell/test_runner/test_runner.h"
|
|
|
| #include <stddef.h>
|
| #include <limits>
|
| @@ -16,22 +16,22 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "build/build_config.h"
|
| -#include "components/test_runner/layout_and_paint_async_then.h"
|
| -#include "components/test_runner/layout_dump.h"
|
| -#include "components/test_runner/mock_content_settings_client.h"
|
| -#include "components/test_runner/mock_credential_manager_client.h"
|
| -#include "components/test_runner/mock_screen_orientation_client.h"
|
| -#include "components/test_runner/mock_web_document_subresource_filter.h"
|
| -#include "components/test_runner/mock_web_speech_recognizer.h"
|
| -#include "components/test_runner/mock_web_user_media_client.h"
|
| -#include "components/test_runner/pixel_dump.h"
|
| -#include "components/test_runner/spell_check_client.h"
|
| -#include "components/test_runner/test_common.h"
|
| -#include "components/test_runner/test_interfaces.h"
|
| -#include "components/test_runner/test_preferences.h"
|
| -#include "components/test_runner/test_runner_for_specific_view.h"
|
| -#include "components/test_runner/web_test_delegate.h"
|
| -#include "components/test_runner/web_view_test_proxy.h"
|
| +#include "content/shell/test_runner/layout_and_paint_async_then.h"
|
| +#include "content/shell/test_runner/layout_dump.h"
|
| +#include "content/shell/test_runner/mock_content_settings_client.h"
|
| +#include "content/shell/test_runner/mock_credential_manager_client.h"
|
| +#include "content/shell/test_runner/mock_screen_orientation_client.h"
|
| +#include "content/shell/test_runner/mock_web_document_subresource_filter.h"
|
| +#include "content/shell/test_runner/mock_web_speech_recognizer.h"
|
| +#include "content/shell/test_runner/mock_web_user_media_client.h"
|
| +#include "content/shell/test_runner/pixel_dump.h"
|
| +#include "content/shell/test_runner/spell_check_client.h"
|
| +#include "content/shell/test_runner/test_common.h"
|
| +#include "content/shell/test_runner/test_interfaces.h"
|
| +#include "content/shell/test_runner/test_preferences.h"
|
| +#include "content/shell/test_runner/test_runner_for_specific_view.h"
|
| +#include "content/shell/test_runner/web_test_delegate.h"
|
| +#include "content/shell/test_runner/web_view_test_proxy.h"
|
| #include "gin/arguments.h"
|
| #include "gin/array_buffer.h"
|
| #include "gin/handle.h"
|
| @@ -276,7 +276,8 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
|
| int max_height);
|
| std::string EvaluateInWebInspectorOverlay(const std::string& script);
|
| v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue(
|
| - int world_id, const std::string& script);
|
| + int world_id,
|
| + const std::string& script);
|
| bool FindString(const std::string& search_text,
|
| const std::vector<std::string>& options_array);
|
| bool HasCustomPageSizeStyle(int page_index);
|
| @@ -297,8 +298,7 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
|
| DISALLOW_COPY_AND_ASSIGN(TestRunnerBindings);
|
| };
|
|
|
| -gin::WrapperInfo TestRunnerBindings::kWrapperInfo = {
|
| - gin::kEmbedderNativeGin};
|
| +gin::WrapperInfo TestRunnerBindings::kWrapperInfo = {gin::kEmbedderNativeGin};
|
|
|
| // static
|
| void TestRunnerBindings::Install(
|
| @@ -711,7 +711,8 @@ bool TestRunnerBindings::CallShouldCloseOnWebView() {
|
| }
|
|
|
| void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme(
|
| - bool forbidden, const std::string& scheme) {
|
| + bool forbidden,
|
| + const std::string& scheme) {
|
| if (view_runner_)
|
| view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
|
| }
|
| @@ -767,7 +768,8 @@ void TestRunnerBindings::RemoveSpellCheckResolvedCallback() {
|
|
|
| v8::Local<v8::Value>
|
| TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue(
|
| - int world_id, const std::string& script) {
|
| + int world_id,
|
| + const std::string& script) {
|
| if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29))
|
| return v8::Local<v8::Value>();
|
| return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id,
|
| @@ -775,19 +777,22 @@ TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue(
|
| }
|
|
|
| void TestRunnerBindings::EvaluateScriptInIsolatedWorld(
|
| - int world_id, const std::string& script) {
|
| + int world_id,
|
| + const std::string& script) {
|
| if (view_runner_ && world_id > 0 && world_id < (1 << 29))
|
| view_runner_->EvaluateScriptInIsolatedWorld(world_id, script);
|
| }
|
|
|
| void TestRunnerBindings::SetIsolatedWorldSecurityOrigin(
|
| - int world_id, v8::Local<v8::Value> origin) {
|
| + int world_id,
|
| + v8::Local<v8::Value> origin) {
|
| if (view_runner_)
|
| view_runner_->SetIsolatedWorldSecurityOrigin(world_id, origin);
|
| }
|
|
|
| void TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy(
|
| - int world_id, const std::string& policy) {
|
| + int world_id,
|
| + const std::string& policy) {
|
| if (view_runner_)
|
| view_runner_->SetIsolatedWorldContentSecurityPolicy(world_id, policy);
|
| }
|
| @@ -798,8 +803,7 @@ void TestRunnerBindings::AddOriginAccessWhitelistEntry(
|
| const std::string& destination_host,
|
| bool allow_destination_subdomains) {
|
| if (runner_) {
|
| - runner_->AddOriginAccessWhitelistEntry(source_origin,
|
| - destination_protocol,
|
| + runner_->AddOriginAccessWhitelistEntry(source_origin, destination_protocol,
|
| destination_host,
|
| allow_destination_subdomains);
|
| }
|
| @@ -811,10 +815,9 @@ void TestRunnerBindings::RemoveOriginAccessWhitelistEntry(
|
| const std::string& destination_host,
|
| bool allow_destination_subdomains) {
|
| if (runner_) {
|
| - runner_->RemoveOriginAccessWhitelistEntry(source_origin,
|
| - destination_protocol,
|
| - destination_host,
|
| - allow_destination_subdomains);
|
| + runner_->RemoveOriginAccessWhitelistEntry(
|
| + source_origin, destination_protocol, destination_host,
|
| + allow_destination_subdomains);
|
| }
|
| }
|
|
|
| @@ -873,8 +876,8 @@ bool TestRunnerBindings::EnableAutoResizeMode(int min_width,
|
| int max_width,
|
| int max_height) {
|
| if (runner_) {
|
| - return runner_->EnableAutoResizeMode(min_width, min_height,
|
| - max_width, max_height);
|
| + return runner_->EnableAutoResizeMode(min_width, min_height, max_width,
|
| + max_height);
|
| }
|
| return false;
|
| }
|
| @@ -940,22 +943,14 @@ void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) {
|
| args->GetNext(&rotation_rate_gamma);
|
| args->GetNext(&interval);
|
|
|
| - runner_->SetMockDeviceMotion(has_acceleration_x, acceleration_x,
|
| - has_acceleration_y, acceleration_y,
|
| - has_acceleration_z, acceleration_z,
|
| - has_acceleration_including_gravity_x,
|
| - acceleration_including_gravity_x,
|
| - has_acceleration_including_gravity_y,
|
| - acceleration_including_gravity_y,
|
| - has_acceleration_including_gravity_z,
|
| - acceleration_including_gravity_z,
|
| - has_rotation_rate_alpha,
|
| - rotation_rate_alpha,
|
| - has_rotation_rate_beta,
|
| - rotation_rate_beta,
|
| - has_rotation_rate_gamma,
|
| - rotation_rate_gamma,
|
| - interval);
|
| + runner_->SetMockDeviceMotion(
|
| + has_acceleration_x, acceleration_x, has_acceleration_y, acceleration_y,
|
| + has_acceleration_z, acceleration_z, has_acceleration_including_gravity_x,
|
| + acceleration_including_gravity_x, has_acceleration_including_gravity_y,
|
| + acceleration_including_gravity_y, has_acceleration_including_gravity_z,
|
| + acceleration_including_gravity_z, has_rotation_rate_alpha,
|
| + rotation_rate_alpha, has_rotation_rate_beta, rotation_rate_beta,
|
| + has_rotation_rate_gamma, rotation_rate_gamma, interval);
|
| }
|
|
|
| void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) {
|
| @@ -978,10 +973,8 @@ void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) {
|
| args->GetNext(&gamma);
|
| args->GetNext(&absolute);
|
|
|
| - runner_->SetMockDeviceOrientation(has_alpha, alpha,
|
| - has_beta, beta,
|
| - has_gamma, gamma,
|
| - absolute);
|
| + runner_->SetMockDeviceOrientation(has_alpha, alpha, has_beta, beta, has_gamma,
|
| + gamma, absolute);
|
| }
|
|
|
| void TestRunnerBindings::SetMockScreenOrientation(
|
| @@ -1321,19 +1314,19 @@ std::string TestRunnerBindings::PathToLocalResource(const std::string& path) {
|
| }
|
|
|
| void TestRunnerBindings::SetBackingScaleFactor(
|
| - double value, v8::Local<v8::Function> callback) {
|
| + double value,
|
| + v8::Local<v8::Function> callback) {
|
| if (view_runner_)
|
| view_runner_->SetBackingScaleFactor(value, callback);
|
| }
|
|
|
| -void TestRunnerBindings::EnableUseZoomForDSF(
|
| - v8::Local<v8::Function> callback) {
|
| +void TestRunnerBindings::EnableUseZoomForDSF(v8::Local<v8::Function> callback) {
|
| if (view_runner_)
|
| view_runner_->EnableUseZoomForDSF(callback);
|
| }
|
|
|
| -void TestRunnerBindings::SetColorProfile(
|
| - const std::string& name, v8::Local<v8::Function> callback) {
|
| +void TestRunnerBindings::SetColorProfile(const std::string& name,
|
| + v8::Local<v8::Function> callback) {
|
| if (view_runner_)
|
| view_runner_->SetColorProfile(name, callback);
|
| }
|
| @@ -1403,13 +1396,15 @@ void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title,
|
| }
|
|
|
| void TestRunnerBindings::AddMockSpeechRecognitionResult(
|
| - const std::string& transcript, double confidence) {
|
| + const std::string& transcript,
|
| + double confidence) {
|
| if (runner_)
|
| runner_->AddMockSpeechRecognitionResult(transcript, confidence);
|
| }
|
|
|
| void TestRunnerBindings::SetMockSpeechRecognitionError(
|
| - const std::string& error, const std::string& message) {
|
| + const std::string& error,
|
| + const std::string& message) {
|
| if (runner_)
|
| runner_->SetMockSpeechRecognitionError(error, message);
|
| }
|
| @@ -1467,7 +1462,9 @@ void TestRunnerBindings::CapturePixelsAsyncThen(
|
| }
|
|
|
| void TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen(
|
| - int x, int y, v8::Local<v8::Function> callback) {
|
| + int x,
|
| + int y,
|
| + v8::Local<v8::Function> callback) {
|
| if (view_runner_)
|
| view_runner_->CopyImageAtAndCapturePixelsAsyncThen(x, y, callback);
|
| }
|
| @@ -1490,8 +1487,8 @@ void TestRunnerBindings::SetPermission(const std::string& name,
|
| if (!runner_)
|
| return;
|
|
|
| - return runner_->SetPermission(
|
| - name, value, GURL(origin), GURL(embedding_origin));
|
| + return runner_->SetPermission(name, value, GURL(origin),
|
| + GURL(embedding_origin));
|
| }
|
|
|
| void TestRunnerBindings::DispatchBeforeInstallPromptEvent(
|
| @@ -1546,8 +1543,7 @@ void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() {
|
| view_runner_->ForceNextDrawingBufferCreationToFail();
|
| }
|
|
|
| -void TestRunnerBindings::NotImplemented(const gin::Arguments& args) {
|
| -}
|
| +void TestRunnerBindings::NotImplemented(const gin::Arguments& args) {}
|
|
|
| TestRunner::WorkQueue::WorkQueue(TestRunner* controller)
|
| : frozen_(false), controller_(controller), weak_factory_(this) {}
|
| @@ -1741,7 +1737,6 @@ bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const {
|
| return layout_test_runtime_flags_.stay_on_page_after_handling_before_unload();
|
| }
|
|
|
| -
|
| void TestRunner::setShouldGeneratePixelResults(bool value) {
|
| layout_test_runtime_flags_.set_generate_pixel_results(value);
|
| OnLayoutTestRuntimeFlagsChanged();
|
| @@ -1967,8 +1962,7 @@ void TestRunner::setToolTipText(const WebString& text) {
|
| tooltip_text_ = text.utf8();
|
| }
|
|
|
| -void TestRunner::setDragImage(
|
| - const blink::WebImage& drag_image) {
|
| +void TestRunner::setDragImage(const blink::WebImage& drag_image) {
|
| if (layout_test_runtime_flags_.dump_drag_image()) {
|
| if (drag_image_.isNull())
|
| drag_image_ = drag_image;
|
| @@ -1992,9 +1986,9 @@ void TestRunner::SetV8CacheDisabled(bool disabled) {
|
| disable_v8_cache_ = disabled;
|
| return;
|
| }
|
| - main_view_->settings()->setV8CacheOptions(disabled ?
|
| - blink::WebSettings::V8CacheOptionsNone :
|
| - blink::WebSettings::V8CacheOptionsDefault);
|
| + main_view_->settings()->setV8CacheOptions(
|
| + disabled ? blink::WebSettings::V8CacheOptionsNone
|
| + : blink::WebSettings::V8CacheOptionsDefault);
|
| }
|
|
|
| void TestRunner::ShowDevTools(const std::string& settings,
|
| @@ -2008,7 +2002,7 @@ class WorkItemBackForward : public TestRunner::WorkItem {
|
|
|
| bool Run(WebTestDelegate* delegate, WebView*) override {
|
| delegate->GoToOffset(distance_);
|
| - return true; // FIXME: Did it really start a navigation?
|
| + return true; // FIXME: Did it really start a navigation?
|
| }
|
|
|
| private:
|
| @@ -2042,13 +2036,12 @@ void TestRunner::QueueReload() {
|
|
|
| class WorkItemLoadingScript : public TestRunner::WorkItem {
|
| public:
|
| - WorkItemLoadingScript(const std::string& script)
|
| - : script_(script) {}
|
| + WorkItemLoadingScript(const std::string& script) : script_(script) {}
|
|
|
| bool Run(WebTestDelegate*, WebView* web_view) override {
|
| web_view->mainFrame()->executeScript(
|
| WebScriptSource(WebString::fromUTF8(script_)));
|
| - return true; // FIXME: Did it really start a navigation?
|
| + return true; // FIXME: Did it really start a navigation?
|
| }
|
|
|
| private:
|
| @@ -2061,8 +2054,7 @@ void TestRunner::QueueLoadingScript(const std::string& script) {
|
|
|
| class WorkItemNonLoadingScript : public TestRunner::WorkItem {
|
| public:
|
| - WorkItemNonLoadingScript(const std::string& script)
|
| - : script_(script) {}
|
| + WorkItemNonLoadingScript(const std::string& script) : script_(script) {}
|
|
|
| bool Run(WebTestDelegate*, WebView* web_view) override {
|
| web_view->mainFrame()->executeScript(
|
| @@ -2085,7 +2077,7 @@ class WorkItemLoad : public TestRunner::WorkItem {
|
|
|
| bool Run(WebTestDelegate* delegate, WebView*) override {
|
| delegate->LoadURLForFrame(url_, target_);
|
| - return true; // FIXME: Did it really start a navigation?
|
| + return true; // FIXME: Did it really start a navigation?
|
| }
|
|
|
| private:
|
| @@ -2146,10 +2138,8 @@ void TestRunner::AddOriginAccessWhitelistEntry(
|
| return;
|
|
|
| WebSecurityPolicy::addOriginAccessWhitelistEntry(
|
| - url,
|
| - WebString::fromUTF8(destination_protocol),
|
| - WebString::fromUTF8(destination_host),
|
| - allow_destination_subdomains);
|
| + url, WebString::fromUTF8(destination_protocol),
|
| + WebString::fromUTF8(destination_host), allow_destination_subdomains);
|
| }
|
|
|
| void TestRunner::RemoveOriginAccessWhitelistEntry(
|
| @@ -2162,10 +2152,8 @@ void TestRunner::RemoveOriginAccessWhitelistEntry(
|
| return;
|
|
|
| WebSecurityPolicy::removeOriginAccessWhitelistEntry(
|
| - url,
|
| - WebString::fromUTF8(destination_protocol),
|
| - WebString::fromUTF8(destination_host),
|
| - allow_destination_subdomains);
|
| + url, WebString::fromUTF8(destination_protocol),
|
| + WebString::fromUTF8(destination_host), allow_destination_subdomains);
|
| }
|
|
|
| void TestRunner::SetTextSubpixelPositioning(bool value) {
|
| @@ -2204,20 +2192,25 @@ void TestRunner::ResetDeviceLight() {
|
| delegate_->SetDeviceLightData(-1);
|
| }
|
|
|
| -void TestRunner::SetMockDeviceMotion(
|
| - bool has_acceleration_x, double acceleration_x,
|
| - bool has_acceleration_y, double acceleration_y,
|
| - bool has_acceleration_z, double acceleration_z,
|
| - bool has_acceleration_including_gravity_x,
|
| - double acceleration_including_gravity_x,
|
| - bool has_acceleration_including_gravity_y,
|
| - double acceleration_including_gravity_y,
|
| - bool has_acceleration_including_gravity_z,
|
| - double acceleration_including_gravity_z,
|
| - bool has_rotation_rate_alpha, double rotation_rate_alpha,
|
| - bool has_rotation_rate_beta, double rotation_rate_beta,
|
| - bool has_rotation_rate_gamma, double rotation_rate_gamma,
|
| - double interval) {
|
| +void TestRunner::SetMockDeviceMotion(bool has_acceleration_x,
|
| + double acceleration_x,
|
| + bool has_acceleration_y,
|
| + double acceleration_y,
|
| + bool has_acceleration_z,
|
| + double acceleration_z,
|
| + bool has_acceleration_including_gravity_x,
|
| + double acceleration_including_gravity_x,
|
| + bool has_acceleration_including_gravity_y,
|
| + double acceleration_including_gravity_y,
|
| + bool has_acceleration_including_gravity_z,
|
| + double acceleration_including_gravity_z,
|
| + bool has_rotation_rate_alpha,
|
| + double rotation_rate_alpha,
|
| + bool has_rotation_rate_beta,
|
| + double rotation_rate_beta,
|
| + bool has_rotation_rate_gamma,
|
| + double rotation_rate_gamma,
|
| + double interval) {
|
| WebDeviceMotionData motion;
|
|
|
| // acceleration
|
| @@ -2253,9 +2246,12 @@ void TestRunner::SetMockDeviceMotion(
|
| delegate_->SetDeviceMotionData(motion);
|
| }
|
|
|
| -void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha,
|
| - bool has_beta, double beta,
|
| - bool has_gamma, double gamma,
|
| +void TestRunner::SetMockDeviceOrientation(bool has_alpha,
|
| + double alpha,
|
| + bool has_beta,
|
| + double beta,
|
| + bool has_gamma,
|
| + double gamma,
|
| bool absolute) {
|
| WebDeviceOrientationData orientation;
|
|
|
|
|