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

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

Issue 784873004: Push API: delete MockWebPushClient [switchover 2/6] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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"
11 #include "content/shell/common/test_runner/test_preferences.h" 11 #include "content/shell/common/test_runner/test_preferences.h"
12 #include "content/shell/renderer/binding_helpers.h" 12 #include "content/shell/renderer/binding_helpers.h"
13 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h" 13 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h"
14 #include "content/shell/renderer/test_runner/mock_web_push_client.h"
15 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h" 14 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h"
16 #include "content/shell/renderer/test_runner/test_interfaces.h" 15 #include "content/shell/renderer/test_runner/test_interfaces.h"
17 #include "content/shell/renderer/test_runner/web_permissions.h" 16 #include "content/shell/renderer/test_runner/web_permissions.h"
18 #include "content/shell/renderer/test_runner/web_test_delegate.h" 17 #include "content/shell/renderer/test_runner/web_test_delegate.h"
19 #include "content/shell/renderer/test_runner/web_test_proxy.h" 18 #include "content/shell/renderer/test_runner/web_test_proxy.h"
20 #include "gin/arguments.h" 19 #include "gin/arguments.h"
21 #include "gin/array_buffer.h" 20 #include "gin/array_buffer.h"
22 #include "gin/handle.h" 21 #include "gin/handle.h"
23 #include "gin/object_template_builder.h" 22 #include "gin/object_template_builder.h"
24 #include "gin/wrappable.h" 23 #include "gin/wrappable.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void RemoveWebPageOverlay(); 285 void RemoveWebPageOverlay();
287 void DisplayAsync(); 286 void DisplayAsync();
288 void DisplayAsyncThen(v8::Handle<v8::Function> callback); 287 void DisplayAsyncThen(v8::Handle<v8::Function> callback);
289 void GetManifestThen(v8::Handle<v8::Function> callback); 288 void GetManifestThen(v8::Handle<v8::Function> callback);
290 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback); 289 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback);
291 void CopyImageAtAndCapturePixelsAsyncThen(int x, 290 void CopyImageAtAndCapturePixelsAsyncThen(int x,
292 int y, 291 int y,
293 v8::Handle<v8::Function> callback); 292 v8::Handle<v8::Function> callback);
294 void SetCustomTextOutput(std::string output); 293 void SetCustomTextOutput(std::string output);
295 void SetViewSourceForFrame(const std::string& name, bool enabled); 294 void SetViewSourceForFrame(const std::string& name, bool enabled);
296 void SetMockPushClientSuccess(const std::string& endpoint,
297 const std::string& registration_id);
298 void SetMockPushClientError(const std::string& message);
299 void SetPushMessagingPermission(const std::string& origin, bool allowed); 295 void SetPushMessagingPermission(const std::string& origin, bool allowed);
300 void ClearPushMessagingPermissions(); 296 void ClearPushMessagingPermissions();
301 void SetBluetoothMockDataSet(const std::string& dataset_name); 297 void SetBluetoothMockDataSet(const std::string& dataset_name);
302 298
303 std::string PlatformName(); 299 std::string PlatformName();
304 std::string TooltipText(); 300 std::string TooltipText();
305 bool DisableNotifyDone(); 301 bool DisableNotifyDone();
306 int WebHistoryItemCount(); 302 int WebHistoryItemCount();
307 bool InterceptPostMessage(); 303 bool InterceptPostMessage();
308 void SetInterceptPostMessage(bool value); 304 void SetInterceptPostMessage(bool value);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen) 530 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen)
535 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) 531 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen)
536 .SetMethod("capturePixelsAsyncThen", 532 .SetMethod("capturePixelsAsyncThen",
537 &TestRunnerBindings::CapturePixelsAsyncThen) 533 &TestRunnerBindings::CapturePixelsAsyncThen)
538 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", 534 .SetMethod("copyImageAtAndCapturePixelsAsyncThen",
539 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) 535 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen)
540 .SetMethod("setCustomTextOutput", 536 .SetMethod("setCustomTextOutput",
541 &TestRunnerBindings::SetCustomTextOutput) 537 &TestRunnerBindings::SetCustomTextOutput)
542 .SetMethod("setViewSourceForFrame", 538 .SetMethod("setViewSourceForFrame",
543 &TestRunnerBindings::SetViewSourceForFrame) 539 &TestRunnerBindings::SetViewSourceForFrame)
544 .SetMethod("setMockPushClientSuccess",
545 &TestRunnerBindings::SetMockPushClientSuccess)
546 .SetMethod("setMockPushClientError",
547 &TestRunnerBindings::SetMockPushClientError)
548 .SetMethod("setPushMessagingPermission", 540 .SetMethod("setPushMessagingPermission",
549 &TestRunnerBindings::SetPushMessagingPermission) 541 &TestRunnerBindings::SetPushMessagingPermission)
550 .SetMethod("clearPushMessagingPermissions", 542 .SetMethod("clearPushMessagingPermissions",
551 &TestRunnerBindings::ClearPushMessagingPermissions) 543 &TestRunnerBindings::ClearPushMessagingPermissions)
552 .SetMethod("setBluetoothMockDataSet", 544 .SetMethod("setBluetoothMockDataSet",
553 &TestRunnerBindings::SetBluetoothMockDataSet) 545 &TestRunnerBindings::SetBluetoothMockDataSet)
554 .SetMethod("forceNextWebGLContextCreationToFail", 546 .SetMethod("forceNextWebGLContextCreationToFail",
555 &TestRunnerBindings::ForceNextWebGLContextCreationToFail) 547 &TestRunnerBindings::ForceNextWebGLContextCreationToFail)
556 548
557 // Properties. 549 // Properties.
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, 1393 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name,
1402 bool enabled) { 1394 bool enabled) {
1403 if (runner_ && runner_->web_view_) { 1395 if (runner_ && runner_->web_view_) {
1404 WebFrame* target_frame = 1396 WebFrame* target_frame =
1405 runner_->web_view_->findFrameByName(WebString::fromUTF8(name)); 1397 runner_->web_view_->findFrameByName(WebString::fromUTF8(name));
1406 if (target_frame) 1398 if (target_frame)
1407 target_frame->enableViewSourceMode(enabled); 1399 target_frame->enableViewSourceMode(enabled);
1408 } 1400 }
1409 } 1401 }
1410 1402
1411 void TestRunnerBindings::SetMockPushClientSuccess(
1412 const std::string& endpoint,
1413 const std::string& registration_id) {
1414 if (!runner_)
1415 return;
1416 runner_->SetMockPushClientSuccess(endpoint, registration_id);
1417 }
1418
1419 void TestRunnerBindings::SetMockPushClientError(const std::string& message) {
1420 if (!runner_)
1421 return;
1422 runner_->SetMockPushClientError(message);
1423 }
1424
1425 void TestRunnerBindings::SetPushMessagingPermission(const std::string& origin, 1403 void TestRunnerBindings::SetPushMessagingPermission(const std::string& origin,
1426 bool allowed) { 1404 bool allowed) {
1427 if (runner_) 1405 if (runner_)
1428 runner_->SetPushMessagingPermission(GURL(origin), allowed); 1406 runner_->SetPushMessagingPermission(GURL(origin), allowed);
1429 } 1407 }
1430 1408
1431 void TestRunnerBindings::ClearPushMessagingPermissions() { 1409 void TestRunnerBindings::ClearPushMessagingPermissions() {
1432 if (runner_) 1410 if (runner_)
1433 runner_->ClearPushMessagingPermissions(); 1411 runner_->ClearPushMessagingPermissions();
1434 } 1412 }
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2919 } 2897 }
2920 #endif 2898 #endif
2921 2899
2922 argv[2] = blink::WebArrayBufferConverter::toV8Value( 2900 argv[2] = blink::WebArrayBufferConverter::toV8Value(
2923 &buffer, context->Global(), isolate); 2901 &buffer, context->Global(), isolate);
2924 2902
2925 task->SetArguments(3, argv); 2903 task->SetArguments(3, argv);
2926 InvokeCallback(task.Pass()); 2904 InvokeCallback(task.Pass());
2927 } 2905 }
2928 2906
2929 void TestRunner::SetMockPushClientSuccess(const std::string& endpoint,
2930 const std::string& registration_id) {
2931 proxy_->GetPushClientMock()->SetMockSuccessValues(endpoint, registration_id);
2932 }
2933
2934 void TestRunner::SetMockPushClientError(const std::string& message) {
2935 proxy_->GetPushClientMock()->SetMockErrorValues(message);
2936 }
2937
2938 void TestRunner::SetPushMessagingPermission(const GURL& origin, bool allowed) { 2907 void TestRunner::SetPushMessagingPermission(const GURL& origin, bool allowed) {
2939 delegate_->SetPushMessagingPermission(origin, allowed); 2908 delegate_->SetPushMessagingPermission(origin, allowed);
2940 } 2909 }
2941 2910
2942 void TestRunner::ClearPushMessagingPermissions() { 2911 void TestRunner::ClearPushMessagingPermissions() {
2943 delegate_->ClearPushMessagingPermissions(); 2912 delegate_->ClearPushMessagingPermissions();
2944 } 2913 }
2945 2914
2946 void TestRunner::LocationChangeDone() { 2915 void TestRunner::LocationChangeDone() {
2947 web_history_item_count_ = delegate_->NavigationEntryCount(); 2916 web_history_item_count_ = delegate_->NavigationEntryCount();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 } 2959 }
2991 2960
2992 void TestRunner::DidLosePointerLockInternal() { 2961 void TestRunner::DidLosePointerLockInternal() {
2993 bool was_locked = pointer_locked_; 2962 bool was_locked = pointer_locked_;
2994 pointer_locked_ = false; 2963 pointer_locked_ = false;
2995 if (was_locked) 2964 if (was_locked)
2996 web_view_->didLosePointerLock(); 2965 web_view_->didLosePointerLock();
2997 } 2966 }
2998 2967
2999 } // namespace content 2968 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.h ('k') | content/shell/renderer/test_runner/web_frame_test_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698