| 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 5318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5388 { | 5389 { |
| 5389 registerMockedHttpURLLoad("link-manifest-change.html"); | 5390 registerMockedHttpURLLoad("link-manifest-change.html"); |
| 5390 | 5391 |
| 5391 ManifestChangeWebFrameClient webFrameClient; | 5392 ManifestChangeWebFrameClient webFrameClient; |
| 5392 FrameTestHelpers::WebViewHelper webViewHelper; | 5393 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5393 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru
e, &webFrameClient); | 5394 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru
e, &webFrameClient); |
| 5394 | 5395 |
| 5395 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); | 5396 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); |
| 5396 } | 5397 } |
| 5397 | 5398 |
| 5399 TEST_F(WebFrameTest, DragDropTest) |
| 5400 { |
| 5401 UseMockScrollbarSettings mockScrollbarSettings; |
| 5402 registerMockedHttpURLLoad("drag-drop.html"); |
| 5403 |
| 5404 FixedLayoutTestWebViewClient client; |
| 5405 client.m_screenInfo.deviceScaleFactor = 1; |
| 5406 int viewportWidth = 200; |
| 5407 int viewportHeight = 200; |
| 5408 |
| 5409 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5410 webViewHelper.initializeAndLoad(m_baseURL + "drag-drop.html", true, 0, &clie
nt); |
| 5411 // FIXME: This test breaks if the viewport is enabled before loading the pag
e due to the paint |
| 5412 // calls below not working on composited layers. For some reason, enabling t
he viewport here |
| 5413 // doesn't cause compositing |
| 5414 webViewHelper.webView()->settings()->setViewportEnabled(true); |
| 5415 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 5416 webViewHelper.webView()->layout(); |
| 5417 |
| 5418 SkBitmap bitmap; |
| 5419 ASSERT_TRUE(bitmap.allocN32Pixels(80, 80)); |
| 5420 SkCanvas canvas(bitmap); |
| 5421 canvas.drawColor(SK_ColorGREEN); |
| 5422 |
| 5423 RefPtr<WebCore::LocalFrame> frame = webViewHelper.webViewImpl()->page()->mai
nFrame(); |
| 5424 WebCore::Element* element = frame->document()->getElementById("drag"); |
| 5425 OwnPtr<WebCore::DragImage> dragImage = frame->nodeImage(*element); |
| 5426 EXPECT_TRUE(dragImage); |
| 5427 EXPECT_EQ(80, dragImage->size().width()); |
| 5428 EXPECT_EQ(80, dragImage->size().height()); |
| 5429 const SkBitmap& dragBitmap = dragImage->bitmap(); |
| 5430 ASSERT_EQ(bitmap.bytesPerPixel(), dragBitmap.bytesPerPixel()); |
| 5431 SkAutoLockPixels lockPixel(dragBitmap); |
| 5432 ASSERT_TRUE(bitmap.getPixels()); |
| 5433 EXPECT_FALSE(dragBitmap.drawsNothing()); |
| 5434 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.rowBy
tes() * 80)); |
| 5435 } |
| 5436 |
| 5398 } // namespace | 5437 } // namespace |
| OLD | NEW |