1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy 6 * of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 package com.android.server.om.hosttest.update_overlay_test; 17 18 import static org.junit.Assert.assertEquals; 19 20 import android.content.res.Configuration; 21 import android.content.res.Resources; 22 import android.support.test.InstrumentationRegistry; 23 import android.support.test.filters.SmallTest; 24 import android.support.test.runner.AndroidJUnit4; 25 26 import org.junit.Before; 27 import org.junit.Test; 28 import org.junit.runner.RunWith; 29 30 import java.util.Locale; 31 32 @RunWith(AndroidJUnit4.class) 33 @SmallTest 34 public class UpdateOverlayTest { 35 private Resources mResources; 36 37 @Before 38 public void setUp() throws Exception { 39 final Configuration defaultLocaleConfiguration = new Configuration(); 40 defaultLocaleConfiguration.setLocale(Locale.US); 41 mResources = InstrumentationRegistry 42 .getInstrumentation() 43 .getContext() 44 .createConfigurationContext(defaultLocaleConfiguration) 45 .getResources(); 46 } 47 48 @Test 49 public void expectAppResource() throws Exception { 50 assertEquals("App Resource", mResources.getString(R.string.app_resource)); 51 } 52 53 @Test 54 public void expectAppOverlayV1Resource() throws Exception { 55 assertEquals("App Resource Overlay V1", mResources.getString(R.string.app_resource)); 56 } 57 58 @Test 59 public void expectAppOverlayV2Resource() throws Exception { 60 assertEquals("App Resource Overlay V2", mResources.getString(R.string.app_resource)); 61 } 62 63 @Test 64 public void expectFrameworkResource() throws Exception { 65 assertEquals("OK", mResources.getString(android.R.string.ok)); 66 } 67 68 @Test 69 public void expectFrameworkOverlayV1Resource() throws Exception { 70 assertEquals("Framework Overlay V1", mResources.getString(android.R.string.ok)); 71 } 72 73 @Test 74 public void expectFrameworkOverlayV2Resource() throws Exception { 75 assertEquals("Framework Overlay V2", mResources.getString(android.R.string.ok)); 76 } 77 } 78