| 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 19 matching lines...) Expand all Loading... |
| 30 #include "third_party/WebKit/public/platform/WebPoint.h" | 30 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 31 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h" | 31 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h" |
| 32 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 32 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 33 #include "third_party/WebKit/public/web/WebArrayBuffer.h" | 33 #include "third_party/WebKit/public/web/WebArrayBuffer.h" |
| 34 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" | 34 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" |
| 35 #include "third_party/WebKit/public/web/WebBindings.h" | 35 #include "third_party/WebKit/public/web/WebBindings.h" |
| 36 #include "third_party/WebKit/public/web/WebDataSource.h" | 36 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 37 #include "third_party/WebKit/public/web/WebDocument.h" | 37 #include "third_party/WebKit/public/web/WebDocument.h" |
| 38 #include "third_party/WebKit/public/web/WebFindOptions.h" | 38 #include "third_party/WebKit/public/web/WebFindOptions.h" |
| 39 #include "third_party/WebKit/public/web/WebFrame.h" | 39 #include "third_party/WebKit/public/web/WebFrame.h" |
| 40 #include "third_party/WebKit/public/web/WebGraphicsContext.h" |
| 40 #include "third_party/WebKit/public/web/WebInputElement.h" | 41 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 41 #include "third_party/WebKit/public/web/WebKit.h" | 42 #include "third_party/WebKit/public/web/WebKit.h" |
| 42 #include "third_party/WebKit/public/web/WebMIDIClientMock.h" | 43 #include "third_party/WebKit/public/web/WebMIDIClientMock.h" |
| 43 #include "third_party/WebKit/public/web/WebPageOverlay.h" | 44 #include "third_party/WebKit/public/web/WebPageOverlay.h" |
| 44 #include "third_party/WebKit/public/web/WebScriptSource.h" | 45 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 45 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 46 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 46 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" | 47 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" |
| 47 #include "third_party/WebKit/public/web/WebSettings.h" | 48 #include "third_party/WebKit/public/web/WebSettings.h" |
| 48 #include "third_party/WebKit/public/web/WebSurroundingText.h" | 49 #include "third_party/WebKit/public/web/WebSurroundingText.h" |
| 49 #include "third_party/WebKit/public/web/WebView.h" | 50 #include "third_party/WebKit/public/web/WebView.h" |
| 50 #include "third_party/skia/include/core/SkBitmap.h" | 51 #include "third_party/skia/include/core/SkBitmap.h" |
| 51 #include "third_party/skia/include/core/SkCanvas.h" | 52 #include "third_party/skia/include/core/SkCanvas.h" |
| 53 #include "ui/gfx/geometry/rect.h" |
| 54 #include "ui/gfx/geometry/rect_f.h" |
| 55 #include "ui/gfx/geometry/size.h" |
| 56 #include "ui/gfx/skia_util.h" |
| 52 | 57 |
| 53 #if defined(__linux__) || defined(ANDROID) | 58 #if defined(__linux__) || defined(ANDROID) |
| 54 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" | 59 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
| 55 #endif | 60 #endif |
| 56 | 61 |
| 57 using namespace blink; | 62 using namespace blink; |
| 58 | 63 |
| 59 namespace content { | 64 namespace content { |
| 60 | 65 |
| 61 namespace { | 66 namespace { |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 1487 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { |
| 1483 if (runner_) | 1488 if (runner_) |
| 1484 runner_->ForceNextWebGLContextCreationToFail(); | 1489 runner_->ForceNextWebGLContextCreationToFail(); |
| 1485 } | 1490 } |
| 1486 | 1491 |
| 1487 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) { | 1492 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) { |
| 1488 } | 1493 } |
| 1489 | 1494 |
| 1490 class TestPageOverlay : public WebPageOverlay { | 1495 class TestPageOverlay : public WebPageOverlay { |
| 1491 public: | 1496 public: |
| 1492 explicit TestPageOverlay(WebView* web_view) | 1497 TestPageOverlay() {} |
| 1493 : web_view_(web_view) { | |
| 1494 } | |
| 1495 virtual ~TestPageOverlay() {} | 1498 virtual ~TestPageOverlay() {} |
| 1496 | 1499 |
| 1497 virtual void paintPageOverlay(WebCanvas* canvas) override { | 1500 virtual void paintPageOverlay(WebGraphicsContext* context, |
| 1498 SkRect rect = SkRect::MakeWH(web_view_->size().width, | 1501 const WebSize& webViewSize) { |
| 1499 web_view_->size().height); | 1502 gfx::Rect rect(webViewSize); |
| 1503 SkCanvas* canvas = context->beginDrawing(gfx::RectF(rect)); |
| 1500 SkPaint paint; | 1504 SkPaint paint; |
| 1501 paint.setColor(SK_ColorCYAN); | 1505 paint.setColor(SK_ColorCYAN); |
| 1502 paint.setStyle(SkPaint::kFill_Style); | 1506 paint.setStyle(SkPaint::kFill_Style); |
| 1503 canvas->drawRect(rect, paint); | 1507 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
| 1508 context->endDrawing(); |
| 1504 } | 1509 } |
| 1505 | |
| 1506 private: | |
| 1507 WebView* web_view_; | |
| 1508 }; | 1510 }; |
| 1509 | 1511 |
| 1510 TestRunner::WorkQueue::WorkQueue(TestRunner* controller) | 1512 TestRunner::WorkQueue::WorkQueue(TestRunner* controller) |
| 1511 : frozen_(false) | 1513 : frozen_(false) |
| 1512 , controller_(controller) {} | 1514 , controller_(controller) {} |
| 1513 | 1515 |
| 1514 TestRunner::WorkQueue::~WorkQueue() { | 1516 TestRunner::WorkQueue::~WorkQueue() { |
| 1515 Reset(); | 1517 Reset(); |
| 1516 } | 1518 } |
| 1517 | 1519 |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 const std::string& password) { | 2853 const std::string& password) { |
| 2852 proxy_->GetCredentialManagerClientMock()->SetResponse( | 2854 proxy_->GetCredentialManagerClientMock()->SetResponse( |
| 2853 new WebLocalCredential(WebString::fromUTF8(id), | 2855 new WebLocalCredential(WebString::fromUTF8(id), |
| 2854 WebString::fromUTF8(name), | 2856 WebString::fromUTF8(name), |
| 2855 WebURL(GURL(avatar)), | 2857 WebURL(GURL(avatar)), |
| 2856 WebString::fromUTF8(password))); | 2858 WebString::fromUTF8(password))); |
| 2857 } | 2859 } |
| 2858 | 2860 |
| 2859 void TestRunner::AddWebPageOverlay() { | 2861 void TestRunner::AddWebPageOverlay() { |
| 2860 if (web_view_ && !page_overlay_) { | 2862 if (web_view_ && !page_overlay_) { |
| 2861 page_overlay_ = new TestPageOverlay(web_view_); | 2863 page_overlay_ = new TestPageOverlay; |
| 2862 web_view_->addPageOverlay(page_overlay_, 0); | 2864 web_view_->addPageOverlay(page_overlay_, 0); |
| 2863 } | 2865 } |
| 2864 } | 2866 } |
| 2865 | 2867 |
| 2866 void TestRunner::RemoveWebPageOverlay() { | 2868 void TestRunner::RemoveWebPageOverlay() { |
| 2867 if (web_view_ && page_overlay_) { | 2869 if (web_view_ && page_overlay_) { |
| 2868 web_view_->removePageOverlay(page_overlay_); | 2870 web_view_->removePageOverlay(page_overlay_); |
| 2869 delete page_overlay_; | 2871 delete page_overlay_; |
| 2870 page_overlay_ = nullptr; | 2872 page_overlay_ = nullptr; |
| 2871 } | 2873 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 } | 3023 } |
| 3022 | 3024 |
| 3023 void TestRunner::DidLosePointerLockInternal() { | 3025 void TestRunner::DidLosePointerLockInternal() { |
| 3024 bool was_locked = pointer_locked_; | 3026 bool was_locked = pointer_locked_; |
| 3025 pointer_locked_ = false; | 3027 pointer_locked_ = false; |
| 3026 if (was_locked) | 3028 if (was_locked) |
| 3027 web_view_->didLosePointerLock(); | 3029 web_view_->didLosePointerLock(); |
| 3028 } | 3030 } |
| 3029 | 3031 |
| 3030 } // namespace content | 3032 } // namespace content |
| OLD | NEW |