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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 double confidence, | 242 double confidence, |
243 const std::string& language); | 243 const std::string& language); |
244 void SetMockSpeechInputDumpRect(bool value); | 244 void SetMockSpeechInputDumpRect(bool value); |
245 void AddMockSpeechRecognitionResult(const std::string& transcript, | 245 void AddMockSpeechRecognitionResult(const std::string& transcript, |
246 double confidence); | 246 double confidence); |
247 void SetMockSpeechRecognitionError(const std::string& error, | 247 void SetMockSpeechRecognitionError(const std::string& error, |
248 const std::string& message); | 248 const std::string& message); |
249 bool WasMockSpeechRecognitionAborted(); | 249 bool WasMockSpeechRecognitionAborted(); |
250 void AddWebPageOverlay(); | 250 void AddWebPageOverlay(); |
251 void RemoveWebPageOverlay(); | 251 void RemoveWebPageOverlay(); |
252 void Display(); | |
253 void DisplayAsync(); | 252 void DisplayAsync(); |
254 void DisplayAsyncThen(v8::Handle<v8::Function> callback); | 253 void DisplayAsyncThen(v8::Handle<v8::Function> callback); |
255 | 254 |
256 bool GlobalFlag(); | 255 bool GlobalFlag(); |
257 void SetGlobalFlag(bool value); | 256 void SetGlobalFlag(bool value); |
258 std::string PlatformName(); | 257 std::string PlatformName(); |
259 std::string TooltipText(); | 258 std::string TooltipText(); |
260 bool DisableNotifyDone(); | 259 bool DisableNotifyDone(); |
261 int WebHistoryItemCount(); | 260 int WebHistoryItemCount(); |
262 bool InterceptPostMessage(); | 261 bool InterceptPostMessage(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 &TestRunnerBindings::SetMockSpeechInputDumpRect) | 473 &TestRunnerBindings::SetMockSpeechInputDumpRect) |
475 .SetMethod("addMockSpeechRecognitionResult", | 474 .SetMethod("addMockSpeechRecognitionResult", |
476 &TestRunnerBindings::AddMockSpeechRecognitionResult) | 475 &TestRunnerBindings::AddMockSpeechRecognitionResult) |
477 .SetMethod("setMockSpeechRecognitionError", | 476 .SetMethod("setMockSpeechRecognitionError", |
478 &TestRunnerBindings::SetMockSpeechRecognitionError) | 477 &TestRunnerBindings::SetMockSpeechRecognitionError) |
479 .SetMethod("wasMockSpeechRecognitionAborted", | 478 .SetMethod("wasMockSpeechRecognitionAborted", |
480 &TestRunnerBindings::WasMockSpeechRecognitionAborted) | 479 &TestRunnerBindings::WasMockSpeechRecognitionAborted) |
481 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 480 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) |
482 .SetMethod("removeWebPageOverlay", | 481 .SetMethod("removeWebPageOverlay", |
483 &TestRunnerBindings::RemoveWebPageOverlay) | 482 &TestRunnerBindings::RemoveWebPageOverlay) |
484 .SetMethod("display", &TestRunnerBindings::Display) | |
485 .SetMethod("displayAsync", &TestRunnerBindings::DisplayAsync) | 483 .SetMethod("displayAsync", &TestRunnerBindings::DisplayAsync) |
486 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen) | 484 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen) |
487 | 485 |
488 // Properties. | 486 // Properties. |
489 .SetProperty("globalFlag", &TestRunnerBindings::GlobalFlag, | 487 .SetProperty("globalFlag", &TestRunnerBindings::GlobalFlag, |
490 &TestRunnerBindings::SetGlobalFlag) | 488 &TestRunnerBindings::SetGlobalFlag) |
491 .SetProperty("platformName", &TestRunnerBindings::PlatformName) | 489 .SetProperty("platformName", &TestRunnerBindings::PlatformName) |
492 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 490 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) |
493 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) | 491 .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) |
494 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 492 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 void TestRunnerBindings::AddWebPageOverlay() { | 1224 void TestRunnerBindings::AddWebPageOverlay() { |
1227 if (runner_) | 1225 if (runner_) |
1228 runner_->AddWebPageOverlay(); | 1226 runner_->AddWebPageOverlay(); |
1229 } | 1227 } |
1230 | 1228 |
1231 void TestRunnerBindings::RemoveWebPageOverlay() { | 1229 void TestRunnerBindings::RemoveWebPageOverlay() { |
1232 if (runner_) | 1230 if (runner_) |
1233 runner_->RemoveWebPageOverlay(); | 1231 runner_->RemoveWebPageOverlay(); |
1234 } | 1232 } |
1235 | 1233 |
1236 void TestRunnerBindings::Display() { | |
1237 if (runner_) | |
1238 runner_->Display(); | |
1239 } | |
1240 | |
1241 void TestRunnerBindings::DisplayAsync() { | 1234 void TestRunnerBindings::DisplayAsync() { |
1242 if (runner_) | 1235 if (runner_) |
1243 runner_->DisplayAsync(); | 1236 runner_->DisplayAsync(); |
1244 } | 1237 } |
1245 | 1238 |
1246 void TestRunnerBindings::DisplayAsyncThen(v8::Handle<v8::Function> callback) { | 1239 void TestRunnerBindings::DisplayAsyncThen(v8::Handle<v8::Function> callback) { |
1247 if (runner_) | 1240 if (runner_) |
1248 runner_->DisplayAsyncThen(callback); | 1241 runner_->DisplayAsyncThen(callback); |
1249 } | 1242 } |
1250 | 1243 |
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 } | 2570 } |
2578 | 2571 |
2579 void TestRunner::RemoveWebPageOverlay() { | 2572 void TestRunner::RemoveWebPageOverlay() { |
2580 if (web_view_ && page_overlay_) { | 2573 if (web_view_ && page_overlay_) { |
2581 web_view_->removePageOverlay(page_overlay_); | 2574 web_view_->removePageOverlay(page_overlay_); |
2582 delete page_overlay_; | 2575 delete page_overlay_; |
2583 page_overlay_ = NULL; | 2576 page_overlay_ = NULL; |
2584 } | 2577 } |
2585 } | 2578 } |
2586 | 2579 |
2587 void TestRunner::Display() { | |
2588 proxy_->display(base::Closure()); | |
2589 } | |
2590 | |
2591 void TestRunner::DisplayAsync() { | 2580 void TestRunner::DisplayAsync() { |
2592 proxy_->displayAsyncThen(base::Closure()); | 2581 proxy_->displayAsyncThen(base::Closure()); |
2593 } | 2582 } |
2594 | 2583 |
2595 void TestRunner::DisplayAsyncThen(v8::Handle<v8::Function> callback) { | 2584 void TestRunner::DisplayAsyncThen(v8::Handle<v8::Function> callback) { |
2596 scoped_ptr<InvokeCallbackTask> task( | 2585 scoped_ptr<InvokeCallbackTask> task( |
2597 new InvokeCallbackTask(this, callback)); | 2586 new InvokeCallbackTask(this, callback)); |
2598 proxy_->displayAsyncThen(base::Bind(&TestRunner::InvokeCallback, | 2587 proxy_->displayAsyncThen(base::Bind(&TestRunner::InvokeCallback, |
2599 base::Unretained(this), | 2588 base::Unretained(this), |
2600 base::Passed(&task))); | 2589 base::Passed(&task))); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 } | 2636 } |
2648 | 2637 |
2649 void TestRunner::DidLosePointerLockInternal() { | 2638 void TestRunner::DidLosePointerLockInternal() { |
2650 bool was_locked = pointer_locked_; | 2639 bool was_locked = pointer_locked_; |
2651 pointer_locked_ = false; | 2640 pointer_locked_ = false; |
2652 if (was_locked) | 2641 if (was_locked) |
2653 web_view_->didLosePointerLock(); | 2642 web_view_->didLosePointerLock(); |
2654 } | 2643 } |
2655 | 2644 |
2656 } // namespace content | 2645 } // namespace content |
OLD | NEW |