| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.tabmodel; | 5 package org.chromium.chrome.browser.tabmodel; |
| 6 | 6 |
| 7 import android.support.test.annotation.UiThreadTest; |
| 7 import android.support.test.filters.SmallTest; | 8 import android.support.test.filters.SmallTest; |
| 8 import android.test.InstrumentationTestCase; | 9 import android.support.test.rule.UiThreadTestRule; |
| 9 import android.test.UiThreadTest; | 10 |
| 11 import org.junit.Assert; |
| 12 import org.junit.Rule; |
| 13 import org.junit.Test; |
| 14 import org.junit.runner.RunWith; |
| 10 | 15 |
| 11 import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; | 16 import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; |
| 17 import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
| 12 import org.chromium.content_public.browser.LoadUrlParams; | 18 import org.chromium.content_public.browser.LoadUrlParams; |
| 13 | 19 |
| 14 /** | 20 /** |
| 15 * Tests that the AsyncTabCreationParamsManager works as expected. | 21 * Tests that the AsyncTabCreationParamsManager works as expected. |
| 16 */ | 22 */ |
| 17 public class AsyncTabCreationParamsManagerTest extends InstrumentationTestCase { | 23 @RunWith(ChromeJUnit4ClassRunner.class) |
| 24 public class AsyncTabCreationParamsManagerTest { |
| 25 @Rule |
| 26 public UiThreadTestRule mRule = new UiThreadTestRule(); |
| 27 |
| 28 @Test |
| 18 @SmallTest | 29 @SmallTest |
| 19 @UiThreadTest | 30 @UiThreadTest |
| 20 public void testBasicAddingAndRemoval() throws Exception { | 31 public void testBasicAddingAndRemoval() throws Exception { |
| 21 AsyncTabCreationParams asyncParams = | 32 AsyncTabCreationParams asyncParams = |
| 22 new AsyncTabCreationParams(new LoadUrlParams("http://google.com"
)); | 33 new AsyncTabCreationParams(new LoadUrlParams("http://google.com"
)); |
| 23 AsyncTabParamsManager.add(11684, asyncParams); | 34 AsyncTabParamsManager.add(11684, asyncParams); |
| 24 | 35 |
| 25 AsyncTabParams retrievedParams = AsyncTabParamsManager.remove(11684); | 36 AsyncTabParams retrievedParams = AsyncTabParamsManager.remove(11684); |
| 26 assertEquals("Removed incorrect parameters from the map", asyncParams, r
etrievedParams); | 37 Assert.assertEquals( |
| 38 "Removed incorrect parameters from the map", asyncParams, retrie
vedParams); |
| 27 | 39 |
| 28 AsyncTabParams failedParams = AsyncTabParamsManager.remove(11684); | 40 AsyncTabParams failedParams = AsyncTabParamsManager.remove(11684); |
| 29 assertNull("Removed same parameters twice", failedParams); | 41 Assert.assertNull("Removed same parameters twice", failedParams); |
| 30 } | 42 } |
| 31 } | 43 } |
| OLD | NEW |