| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 301 | 301 | 
| 302   std::string PlatformName(); | 302   std::string PlatformName(); | 
| 303   std::string TooltipText(); | 303   std::string TooltipText(); | 
| 304   bool DisableNotifyDone(); | 304   bool DisableNotifyDone(); | 
| 305   int WebHistoryItemCount(); | 305   int WebHistoryItemCount(); | 
| 306   bool InterceptPostMessage(); | 306   bool InterceptPostMessage(); | 
| 307   void SetInterceptPostMessage(bool value); | 307   void SetInterceptPostMessage(bool value); | 
| 308 | 308 | 
| 309   void NotImplemented(const gin::Arguments& args); | 309   void NotImplemented(const gin::Arguments& args); | 
| 310 | 310 | 
|  | 311   void ForceNextWebGLContextCreationToFail(); | 
|  | 312 | 
| 311   base::WeakPtr<TestRunner> runner_; | 313   base::WeakPtr<TestRunner> runner_; | 
| 312 | 314 | 
| 313   DISALLOW_COPY_AND_ASSIGN(TestRunnerBindings); | 315   DISALLOW_COPY_AND_ASSIGN(TestRunnerBindings); | 
| 314 }; | 316 }; | 
| 315 | 317 | 
| 316 gin::WrapperInfo TestRunnerBindings::kWrapperInfo = { | 318 gin::WrapperInfo TestRunnerBindings::kWrapperInfo = { | 
| 317     gin::kEmbedderNativeGin}; | 319     gin::kEmbedderNativeGin}; | 
| 318 | 320 | 
| 319 // static | 321 // static | 
| 320 void TestRunnerBindings::Install(base::WeakPtr<TestRunner> runner, | 322 void TestRunnerBindings::Install(base::WeakPtr<TestRunner> runner, | 
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 537       .SetMethod("setCustomTextOutput", | 539       .SetMethod("setCustomTextOutput", | 
| 538                  &TestRunnerBindings::SetCustomTextOutput) | 540                  &TestRunnerBindings::SetCustomTextOutput) | 
| 539       .SetMethod("setViewSourceForFrame", | 541       .SetMethod("setViewSourceForFrame", | 
| 540                  &TestRunnerBindings::SetViewSourceForFrame) | 542                  &TestRunnerBindings::SetViewSourceForFrame) | 
| 541       .SetMethod("setMockPushClientSuccess", | 543       .SetMethod("setMockPushClientSuccess", | 
| 542                  &TestRunnerBindings::SetMockPushClientSuccess) | 544                  &TestRunnerBindings::SetMockPushClientSuccess) | 
| 543       .SetMethod("setMockPushClientError", | 545       .SetMethod("setMockPushClientError", | 
| 544                  &TestRunnerBindings::SetMockPushClientError) | 546                  &TestRunnerBindings::SetMockPushClientError) | 
| 545       .SetMethod("setBluetoothMockDataSet", | 547       .SetMethod("setBluetoothMockDataSet", | 
| 546                  &TestRunnerBindings::SetBluetoothMockDataSet) | 548                  &TestRunnerBindings::SetBluetoothMockDataSet) | 
|  | 549       .SetMethod("forceNextWebGLContextCreationToFail", | 
|  | 550                  &TestRunnerBindings::ForceNextWebGLContextCreationToFail) | 
| 547 | 551 | 
| 548       // Properties. | 552       // Properties. | 
| 549       .SetProperty("platformName", &TestRunnerBindings::PlatformName) | 553       .SetProperty("platformName", &TestRunnerBindings::PlatformName) | 
| 550       .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 554       .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 
| 551       .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) | 555       .SetProperty("disableNotifyDone", &TestRunnerBindings::DisableNotifyDone) | 
| 552       // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 556       // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 
| 553       .SetProperty("webHistoryItemCount", | 557       .SetProperty("webHistoryItemCount", | 
| 554                    &TestRunnerBindings::WebHistoryItemCount) | 558                    &TestRunnerBindings::WebHistoryItemCount) | 
| 555       .SetProperty("interceptPostMessage", | 559       .SetProperty("interceptPostMessage", | 
| 556                    &TestRunnerBindings::InterceptPostMessage, | 560                    &TestRunnerBindings::InterceptPostMessage, | 
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1441   if (runner_) | 1445   if (runner_) | 
| 1442     return runner_->intercept_post_message_; | 1446     return runner_->intercept_post_message_; | 
| 1443   return false; | 1447   return false; | 
| 1444 } | 1448 } | 
| 1445 | 1449 | 
| 1446 void TestRunnerBindings::SetInterceptPostMessage(bool value) { | 1450 void TestRunnerBindings::SetInterceptPostMessage(bool value) { | 
| 1447   if (runner_) | 1451   if (runner_) | 
| 1448     runner_->intercept_post_message_ = value; | 1452     runner_->intercept_post_message_ = value; | 
| 1449 } | 1453 } | 
| 1450 | 1454 | 
|  | 1455 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 
|  | 1456   if (runner_) | 
|  | 1457     runner_->ForceNextWebGLContextCreationToFail(); | 
|  | 1458 } | 
|  | 1459 | 
| 1451 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) { | 1460 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) { | 
| 1452 } | 1461 } | 
| 1453 | 1462 | 
| 1454 class TestPageOverlay : public WebPageOverlay { | 1463 class TestPageOverlay : public WebPageOverlay { | 
| 1455  public: | 1464  public: | 
| 1456   explicit TestPageOverlay(WebView* web_view) | 1465   explicit TestPageOverlay(WebView* web_view) | 
| 1457       : web_view_(web_view) { | 1466       : web_view_(web_view) { | 
| 1458   } | 1467   } | 
| 1459   virtual ~TestPageOverlay() {} | 1468   virtual ~TestPageOverlay() {} | 
| 1460 | 1469 | 
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2838 } | 2847 } | 
| 2839 | 2848 | 
| 2840 void TestRunner::CapturePixelsAsyncThen(v8::Handle<v8::Function> callback) { | 2849 void TestRunner::CapturePixelsAsyncThen(v8::Handle<v8::Function> callback) { | 
| 2841   scoped_ptr<InvokeCallbackTask> task( | 2850   scoped_ptr<InvokeCallbackTask> task( | 
| 2842       new InvokeCallbackTask(this, callback)); | 2851       new InvokeCallbackTask(this, callback)); | 
| 2843   proxy_->CapturePixelsAsync(base::Bind(&TestRunner::CapturePixelsCallback, | 2852   proxy_->CapturePixelsAsync(base::Bind(&TestRunner::CapturePixelsCallback, | 
| 2844                                         weak_factory_.GetWeakPtr(), | 2853                                         weak_factory_.GetWeakPtr(), | 
| 2845                                         base::Passed(&task))); | 2854                                         base::Passed(&task))); | 
| 2846 } | 2855 } | 
| 2847 | 2856 | 
|  | 2857 void TestRunner::ForceNextWebGLContextCreationToFail() { | 
|  | 2858   if (web_view_) | 
|  | 2859     web_view_->forceNextWebGLContextCreationToFail(); | 
|  | 2860 } | 
|  | 2861 | 
| 2848 void TestRunner::CopyImageAtAndCapturePixelsAsyncThen( | 2862 void TestRunner::CopyImageAtAndCapturePixelsAsyncThen( | 
| 2849     int x, int y, v8::Handle<v8::Function> callback) { | 2863     int x, int y, v8::Handle<v8::Function> callback) { | 
| 2850   scoped_ptr<InvokeCallbackTask> task( | 2864   scoped_ptr<InvokeCallbackTask> task( | 
| 2851       new InvokeCallbackTask(this, callback)); | 2865       new InvokeCallbackTask(this, callback)); | 
| 2852   proxy_->CopyImageAtAndCapturePixels( | 2866   proxy_->CopyImageAtAndCapturePixels( | 
| 2853       x, y, base::Bind(&TestRunner::CapturePixelsCallback, | 2867       x, y, base::Bind(&TestRunner::CapturePixelsCallback, | 
| 2854                        weak_factory_.GetWeakPtr(), | 2868                        weak_factory_.GetWeakPtr(), | 
| 2855                        base::Passed(&task))); | 2869                        base::Passed(&task))); | 
| 2856 } | 2870 } | 
| 2857 | 2871 | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2961 } | 2975 } | 
| 2962 | 2976 | 
| 2963 void TestRunner::DidLosePointerLockInternal() { | 2977 void TestRunner::DidLosePointerLockInternal() { | 
| 2964   bool was_locked = pointer_locked_; | 2978   bool was_locked = pointer_locked_; | 
| 2965   pointer_locked_ = false; | 2979   pointer_locked_ = false; | 
| 2966   if (was_locked) | 2980   if (was_locked) | 
| 2967     web_view_->didLosePointerLock(); | 2981     web_view_->didLosePointerLock(); | 
| 2968 } | 2982 } | 
| 2969 | 2983 | 
| 2970 }  // namespace content | 2984 }  // namespace content | 
| OLD | NEW | 
|---|