commit | c3c76f5873f98dfbb4f09ae002296e51059708ba | [log] [tgz] |
---|---|---|
author | Takeshi Hagikura <thagikura@google.com> | Wed Mar 18 14:28:08 2015 +0900 |
committer | Takeshi Hagikura <thagikura@google.com> | Wed Mar 18 14:29:50 2015 +0900 |
tree | dcc180b35354ac238b6b7c9099ba3b942dff18b2 | |
parent | dd37043cbd52dc94142d3ceb126a7415b883d5fd [diff] |
Fixes the broken tests for AppUsageStatistics. Update the UI in the UI thread. https://b.corp.google.com/issues/19685630 Succeeded tests log. https://paste.googleplex.com/5935381669216256 Change-Id: I9a679b80407cd02bd5cc1488a0c758aa690a8225
diff --git a/system/AppUsageStatistics/Application/tests/src/com/example/android/appusagestatistics/AppUsageStatisticsFragmentTests.java b/system/AppUsageStatistics/Application/tests/src/com/example/android/appusagestatistics/AppUsageStatisticsFragmentTests.java index d8adb1c..bcffdea 100644 --- a/system/AppUsageStatistics/Application/tests/src/com/example/android/appusagestatistics/AppUsageStatisticsFragmentTests.java +++ b/system/AppUsageStatistics/Application/tests/src/com/example/android/appusagestatistics/AppUsageStatisticsFragmentTests.java
@@ -31,6 +31,7 @@ extends ActivityInstrumentationTestCase2<AppUsageStatisticsActivity> { private AppUsageStatisticsActivity mTestActivity; + private AppUsageStatisticsFragment mTestFragment; public AppUsageStatisticsFragmentTests() { @@ -81,10 +82,14 @@ } public void testUpdateAppsList() { - List<UsageStats> usageStatsList = mTestFragment + final List<UsageStats> usageStatsList = mTestFragment .getUsageStatistics(UsageStatsManager.INTERVAL_DAILY); - - mTestFragment.updateAppsList(usageStatsList); + mTestActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + mTestFragment.updateAppsList(usageStatsList); + } + }); getInstrumentation().waitForIdleSync(); // The result depends on if the app is granted the access to App usage statistics.