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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback); | 285 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback); |
286 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 286 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
287 int y, | 287 int y, |
288 v8::Handle<v8::Function> callback); | 288 v8::Handle<v8::Function> callback); |
289 void SetCustomTextOutput(std::string output); | 289 void SetCustomTextOutput(std::string output); |
290 void SetViewSourceForFrame(const std::string& name, bool enabled); | 290 void SetViewSourceForFrame(const std::string& name, bool enabled); |
291 void SetMockPushClientSuccess(const std::string& endpoint, | 291 void SetMockPushClientSuccess(const std::string& endpoint, |
292 const std::string& registration_id); | 292 const std::string& registration_id); |
293 void SetMockPushClientError(const std::string& message); | 293 void SetMockPushClientError(const std::string& message); |
294 | 294 |
295 bool GlobalFlag(); | |
296 void SetGlobalFlag(bool value); | |
297 std::string PlatformName(); | 295 std::string PlatformName(); |
298 std::string TooltipText(); | 296 std::string TooltipText(); |
299 bool DisableNotifyDone(); | 297 bool DisableNotifyDone(); |
300 int WebHistoryItemCount(); | 298 int WebHistoryItemCount(); |
301 bool InterceptPostMessage(); | 299 bool InterceptPostMessage(); |
302 void SetInterceptPostMessage(bool value); | 300 void SetInterceptPostMessage(bool value); |
303 | 301 |
304 void NotImplemented(const gin::Arguments& args); | 302 void NotImplemented(const gin::Arguments& args); |
305 | 303 |
306 base::WeakPtr<TestRunner> runner_; | 304 base::WeakPtr<TestRunner> runner_; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 .SetMethod("setCustomTextOutput", | 527 .SetMethod("setCustomTextOutput", |
530 &TestRunnerBindings::SetCustomTextOutput) | 528 &TestRunnerBindings::SetCustomTextOutput) |
531 .SetMethod("setViewSourceForFrame", | 529 .SetMethod("setViewSourceForFrame", |
532 &TestRunnerBindings::SetViewSourceForFrame) | 530 &TestRunnerBindings::SetViewSourceForFrame) |
533 .SetMethod("setMockPushClientSuccess", | 531 .SetMethod("setMockPushClientSuccess", |
534 &TestRunnerBindings::SetMockPushClientSuccess) | 532 &TestRunnerBindings::SetMockPushClientSuccess) |
535 .SetMethod("setMockPushClientError", | 533 .SetMethod("setMockPushClientError", |
536 &TestRunnerBindings::SetMockPushClientError) | 534 &TestRunnerBindings::SetMockPushClientError) |
537 | 535 |
538 // Properties. | 536 // Properties. |
539 .SetProperty("globalFlag", | |
540 &TestRunnerBindings::GlobalFlag, | |
541 &TestRunnerBindings::SetGlobalFlag) | |
542 .SetProperty("platformName", &TestRunnerBindings::PlatformName) | 537 .SetProperty("platformName", &TestRunnerBindings::PlatformName) |
543 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 538 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) |
544 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) | 539 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) |
545 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 540 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
546 .SetProperty("webHistoryItemCount", | 541 .SetProperty("webHistoryItemCount", |
547 &TestRunnerBindings::WebHistoryItemCount) | 542 &TestRunnerBindings::WebHistoryItemCount) |
548 .SetProperty("interceptPostMessage", | 543 .SetProperty("interceptPostMessage", |
549 &TestRunnerBindings::InterceptPostMessage, | 544 &TestRunnerBindings::InterceptPostMessage, |
550 &TestRunnerBindings::SetInterceptPostMessage) | 545 &TestRunnerBindings::SetInterceptPostMessage) |
551 | 546 |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 return; | 1376 return; |
1382 runner_->SetMockPushClientSuccess(endpoint, registration_id); | 1377 runner_->SetMockPushClientSuccess(endpoint, registration_id); |
1383 } | 1378 } |
1384 | 1379 |
1385 void TestRunnerBindings::SetMockPushClientError(const std::string& message) { | 1380 void TestRunnerBindings::SetMockPushClientError(const std::string& message) { |
1386 if (!runner_) | 1381 if (!runner_) |
1387 return; | 1382 return; |
1388 runner_->SetMockPushClientError(message); | 1383 runner_->SetMockPushClientError(message); |
1389 } | 1384 } |
1390 | 1385 |
1391 bool TestRunnerBindings::GlobalFlag() { | |
1392 if (runner_) | |
1393 return runner_->global_flag_; | |
1394 return false; | |
1395 } | |
1396 | |
1397 void TestRunnerBindings::SetGlobalFlag(bool value) { | |
1398 if (runner_) | |
1399 runner_->global_flag_ = value; | |
1400 } | |
1401 | |
1402 std::string TestRunnerBindings::PlatformName() { | 1386 std::string TestRunnerBindings::PlatformName() { |
1403 if (runner_) | 1387 if (runner_) |
1404 return runner_->platform_name_; | 1388 return runner_->platform_name_; |
1405 return std::string(); | 1389 return std::string(); |
1406 } | 1390 } |
1407 | 1391 |
1408 std::string TestRunnerBindings::TooltipText() { | 1392 std::string TestRunnerBindings::TooltipText() { |
1409 if (runner_) | 1393 if (runner_) |
1410 return runner_->tooltip_text_; | 1394 return runner_->tooltip_text_; |
1411 return std::string(); | 1395 return std::string(); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 sweep_horizontally_ = false; | 1604 sweep_horizontally_ = false; |
1621 is_printing_ = false; | 1605 is_printing_ = false; |
1622 midi_accessor_result_ = true; | 1606 midi_accessor_result_ = true; |
1623 should_stay_on_page_after_handling_before_unload_ = false; | 1607 should_stay_on_page_after_handling_before_unload_ = false; |
1624 should_dump_resource_priorities_ = false; | 1608 should_dump_resource_priorities_ = false; |
1625 has_custom_text_output_ = false; | 1609 has_custom_text_output_ = false; |
1626 custom_text_output_.clear(); | 1610 custom_text_output_.clear(); |
1627 | 1611 |
1628 http_headers_to_clear_.clear(); | 1612 http_headers_to_clear_.clear(); |
1629 | 1613 |
1630 global_flag_ = false; | |
1631 platform_name_ = "chromium"; | 1614 platform_name_ = "chromium"; |
1632 tooltip_text_ = std::string(); | 1615 tooltip_text_ = std::string(); |
1633 disable_notify_done_ = false; | 1616 disable_notify_done_ = false; |
1634 web_history_item_count_ = 0; | 1617 web_history_item_count_ = 0; |
1635 intercept_post_message_ = false; | 1618 intercept_post_message_ = false; |
1636 | 1619 |
1637 web_permissions_->Reset(); | 1620 web_permissions_->Reset(); |
1638 | 1621 |
1639 notification_presenter_->Reset(); | 1622 notification_presenter_->Reset(); |
1640 use_mock_theme_ = true; | 1623 use_mock_theme_ = true; |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2913 } | 2896 } |
2914 | 2897 |
2915 void TestRunner::DidLosePointerLockInternal() { | 2898 void TestRunner::DidLosePointerLockInternal() { |
2916 bool was_locked = pointer_locked_; | 2899 bool was_locked = pointer_locked_; |
2917 pointer_locked_ = false; | 2900 pointer_locked_ = false; |
2918 if (was_locked) | 2901 if (was_locked) |
2919 web_view_->didLosePointerLock(); | 2902 web_view_->didLosePointerLock(); |
2920 } | 2903 } |
2921 | 2904 |
2922 } // namespace content | 2905 } // namespace content |
OLD | NEW |