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