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 "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/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void DisplayAsyncThen(v8::Handle<v8::Function> callback); | 283 void DisplayAsyncThen(v8::Handle<v8::Function> callback); |
284 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback); | 284 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback); |
285 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 285 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
286 int y, | 286 int y, |
287 v8::Handle<v8::Function> callback); | 287 v8::Handle<v8::Function> callback); |
288 void SetCustomTextOutput(std::string output); | 288 void SetCustomTextOutput(std::string output); |
289 void SetViewSourceForFrame(const std::string& name, bool enabled); | 289 void SetViewSourceForFrame(const std::string& name, bool enabled); |
290 void SetMockPushClientSuccess(const std::string& endpoint, | 290 void SetMockPushClientSuccess(const std::string& endpoint, |
291 const std::string& registration_id); | 291 const std::string& registration_id); |
292 void SetMockPushClientError(const std::string& message); | 292 void SetMockPushClientError(const std::string& message); |
| 293 void RequestEcho(int id, int size); |
| 294 int GetLastEchoId() const; |
| 295 int GetLastEchoSize() const; |
293 | 296 |
294 bool GlobalFlag(); | 297 bool GlobalFlag(); |
295 void SetGlobalFlag(bool value); | 298 void SetGlobalFlag(bool value); |
296 std::string PlatformName(); | 299 std::string PlatformName(); |
297 std::string TooltipText(); | 300 std::string TooltipText(); |
298 bool DisableNotifyDone(); | 301 bool DisableNotifyDone(); |
299 int WebHistoryItemCount(); | 302 int WebHistoryItemCount(); |
300 bool InterceptPostMessage(); | 303 bool InterceptPostMessage(); |
301 void SetInterceptPostMessage(bool value); | 304 void SetInterceptPostMessage(bool value); |
302 | 305 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 540 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", |
538 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 541 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) |
539 .SetMethod("setCustomTextOutput", | 542 .SetMethod("setCustomTextOutput", |
540 &TestRunnerBindings::SetCustomTextOutput) | 543 &TestRunnerBindings::SetCustomTextOutput) |
541 .SetMethod("setViewSourceForFrame", | 544 .SetMethod("setViewSourceForFrame", |
542 &TestRunnerBindings::SetViewSourceForFrame) | 545 &TestRunnerBindings::SetViewSourceForFrame) |
543 .SetMethod("setMockPushClientSuccess", | 546 .SetMethod("setMockPushClientSuccess", |
544 &TestRunnerBindings::SetMockPushClientSuccess) | 547 &TestRunnerBindings::SetMockPushClientSuccess) |
545 .SetMethod("setMockPushClientError", | 548 .SetMethod("setMockPushClientError", |
546 &TestRunnerBindings::SetMockPushClientError) | 549 &TestRunnerBindings::SetMockPushClientError) |
| 550 // IPCEcho API |
| 551 .SetMethod("requestEcho", |
| 552 &TestRunnerBindings::RequestEcho) |
| 553 .SetProperty("lastEchoId", |
| 554 &TestRunnerBindings::GetLastEchoId) |
| 555 .SetProperty("lastEchoSize", |
| 556 &TestRunnerBindings::GetLastEchoSize) |
547 | 557 |
548 // Properties. | 558 // Properties. |
549 .SetProperty("globalFlag", | 559 .SetProperty("globalFlag", |
550 &TestRunnerBindings::GlobalFlag, | 560 &TestRunnerBindings::GlobalFlag, |
551 &TestRunnerBindings::SetGlobalFlag) | 561 &TestRunnerBindings::SetGlobalFlag) |
552 .SetProperty("platformName", &TestRunnerBindings::PlatformName) | 562 .SetProperty("platformName", &TestRunnerBindings::PlatformName) |
553 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 563 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) |
554 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) | 564 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) |
555 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 565 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
556 .SetProperty("webHistoryItemCount", | 566 .SetProperty("webHistoryItemCount", |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 return; | 1401 return; |
1392 runner_->SetMockPushClientSuccess(endpoint, registration_id); | 1402 runner_->SetMockPushClientSuccess(endpoint, registration_id); |
1393 } | 1403 } |
1394 | 1404 |
1395 void TestRunnerBindings::SetMockPushClientError(const std::string& message) { | 1405 void TestRunnerBindings::SetMockPushClientError(const std::string& message) { |
1396 if (!runner_) | 1406 if (!runner_) |
1397 return; | 1407 return; |
1398 runner_->SetMockPushClientError(message); | 1408 runner_->SetMockPushClientError(message); |
1399 } | 1409 } |
1400 | 1410 |
| 1411 void TestRunnerBindings::RequestEcho(int id, int size) { |
| 1412 if (!runner_) |
| 1413 return; |
| 1414 runner_->RequestEcho(id, size); |
| 1415 } |
| 1416 |
| 1417 int TestRunnerBindings::GetLastEchoId() const { |
| 1418 if (!runner_) |
| 1419 return 0; |
| 1420 return runner_->GetLastEchoId(); |
| 1421 } |
| 1422 |
| 1423 int TestRunnerBindings::GetLastEchoSize() const { |
| 1424 if (!runner_) |
| 1425 return 0; |
| 1426 return runner_->GetLastEchoSize(); |
| 1427 } |
| 1428 |
1401 bool TestRunnerBindings::GlobalFlag() { | 1429 bool TestRunnerBindings::GlobalFlag() { |
1402 if (runner_) | 1430 if (runner_) |
1403 return runner_->global_flag_; | 1431 return runner_->global_flag_; |
1404 return false; | 1432 return false; |
1405 } | 1433 } |
1406 | 1434 |
1407 void TestRunnerBindings::SetGlobalFlag(bool value) { | 1435 void TestRunnerBindings::SetGlobalFlag(bool value) { |
1408 if (runner_) | 1436 if (runner_) |
1409 runner_->global_flag_ = value; | 1437 runner_->global_flag_ = value; |
1410 } | 1438 } |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2869 | 2897 |
2870 void TestRunner::SetMockPushClientSuccess(const std::string& endpoint, | 2898 void TestRunner::SetMockPushClientSuccess(const std::string& endpoint, |
2871 const std::string& registration_id) { | 2899 const std::string& registration_id) { |
2872 proxy_->GetPushClientMock()->SetMockSuccessValues(endpoint, registration_id); | 2900 proxy_->GetPushClientMock()->SetMockSuccessValues(endpoint, registration_id); |
2873 } | 2901 } |
2874 | 2902 |
2875 void TestRunner::SetMockPushClientError(const std::string& message) { | 2903 void TestRunner::SetMockPushClientError(const std::string& message) { |
2876 proxy_->GetPushClientMock()->SetMockErrorValues(message); | 2904 proxy_->GetPushClientMock()->SetMockErrorValues(message); |
2877 } | 2905 } |
2878 | 2906 |
| 2907 void TestRunner::RequestEcho(int id, int size) { |
| 2908 delegate_->requestEcho(id, size); |
| 2909 } |
| 2910 |
| 2911 int TestRunner::GetLastEchoId() const { |
| 2912 return delegate_->lastEchoId(); |
| 2913 } |
| 2914 |
| 2915 int TestRunner::GetLastEchoSize() const { |
| 2916 return delegate_->lastEchoSize(); |
| 2917 } |
| 2918 |
2879 void TestRunner::LocationChangeDone() { | 2919 void TestRunner::LocationChangeDone() { |
2880 web_history_item_count_ = delegate_->navigationEntryCount(); | 2920 web_history_item_count_ = delegate_->navigationEntryCount(); |
2881 | 2921 |
2882 // No more new work after the first complete load. | 2922 // No more new work after the first complete load. |
2883 work_queue_.set_frozen(true); | 2923 work_queue_.set_frozen(true); |
2884 | 2924 |
2885 if (!wait_until_done_) | 2925 if (!wait_until_done_) |
2886 work_queue_.ProcessWorkSoon(); | 2926 work_queue_.ProcessWorkSoon(); |
2887 } | 2927 } |
2888 | 2928 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2923 } | 2963 } |
2924 | 2964 |
2925 void TestRunner::DidLosePointerLockInternal() { | 2965 void TestRunner::DidLosePointerLockInternal() { |
2926 bool was_locked = pointer_locked_; | 2966 bool was_locked = pointer_locked_; |
2927 pointer_locked_ = false; | 2967 pointer_locked_ = false; |
2928 if (was_locked) | 2968 if (was_locked) |
2929 web_view_->didLosePointerLock(); | 2969 web_view_->didLosePointerLock(); |
2930 } | 2970 } |
2931 | 2971 |
2932 } // namespace content | 2972 } // namespace content |
OLD | NEW |