| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.webapps; | 5 package org.chromium.chrome.browser.webapps; |
| 6 | 6 |
| 7 import android.test.InstrumentationTestCase; | 7 import android.test.InstrumentationTestCase; |
| 8 import android.test.UiThreadTest; | 8 import android.test.UiThreadTest; |
| 9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 for (int i = 0; i < ActivityAssigner.NAMESPACE_COUNT; ++i) { | 38 for (int i = 0; i < ActivityAssigner.NAMESPACE_COUNT; ++i) { |
| 39 mPreferences[i] = new HashMap<String, Object>(); | 39 mPreferences[i] = new HashMap<String, Object>(); |
| 40 mContext.addSharedPreferences(ActivityAssigner.PREF_PACKAGE[i], mPre
ferences[i]); | 40 mContext.addSharedPreferences(ActivityAssigner.PREF_PACKAGE[i], mPre
ferences[i]); |
| 41 } | 41 } |
| 42 ContextUtils.initApplicationContextForTests(mContext); | 42 ContextUtils.initApplicationContextForTests(mContext); |
| 43 } | 43 } |
| 44 | 44 |
| 45 @UiThreadTest | 45 @UiThreadTest |
| 46 @SmallTest | 46 @SmallTest |
| 47 @Feature({"Webapps"}) | 47 @Feature({"Webapps"}) |
| 48 @RetryOnFailure |
| 48 public void testEntriesCreated() { | 49 public void testEntriesCreated() { |
| 49 ActivityAssigner assigner = ActivityAssigner.instance(ActivityAssigner.W
EBAPP_NAMESPACE); | 50 ActivityAssigner assigner = ActivityAssigner.instance(ActivityAssigner.W
EBAPP_NAMESPACE); |
| 50 | 51 |
| 51 // Make sure that no webapps have been assigned to any Activities for a
fresh install. | 52 // Make sure that no webapps have been assigned to any Activities for a
fresh install. |
| 52 checkState(assigner, ActivityAssigner.WEBAPP_NAMESPACE); | 53 checkState(assigner, ActivityAssigner.WEBAPP_NAMESPACE); |
| 53 List<ActivityAssigner.ActivityEntry> entries = assigner.getEntries(); | 54 List<ActivityAssigner.ActivityEntry> entries = assigner.getEntries(); |
| 54 assertEquals(ActivityAssigner.NUM_WEBAPP_ACTIVITIES, entries.size()); | 55 assertEquals(ActivityAssigner.NUM_WEBAPP_ACTIVITIES, entries.size()); |
| 55 for (ActivityAssigner.ActivityEntry entry : entries) { | 56 for (ActivityAssigner.ActivityEntry entry : entries) { |
| 56 assertEquals(null, entry.mWebappId); | 57 assertEquals(null, entry.mWebappId); |
| 57 } | 58 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Confirm that the Activity indices go from 0 to NUM_WEBAPP_ACTIVITIES
- 1. | 178 // Confirm that the Activity indices go from 0 to NUM_WEBAPP_ACTIVITIES
- 1. |
| 178 HashSet<Integer> assignedActivities = new HashSet<Integer>(); | 179 HashSet<Integer> assignedActivities = new HashSet<Integer>(); |
| 179 for (ActivityAssigner.ActivityEntry entry : entries) { | 180 for (ActivityAssigner.ActivityEntry entry : entries) { |
| 180 assignedActivities.add(entry.mActivityIndex); | 181 assignedActivities.add(entry.mActivityIndex); |
| 181 } | 182 } |
| 182 for (int i = 0; i < ActivityAssigner.NUM_WEBAPP_ACTIVITIES; ++i) { | 183 for (int i = 0; i < ActivityAssigner.NUM_WEBAPP_ACTIVITIES; ++i) { |
| 183 assertTrue(assignedActivities.contains(i)); | 184 assertTrue(assignedActivities.contains(i)); |
| 184 } | 185 } |
| 185 } | 186 } |
| 186 } | 187 } |
| OLD | NEW |