summaryrefslogtreecommitdiffstats
path: root/location/tests/locationtests
diff options
context:
space:
mode:
authorBai Tao <michaelbai@google.com>2010-07-13 15:32:16 +0800
committerBai Tao <michaelbai@google.com>2010-07-28 09:45:57 +0800
commita58a8751b4c2ce457f0082a0baaee61312d56195 (patch)
tree14521164e8ce7f53e55f3af25efa9c4078a8c8b0 /location/tests/locationtests
parent42d8f6f2fbf2d73f01dd485e043bc33b575f9881 (diff)
downloadframeworks_base-a58a8751b4c2ce457f0082a0baaee61312d56195.zip
frameworks_base-a58a8751b4c2ce457f0082a0baaee61312d56195.tar.gz
frameworks_base-a58a8751b4c2ce457f0082a0baaee61312d56195.tar.bz2
Add new system service CountryDetector
a. The CountryDetector detects the country the user is in in order of mobile network, location, sim card or locale. It will be used by contact and contact provider. b. All added APIs are hidden at this stage. Change-Id: I4ba278571ffb6ab6ded0996d4f440a18534f8ed4
Diffstat (limited to 'location/tests/locationtests')
-rw-r--r--location/tests/locationtests/src/android/location/CountryTester.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/location/tests/locationtests/src/android/location/CountryTester.java b/location/tests/locationtests/src/android/location/CountryTester.java
new file mode 100644
index 0000000..9802d5a
--- /dev/null
+++ b/location/tests/locationtests/src/android/location/CountryTester.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.test.AndroidTestCase;
+
+public class CountryTester extends AndroidTestCase {
+ public void testCountryEquals() {
+ Country countryA = new Country("US", Country.COUNTRY_SOURCE_NETWORK);
+ Country countryB = new Country("US", Country.COUNTRY_SOURCE_LOCALE);
+ Country countryC = new Country("CN", Country.COUNTRY_SOURCE_LOCALE);
+ Country countryD = new Country("us", Country.COUNTRY_SOURCE_NETWORK);
+ assertTrue(countryA.equalsIgnoreSource(countryB));
+ assertFalse(countryA.equalsIgnoreSource(countryC));
+ assertFalse(countryA.equals(countryC));
+ assertTrue(countryA.equals(countryD));
+ assertTrue(countryA.hashCode() == countryD.hashCode());
+ }
+}