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 <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const std::string& platform); | 190 const std::string& platform); |
191 void RunIdleTasks(v8::Local<v8::Function> callback); | 191 void RunIdleTasks(v8::Local<v8::Function> callback); |
192 void SendBluetoothManualChooserEvent(const std::string& event, | 192 void SendBluetoothManualChooserEvent(const std::string& event, |
193 const std::string& argument); | 193 const std::string& argument); |
194 void SetAcceptLanguages(const std::string& accept_languages); | 194 void SetAcceptLanguages(const std::string& accept_languages); |
195 void SetAllowDisplayOfInsecureContent(bool allowed); | 195 void SetAllowDisplayOfInsecureContent(bool allowed); |
196 void SetAllowFileAccessFromFileURLs(bool allow); | 196 void SetAllowFileAccessFromFileURLs(bool allow); |
197 void SetAllowRunningOfInsecureContent(bool allowed); | 197 void SetAllowRunningOfInsecureContent(bool allowed); |
198 void SetAutoplayAllowed(bool allowed); | 198 void SetAutoplayAllowed(bool allowed); |
199 void SetAllowUniversalAccessFromFileURLs(bool allow); | 199 void SetAllowUniversalAccessFromFileURLs(bool allow); |
200 void SetAlwaysAcceptCookies(bool accept); | 200 void SetBlockThirdPartyCookies(bool block); |
201 void SetAudioData(const gin::ArrayBufferView& view); | 201 void SetAudioData(const gin::ArrayBufferView& view); |
202 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 202 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
203 void SetBluetoothFakeAdapter(const std::string& adapter_name, | 203 void SetBluetoothFakeAdapter(const std::string& adapter_name, |
204 v8::Local<v8::Function> callback); | 204 v8::Local<v8::Function> callback); |
205 void SetBluetoothManualChooser(bool enable); | 205 void SetBluetoothManualChooser(bool enable); |
206 void SetCanOpenWindows(); | 206 void SetCanOpenWindows(); |
207 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); | 207 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); |
208 void SetColorProfile(const std::string& name, | 208 void SetColorProfile(const std::string& name, |
209 v8::Local<v8::Function> callback); | 209 v8::Local<v8::Function> callback); |
210 void SetCustomPolicyDelegate(gin::Arguments* args); | 210 void SetCustomPolicyDelegate(gin::Arguments* args); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) | 485 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) |
486 .SetMethod("setAllowDisplayOfInsecureContent", | 486 .SetMethod("setAllowDisplayOfInsecureContent", |
487 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) | 487 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) |
488 .SetMethod("setAllowFileAccessFromFileURLs", | 488 .SetMethod("setAllowFileAccessFromFileURLs", |
489 &TestRunnerBindings::SetAllowFileAccessFromFileURLs) | 489 &TestRunnerBindings::SetAllowFileAccessFromFileURLs) |
490 .SetMethod("setAllowRunningOfInsecureContent", | 490 .SetMethod("setAllowRunningOfInsecureContent", |
491 &TestRunnerBindings::SetAllowRunningOfInsecureContent) | 491 &TestRunnerBindings::SetAllowRunningOfInsecureContent) |
492 .SetMethod("setAutoplayAllowed", &TestRunnerBindings::SetAutoplayAllowed) | 492 .SetMethod("setAutoplayAllowed", &TestRunnerBindings::SetAutoplayAllowed) |
493 .SetMethod("setAllowUniversalAccessFromFileURLs", | 493 .SetMethod("setAllowUniversalAccessFromFileURLs", |
494 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs) | 494 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs) |
495 .SetMethod("setAlwaysAcceptCookies", | 495 .SetMethod("setBlockThirdPartyCookies", |
496 &TestRunnerBindings::SetAlwaysAcceptCookies) | 496 &TestRunnerBindings::SetBlockThirdPartyCookies) |
497 .SetMethod("setAudioData", &TestRunnerBindings::SetAudioData) | 497 .SetMethod("setAudioData", &TestRunnerBindings::SetAudioData) |
498 .SetMethod("setBackingScaleFactor", | 498 .SetMethod("setBackingScaleFactor", |
499 &TestRunnerBindings::SetBackingScaleFactor) | 499 &TestRunnerBindings::SetBackingScaleFactor) |
500 // The Bluetooth functions are specified at | 500 // The Bluetooth functions are specified at |
501 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 501 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
502 .SetMethod("setBluetoothFakeAdapter", | 502 .SetMethod("setBluetoothFakeAdapter", |
503 &TestRunnerBindings::SetBluetoothFakeAdapter) | 503 &TestRunnerBindings::SetBluetoothFakeAdapter) |
504 .SetMethod("setBluetoothManualChooser", | 504 .SetMethod("setBluetoothManualChooser", |
505 &TestRunnerBindings::SetBluetoothManualChooser) | 505 &TestRunnerBindings::SetBluetoothManualChooser) |
506 .SetMethod("setCallCloseOnWebViews", &TestRunnerBindings::NotImplemented) | 506 .SetMethod("setCallCloseOnWebViews", &TestRunnerBindings::NotImplemented) |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 void TestRunnerBindings::ClearAllDatabases() { | 1257 void TestRunnerBindings::ClearAllDatabases() { |
1258 if (runner_) | 1258 if (runner_) |
1259 runner_->ClearAllDatabases(); | 1259 runner_->ClearAllDatabases(); |
1260 } | 1260 } |
1261 | 1261 |
1262 void TestRunnerBindings::SetDatabaseQuota(int quota) { | 1262 void TestRunnerBindings::SetDatabaseQuota(int quota) { |
1263 if (runner_) | 1263 if (runner_) |
1264 runner_->SetDatabaseQuota(quota); | 1264 runner_->SetDatabaseQuota(quota); |
1265 } | 1265 } |
1266 | 1266 |
1267 void TestRunnerBindings::SetAlwaysAcceptCookies(bool accept) { | 1267 void TestRunnerBindings::SetBlockThirdPartyCookies(bool block) { |
1268 if (runner_) | 1268 if (runner_) |
1269 runner_->SetAlwaysAcceptCookies(accept); | 1269 runner_->SetBlockThirdPartyCookies(block); |
1270 } | 1270 } |
1271 | 1271 |
1272 void TestRunnerBindings::SetWindowIsKey(bool value) { | 1272 void TestRunnerBindings::SetWindowIsKey(bool value) { |
1273 if (view_runner_) | 1273 if (view_runner_) |
1274 view_runner_->SetWindowIsKey(value); | 1274 view_runner_->SetWindowIsKey(value); |
1275 } | 1275 } |
1276 | 1276 |
1277 std::string TestRunnerBindings::PathToLocalResource(const std::string& path) { | 1277 std::string TestRunnerBindings::PathToLocalResource(const std::string& path) { |
1278 if (runner_) | 1278 if (runner_) |
1279 return runner_->PathToLocalResource(path); | 1279 return runner_->PathToLocalResource(path); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1595 WebSecurityPolicy::resetOriginAccessWhitelists(); |
1596 #if defined(__linux__) || defined(ANDROID) | 1596 #if defined(__linux__) || defined(ANDROID) |
1597 WebFontRendering::setSubpixelPositioning(false); | 1597 WebFontRendering::setSubpixelPositioning(false); |
1598 #endif | 1598 #endif |
1599 | 1599 |
1600 if (delegate_) { | 1600 if (delegate_) { |
1601 // Reset the default quota for each origin to 5MB | 1601 // Reset the default quota for each origin to 5MB |
1602 delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1602 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
1603 delegate_->SetDeviceColorProfile("reset"); | 1603 delegate_->SetDeviceColorProfile("reset"); |
1604 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); | 1604 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); |
1605 delegate_->SetAcceptAllCookies(false); | 1605 delegate_->SetBlockThirdPartyCookies(true); |
1606 delegate_->SetLocale(""); | 1606 delegate_->SetLocale(""); |
1607 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1607 delegate_->UseUnfortunateSynchronousResizeMode(false); |
1608 delegate_->DisableAutoResizeMode(WebSize()); | 1608 delegate_->DisableAutoResizeMode(WebSize()); |
1609 delegate_->DeleteAllCookies(); | 1609 delegate_->DeleteAllCookies(); |
1610 delegate_->SetBluetoothManualChooser(false); | 1610 delegate_->SetBluetoothManualChooser(false); |
1611 delegate_->ResetPermissions(); | 1611 delegate_->ResetPermissions(); |
1612 ResetDeviceLight(); | 1612 ResetDeviceLight(); |
1613 } | 1613 } |
1614 | 1614 |
1615 dump_as_audio_ = false; | 1615 dump_as_audio_ = false; |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 } | 2599 } |
2600 | 2600 |
2601 void TestRunner::ClearAllDatabases() { | 2601 void TestRunner::ClearAllDatabases() { |
2602 delegate_->ClearAllDatabases(); | 2602 delegate_->ClearAllDatabases(); |
2603 } | 2603 } |
2604 | 2604 |
2605 void TestRunner::SetDatabaseQuota(int quota) { | 2605 void TestRunner::SetDatabaseQuota(int quota) { |
2606 delegate_->SetDatabaseQuota(quota); | 2606 delegate_->SetDatabaseQuota(quota); |
2607 } | 2607 } |
2608 | 2608 |
2609 void TestRunner::SetAlwaysAcceptCookies(bool accept) { | 2609 void TestRunner::SetBlockThirdPartyCookies(bool block) { |
2610 delegate_->SetAcceptAllCookies(accept); | 2610 delegate_->SetBlockThirdPartyCookies(block); |
2611 } | 2611 } |
2612 | 2612 |
2613 void TestRunner::SetFocus(blink::WebView* web_view, bool focus) { | 2613 void TestRunner::SetFocus(blink::WebView* web_view, bool focus) { |
2614 if (focus) { | 2614 if (focus) { |
2615 if (previously_focused_view_ != web_view) { | 2615 if (previously_focused_view_ != web_view) { |
2616 delegate_->SetFocus(previously_focused_view_, false); | 2616 delegate_->SetFocus(previously_focused_view_, false); |
2617 delegate_->SetFocus(web_view, true); | 2617 delegate_->SetFocus(web_view, true); |
2618 previously_focused_view_ = web_view; | 2618 previously_focused_view_ = web_view; |
2619 } | 2619 } |
2620 } else { | 2620 } else { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 | 2733 |
2734 void TestRunner::NotifyDone() { | 2734 void TestRunner::NotifyDone() { |
2735 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2735 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2736 work_queue_.is_empty()) | 2736 work_queue_.is_empty()) |
2737 delegate_->TestFinished(); | 2737 delegate_->TestFinished(); |
2738 layout_test_runtime_flags_.set_wait_until_done(false); | 2738 layout_test_runtime_flags_.set_wait_until_done(false); |
2739 OnLayoutTestRuntimeFlagsChanged(); | 2739 OnLayoutTestRuntimeFlagsChanged(); |
2740 } | 2740 } |
2741 | 2741 |
2742 } // namespace test_runner | 2742 } // namespace test_runner |
OLD | NEW |