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

Side by Side Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 701953007: Expose mock geofencing service via testRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mention unifying bug in a comment Created 6 years 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 "content/shell/renderer/test_runner/test_runner.h" 5 #include "content/shell/renderer/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 "content/public/test/layouttest_support.h" 10 #include "content/public/test/layouttest_support.h"
(...skipping 11 matching lines...) Expand all
22 #include "gin/handle.h" 22 #include "gin/handle.h"
23 #include "gin/object_template_builder.h" 23 #include "gin/object_template_builder.h"
24 #include "gin/wrappable.h" 24 #include "gin/wrappable.h"
25 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" 25 #include "third_party/WebKit/public/platform/WebBatteryStatus.h"
26 #include "third_party/WebKit/public/platform/WebCanvas.h" 26 #include "third_party/WebKit/public/platform/WebCanvas.h"
27 #include "third_party/WebKit/public/platform/WebData.h" 27 #include "third_party/WebKit/public/platform/WebData.h"
28 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" 28 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
29 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" 29 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h"
30 #include "third_party/WebKit/public/platform/WebLocalCredential.h" 30 #include "third_party/WebKit/public/platform/WebLocalCredential.h"
31 #include "third_party/WebKit/public/platform/WebPoint.h" 31 #include "third_party/WebKit/public/platform/WebPoint.h"
32 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h"
32 #include "third_party/WebKit/public/platform/WebURLResponse.h" 33 #include "third_party/WebKit/public/platform/WebURLResponse.h"
33 #include "third_party/WebKit/public/web/WebArrayBuffer.h" 34 #include "third_party/WebKit/public/web/WebArrayBuffer.h"
34 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" 35 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h"
35 #include "third_party/WebKit/public/web/WebBindings.h" 36 #include "third_party/WebKit/public/web/WebBindings.h"
36 #include "third_party/WebKit/public/web/WebDataSource.h" 37 #include "third_party/WebKit/public/web/WebDataSource.h"
37 #include "third_party/WebKit/public/web/WebDocument.h" 38 #include "third_party/WebKit/public/web/WebDocument.h"
38 #include "third_party/WebKit/public/web/WebFindOptions.h" 39 #include "third_party/WebKit/public/web/WebFindOptions.h"
39 #include "third_party/WebKit/public/web/WebFrame.h" 40 #include "third_party/WebKit/public/web/WebFrame.h"
40 #include "third_party/WebKit/public/web/WebInputElement.h" 41 #include "third_party/WebKit/public/web/WebInputElement.h"
41 #include "third_party/WebKit/public/web/WebKit.h" 42 #include "third_party/WebKit/public/web/WebKit.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 int y, 293 int y,
293 v8::Handle<v8::Function> callback); 294 v8::Handle<v8::Function> callback);
294 void SetCustomTextOutput(std::string output); 295 void SetCustomTextOutput(std::string output);
295 void SetViewSourceForFrame(const std::string& name, bool enabled); 296 void SetViewSourceForFrame(const std::string& name, bool enabled);
296 void SetMockPushClientSuccess(const std::string& endpoint, 297 void SetMockPushClientSuccess(const std::string& endpoint,
297 const std::string& registration_id); 298 const std::string& registration_id);
298 void SetMockPushClientError(const std::string& message); 299 void SetMockPushClientError(const std::string& message);
299 void SetPushMessagingPermission(const std::string& origin, bool allowed); 300 void SetPushMessagingPermission(const std::string& origin, bool allowed);
300 void ClearPushMessagingPermissions(); 301 void ClearPushMessagingPermissions();
301 void SetBluetoothMockDataSet(const std::string& dataset_name); 302 void SetBluetoothMockDataSet(const std::string& dataset_name);
303 void SetGeofencingMockProvider(bool service_available);
304 void ClearGeofencingMockProvider();
305 void SetGeofencingMockPosition(double latitude, double longitude);
302 306
303 std::string PlatformName(); 307 std::string PlatformName();
304 std::string TooltipText(); 308 std::string TooltipText();
305 bool DisableNotifyDone(); 309 bool DisableNotifyDone();
306 int WebHistoryItemCount(); 310 int WebHistoryItemCount();
307 bool InterceptPostMessage(); 311 bool InterceptPostMessage();
308 void SetInterceptPostMessage(bool value); 312 void SetInterceptPostMessage(bool value);
309 313
310 void NotImplemented(const gin::Arguments& args); 314 void NotImplemented(const gin::Arguments& args);
311 315
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 .SetMethod("setMockPushClientError", 550 .SetMethod("setMockPushClientError",
547 &TestRunnerBindings::SetMockPushClientError) 551 &TestRunnerBindings::SetMockPushClientError)
548 .SetMethod("setPushMessagingPermission", 552 .SetMethod("setPushMessagingPermission",
549 &TestRunnerBindings::SetPushMessagingPermission) 553 &TestRunnerBindings::SetPushMessagingPermission)
550 .SetMethod("clearPushMessagingPermissions", 554 .SetMethod("clearPushMessagingPermissions",
551 &TestRunnerBindings::ClearPushMessagingPermissions) 555 &TestRunnerBindings::ClearPushMessagingPermissions)
552 .SetMethod("setBluetoothMockDataSet", 556 .SetMethod("setBluetoothMockDataSet",
553 &TestRunnerBindings::SetBluetoothMockDataSet) 557 &TestRunnerBindings::SetBluetoothMockDataSet)
554 .SetMethod("forceNextWebGLContextCreationToFail", 558 .SetMethod("forceNextWebGLContextCreationToFail",
555 &TestRunnerBindings::ForceNextWebGLContextCreationToFail) 559 &TestRunnerBindings::ForceNextWebGLContextCreationToFail)
560 .SetMethod("setGeofencingMockProvider",
561 &TestRunnerBindings::SetGeofencingMockProvider)
562 .SetMethod("clearGeofencingMockProvider",
563 &TestRunnerBindings::ClearGeofencingMockProvider)
564 .SetMethod("setGeofencingMockPosition",
565 &TestRunnerBindings::SetGeofencingMockPosition)
556 566
557 // Properties. 567 // Properties.
558 .SetProperty("platformName", &TestRunnerBindings::PlatformName) 568 .SetProperty("platformName", &TestRunnerBindings::PlatformName)
559 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) 569 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText)
560 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) 570 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone)
561 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history 571 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history
562 .SetProperty("webHistoryItemCount", 572 .SetProperty("webHistoryItemCount",
563 &TestRunnerBindings::WebHistoryItemCount) 573 &TestRunnerBindings::WebHistoryItemCount)
564 .SetProperty("interceptPostMessage", 574 .SetProperty("interceptPostMessage",
565 &TestRunnerBindings::InterceptPostMessage, 575 &TestRunnerBindings::InterceptPostMessage,
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 bool allowed) { 1436 bool allowed) {
1427 if (runner_) 1437 if (runner_)
1428 runner_->SetPushMessagingPermission(GURL(origin), allowed); 1438 runner_->SetPushMessagingPermission(GURL(origin), allowed);
1429 } 1439 }
1430 1440
1431 void TestRunnerBindings::ClearPushMessagingPermissions() { 1441 void TestRunnerBindings::ClearPushMessagingPermissions() {
1432 if (runner_) 1442 if (runner_)
1433 runner_->ClearPushMessagingPermissions(); 1443 runner_->ClearPushMessagingPermissions();
1434 } 1444 }
1435 1445
1446 void TestRunnerBindings::SetGeofencingMockProvider(bool service_available) {
1447 if (runner_)
1448 runner_->SetGeofencingMockProvider(service_available);
1449 }
1450
1451 void TestRunnerBindings::ClearGeofencingMockProvider() {
1452 if (runner_)
1453 runner_->ClearGeofencingMockProvider();
1454 }
1455
1456 void TestRunnerBindings::SetGeofencingMockPosition(double latitude,
1457 double longitude) {
1458 if (runner_)
1459 runner_->SetGeofencingMockPosition(latitude, longitude);
1460 }
1461
1436 std::string TestRunnerBindings::PlatformName() { 1462 std::string TestRunnerBindings::PlatformName() {
1437 if (runner_) 1463 if (runner_)
1438 return runner_->platform_name_; 1464 return runner_->platform_name_;
1439 return std::string(); 1465 return std::string();
1440 } 1466 }
1441 1467
1442 std::string TestRunnerBindings::TooltipText() { 1468 std::string TestRunnerBindings::TooltipText() {
1443 if (runner_) 1469 if (runner_)
1444 return runner_->tooltip_text_; 1470 return runner_->tooltip_text_;
1445 return std::string(); 1471 return std::string();
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 delegate_->SetDatabaseQuota(5 * 1024 * 1024); 1646 delegate_->SetDatabaseQuota(5 * 1024 * 1024);
1621 delegate_->SetDeviceColorProfile("reset"); 1647 delegate_->SetDeviceColorProfile("reset");
1622 delegate_->SetDeviceScaleFactor(1); 1648 delegate_->SetDeviceScaleFactor(1);
1623 delegate_->SetAcceptAllCookies(false); 1649 delegate_->SetAcceptAllCookies(false);
1624 delegate_->SetLocale(""); 1650 delegate_->SetLocale("");
1625 delegate_->UseUnfortunateSynchronousResizeMode(false); 1651 delegate_->UseUnfortunateSynchronousResizeMode(false);
1626 delegate_->DisableAutoResizeMode(WebSize()); 1652 delegate_->DisableAutoResizeMode(WebSize());
1627 delegate_->DeleteAllCookies(); 1653 delegate_->DeleteAllCookies();
1628 delegate_->ResetScreenOrientation(); 1654 delegate_->ResetScreenOrientation();
1629 delegate_->SetBluetoothMockDataSet(""); 1655 delegate_->SetBluetoothMockDataSet("");
1656 delegate_->ClearGeofencingMockProvider();
1630 ResetBatteryStatus(); 1657 ResetBatteryStatus();
1631 ResetDeviceLight(); 1658 ResetDeviceLight();
1632 } 1659 }
1633 1660
1634 dump_editting_callbacks_ = false; 1661 dump_editting_callbacks_ = false;
1635 dump_as_text_ = false; 1662 dump_as_text_ = false;
1636 dump_as_markup_ = false; 1663 dump_as_markup_ = false;
1637 generate_pixel_results_ = true; 1664 generate_pixel_results_ = true;
1638 dump_child_frame_scroll_positions_ = false; 1665 dump_child_frame_scroll_positions_ = false;
1639 dump_child_frames_as_markup_ = false; 1666 dump_child_frames_as_markup_ = false;
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 void TestRunner::SetColorProfile(const std::string& name, 2783 void TestRunner::SetColorProfile(const std::string& name,
2757 v8::Handle<v8::Function> callback) { 2784 v8::Handle<v8::Function> callback) {
2758 delegate_->SetDeviceColorProfile(name); 2785 delegate_->SetDeviceColorProfile(name);
2759 delegate_->PostTask(new InvokeCallbackTask(this, callback)); 2786 delegate_->PostTask(new InvokeCallbackTask(this, callback));
2760 } 2787 }
2761 2788
2762 void TestRunner::SetBluetoothMockDataSet(const std::string& name) { 2789 void TestRunner::SetBluetoothMockDataSet(const std::string& name) {
2763 delegate_->SetBluetoothMockDataSet(name); 2790 delegate_->SetBluetoothMockDataSet(name);
2764 } 2791 }
2765 2792
2793 void TestRunner::SetGeofencingMockProvider(bool service_available) {
2794 delegate_->SetGeofencingMockProvider(service_available);
2795 }
2796
2797 void TestRunner::ClearGeofencingMockProvider() {
2798 delegate_->ClearGeofencingMockProvider();
2799 }
2800
2801 void TestRunner::SetGeofencingMockPosition(double latitude, double longitude) {
2802 delegate_->SetGeofencingMockPosition(latitude, longitude);
2803 }
2804
2766 void TestRunner::SetPOSIXLocale(const std::string& locale) { 2805 void TestRunner::SetPOSIXLocale(const std::string& locale) {
2767 delegate_->SetLocale(locale); 2806 delegate_->SetLocale(locale);
2768 } 2807 }
2769 2808
2770 void TestRunner::SetMIDIAccessorResult(bool result) { 2809 void TestRunner::SetMIDIAccessorResult(bool result) {
2771 midi_accessor_result_ = result; 2810 midi_accessor_result_ = result;
2772 } 2811 }
2773 2812
2774 void TestRunner::SetMIDISysexPermission(bool value) { 2813 void TestRunner::SetMIDISysexPermission(bool value) {
2775 for (auto* window : test_interfaces_->GetWindowList()) 2814 for (auto* window : test_interfaces_->GetWindowList())
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 } 3029 }
2991 3030
2992 void TestRunner::DidLosePointerLockInternal() { 3031 void TestRunner::DidLosePointerLockInternal() {
2993 bool was_locked = pointer_locked_; 3032 bool was_locked = pointer_locked_;
2994 pointer_locked_ = false; 3033 pointer_locked_ = false;
2995 if (was_locked) 3034 if (was_locked)
2996 web_view_->didLosePointerLock(); 3035 web_view_->didLosePointerLock();
2997 } 3036 }
2998 3037
2999 } // namespace content 3038 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.h ('k') | content/shell/renderer/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698