Index: components/html_viewer/web_test_delegate_impl.h |
diff --git a/content/shell/renderer/layout_test/blink_test_runner.h b/components/html_viewer/web_test_delegate_impl.h |
similarity index 54% |
copy from content/shell/renderer/layout_test/blink_test_runner.h |
copy to components/html_viewer/web_test_delegate_impl.h |
index c2e536996f3a8c58dd3fad8a880e5880b7750b78..96fe61accf07c135f910764fba42cd64ff7ed30e 100644 |
--- a/content/shell/renderer/layout_test/blink_test_runner.h |
+++ b/components/html_viewer/web_test_delegate_impl.h |
@@ -1,60 +1,35 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2015 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_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
-#define CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
+#ifndef COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ |
+#define COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ |
-#include <vector> |
- |
-#include "base/files/file_path.h" |
-#include "base/memory/scoped_ptr.h" |
+#include "base/macros.h" |
#include "components/test_runner/test_preferences.h" |
#include "components/test_runner/web_test_delegate.h" |
-#include "content/public/common/page_state.h" |
-#include "content/public/renderer/render_view_observer.h" |
-#include "content/public/renderer/render_view_observer_tracker.h" |
-#include "content/shell/common/shell_test_configuration.h" |
-#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h" |
-#include "v8/include/v8.h" |
- |
-class SkBitmap; |
-class SkCanvas; |
- |
-namespace blink { |
-class WebBatteryStatus; |
-class WebDeviceMotionData; |
-class WebDeviceOrientationData; |
-struct WebRect; |
-} |
namespace test_runner { |
+class WebTestInterfaces; |
class WebTestProxyBase; |
} |
-namespace content { |
- |
-class LeakDetector; |
-struct LeakDetectionResult; |
+namespace html_viewer { |
-// This is the renderer side of the webkit test runner. |
-class BlinkTestRunner : public RenderViewObserver, |
- public RenderViewObserverTracker<BlinkTestRunner>, |
- public test_runner::WebTestDelegate { |
+class WebTestDelegateImpl : public test_runner::WebTestDelegate { |
public: |
- explicit BlinkTestRunner(RenderView* render_view); |
- ~BlinkTestRunner() override; |
+ WebTestDelegateImpl(); |
+ ~WebTestDelegateImpl(); |
- // RenderViewObserver implementation. |
- bool OnMessageReceived(const IPC::Message& message) override; |
- void DidClearWindowObject(blink::WebLocalFrame* frame) override; |
- void Navigate(const GURL& url) override; |
- void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, |
- bool is_new_navigation) override; |
- void DidFailProvisionalLoad(blink::WebLocalFrame* frame, |
- const blink::WebURLError& error) override; |
+ void set_test_interfaces(test_runner::WebTestInterfaces* test_interfaces) { |
+ test_interfaces_ = test_interfaces; |
+ } |
+ void set_test_proxy(test_runner::WebTestProxyBase* proxy) { |
+ proxy_ = proxy; |
+ } |
- // WebTestDelegate implementation. |
+ private: |
+ // From test_runner::WebTestDelegate: |
void ClearEditCommand() override; |
void SetEditCommand(const std::string& name, |
const std::string& value) override; |
@@ -74,12 +49,11 @@ class BlinkTestRunner : public RenderViewObserver, |
const blink::WebVector<blink::WebString>& absolute_filenames) override; |
long long GetCurrentTimeInMillisecond() override; |
blink::WebString GetAbsoluteWebStringFromUTF8Path( |
- const std::string& utf8_path) override; |
+ const std::string& path) override; |
blink::WebURL LocalFileToDataURL(const blink::WebURL& file_url) override; |
blink::WebURL RewriteLayoutTestsURL(const std::string& utf8_url) override; |
test_runner::TestPreferences* Preferences() override; |
void ApplyPreferences() override; |
- virtual std::string makeURLErrorDescription(const blink::WebURLError& error); |
void UseUnfortunateSynchronousResizeMode(bool enable) override; |
void EnableAutoResizeMode(const blink::WebSize& min_size, |
const blink::WebSize& max_size) override; |
@@ -94,7 +68,7 @@ class BlinkTestRunner : public RenderViewObserver, |
void SimulateWebNotificationClick(const std::string& title) override; |
void SetDeviceScaleFactor(float factor) override; |
void SetDeviceColorProfile(const std::string& name) override; |
- void SetBluetoothMockDataSet(const std::string& name) override; |
+ void SetBluetoothMockDataSet(const std::string& data_set) override; |
void SetGeofencingMockProvider(bool service_available) override; |
void ClearGeofencingMockProvider() override; |
void SetGeofencingMockPosition(double latitude, double longitude) override; |
@@ -118,8 +92,8 @@ class BlinkTestRunner : public RenderViewObserver, |
const GURL& url, |
const base::Callback<void(const blink::WebURLResponse& response, |
const std::string& data)>& callback) override; |
- void SetPermission(const std::string& name, |
- const std::string& value, |
+ void SetPermission(const std::string& permission_name, |
+ const std::string& permission_value, |
const GURL& origin, |
const GURL& embedding_origin) override; |
void ResetPermissions() override; |
@@ -132,59 +106,19 @@ class BlinkTestRunner : public RenderViewObserver, |
int request_id, |
const std::vector<std::string>& event_platforms, |
const base::Callback<void(bool)>& callback) override; |
- void ResolveBeforeInstallPromptPromise( |
- int request_id, |
- const std::string& platform) override; |
+ void ResolveBeforeInstallPromptPromise(int request_id, |
+ const std::string& platform) override; |
blink::WebPlugin* CreatePluginPlaceholder( |
- blink::WebLocalFrame* frame, |
- const blink::WebPluginParams& params) override; |
- |
- void Reset(); |
- |
- void set_proxy(test_runner::WebTestProxyBase* proxy) { proxy_ = proxy; } |
- test_runner::WebTestProxyBase* proxy() const { return proxy_; } |
- |
- void ReportLeakDetectionResult(const LeakDetectionResult& result); |
- |
- private: |
- // Message handlers. |
- void OnSetTestConfiguration(const ShellTestConfiguration& params); |
- void OnSessionHistory( |
- const std::vector<int>& routing_ids, |
- const std::vector<std::vector<PageState> >& session_histories, |
- const std::vector<unsigned>& current_entry_indexes); |
- void OnReset(); |
- void OnNotifyDone(); |
- void OnTryLeakDetection(); |
- |
- // After finishing the test, retrieves the audio, text, and pixel dumps from |
- // the TestRunner library and sends them to the browser process. |
- void CaptureDump(); |
- void CaptureDumpPixels(const SkBitmap& snapshot); |
- void CaptureDumpComplete(); |
- |
- test_runner::WebTestProxyBase* proxy_; |
- |
- RenderView* focused_view_; |
+ blink::WebLocalFrame* frame, |
+ const blink::WebPluginParams& params) override; |
test_runner::TestPreferences prefs_; |
+ test_runner::WebTestInterfaces* test_interfaces_; |
+ test_runner::WebTestProxyBase* proxy_; |
- ShellTestConfiguration test_config_; |
- |
- std::vector<int> routing_ids_; |
- std::vector<std::vector<PageState> > session_histories_; |
- std::vector<unsigned> current_entry_indexes_; |
- |
- bool is_main_window_; |
- |
- bool focus_on_next_commit_; |
- |
- scoped_ptr<LeakDetector> leak_detector_; |
- bool needs_leak_detector_; |
- |
- DISALLOW_COPY_AND_ASSIGN(BlinkTestRunner); |
+ DISALLOW_COPY_AND_ASSIGN(WebTestDelegateImpl); |
}; |
-} // namespace content |
+} // namespace html_viewer |
-#endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
+#endif // COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ |