| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ | |
| 6 #define COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "components/test_runner/test_preferences.h" | |
| 11 #include "components/test_runner/web_test_delegate.h" | |
| 12 | |
| 13 namespace test_runner { | |
| 14 class WebTestInterfaces; | |
| 15 class WebTestProxyBase; | |
| 16 } | |
| 17 | |
| 18 namespace html_viewer { | |
| 19 | |
| 20 class WebTestDelegateImpl : public test_runner::WebTestDelegate { | |
| 21 public: | |
| 22 WebTestDelegateImpl(); | |
| 23 ~WebTestDelegateImpl(); | |
| 24 | |
| 25 void set_test_interfaces(test_runner::WebTestInterfaces* test_interfaces) { | |
| 26 test_interfaces_ = test_interfaces; | |
| 27 } | |
| 28 void set_test_proxy(test_runner::WebTestProxyBase* proxy) { | |
| 29 proxy_ = proxy; | |
| 30 } | |
| 31 void set_completion_callback(const base::Closure& callback) { | |
| 32 completion_callback_ = callback; | |
| 33 } | |
| 34 | |
| 35 private: | |
| 36 // From test_runner::WebTestDelegate: | |
| 37 void ClearEditCommand() override; | |
| 38 void SetEditCommand(const std::string& name, | |
| 39 const std::string& value) override; | |
| 40 void SetGamepadProvider(test_runner::GamepadController* controller) override; | |
| 41 void SetDeviceLightData(const double data) override; | |
| 42 void SetDeviceMotionData(const blink::WebDeviceMotionData& data) override; | |
| 43 void SetDeviceOrientationData( | |
| 44 const blink::WebDeviceOrientationData& data) override; | |
| 45 void SetScreenOrientation( | |
| 46 const blink::WebScreenOrientationType& orientation) override; | |
| 47 void ResetScreenOrientation() override; | |
| 48 void DidChangeBatteryStatus(const blink::WebBatteryStatus& status) override; | |
| 49 void PrintMessage(const std::string& message) override; | |
| 50 void PostTask(test_runner::WebTask* task) override; | |
| 51 void PostDelayedTask(test_runner::WebTask* task, long long ms) override; | |
| 52 blink::WebString RegisterIsolatedFileSystem( | |
| 53 const blink::WebVector<blink::WebString>& absolute_filenames) override; | |
| 54 long long GetCurrentTimeInMillisecond() override; | |
| 55 blink::WebString GetAbsoluteWebStringFromUTF8Path( | |
| 56 const std::string& path) override; | |
| 57 blink::WebURL LocalFileToDataURL(const blink::WebURL& file_url) override; | |
| 58 blink::WebURL RewriteLayoutTestsURL(const std::string& utf8_url) override; | |
| 59 test_runner::TestPreferences* Preferences() override; | |
| 60 void ApplyPreferences() override; | |
| 61 void UseUnfortunateSynchronousResizeMode(bool enable) override; | |
| 62 void EnableAutoResizeMode(const blink::WebSize& min_size, | |
| 63 const blink::WebSize& max_size) override; | |
| 64 void DisableAutoResizeMode(const blink::WebSize& new_size) override; | |
| 65 void ClearDevToolsLocalStorage() override; | |
| 66 void ShowDevTools(const std::string& settings, | |
| 67 const std::string& frontend_url) override; | |
| 68 void CloseDevTools() override; | |
| 69 void EvaluateInWebInspector(long call_id, const std::string& script) override; | |
| 70 std::string EvaluateInWebInspectorOverlay(const std::string& script) override; | |
| 71 void ClearAllDatabases() override; | |
| 72 void SetDatabaseQuota(int quota) override; | |
| 73 void SimulateWebNotificationClick(const std::string& title, | |
| 74 int action_index) override; | |
| 75 void SetDeviceScaleFactor(float factor) override; | |
| 76 void EnableUseZoomForDSF() override; | |
| 77 void SetDeviceColorProfile(const std::string& name) override; | |
| 78 void SetBluetoothMockDataSet(const std::string& data_set) override; | |
| 79 void SetBluetoothManualChooser() override; | |
| 80 void GetBluetoothManualChooserEvents( | |
| 81 const base::Callback<void(const std::vector<std::string>&)>& callback) | |
| 82 override; | |
| 83 void SendBluetoothManualChooserEvent(const std::string& event, | |
| 84 const std::string& argument) override; | |
| 85 void SetGeofencingMockProvider(bool service_available) override; | |
| 86 void ClearGeofencingMockProvider() override; | |
| 87 void SetGeofencingMockPosition(double latitude, double longitude) override; | |
| 88 void SetFocus(test_runner::WebTestProxyBase* proxy, bool focus) override; | |
| 89 void SetAcceptAllCookies(bool accept) override; | |
| 90 std::string PathToLocalResource(const std::string& resource) override; | |
| 91 void SetLocale(const std::string& locale) override; | |
| 92 void TestFinished() override; | |
| 93 void CloseRemainingWindows() override; | |
| 94 void DeleteAllCookies() override; | |
| 95 int NavigationEntryCount() override; | |
| 96 void GoToOffset(int offset) override; | |
| 97 void Reload() override; | |
| 98 void LoadURLForFrame(const blink::WebURL& url, | |
| 99 const std::string& frame_name) override; | |
| 100 bool AllowExternalPages() override; | |
| 101 std::string DumpHistoryForWindow( | |
| 102 test_runner::WebTestProxyBase* proxy) override; | |
| 103 void FetchManifest( | |
| 104 blink::WebView* view, | |
| 105 const GURL& url, | |
| 106 const base::Callback<void(const blink::WebURLResponse& response, | |
| 107 const std::string& data)>& callback) override; | |
| 108 void SetPermission(const std::string& permission_name, | |
| 109 const std::string& permission_value, | |
| 110 const GURL& origin, | |
| 111 const GURL& embedding_origin) override; | |
| 112 void ResetPermissions() override; | |
| 113 bool AddMediaStreamVideoSourceAndTrack( | |
| 114 blink::WebMediaStream* stream) override; | |
| 115 bool AddMediaStreamAudioSourceAndTrack( | |
| 116 blink::WebMediaStream* stream) override; | |
| 117 cc::SharedBitmapManager* GetSharedBitmapManager() override; | |
| 118 void DispatchBeforeInstallPromptEvent( | |
| 119 int request_id, | |
| 120 const std::vector<std::string>& event_platforms, | |
| 121 const base::Callback<void(bool)>& callback) override; | |
| 122 void ResolveBeforeInstallPromptPromise(int request_id, | |
| 123 const std::string& platform) override; | |
| 124 blink::WebPlugin* CreatePluginPlaceholder( | |
| 125 blink::WebLocalFrame* frame, | |
| 126 const blink::WebPluginParams& params) override; | |
| 127 void OnWebTestProxyBaseDestroy(test_runner::WebTestProxyBase* base) override; | |
| 128 blink::WebPoint ConvertDIPToNative( | |
| 129 const blink::WebPoint& point_in_dip) const override; | |
| 130 | |
| 131 // Must not be constructed until after blink has been initialized. | |
| 132 scoped_ptr<test_runner::TestPreferences> prefs_; | |
| 133 test_runner::WebTestInterfaces* test_interfaces_; | |
| 134 test_runner::WebTestProxyBase* proxy_; | |
| 135 base::Closure completion_callback_; | |
| 136 | |
| 137 DISALLOW_COPY_AND_ASSIGN(WebTestDelegateImpl); | |
| 138 }; | |
| 139 | |
| 140 } // namespace html_viewer | |
| 141 | |
| 142 #endif // COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_ | |
| OLD | NEW |