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

Unified Diff: services/shape_detection/android/junit/src/org/chromium/shape_detection/SharedBufferUtilsTest.java

Issue 2875243002: RELAND: ShapeDetection: use mojom::Bitmap for mojo interface. (Closed)
Patch Set: RELAND2: ShapeDetection: use mojom::Bitmap for mojo interface. Created 3 years, 7 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: services/shape_detection/android/junit/src/org/chromium/shape_detection/SharedBufferUtilsTest.java
diff --git a/services/shape_detection/android/junit/src/org/chromium/shape_detection/SharedBufferUtilsTest.java b/services/shape_detection/android/junit/src/org/chromium/shape_detection/SharedBufferUtilsTest.java
deleted file mode 100644
index 6078c0fbe6d738b6722b4a4954f6cd99d939d90a..0000000000000000000000000000000000000000
--- a/services/shape_detection/android/junit/src/org/chromium/shape_detection/SharedBufferUtilsTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2017 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.shape_detection;
-
-import static org.junit.Assert.assertNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowLog;
-
-import org.chromium.base.test.util.Feature;
-import org.chromium.mojo.system.SharedBufferHandle;
-import org.chromium.mojo.system.SharedBufferHandle.MapFlags;
-import org.chromium.testing.local.LocalRobolectricTestRunner;
-
-import java.nio.ByteBuffer;
-
-/**
- * Test suite for conversion-to-Frame utils.
- */
-@RunWith(LocalRobolectricTestRunner.class)
-@Config(manifest = Config.NONE)
-public class SharedBufferUtilsTest {
- private static final int VALID_WIDTH = 1;
- private static final int VALID_HEIGHT = 1;
- private static final int INVALID_WIDTH = 0;
- private static final long NUM_BYTES = VALID_WIDTH * VALID_HEIGHT * 4;
-
- public SharedBufferUtilsTest() {}
-
- @Before
- public void setUp() {
- ShadowLog.stream = System.out;
- MockitoAnnotations.initMocks(this);
- }
-
- /**
- * Verify conversion fails if the SharedBufferHandle is invalid.
- */
- @Test
- @Feature({"ShapeDetection"})
- public void testConversionFailsWithInvalidHandle() {
- SharedBufferHandle handle = Mockito.mock(SharedBufferHandle.class);
- Mockito.when(handle.isValid()).thenReturn(false);
-
- assertNull(SharedBufferUtils.convertToFrame(handle, VALID_WIDTH, VALID_HEIGHT));
- }
-
- /**
- * Verify conversion fails if the sent dimensions are ugly.
- */
- @Test
- @Feature({"ShapeDetection"})
- public void testConversionFailsWithInvalidDimensions() {
- SharedBufferHandle handle = Mockito.mock(SharedBufferHandle.class);
- Mockito.when(handle.isValid()).thenReturn(true);
-
- assertNull(SharedBufferUtils.convertToFrame(handle, INVALID_WIDTH, VALID_HEIGHT));
- }
-
- /**
- * Verify conversion fails if SharedBufferHandle fails to map().
- */
- @Test
- @Feature({"ShapeDetection"})
- public void testConversionFailsWithWronglyMappedBuffer() {
- SharedBufferHandle handle = Mockito.mock(SharedBufferHandle.class);
- Mockito.when(handle.isValid()).thenReturn(true);
- Mockito.when(handle.map(Mockito.eq(0L), Mockito.eq(NUM_BYTES), Mockito.any(MapFlags.class)))
- .thenReturn(ByteBuffer.allocate(0));
-
- assertNull(SharedBufferUtils.convertToFrame(handle, VALID_WIDTH, VALID_HEIGHT));
- }
-}

Powered by Google App Engine
This is Rietveld 408576698