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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java

Issue 141533006: [Android] Move the java content/ package to content_public/ to start the split. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fixes and findbugs line update Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java
deleted file mode 100644
index f44a939a3407ab71ea9a6abe8fdeaf28424cba58..0000000000000000000000000000000000000000
--- a/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser;
-
-import android.content.Context;
-import android.util.DisplayMetrics;
-import android.view.WindowManager;
-
-import org.chromium.base.test.util.DisabledTest;
-import org.chromium.content.browser.test.util.JavaScriptUtils;
-import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
-
-/**
- * Test suite for viewport-related properties.
- */
-public class ViewportTest extends ContentViewTestBase {
-
- private TestCallbackHelperContainer mCallbackHelper;
-
- /**
- * Returns the TestCallbackHelperContainer associated with this ContentView,
- * or creates it lazily.
- */
- protected TestCallbackHelperContainer getTestCallbackHelperContainer() {
- if (mCallbackHelper == null) {
- mCallbackHelper = new TestCallbackHelperContainer(getContentView());
- }
- return mCallbackHelper;
- }
-
- protected String evaluateStringValue(String expression) throws Throwable {
- return JavaScriptUtils.executeJavaScriptAndWaitForResult(getContentView(),
- getTestCallbackHelperContainer(), expression);
- }
-
- protected float evaluateFloatValue(String expression) throws Throwable {
- return Float.valueOf(evaluateStringValue(expression));
- }
-
- protected int evaluateIntegerValue(String expression) throws Throwable {
- return Integer.valueOf(evaluateStringValue(expression));
- }
-
- /*
- @MediumTest
- @Feature({"Viewport", "InitialViewportSize"})
- https://bugs.webkit.org/show_bug.cgi?id=107424
- */
- @DisabledTest
- public void testDefaultViewportSize() throws Throwable {
- launchContentShellWithUrl("about:blank");
- waitForActiveShellToBeDoneLoading();
-
- Context context = getInstrumentation().getTargetContext();
- WindowManager winManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- DisplayMetrics metrics = new DisplayMetrics();
- winManager.getDefaultDisplay().getMetrics(metrics);
-
- // window.devicePixelRatio should match the default display. Only check to 1 decimal place
- // to allow for rounding.
- assertEquals(String.format("%.1g", metrics.density),
- String.format("%.1g", evaluateFloatValue("window.devicePixelRatio")));
-
- // Check that the viewport width is vaguely sensible.
- int viewportWidth = evaluateIntegerValue("document.documentElement.clientWidth");
- assertTrue(Math.abs(evaluateIntegerValue("window.innerWidth") - viewportWidth) <= 1);
- assertTrue(viewportWidth >= 979);
- assertTrue(viewportWidth <= Math.max(981, metrics.widthPixels / metrics.density + 1));
- }
-}

Powered by Google App Engine
This is Rietveld 408576698