Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: components/test_runner/test_runner.cc

Issue 1832673002: Add testRunner.runIdleTasks() to force idle tasks to run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void QueueReload(); 183 void QueueReload();
184 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, 184 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin,
185 const std::string& destination_protocol, 185 const std::string& destination_protocol,
186 const std::string& destination_host, 186 const std::string& destination_host,
187 bool allow_destination_subdomains); 187 bool allow_destination_subdomains);
188 void RemoveWebPageOverlay(); 188 void RemoveWebPageOverlay();
189 void ResetDeviceLight(); 189 void ResetDeviceLight();
190 void ResetTestHelperControllers(); 190 void ResetTestHelperControllers();
191 void ResolveBeforeInstallPromptPromise(int request_id, 191 void ResolveBeforeInstallPromptPromise(int request_id,
192 const std::string& platform); 192 const std::string& platform);
193 void RunIdleTasks(v8::Local<v8::Function> callback);
193 void SendBluetoothManualChooserEvent(const std::string& event, 194 void SendBluetoothManualChooserEvent(const std::string& event,
194 const std::string& argument); 195 const std::string& argument);
195 void SetAcceptLanguages(const std::string& accept_languages); 196 void SetAcceptLanguages(const std::string& accept_languages);
196 void SetAllowDisplayOfInsecureContent(bool allowed); 197 void SetAllowDisplayOfInsecureContent(bool allowed);
197 void SetAllowFileAccessFromFileURLs(bool allow); 198 void SetAllowFileAccessFromFileURLs(bool allow);
198 void SetAllowRunningOfInsecureContent(bool allowed); 199 void SetAllowRunningOfInsecureContent(bool allowed);
199 void SetAllowUniversalAccessFromFileURLs(bool allow); 200 void SetAllowUniversalAccessFromFileURLs(bool allow);
200 void SetAlwaysAcceptCookies(bool accept); 201 void SetAlwaysAcceptCookies(bool accept);
201 void SetAudioData(const gin::ArrayBufferView& view); 202 void SetAudioData(const gin::ArrayBufferView& view);
202 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); 203 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) 468 .SetMethod("queueReload", &TestRunnerBindings::QueueReload)
468 .SetMethod("removeOriginAccessWhitelistEntry", 469 .SetMethod("removeOriginAccessWhitelistEntry",
469 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) 470 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry)
470 .SetMethod("removeWebPageOverlay", 471 .SetMethod("removeWebPageOverlay",
471 &TestRunnerBindings::RemoveWebPageOverlay) 472 &TestRunnerBindings::RemoveWebPageOverlay)
472 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) 473 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight)
473 .SetMethod("resetTestHelperControllers", 474 .SetMethod("resetTestHelperControllers",
474 &TestRunnerBindings::ResetTestHelperControllers) 475 &TestRunnerBindings::ResetTestHelperControllers)
475 .SetMethod("resolveBeforeInstallPromptPromise", 476 .SetMethod("resolveBeforeInstallPromptPromise",
476 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) 477 &TestRunnerBindings::ResolveBeforeInstallPromptPromise)
478 .SetMethod("runIdleTasks",
479 &TestRunnerBindings::RunIdleTasks)
477 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) 480 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup)
478 481
479 // The Bluetooth functions are specified at 482 // The Bluetooth functions are specified at
480 // https://webbluetoothcg.github.io/web-bluetooth/tests/. 483 // https://webbluetoothcg.github.io/web-bluetooth/tests/.
481 .SetMethod("sendBluetoothManualChooserEvent", 484 .SetMethod("sendBluetoothManualChooserEvent",
482 &TestRunnerBindings::SendBluetoothManualChooserEvent) 485 &TestRunnerBindings::SendBluetoothManualChooserEvent)
483 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) 486 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages)
484 .SetMethod("setAllowDisplayOfInsecureContent", 487 .SetMethod("setAllowDisplayOfInsecureContent",
485 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) 488 &TestRunnerBindings::SetAllowDisplayOfInsecureContent)
486 .SetMethod("setAllowFileAccessFromFileURLs", 489 .SetMethod("setAllowFileAccessFromFileURLs",
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1458
1456 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( 1459 void TestRunnerBindings::ResolveBeforeInstallPromptPromise(
1457 int request_id, 1460 int request_id,
1458 const std::string& platform) { 1461 const std::string& platform) {
1459 if (!runner_) 1462 if (!runner_)
1460 return; 1463 return;
1461 1464
1462 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); 1465 runner_->ResolveBeforeInstallPromptPromise(request_id, platform);
1463 } 1466 }
1464 1467
1468 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) {
1469 if (!runner_)
1470 return;
1471 runner_->RunIdleTasks(callback);
1472 }
1473
1465 std::string TestRunnerBindings::PlatformName() { 1474 std::string TestRunnerBindings::PlatformName() {
1466 if (runner_) 1475 if (runner_)
1467 return runner_->platform_name_; 1476 return runner_->platform_name_;
1468 return std::string(); 1477 return std::string();
1469 } 1478 }
1470 1479
1471 std::string TestRunnerBindings::TooltipText() { 1480 std::string TestRunnerBindings::TooltipText() {
1472 if (runner_) 1481 if (runner_)
1473 return runner_->tooltip_text_; 1482 return runner_->tooltip_text_;
1474 return std::string(); 1483 return std::string();
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 base::Passed(v8::UniquePersistent<v8::Function>( 2954 base::Passed(v8::UniquePersistent<v8::Function>(
2946 blink::mainThreadIsolate(), callback)))); 2955 blink::mainThreadIsolate(), callback))));
2947 } 2956 }
2948 2957
2949 void TestRunner::ResolveBeforeInstallPromptPromise( 2958 void TestRunner::ResolveBeforeInstallPromptPromise(
2950 int request_id, 2959 int request_id,
2951 const std::string& platform) { 2960 const std::string& platform) {
2952 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); 2961 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform);
2953 } 2962 }
2954 2963
2964 void TestRunner::RunIdleTasks(v8::Local<v8::Function> callback) {
2965 delegate_->RunIdleTasks(
2966 CreateClosureThatPostsV8Callback(callback));
2967 }
2968
2955 void TestRunner::SetPOSIXLocale(const std::string& locale) { 2969 void TestRunner::SetPOSIXLocale(const std::string& locale) {
2956 delegate_->SetLocale(locale); 2970 delegate_->SetLocale(locale);
2957 } 2971 }
2958 2972
2959 void TestRunner::SetMIDIAccessorResult(bool result) { 2973 void TestRunner::SetMIDIAccessorResult(bool result) {
2960 midi_accessor_result_ = result; 2974 midi_accessor_result_ = result;
2961 } 2975 }
2962 2976
2963 void TestRunner::SimulateWebNotificationClick(const std::string& title, 2977 void TestRunner::SimulateWebNotificationClick(const std::string& title,
2964 int action_index) { 2978 int action_index) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 } 3249 }
3236 3250
3237 void TestRunner::DidLosePointerLockInternal() { 3251 void TestRunner::DidLosePointerLockInternal() {
3238 bool was_locked = pointer_locked_; 3252 bool was_locked = pointer_locked_;
3239 pointer_locked_ = false; 3253 pointer_locked_ = false;
3240 if (was_locked) 3254 if (was_locked)
3241 web_view_->didLosePointerLock(); 3255 web_view_->didLosePointerLock();
3242 } 3256 }
3243 3257
3244 } // namespace test_runner 3258 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698