blob: 6beb009b5f60e971174f8474a1d382d19f00fc6b [file] [log] [blame]
Mindy Pereira33fe9082012-01-09 16:24:30 -08001/**
2 * Copyright (c) 2012, Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy 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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.mail.providers;
17
18import android.content.Intent;
Mindy Pereirac4b42232012-02-21 16:16:32 -080019import android.os.Parcel;
Mindy Pereira33fe9082012-01-09 16:24:30 -080020import android.test.AndroidTestCase;
21
22import com.android.mail.utils.Utils;
23
24public class AccountTests extends AndroidTestCase {
25
26 public void testSerializeDeSerialize() {
Mindy Pereirac4b42232012-02-21 16:16:32 -080027 Parcel dest = Parcel.obtain();
28 dest.writeInt(0);
29 dest.writeString("accountUri");
30 dest.writeInt(12345);
31 dest.writeString("foldersList");
32 dest.writeString("searchUri");
33 dest.writeString("fromAddresses");
34 dest.writeString("saveDraftUri");
35 dest.writeString("sendMessageUri");
36 dest.writeString("expungeMessageUri");
37 dest.writeString("undoUri");
Mindy Pereirac4b42232012-02-21 16:16:32 -080038 dest.writeString("settingIntentUri");
Marc Blank9ace18a2012-02-21 16:34:07 -080039 dest.writeInt(0);
Mindy Pereirac4b42232012-02-21 16:16:32 -080040 Account account = new Account(dest);
Mindy Pereira33fe9082012-01-09 16:24:30 -080041 Intent intent = new Intent();
42 intent.putExtra(Utils.EXTRA_ACCOUNT, account);
43 Account outAccount = (Account) intent.getParcelableExtra(Utils.EXTRA_ACCOUNT);
44 assertEquals(outAccount.name, account.name);
45 assertEquals(outAccount.accountFromAddressesUri, account.accountFromAddressesUri);
46 assertEquals(outAccount.capabilities, account.capabilities);
47 assertEquals(outAccount.providerVersion, account.providerVersion);
Mindy Pereira4fa30612012-02-23 17:50:38 -080048 assertEquals(outAccount.uri, account.uri);
Mindy Pereira33fe9082012-01-09 16:24:30 -080049 assertEquals(outAccount.folderListUri, account.folderListUri);
50 assertEquals(outAccount.searchUri, account.searchUri);
51 assertEquals(outAccount.saveDraftUri, account.saveDraftUri);
52 assertEquals(outAccount.sendMessageUri, account.sendMessageUri);
Mindy Pereira82cc5662012-01-09 17:29:30 -080053 assertEquals(outAccount.expungeMessageUri, account.expungeMessageUri);
Mindy Pereira33fe9082012-01-09 16:24:30 -080054 }
55}