summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Lemieux <jplemieux@google.com>2014-09-29 17:51:28 -0700
committerJames Lemieux <jplemieux@google.com>2014-09-30 14:43:57 -0700
commitdeee5bee475a678bc2a4efe81c2900b1e5ac54dc (patch)
tree754437b3a6bc34e1aadc7768bbcc2a9f6acd1417 /tests
parent953498c6b51d4fbe66c9305555dd55e4177d36d5 (diff)
downloadandroid_packages_apps_UnifiedEmail-deee5bee475a678bc2a4efe81c2900b1e5ac54dc.tar.gz
android_packages_apps_UnifiedEmail-deee5bee475a678bc2a4efe81c2900b1e5ac54dc.tar.bz2
android_packages_apps_UnifiedEmail-deee5bee475a678bc2a4efe81c2900b1e5ac54dc.zip
Display sync errors using snackbar and not as a TL footer
b/16463253 The FAB compose button overlaps the action button found in the TL footer when network errors occur during sync. To avoid this overlap, the snackbar is used to display these errors and they no longer appear as a TL footer. In order to signal the sync error to AAC for display in the snackbar, the Folder.lastSyncResult needed to be encoded in the manner that AAC reads. This was not happening for POP/IMAP/Exchange accounts, so a large portion of this change is encoding that value properly every place it is written. To ensure the value is read/written properly everywhere, common methods were introduced in UIProvider that do this work. UIProviderTest was also added to ensure the read/write methods agree with each other. Finally, the display of the "Load More" TL footer was updated to match the latest spec. Change-Id: Ia44f4ca1caa77c5d76f58d75fa4ab308442d2a72
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/mail/providers/UIProviderTest.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/src/com/android/mail/providers/UIProviderTest.java b/tests/src/com/android/mail/providers/UIProviderTest.java
new file mode 100644
index 000000000..20f3854c6
--- /dev/null
+++ b/tests/src/com/android/mail/providers/UIProviderTest.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2014, Google Inc.
+ *
+ * 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.mail.providers;
+
+import android.test.AndroidTestCase;
+
+public class UIProviderTest extends AndroidTestCase {
+
+ public void testReadAndWriteOfLastSyncResult() {
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.NO_SYNC,
+ UIProvider.LastSyncResult.STORAGE_ERROR);
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.NO_SYNC,
+ UIProvider.LastSyncResult.SECURITY_ERROR);
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.USER_REFRESH,
+ UIProvider.LastSyncResult.SUCCESS);
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.USER_REFRESH,
+ UIProvider.LastSyncResult.AUTH_ERROR);
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.BACKGROUND_SYNC,
+ UIProvider.LastSyncResult.SUCCESS);
+ packAndUnpackLastSyncResult(UIProvider.SyncStatus.BACKGROUND_SYNC,
+ UIProvider.LastSyncResult.CONNECTION_ERROR);
+ }
+
+ private void packAndUnpackLastSyncResult(int syncStatus, int lastSyncResult) {
+ final int value = UIProvider.createSyncValue(syncStatus, lastSyncResult);
+
+ assertEquals(syncStatus, UIProvider.getStatusFromLastSyncResult(value));
+ assertEquals(lastSyncResult, UIProvider.getResultFromLastSyncResult(value));
+ }
+}