| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.base; | 5 package org.chromium.base; |
| 6 | 6 |
| 7 import android.app.Application; | 7 import android.app.Application; |
| 8 import android.content.ComponentCallbacks; | 8 import android.content.ComponentCallbacks; |
| 9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| 11 import android.content.res.Configuration; | 11 import android.content.res.Configuration; |
| 12 import android.support.test.filters.SmallTest; |
| 12 import android.test.InstrumentationTestCase; | 13 import android.test.InstrumentationTestCase; |
| 13 import android.test.suitebuilder.annotation.SmallTest; | |
| 14 | 14 |
| 15 import org.chromium.base.test.util.AdvancedMockContext; | 15 import org.chromium.base.test.util.AdvancedMockContext; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Tests for {@link org.chromium.base.test.util.AdvancedMockContext}. | 18 * Tests for {@link org.chromium.base.test.util.AdvancedMockContext}. |
| 19 */ | 19 */ |
| 20 public class AdvancedMockContextTest extends InstrumentationTestCase { | 20 public class AdvancedMockContextTest extends InstrumentationTestCase { |
| 21 private static class Callback1 implements ComponentCallbacks { | 21 private static class Callback1 implements ComponentCallbacks { |
| 22 protected Configuration mConfiguration; | 22 protected Configuration mConfiguration; |
| 23 protected boolean mOnLowMemoryCalled; | 23 protected boolean mOnLowMemoryCalled; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 assertEquals("onConfigurationChanged should have been called.", configur
ation, | 61 assertEquals("onConfigurationChanged should have been called.", configur
ation, |
| 62 callback1.mConfiguration); | 62 callback1.mConfiguration); |
| 63 assertEquals("onConfigurationChanged should have been called.", configur
ation, | 63 assertEquals("onConfigurationChanged should have been called.", configur
ation, |
| 64 callback2.mConfiguration); | 64 callback2.mConfiguration); |
| 65 | 65 |
| 66 targetApplication.onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE)
; | 66 targetApplication.onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE)
; |
| 67 assertEquals("onTrimMemory should have been called.", ComponentCallbacks
2 | 67 assertEquals("onTrimMemory should have been called.", ComponentCallbacks
2 |
| 68 .TRIM_MEMORY_MODERATE, callback2.mLevel); | 68 .TRIM_MEMORY_MODERATE, callback2.mLevel); |
| 69 } | 69 } |
| 70 } | 70 } |
| OLD | NEW |