summaryrefslogtreecommitdiff
path: root/tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-04-10 17:12:40 -0700
committerYorke Lee <yorkelee@google.com>2013-04-17 17:45:37 -0700
commitafd650b7f81f363a4bb554ff7199338aee1a49c2 (patch)
tree5d7ca86c71674740d652ecab7a252ba6a59ef3ae /tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java
parent4334d3b852e369b591f591e66e493cc92a721233 (diff)
Allow smart dialing to ignore country code/area code
Add handling of country codes if the number starts with a '+' prefix Also add special case handling for NANP numbers in SmartDialTrie if we determine that the user is in North America. Save user's SIM country ISO into SharedPreferences. Add SmartDialNameMatcher methods to correctly match NANP numbers Fix tests to use assertTrue/assertFalse instead of assertEquals Bug 8292294 Change-Id: Ic61dac75ee3b772986d3008240bbda81322c8f31
Diffstat (limited to 'tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java')
-rw-r--r--tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java b/tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java
new file mode 100644
index 000000000..8d96edafc
--- /dev/null
+++ b/tests/src/com/android/dialer/dialpad/SmartDialCacheTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 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 com.android.dialer.dialpad;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import junit.framework.TestCase;
+
+@SmallTest
+public class SmartDialCacheTest extends TestCase {
+ public void testIsCountryNanp_CaseInsensitive() {
+ assertFalse(SmartDialCache.isCountryNanp(null));
+ assertFalse(SmartDialCache.isCountryNanp("CN"));
+ assertFalse(SmartDialCache.isCountryNanp("HK"));
+ assertFalse(SmartDialCache.isCountryNanp("uk"));
+ assertFalse(SmartDialCache.isCountryNanp("sg"));
+ assertTrue(SmartDialCache.isCountryNanp("US"));
+ assertTrue(SmartDialCache.isCountryNanp("CA"));
+ assertTrue(SmartDialCache.isCountryNanp("AS"));
+ assertTrue(SmartDialCache.isCountryNanp("AI"));
+ assertTrue(SmartDialCache.isCountryNanp("AG"));
+ assertTrue(SmartDialCache.isCountryNanp("BS"));
+ assertTrue(SmartDialCache.isCountryNanp("BB"));
+ assertTrue(SmartDialCache.isCountryNanp("bm"));
+ assertTrue(SmartDialCache.isCountryNanp("vg"));
+ assertTrue(SmartDialCache.isCountryNanp("ky"));
+ assertTrue(SmartDialCache.isCountryNanp("dm"));
+ assertTrue(SmartDialCache.isCountryNanp("do"));
+ assertTrue(SmartDialCache.isCountryNanp("gd"));
+ assertTrue(SmartDialCache.isCountryNanp("gu"));
+ assertTrue(SmartDialCache.isCountryNanp("jm"));
+ assertTrue(SmartDialCache.isCountryNanp("pr"));
+ assertTrue(SmartDialCache.isCountryNanp("ms"));
+ assertTrue(SmartDialCache.isCountryNanp("mp"));
+ assertTrue(SmartDialCache.isCountryNanp("kn"));
+ assertTrue(SmartDialCache.isCountryNanp("lc"));
+ assertTrue(SmartDialCache.isCountryNanp("vc"));
+ assertTrue(SmartDialCache.isCountryNanp("tt"));
+ assertTrue(SmartDialCache.isCountryNanp("tc"));
+ assertTrue(SmartDialCache.isCountryNanp("vi"));
+ }
+}