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/public/test/layouttest_support.h" | 10 #include "content/public/test/layouttest_support.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const std::string& message); | 283 const std::string& message); |
284 bool WasMockSpeechRecognitionAborted(); | 284 bool WasMockSpeechRecognitionAborted(); |
285 void AddMockCredentialManagerResponse(const std::string& id, | 285 void AddMockCredentialManagerResponse(const std::string& id, |
286 const std::string& name, | 286 const std::string& name, |
287 const std::string& avatar, | 287 const std::string& avatar, |
288 const std::string& password); | 288 const std::string& password); |
289 void AddWebPageOverlay(); | 289 void AddWebPageOverlay(); |
290 void RemoveWebPageOverlay(); | 290 void RemoveWebPageOverlay(); |
291 void LayoutAndPaintAsync(); | 291 void LayoutAndPaintAsync(); |
292 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); | 292 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); |
293 void DisplayAsync(); | |
294 void DisplayAsyncThen(v8::Local<v8::Function> callback); | |
295 void GetManifestThen(v8::Local<v8::Function> callback); | 293 void GetManifestThen(v8::Local<v8::Function> callback); |
296 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); | 294 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); |
297 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 295 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
298 int y, | 296 int y, |
299 v8::Local<v8::Function> callback); | 297 v8::Local<v8::Function> callback); |
300 void SetCustomTextOutput(std::string output); | 298 void SetCustomTextOutput(std::string output); |
301 void SetViewSourceForFrame(const std::string& name, bool enabled); | 299 void SetViewSourceForFrame(const std::string& name, bool enabled); |
302 void SetBluetoothMockDataSet(const std::string& dataset_name); | 300 void SetBluetoothMockDataSet(const std::string& dataset_name); |
303 void SetGeofencingMockProvider(bool service_available); | 301 void SetGeofencingMockProvider(bool service_available); |
304 void ClearGeofencingMockProvider(); | 302 void ClearGeofencingMockProvider(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 &TestRunnerBindings::WasMockSpeechRecognitionAborted) | 530 &TestRunnerBindings::WasMockSpeechRecognitionAborted) |
533 .SetMethod("addMockCredentialManagerResponse", | 531 .SetMethod("addMockCredentialManagerResponse", |
534 &TestRunnerBindings::AddMockCredentialManagerResponse) | 532 &TestRunnerBindings::AddMockCredentialManagerResponse) |
535 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 533 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) |
536 .SetMethod("removeWebPageOverlay", | 534 .SetMethod("removeWebPageOverlay", |
537 &TestRunnerBindings::RemoveWebPageOverlay) | 535 &TestRunnerBindings::RemoveWebPageOverlay) |
538 .SetMethod("layoutAndPaintAsync", | 536 .SetMethod("layoutAndPaintAsync", |
539 &TestRunnerBindings::LayoutAndPaintAsync) | 537 &TestRunnerBindings::LayoutAndPaintAsync) |
540 .SetMethod("layoutAndPaintAsyncThen", | 538 .SetMethod("layoutAndPaintAsyncThen", |
541 &TestRunnerBindings::LayoutAndPaintAsyncThen) | 539 &TestRunnerBindings::LayoutAndPaintAsyncThen) |
542 .SetMethod("displayAsync", &TestRunnerBindings::DisplayAsync) | |
543 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen) | |
544 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) | 540 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) |
545 .SetMethod("capturePixelsAsyncThen", | 541 .SetMethod("capturePixelsAsyncThen", |
546 &TestRunnerBindings::CapturePixelsAsyncThen) | 542 &TestRunnerBindings::CapturePixelsAsyncThen) |
547 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 543 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", |
548 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 544 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) |
549 .SetMethod("setCustomTextOutput", | 545 .SetMethod("setCustomTextOutput", |
550 &TestRunnerBindings::SetCustomTextOutput) | 546 &TestRunnerBindings::SetCustomTextOutput) |
551 .SetMethod("setViewSourceForFrame", | 547 .SetMethod("setViewSourceForFrame", |
552 &TestRunnerBindings::SetViewSourceForFrame) | 548 &TestRunnerBindings::SetViewSourceForFrame) |
553 .SetMethod("setBluetoothMockDataSet", | 549 .SetMethod("setBluetoothMockDataSet", |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 if (runner_) | 1363 if (runner_) |
1368 runner_->LayoutAndPaintAsync(); | 1364 runner_->LayoutAndPaintAsync(); |
1369 } | 1365 } |
1370 | 1366 |
1371 void TestRunnerBindings::LayoutAndPaintAsyncThen( | 1367 void TestRunnerBindings::LayoutAndPaintAsyncThen( |
1372 v8::Local<v8::Function> callback) { | 1368 v8::Local<v8::Function> callback) { |
1373 if (runner_) | 1369 if (runner_) |
1374 runner_->LayoutAndPaintAsyncThen(callback); | 1370 runner_->LayoutAndPaintAsyncThen(callback); |
1375 } | 1371 } |
1376 | 1372 |
1377 void TestRunnerBindings::DisplayAsync() { | |
1378 if (runner_) | |
1379 runner_->DisplayAsync(); | |
1380 } | |
1381 | |
1382 void TestRunnerBindings::DisplayAsyncThen( | |
1383 v8::Local<v8::Function> callback) { | |
1384 if (runner_) | |
1385 runner_->DisplayAsyncThen(callback); | |
1386 } | |
1387 | |
1388 void TestRunnerBindings::GetManifestThen(v8::Local<v8::Function> callback) { | 1373 void TestRunnerBindings::GetManifestThen(v8::Local<v8::Function> callback) { |
1389 if (runner_) | 1374 if (runner_) |
1390 runner_->GetManifestThen(callback); | 1375 runner_->GetManifestThen(callback); |
1391 } | 1376 } |
1392 | 1377 |
1393 void TestRunnerBindings::CapturePixelsAsyncThen( | 1378 void TestRunnerBindings::CapturePixelsAsyncThen( |
1394 v8::Local<v8::Function> callback) { | 1379 v8::Local<v8::Function> callback) { |
1395 if (runner_) | 1380 if (runner_) |
1396 runner_->CapturePixelsAsyncThen(callback); | 1381 runner_->CapturePixelsAsyncThen(callback); |
1397 } | 1382 } |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 } | 2855 } |
2871 | 2856 |
2872 void TestRunner::LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback) { | 2857 void TestRunner::LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback) { |
2873 scoped_ptr<InvokeCallbackTask> task( | 2858 scoped_ptr<InvokeCallbackTask> task( |
2874 new InvokeCallbackTask(this, callback)); | 2859 new InvokeCallbackTask(this, callback)); |
2875 proxy_->LayoutAndPaintAsyncThen(base::Bind(&TestRunner::InvokeCallback, | 2860 proxy_->LayoutAndPaintAsyncThen(base::Bind(&TestRunner::InvokeCallback, |
2876 weak_factory_.GetWeakPtr(), | 2861 weak_factory_.GetWeakPtr(), |
2877 base::Passed(&task))); | 2862 base::Passed(&task))); |
2878 } | 2863 } |
2879 | 2864 |
2880 void TestRunner::DisplayAsync() { | |
2881 proxy_->DisplayAsyncThen(base::Closure()); | |
2882 } | |
2883 | |
2884 void TestRunner::DisplayAsyncThen(v8::Local<v8::Function> callback) { | |
2885 scoped_ptr<InvokeCallbackTask> task( | |
2886 new InvokeCallbackTask(this, callback)); | |
2887 proxy_->DisplayAsyncThen(base::Bind(&TestRunner::InvokeCallback, | |
2888 weak_factory_.GetWeakPtr(), | |
2889 base::Passed(&task))); | |
2890 } | |
2891 | |
2892 void TestRunner::GetManifestThen(v8::Local<v8::Function> callback) { | 2865 void TestRunner::GetManifestThen(v8::Local<v8::Function> callback) { |
2893 scoped_ptr<InvokeCallbackTask> task( | 2866 scoped_ptr<InvokeCallbackTask> task( |
2894 new InvokeCallbackTask(this, callback)); | 2867 new InvokeCallbackTask(this, callback)); |
2895 | 2868 |
2896 FetchManifest(web_view_, web_view_->mainFrame()->document().manifestURL(), | 2869 FetchManifest(web_view_, web_view_->mainFrame()->document().manifestURL(), |
2897 base::Bind(&TestRunner::GetManifestCallback, | 2870 base::Bind(&TestRunner::GetManifestCallback, |
2898 weak_factory_.GetWeakPtr(), | 2871 weak_factory_.GetWeakPtr(), |
2899 base::Passed(&task))); | 2872 base::Passed(&task))); |
2900 } | 2873 } |
2901 | 2874 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 } | 2992 } |
3020 | 2993 |
3021 void TestRunner::DidLosePointerLockInternal() { | 2994 void TestRunner::DidLosePointerLockInternal() { |
3022 bool was_locked = pointer_locked_; | 2995 bool was_locked = pointer_locked_; |
3023 pointer_locked_ = false; | 2996 pointer_locked_ = false; |
3024 if (was_locked) | 2997 if (was_locked) |
3025 web_view_->didLosePointerLock(); | 2998 web_view_->didLosePointerLock(); |
3026 } | 2999 } |
3027 | 3000 |
3028 } // namespace content | 3001 } // namespace content |
OLD | NEW |