Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/ContentViewReadbackTest.java

Issue 744453002: Fix a bunch of Java Checkstyle issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NeedsBraces to info Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
8 8
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.Color; 10 import android.graphics.Color;
(...skipping 19 matching lines...) Expand all
30 */ 30 */
31 public class ContentViewReadbackTest extends ContentShellTestBase { 31 public class ContentViewReadbackTest extends ContentShellTestBase {
32 32
33 private static final int COLOR_THRESHOLD = 8; 33 private static final int COLOR_THRESHOLD = 8;
34 private static final long WAIT_FOR_READBACK_TIMEOUT = scaleTimeout(10000); 34 private static final long WAIT_FOR_READBACK_TIMEOUT = scaleTimeout(10000);
35 35
36 @Override 36 @Override
37 protected void setUp() throws Exception { 37 protected void setUp() throws Exception {
38 super.setUp(); 38 super.setUp();
39 launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri( 39 launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri(
40 "<html style=\"background: #00f;\"><head><style>body { height: 5 000px; }</style>" + 40 "<html style=\"background: #00f;\"><head><style>body { height: 5 000px; }</style>"
41 "</head></html>")); 41 + "</head></html>"));
42 assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); 42 assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
43 } 43 }
44 44
45 private static void assertEqualColor(int actual, int expected, int threshold ) { 45 private static void assertEqualColor(int actual, int expected, int threshold ) {
46 int deltaR = Math.abs(Color.red(actual) - Color.red(expected)); 46 int deltaR = Math.abs(Color.red(actual) - Color.red(expected));
47 int deltaG = Math.abs(Color.green(actual) - Color.green(expected)); 47 int deltaG = Math.abs(Color.green(actual) - Color.green(expected));
48 int deltaB = Math.abs(Color.blue(actual) - Color.blue(expected)); 48 int deltaB = Math.abs(Color.blue(actual) - Color.blue(expected));
49 if (deltaR > threshold || deltaG > threshold || deltaB > threshold) { 49 if (deltaR > threshold || deltaG > threshold || deltaB > threshold) {
50 throw new AssertionFailedError( 50 throw new AssertionFailedError(
51 "Color does not match; expected " + expected + ", got " + ac tual); 51 "Color does not match; expected " + expected + ", got " + ac tual);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 contentReadbackHandler.initNativeContentReadbackHandler(); 116 contentReadbackHandler.initNativeContentReadbackHandler();
117 contentReadbackHandler.getContentBitmapAsync(1.0f, new Rect(), g etContentViewCore(), 117 contentReadbackHandler.getContentBitmapAsync(1.0f, new Rect(), g etContentViewCore(),
118 callback); 118 callback);
119 } 119 }
120 }); 120 });
121 assertWaitForReadback(readbackDone); 121 assertWaitForReadback(readbackDone);
122 122
123 assertEqualColor(color.get(), Color.BLUE, COLOR_THRESHOLD); 123 assertEqualColor(color.get(), Color.BLUE, COLOR_THRESHOLD);
124 } 124 }
125 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698