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

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

Issue 1815483003: bluetooth: Create Mojo equivalent of SetBluetoothMockDataSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo
Patch Set: Clean up 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
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void SendBluetoothManualChooserEvent(const std::string& event, 250 void SendBluetoothManualChooserEvent(const std::string& event,
251 const std::string& argument); 251 const std::string& argument);
252 void SetAcceptLanguages(const std::string& accept_languages); 252 void SetAcceptLanguages(const std::string& accept_languages);
253 void SetAllowDisplayOfInsecureContent(bool allowed); 253 void SetAllowDisplayOfInsecureContent(bool allowed);
254 void SetAllowFileAccessFromFileURLs(bool allow); 254 void SetAllowFileAccessFromFileURLs(bool allow);
255 void SetAllowRunningOfInsecureContent(bool allowed); 255 void SetAllowRunningOfInsecureContent(bool allowed);
256 void SetAllowUniversalAccessFromFileURLs(bool allow); 256 void SetAllowUniversalAccessFromFileURLs(bool allow);
257 void SetAlwaysAcceptCookies(bool accept); 257 void SetAlwaysAcceptCookies(bool accept);
258 void SetAudioData(const gin::ArrayBufferView& view); 258 void SetAudioData(const gin::ArrayBufferView& view);
259 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); 259 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback);
260 void SetBluetoothManualChooser(); 260 void SetBluetoothFakeAdapter(const std::string& adapter_name,
261 void SetBluetoothMockDataSet(const std::string& dataset_name); 261 v8::Local<v8::Function> callback);
262 void SetBluetoothManualChooser(bool enable);
262 void SetCanOpenWindows(); 263 void SetCanOpenWindows();
263 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); 264 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args);
264 void SetColorProfile(const std::string& name, 265 void SetColorProfile(const std::string& name,
265 v8::Local<v8::Function> callback); 266 v8::Local<v8::Function> callback);
266 void SetCustomPolicyDelegate(gin::Arguments* args); 267 void SetCustomPolicyDelegate(gin::Arguments* args);
267 void SetCustomTextOutput(const std::string& output); 268 void SetCustomTextOutput(const std::string& output);
268 void SetDatabaseQuota(int quota); 269 void SetDatabaseQuota(int quota);
269 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, 270 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden,
270 const std::string& scheme); 271 const std::string& scheme);
271 void SetGeofencingMockPosition(double latitude, double longitude); 272 void SetGeofencingMockPosition(double latitude, double longitude);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 &TestRunnerBindings::SetAllowRunningOfInsecureContent) 568 &TestRunnerBindings::SetAllowRunningOfInsecureContent)
568 .SetMethod("setAllowUniversalAccessFromFileURLs", 569 .SetMethod("setAllowUniversalAccessFromFileURLs",
569 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs) 570 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs)
570 .SetMethod("setAlwaysAcceptCookies", 571 .SetMethod("setAlwaysAcceptCookies",
571 &TestRunnerBindings::SetAlwaysAcceptCookies) 572 &TestRunnerBindings::SetAlwaysAcceptCookies)
572 .SetMethod("setApplicationCacheOriginQuota", 573 .SetMethod("setApplicationCacheOriginQuota",
573 &TestRunnerBindings::NotImplemented) 574 &TestRunnerBindings::NotImplemented)
574 .SetMethod("setAudioData", &TestRunnerBindings::SetAudioData) 575 .SetMethod("setAudioData", &TestRunnerBindings::SetAudioData)
575 .SetMethod("setBackingScaleFactor", 576 .SetMethod("setBackingScaleFactor",
576 &TestRunnerBindings::SetBackingScaleFactor) 577 &TestRunnerBindings::SetBackingScaleFactor)
577 578 .SetMethod("setBluetoothFakeAdapter",
Jeffrey Yasskin 2016/03/29 01:59:13 I think keep this below the link to the spec that'
ortuno 2016/03/29 16:05:16 Done.
579 &TestRunnerBindings::SetBluetoothFakeAdapter)
578 // The Bluetooth functions are specified at 580 // The Bluetooth functions are specified at
579 // https://webbluetoothcg.github.io/web-bluetooth/tests/. 581 // https://webbluetoothcg.github.io/web-bluetooth/tests/.
580 .SetMethod("setBluetoothManualChooser", 582 .SetMethod("setBluetoothManualChooser",
581 &TestRunnerBindings::SetBluetoothManualChooser) 583 &TestRunnerBindings::SetBluetoothManualChooser)
582 .SetMethod("setBluetoothMockDataSet",
583 &TestRunnerBindings::SetBluetoothMockDataSet)
584 .SetMethod("setCallCloseOnWebViews", &TestRunnerBindings::NotImplemented) 584 .SetMethod("setCallCloseOnWebViews", &TestRunnerBindings::NotImplemented)
585 .SetMethod("setCanOpenWindows", &TestRunnerBindings::SetCanOpenWindows) 585 .SetMethod("setCanOpenWindows", &TestRunnerBindings::SetCanOpenWindows)
586 .SetMethod("setCloseRemainingWindowsWhenComplete", 586 .SetMethod("setCloseRemainingWindowsWhenComplete",
587 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) 587 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete)
588 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) 588 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile)
589 .SetMethod("setCustomPolicyDelegate", 589 .SetMethod("setCustomPolicyDelegate",
590 &TestRunnerBindings::SetCustomPolicyDelegate) 590 &TestRunnerBindings::SetCustomPolicyDelegate)
591 .SetMethod("setCustomTextOutput", 591 .SetMethod("setCustomTextOutput",
592 &TestRunnerBindings::SetCustomTextOutput) 592 &TestRunnerBindings::SetCustomTextOutput)
593 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) 593 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota)
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 if (runner_) 1373 if (runner_)
1374 runner_->EnableUseZoomForDSF(callback); 1374 runner_->EnableUseZoomForDSF(callback);
1375 } 1375 }
1376 1376
1377 void TestRunnerBindings::SetColorProfile( 1377 void TestRunnerBindings::SetColorProfile(
1378 const std::string& name, v8::Local<v8::Function> callback) { 1378 const std::string& name, v8::Local<v8::Function> callback) {
1379 if (runner_) 1379 if (runner_)
1380 runner_->SetColorProfile(name, callback); 1380 runner_->SetColorProfile(name, callback);
1381 } 1381 }
1382 1382
1383 void TestRunnerBindings::SetBluetoothMockDataSet(const std::string& name) { 1383 void TestRunnerBindings::SetBluetoothFakeAdapter(
1384 const std::string& adapter_name,
1385 v8::Local<v8::Function> callback) {
1384 if (runner_) 1386 if (runner_)
1385 runner_->SetBluetoothMockDataSet(name); 1387 runner_->SetBluetoothFakeAdapter(adapter_name, callback);
1386 } 1388 }
1387 1389
1388 void TestRunnerBindings::SetBluetoothManualChooser() { 1390 void TestRunnerBindings::SetBluetoothManualChooser(bool enable) {
1389 if (runner_) 1391 if (runner_)
1390 runner_->SetBluetoothManualChooser(); 1392 runner_->SetBluetoothManualChooser(enable);
1391 } 1393 }
1392 1394
1393 void TestRunnerBindings::GetBluetoothManualChooserEvents( 1395 void TestRunnerBindings::GetBluetoothManualChooserEvents(
1394 v8::Local<v8::Function> callback) { 1396 v8::Local<v8::Function> callback) {
1395 if (runner_) 1397 if (runner_)
1396 return runner_->GetBluetoothManualChooserEvents(callback); 1398 return runner_->GetBluetoothManualChooserEvents(callback);
1397 } 1399 }
1398 1400
1399 void TestRunnerBindings::SendBluetoothManualChooserEvent( 1401 void TestRunnerBindings::SendBluetoothManualChooserEvent(
1400 const std::string& event, 1402 const std::string& event,
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 if (delegate_) { 1721 if (delegate_) {
1720 // Reset the default quota for each origin to 5MB 1722 // Reset the default quota for each origin to 5MB
1721 delegate_->SetDatabaseQuota(5 * 1024 * 1024); 1723 delegate_->SetDatabaseQuota(5 * 1024 * 1024);
1722 delegate_->SetDeviceColorProfile("reset"); 1724 delegate_->SetDeviceColorProfile("reset");
1723 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); 1725 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor());
1724 delegate_->SetAcceptAllCookies(false); 1726 delegate_->SetAcceptAllCookies(false);
1725 delegate_->SetLocale(""); 1727 delegate_->SetLocale("");
1726 delegate_->UseUnfortunateSynchronousResizeMode(false); 1728 delegate_->UseUnfortunateSynchronousResizeMode(false);
1727 delegate_->DisableAutoResizeMode(WebSize()); 1729 delegate_->DisableAutoResizeMode(WebSize());
1728 delegate_->DeleteAllCookies(); 1730 delegate_->DeleteAllCookies();
1729 delegate_->SetBluetoothMockDataSet(""); 1731 delegate_->SetBluetoothManualChooser(false);
1730 delegate_->ClearGeofencingMockProvider(); 1732 delegate_->ClearGeofencingMockProvider();
1731 delegate_->ResetPermissions(); 1733 delegate_->ResetPermissions();
1732 ResetDeviceLight(); 1734 ResetDeviceLight();
1733 } 1735 }
1734 1736
1735 dump_editting_callbacks_ = false; 1737 dump_editting_callbacks_ = false;
1736 dump_icon_changes_ = false; 1738 dump_icon_changes_ = false;
1737 dump_as_audio_ = false; 1739 dump_as_audio_ = false;
1738 dump_frame_load_callbacks_ = false; 1740 dump_frame_load_callbacks_ = false;
1739 dump_ping_loader_callbacks_ = false; 1741 dump_ping_loader_callbacks_ = false;
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 delegate_->EnableUseZoomForDSF(); 2893 delegate_->EnableUseZoomForDSF();
2892 delegate_->PostTask(new InvokeCallbackTask(this, callback)); 2894 delegate_->PostTask(new InvokeCallbackTask(this, callback));
2893 } 2895 }
2894 2896
2895 void TestRunner::SetColorProfile(const std::string& name, 2897 void TestRunner::SetColorProfile(const std::string& name,
2896 v8::Local<v8::Function> callback) { 2898 v8::Local<v8::Function> callback) {
2897 delegate_->SetDeviceColorProfile(name); 2899 delegate_->SetDeviceColorProfile(name);
2898 delegate_->PostTask(new InvokeCallbackTask(this, callback)); 2900 delegate_->PostTask(new InvokeCallbackTask(this, callback));
2899 } 2901 }
2900 2902
2901 void TestRunner::SetBluetoothMockDataSet(const std::string& name) { 2903 void TestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name,
2902 delegate_->SetBluetoothMockDataSet(name); 2904 v8::Local<v8::Function> callback) {
2905 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback));
2906 delegate_->SetBluetoothFakeAdapter(
2907 adapter_name,
2908 base::Bind(&TestRunner::InvokeCallback, weak_factory_.GetWeakPtr(),
2909 base::Passed(&task)));
2903 } 2910 }
2904 2911
2905 void TestRunner::SetBluetoothManualChooser() { 2912 void TestRunner::SetBluetoothManualChooser(bool enable) {
2906 delegate_->SetBluetoothManualChooser(); 2913 delegate_->SetBluetoothManualChooser(enable);
2907 } 2914 }
2908 2915
2909 void TestRunner::GetBluetoothManualChooserEvents( 2916 void TestRunner::GetBluetoothManualChooserEvents(
2910 v8::Local<v8::Function> callback) { 2917 v8::Local<v8::Function> callback) {
2911 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback)); 2918 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback));
2912 return delegate_->GetBluetoothManualChooserEvents( 2919 return delegate_->GetBluetoothManualChooserEvents(
2913 base::Bind(&TestRunner::GetBluetoothManualChooserEventsCallback, 2920 base::Bind(&TestRunner::GetBluetoothManualChooserEventsCallback,
2914 weak_factory_.GetWeakPtr(), base::Passed(&task))); 2921 weak_factory_.GetWeakPtr(), base::Passed(&task)));
2915 } 2922 }
2916 2923
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 } 3229 }
3223 3230
3224 void TestRunner::DidLosePointerLockInternal() { 3231 void TestRunner::DidLosePointerLockInternal() {
3225 bool was_locked = pointer_locked_; 3232 bool was_locked = pointer_locked_;
3226 pointer_locked_ = false; 3233 pointer_locked_ = false;
3227 if (was_locked) 3234 if (was_locked)
3228 web_view_->didLosePointerLock(); 3235 web_view_->didLosePointerLock();
3229 } 3236 }
3230 3237
3231 } // namespace test_runner 3238 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698