| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.chrome.browser.compositor; | 5 package org.chromium.chrome.browser.compositor; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.graphics.PixelFormat; | 8 import android.graphics.PixelFormat; |
| 9 import android.view.Surface; | 9 import android.view.Surface; |
| 10 import android.view.SurfaceHolder; | 10 import android.view.SurfaceHolder; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 import java.util.Set; | 41 import java.util.Set; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Unit tests for the CompositorSurfaceManager. | 44 * Unit tests for the CompositorSurfaceManager. |
| 45 */ | 45 */ |
| 46 @RunWith(LocalRobolectricTestRunner.class) | 46 @RunWith(LocalRobolectricTestRunner.class) |
| 47 @Config(manifest = Config.NONE) | 47 @Config(manifest = Config.NONE) |
| 48 public class CompositorSurfaceManagerTest { | 48 public class CompositorSurfaceManagerTest { |
| 49 @Mock | 49 @Mock |
| 50 private SurfaceHolder.Callback mCallback; | 50 private CompositorSurfaceManager.SurfaceHolderCallbackTarget mCallback; |
| 51 | 51 |
| 52 private CompositorSurfaceManager mManager; | 52 private CompositorSurfaceManager mManager; |
| 53 | 53 |
| 54 private FrameLayout mLayout; | 54 private FrameLayout mLayout; |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Implementation of a SurfaceView shadow that provides additional functiona
lity for controlling | 57 * Implementation of a SurfaceView shadow that provides additional functiona
lity for controlling |
| 58 * the state of the underlying (fake) Surface. | 58 * the state of the underlying (fake) Surface. |
| 59 */ | 59 */ |
| 60 @Implements(SurfaceView.class) | 60 @Implements(SurfaceView.class) |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 // When the opaque surface becomes available, we'll get the synthetic de
stroy for the | 432 // When the opaque surface becomes available, we'll get the synthetic de
stroy for the |
| 433 // translucent one that we lost ownership of, and the real create for th
e opaque one. | 433 // translucent one that we lost ownership of, and the real create for th
e opaque one. |
| 434 callbackFor(opaque).surfaceCreated(opaque.getHolder()); | 434 callbackFor(opaque).surfaceCreated(opaque.getHolder()); |
| 435 assertEquals(2, mLayout.getChildCount()); | 435 assertEquals(2, mLayout.getChildCount()); |
| 436 verify(mCallback, times(2)).surfaceCreated(opaque.getHolder()); | 436 verify(mCallback, times(2)).surfaceCreated(opaque.getHolder()); |
| 437 verify(mCallback, times(1)).surfaceDestroyed(opaque.getHolder()); | 437 verify(mCallback, times(1)).surfaceDestroyed(opaque.getHolder()); |
| 438 verify(mCallback, times(1)).surfaceDestroyed(translucent.getHolder()); | 438 verify(mCallback, times(1)).surfaceDestroyed(translucent.getHolder()); |
| 439 } | 439 } |
| 440 } | 440 } |
| OLD | NEW |