OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/test_runner/test_runner.h" | 5 #include "components/test_runner/test_runner.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "components/test_runner/mock_credential_manager_client.h" | 10 #include "components/test_runner/mock_credential_manager_client.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void DidAcquirePointerLock(); | 209 void DidAcquirePointerLock(); |
210 void DidNotAcquirePointerLock(); | 210 void DidNotAcquirePointerLock(); |
211 void DidLosePointerLock(); | 211 void DidLosePointerLock(); |
212 void SetPointerLockWillFailSynchronously(); | 212 void SetPointerLockWillFailSynchronously(); |
213 void SetPointerLockWillRespondAsynchronously(); | 213 void SetPointerLockWillRespondAsynchronously(); |
214 void SetPopupBlockingEnabled(bool block_popups); | 214 void SetPopupBlockingEnabled(bool block_popups); |
215 void SetJavaScriptCanAccessClipboard(bool can_access); | 215 void SetJavaScriptCanAccessClipboard(bool can_access); |
216 void SetXSSAuditorEnabled(bool enabled); | 216 void SetXSSAuditorEnabled(bool enabled); |
217 void SetAllowUniversalAccessFromFileURLs(bool allow); | 217 void SetAllowUniversalAccessFromFileURLs(bool allow); |
218 void SetAllowFileAccessFromFileURLs(bool allow); | 218 void SetAllowFileAccessFromFileURLs(bool allow); |
219 void OverridePreference(const std::string key, v8::Local<v8::Value> value); | 219 void OverridePreference(const std::string& key, v8::Local<v8::Value> value); |
220 void SetAcceptLanguages(const std::string& accept_languages); | 220 void SetAcceptLanguages(const std::string& accept_languages); |
221 void SetPluginsEnabled(bool enabled); | 221 void SetPluginsEnabled(bool enabled); |
222 void DumpEditingCallbacks(); | 222 void DumpEditingCallbacks(); |
223 void DumpAsMarkup(); | 223 void DumpAsMarkup(); |
224 void DumpAsText(); | 224 void DumpAsText(); |
225 void DumpAsTextWithPixelResults(); | 225 void DumpAsTextWithPixelResults(); |
226 void DumpChildFrameScrollPositions(); | 226 void DumpChildFrameScrollPositions(); |
227 void DumpChildFramesAsMarkup(); | 227 void DumpChildFramesAsMarkup(); |
228 void DumpChildFramesAsText(); | 228 void DumpChildFramesAsText(); |
229 void DumpIconChanges(); | 229 void DumpIconChanges(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 const std::string& password); | 285 const std::string& password); |
286 void AddWebPageOverlay(); | 286 void AddWebPageOverlay(); |
287 void RemoveWebPageOverlay(); | 287 void RemoveWebPageOverlay(); |
288 void LayoutAndPaintAsync(); | 288 void LayoutAndPaintAsync(); |
289 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); | 289 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); |
290 void GetManifestThen(v8::Local<v8::Function> callback); | 290 void GetManifestThen(v8::Local<v8::Function> callback); |
291 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); | 291 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); |
292 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 292 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
293 int y, | 293 int y, |
294 v8::Local<v8::Function> callback); | 294 v8::Local<v8::Function> callback); |
295 void SetCustomTextOutput(std::string output); | 295 void SetCustomTextOutput(const std::string& output); |
296 void SetViewSourceForFrame(const std::string& name, bool enabled); | 296 void SetViewSourceForFrame(const std::string& name, bool enabled); |
297 void SetBluetoothMockDataSet(const std::string& dataset_name); | 297 void SetBluetoothMockDataSet(const std::string& dataset_name); |
298 void SetBluetoothManualChooser(); | 298 void SetBluetoothManualChooser(); |
299 std::vector<std::string> GetBluetoothManualChooserEvents(); | 299 std::vector<std::string> GetBluetoothManualChooserEvents(); |
300 void SendBluetoothManualChooserEvent(const std::string& event, | 300 void SendBluetoothManualChooserEvent(const std::string& event, |
301 const std::string& argument); | 301 const std::string& argument); |
302 void SetGeofencingMockProvider(bool service_available); | 302 void SetGeofencingMockProvider(bool service_available); |
303 void ClearGeofencingMockProvider(); | 303 void ClearGeofencingMockProvider(); |
304 void SetGeofencingMockPosition(double latitude, double longitude); | 304 void SetGeofencingMockPosition(double latitude, double longitude); |
305 void SetPermission(const std::string& name, | 305 void SetPermission(const std::string& name, |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 void TestRunnerBindings::SetAllowUniversalAccessFromFileURLs(bool allow) { | 1047 void TestRunnerBindings::SetAllowUniversalAccessFromFileURLs(bool allow) { |
1048 if (runner_) | 1048 if (runner_) |
1049 runner_->SetAllowUniversalAccessFromFileURLs(allow); | 1049 runner_->SetAllowUniversalAccessFromFileURLs(allow); |
1050 } | 1050 } |
1051 | 1051 |
1052 void TestRunnerBindings::SetAllowFileAccessFromFileURLs(bool allow) { | 1052 void TestRunnerBindings::SetAllowFileAccessFromFileURLs(bool allow) { |
1053 if (runner_) | 1053 if (runner_) |
1054 runner_->SetAllowFileAccessFromFileURLs(allow); | 1054 runner_->SetAllowFileAccessFromFileURLs(allow); |
1055 } | 1055 } |
1056 | 1056 |
1057 void TestRunnerBindings::OverridePreference(const std::string key, | 1057 void TestRunnerBindings::OverridePreference(const std::string& key, |
1058 v8::Local<v8::Value> value) { | 1058 v8::Local<v8::Value> value) { |
1059 if (runner_) | 1059 if (runner_) |
1060 runner_->OverridePreference(key, value); | 1060 runner_->OverridePreference(key, value); |
1061 } | 1061 } |
1062 | 1062 |
1063 void TestRunnerBindings::SetAcceptLanguages( | 1063 void TestRunnerBindings::SetAcceptLanguages( |
1064 const std::string& accept_languages) { | 1064 const std::string& accept_languages) { |
1065 if (!runner_) | 1065 if (!runner_) |
1066 return; | 1066 return; |
1067 | 1067 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 if (runner_) | 1443 if (runner_) |
1444 runner_->CapturePixelsAsyncThen(callback); | 1444 runner_->CapturePixelsAsyncThen(callback); |
1445 } | 1445 } |
1446 | 1446 |
1447 void TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen( | 1447 void TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen( |
1448 int x, int y, v8::Local<v8::Function> callback) { | 1448 int x, int y, v8::Local<v8::Function> callback) { |
1449 if (runner_) | 1449 if (runner_) |
1450 runner_->CopyImageAtAndCapturePixelsAsyncThen(x, y, callback); | 1450 runner_->CopyImageAtAndCapturePixelsAsyncThen(x, y, callback); |
1451 } | 1451 } |
1452 | 1452 |
1453 void TestRunnerBindings::SetCustomTextOutput(std::string output) { | 1453 void TestRunnerBindings::SetCustomTextOutput(const std::string& output) { |
1454 runner_->setCustomTextOutput(output); | 1454 runner_->setCustomTextOutput(output); |
1455 } | 1455 } |
1456 | 1456 |
1457 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, | 1457 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, |
1458 bool enabled) { | 1458 bool enabled) { |
1459 if (runner_ && runner_->web_view_) { | 1459 if (runner_ && runner_->web_view_) { |
1460 WebFrame* target_frame = | 1460 WebFrame* target_frame = |
1461 runner_->web_view_->findFrameByName(WebString::fromUTF8(name)); | 1461 runner_->web_view_->findFrameByName(WebString::fromUTF8(name)); |
1462 if (target_frame) | 1462 if (target_frame) |
1463 target_frame->enableViewSourceMode(enabled); | 1463 target_frame->enableViewSourceMode(enabled); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 } | 1777 } |
1778 | 1778 |
1779 bool TestRunner::shouldDumpAsCustomText() const { | 1779 bool TestRunner::shouldDumpAsCustomText() const { |
1780 return has_custom_text_output_; | 1780 return has_custom_text_output_; |
1781 } | 1781 } |
1782 | 1782 |
1783 std::string TestRunner::customDumpText() const { | 1783 std::string TestRunner::customDumpText() const { |
1784 return custom_text_output_; | 1784 return custom_text_output_; |
1785 } | 1785 } |
1786 | 1786 |
1787 void TestRunner::setCustomTextOutput(std::string text) { | 1787 void TestRunner::setCustomTextOutput(const std::string& text) { |
1788 custom_text_output_ = text; | 1788 custom_text_output_ = text; |
1789 has_custom_text_output_ = true; | 1789 has_custom_text_output_ = true; |
1790 } | 1790 } |
1791 | 1791 |
1792 bool TestRunner::ShouldGeneratePixelResults() { | 1792 bool TestRunner::ShouldGeneratePixelResults() { |
1793 CheckResponseMimeType(); | 1793 CheckResponseMimeType(); |
1794 return generate_pixel_results_; | 1794 return generate_pixel_results_; |
1795 } | 1795 } |
1796 | 1796 |
1797 bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const { | 1797 bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const { |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 void TestRunner::SetAllowUniversalAccessFromFileURLs(bool allow) { | 2547 void TestRunner::SetAllowUniversalAccessFromFileURLs(bool allow) { |
2548 delegate_->Preferences()->allow_universal_access_from_file_urls = allow; | 2548 delegate_->Preferences()->allow_universal_access_from_file_urls = allow; |
2549 delegate_->ApplyPreferences(); | 2549 delegate_->ApplyPreferences(); |
2550 } | 2550 } |
2551 | 2551 |
2552 void TestRunner::SetAllowFileAccessFromFileURLs(bool allow) { | 2552 void TestRunner::SetAllowFileAccessFromFileURLs(bool allow) { |
2553 delegate_->Preferences()->allow_file_access_from_file_urls = allow; | 2553 delegate_->Preferences()->allow_file_access_from_file_urls = allow; |
2554 delegate_->ApplyPreferences(); | 2554 delegate_->ApplyPreferences(); |
2555 } | 2555 } |
2556 | 2556 |
2557 void TestRunner::OverridePreference(const std::string key, | 2557 void TestRunner::OverridePreference(const std::string& key, |
2558 v8::Local<v8::Value> value) { | 2558 v8::Local<v8::Value> value) { |
2559 TestPreferences* prefs = delegate_->Preferences(); | 2559 TestPreferences* prefs = delegate_->Preferences(); |
2560 if (key == "WebKitDefaultFontSize") { | 2560 if (key == "WebKitDefaultFontSize") { |
2561 prefs->default_font_size = value->Int32Value(); | 2561 prefs->default_font_size = value->Int32Value(); |
2562 } else if (key == "WebKitMinimumFontSize") { | 2562 } else if (key == "WebKitMinimumFontSize") { |
2563 prefs->minimum_font_size = value->Int32Value(); | 2563 prefs->minimum_font_size = value->Int32Value(); |
2564 } else if (key == "WebKitDefaultTextEncodingName") { | 2564 } else if (key == "WebKitDefaultTextEncodingName") { |
2565 v8::Isolate* isolate = blink::mainThreadIsolate(); | 2565 v8::Isolate* isolate = blink::mainThreadIsolate(); |
2566 prefs->default_text_encoding_name = | 2566 prefs->default_text_encoding_name = |
2567 V8StringToWebString(value->ToString(isolate)); | 2567 V8StringToWebString(value->ToString(isolate)); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 } | 3109 } |
3110 | 3110 |
3111 void TestRunner::DidLosePointerLockInternal() { | 3111 void TestRunner::DidLosePointerLockInternal() { |
3112 bool was_locked = pointer_locked_; | 3112 bool was_locked = pointer_locked_; |
3113 pointer_locked_ = false; | 3113 pointer_locked_ = false; |
3114 if (was_locked) | 3114 if (was_locked) |
3115 web_view_->didLosePointerLock(); | 3115 web_view_->didLosePointerLock(); |
3116 } | 3116 } |
3117 | 3117 |
3118 } // namespace test_runner | 3118 } // namespace test_runner |
OLD | NEW |