OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "core/frame/FrameView.h" | 50 #include "core/frame/FrameView.h" |
51 #include "core/frame/LocalFrame.h" | 51 #include "core/frame/LocalFrame.h" |
52 #include "core/frame/Settings.h" | 52 #include "core/frame/Settings.h" |
53 #include "core/html/HTMLFormElement.h" | 53 #include "core/html/HTMLFormElement.h" |
54 #include "core/loader/FrameLoadRequest.h" | 54 #include "core/loader/FrameLoadRequest.h" |
55 #include "core/page/EventHandler.h" | 55 #include "core/page/EventHandler.h" |
56 #include "core/rendering/HitTestResult.h" | 56 #include "core/rendering/HitTestResult.h" |
57 #include "core/rendering/RenderView.h" | 57 #include "core/rendering/RenderView.h" |
58 #include "core/rendering/TextAutosizer.h" | 58 #include "core/rendering/TextAutosizer.h" |
59 #include "core/rendering/compositing/RenderLayerCompositor.h" | 59 #include "core/rendering/compositing/RenderLayerCompositor.h" |
60 #include "platform/DragImage.h" | |
60 #include "platform/UserGestureIndicator.h" | 61 #include "platform/UserGestureIndicator.h" |
61 #include "platform/geometry/FloatRect.h" | 62 #include "platform/geometry/FloatRect.h" |
62 #include "platform/network/ResourceError.h" | 63 #include "platform/network/ResourceError.h" |
63 #include "platform/scroll/ScrollbarTheme.h" | 64 #include "platform/scroll/ScrollbarTheme.h" |
64 #include "public/platform/Platform.h" | 65 #include "public/platform/Platform.h" |
65 #include "public/platform/WebFloatRect.h" | 66 #include "public/platform/WebFloatRect.h" |
66 #include "public/platform/WebThread.h" | 67 #include "public/platform/WebThread.h" |
67 #include "public/platform/WebURL.h" | 68 #include "public/platform/WebURL.h" |
68 #include "public/platform/WebURLResponse.h" | 69 #include "public/platform/WebURLResponse.h" |
69 #include "public/platform/WebUnitTestSupport.h" | 70 #include "public/platform/WebUnitTestSupport.h" |
(...skipping 5372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5442 { | 5443 { |
5443 registerMockedHttpURLLoad("link-manifest-change.html"); | 5444 registerMockedHttpURLLoad("link-manifest-change.html"); |
5444 | 5445 |
5445 ManifestChangeWebFrameClient webFrameClient; | 5446 ManifestChangeWebFrameClient webFrameClient; |
5446 FrameTestHelpers::WebViewHelper webViewHelper; | 5447 FrameTestHelpers::WebViewHelper webViewHelper; |
5447 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); | 5448 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); |
5448 | 5449 |
5449 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); | 5450 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); |
5450 } | 5451 } |
5451 | 5452 |
5453 TEST_F(WebFrameTest, NodeImageTest) | |
5454 { | |
5455 registerMockedHttpURLLoad("nodeimage.html"); | |
5456 | |
5457 FixedLayoutTestWebViewClient client; | |
5458 client.m_screenInfo.deviceScaleFactor = 1; | |
5459 int viewportWidth = 100; | |
5460 int viewportHeight = 100; | |
5461 | |
5462 FrameTestHelpers::WebViewHelper webViewHelper; | |
5463 webViewHelper.initializeAndLoad(m_baseURL + "nodeimage.html", true, 0, &clie nt); | |
5464 webViewHelper.webView()->settings()->setViewportEnabled(true); | |
5465 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | |
5466 webViewHelper.webView()->layout(); | |
5467 | |
5468 | |
5469 RefPtr<WebCore::LocalFrame> frame = webViewHelper.webViewImpl()->page()->mai nFrame(); | |
5470 | |
5471 // Sub Test 1 | |
5472 { | |
esprehn
2014/06/04 18:13:45
I think it's preferable to split the test into two
spartha
2014/06/05 07:48:55
Done.
| |
5473 SkBitmap bitmap; | |
5474 ASSERT_TRUE(bitmap.allocN32Pixels(40, 40)); | |
5475 SkCanvas canvas(bitmap); | |
5476 canvas.drawColor(SK_ColorGREEN); | |
5477 WebCore::Element* element = frame->document()->getElementById("case-css- transform"); | |
5478 OwnPtr<WebCore::DragImage> dragImage = frame->nodeImage(*element); | |
5479 EXPECT_TRUE(dragImage); | |
5480 EXPECT_EQ(40, dragImage->size().width()); | |
5481 EXPECT_EQ(40, dragImage->size().height()); | |
5482 const SkBitmap& dragBitmap = dragImage->bitmap(); | |
5483 SkAutoLockPixels lockPixel(dragBitmap); | |
5484 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.g etSize())); | |
5485 } | |
5486 | |
5487 // Sub Test 2 | |
5488 { | |
5489 SkBitmap bitmap; | |
5490 SkPaint paint; | |
5491 ASSERT_TRUE(bitmap.allocN32Pixels(20, 40)); | |
5492 SkCanvas canvas(bitmap); | |
5493 canvas.drawColor(SK_ColorGREEN); | |
5494 WebCore::Element* element = frame->document()->getElementById("case-css- 3dtransform"); | |
5495 OwnPtr<WebCore::DragImage> dragImage = frame->nodeImage(*element); | |
5496 EXPECT_TRUE(dragImage); | |
5497 EXPECT_EQ(20, dragImage->size().width()); | |
5498 EXPECT_EQ(40, dragImage->size().height()); | |
5499 const SkBitmap& dragBitmap = dragImage->bitmap(); | |
5500 SkAutoLockPixels lockPixel(dragBitmap); | |
5501 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.g etSize())); | |
5502 } | |
5503 | |
5504 } | |
5505 | |
5452 } // namespace | 5506 } // namespace |
OLD | NEW |