OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 // Set WebView background to green with alpha. | 279 // Set WebView background to green with alpha. |
280 WebView* webView = m_webViewHelper.initialize(); | 280 WebView* webView = m_webViewHelper.initialize(); |
281 webView->setBaseBackgroundColor(kAlphaGreen); | 281 webView->setBaseBackgroundColor(kAlphaGreen); |
282 webView->settings()->setShouldClearDocumentBackground(false); | 282 webView->settings()->setShouldClearDocumentBackground(false); |
283 webView->resize(WebSize(kWidth, kHeight)); | 283 webView->resize(WebSize(kWidth, kHeight)); |
284 webView->layout(); | 284 webView->layout(); |
285 | 285 |
286 // Set canvas background to red with alpha. | 286 // Set canvas background to red with alpha. |
287 SkBitmap bitmap; | 287 SkBitmap bitmap; |
288 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kWidth, kHeight); | 288 ASSERT_TRUE(bitmap.allocN32Pixels(kWidth, kHeight)); |
289 bitmap.allocPixels(); | 289 SkCanvas canvas(bitmap); |
290 SkBitmapDevice device(bitmap); | |
291 SkCanvas canvas(&device); | |
292 canvas.clear(kAlphaRed); | 290 canvas.clear(kAlphaRed); |
293 webView->paint(&canvas, WebRect(0, 0, kWidth, kHeight)); | 291 webView->paint(&canvas, WebRect(0, 0, kWidth, kHeight)); |
294 | 292 |
295 // The result should be a blend of red and green. | 293 // The result should be a blend of red and green. |
296 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2); | 294 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2); |
297 EXPECT_TRUE(WebCore::redChannel(color)); | 295 EXPECT_TRUE(WebCore::redChannel(color)); |
298 EXPECT_TRUE(WebCore::greenChannel(color)); | 296 EXPECT_TRUE(WebCore::greenChannel(color)); |
299 } | 297 } |
300 | 298 |
301 TEST_F(WebViewTest, FocusIsInactive) | 299 TEST_F(WebViewTest, FocusIsInactive) |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 testSelectionRootBounds("select_range_iframe_textarea_overflow.html", 1.0f); | 1739 testSelectionRootBounds("select_range_iframe_textarea_overflow.html", 1.0f); |
1742 | 1740 |
1743 // Basic page with scale factor. | 1741 // Basic page with scale factor. |
1744 testSelectionRootBounds("select_range_basic.html", 0.0f); | 1742 testSelectionRootBounds("select_range_basic.html", 0.0f); |
1745 testSelectionRootBounds("select_range_basic.html", 0.1f); | 1743 testSelectionRootBounds("select_range_basic.html", 0.1f); |
1746 testSelectionRootBounds("select_range_basic.html", 1.5f); | 1744 testSelectionRootBounds("select_range_basic.html", 1.5f); |
1747 testSelectionRootBounds("select_range_basic.html", 2.0f); | 1745 testSelectionRootBounds("select_range_basic.html", 2.0f); |
1748 } | 1746 } |
1749 | 1747 |
1750 } // namespace | 1748 } // namespace |
OLD | NEW |