1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.components.browser_ui.photo_picker; 6 7 import org.junit.Test; 8 import org.junit.runner.RunWith; 9 import org.robolectric.RuntimeEnvironment; 10 import org.robolectric.annotation.Config; 11 12 import org.chromium.base.test.BaseRobolectricTestRunner; 13 14 import java.util.Collections; 15 16 /** 17 * junit tests for the {@link PickerBitmapView} class. 18 */ 19 @RunWith(BaseRobolectricTestRunner.class) 20 @Config(manifest = Config.NONE) 21 public class PickerBitmapViewTest { 22 @Test testPrematureOnSelectionStateChanged()23 public void testPrematureOnSelectionStateChanged() { 24 PickerBitmapView view = 25 new PickerBitmapView(RuntimeEnvironment.application.getApplicationContext(), null); 26 // Simulate crash scenario in crbug.com/1006823, where an event occurred before 27 // PickerBitmapView has been initialized. 28 view.onSelectionStateChange(Collections.emptyList()); 29 } 30 } 31