Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java

Issue 1893513002: Remove the first launch from home screen requirement for notification deep linking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 static org.junit.Assert.assertEquals; 7 import static org.junit.Assert.assertEquals;
8 import static org.junit.Assert.assertTrue; 8 import static org.junit.Assert.assertTrue;
9 9
10 import android.content.Context; 10 import android.content.Context;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 boolean getCallbackCalled() { 64 boolean getCallbackCalled() {
65 return mCallbackCalled; 65 return mCallbackCalled;
66 } 66 }
67 } 67 }
68 68
69 private static class FetchStorageCallback 69 private static class FetchStorageCallback
70 implements WebappRegistry.FetchWebappDataStorageCallback { 70 implements WebappRegistry.FetchWebappDataStorageCallback {
71 Intent mShortcutIntent; 71 Intent mShortcutIntent;
72 boolean mMarkLaunched;
73 boolean mCallbackCalled; 72 boolean mCallbackCalled;
74 73
75 FetchStorageCallback(Intent shortcutIntent, boolean markLaunched) { 74 FetchStorageCallback(Intent shortcutIntent) {
76 mCallbackCalled = false; 75 mCallbackCalled = false;
77 mShortcutIntent = shortcutIntent; 76 mShortcutIntent = shortcutIntent;
78 mMarkLaunched = markLaunched;
79 } 77 }
80 78
81 @Override 79 @Override
82 public void onWebappDataStorageRetrieved(WebappDataStorage storage) { 80 public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
83 mCallbackCalled = true; 81 mCallbackCalled = true;
84 storage.updateFromShortcutIntent(mShortcutIntent); 82 storage.updateFromShortcutIntent(mShortcutIntent);
85 storage.updateLastUsedTime(); 83 storage.updateLastUsedTime();
86 if (mMarkLaunched) storage.setLaunched();
87 } 84 }
88 85
89 boolean getCallbackCalled() { 86 boolean getCallbackCalled() {
90 return mCallbackCalled; 87 return mCallbackCalled;
91 } 88 }
92 } 89 }
93 90
94 private static class FetchStorageByUrlCallback 91 private static class FetchStorageByUrlCallback
95 implements WebappRegistry.FetchWebappDataStorageCallback { 92 implements WebappRegistry.FetchWebappDataStorageCallback {
96 String mUrl; 93 String mUrl;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 BackgroundShadowAsyncTask.runBackgroundTasks(); 153 BackgroundShadowAsyncTask.runBackgroundTasks();
157 154
158 Set<String> actual = mSharedPreferences.getStringSet( 155 Set<String> actual = mSharedPreferences.getStringSet(
159 WebappRegistry.KEY_WEBAPP_SET, Collections.<String>emptySet()); 156 WebappRegistry.KEY_WEBAPP_SET, Collections.<String>emptySet());
160 assertEquals(1, actual.size()); 157 assertEquals(1, actual.size());
161 assertTrue(actual.contains("test")); 158 assertTrue(actual.contains("test"));
162 } 159 }
163 160
164 @Test 161 @Test
165 @Feature({"Webapp"}) 162 @Feature({"Webapp"})
166 public void testWebappRegistrationUpdatesLastUsedAndDoesNotMarkLaunched() th rows Exception { 163 public void testWebappRegistrationUpdatesLastUsed() throws Exception {
167 WebappRegistry.registerWebapp(Robolectric.application, "test", null); 164 WebappRegistry.registerWebapp(Robolectric.application, "test", null);
168 BackgroundShadowAsyncTask.runBackgroundTasks(); 165 BackgroundShadowAsyncTask.runBackgroundTasks();
169 long after = System.currentTimeMillis(); 166 long after = System.currentTimeMillis();
170 167
171 SharedPreferences webAppPrefs = Robolectric.application.getSharedPrefere nces( 168 SharedPreferences webAppPrefs = Robolectric.application.getSharedPrefere nces(
172 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MOD E_PRIVATE); 169 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MOD E_PRIVATE);
173 long actual = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED, 170 long actual = webAppPrefs.getLong(WebappDataStorage.KEY_LAST_USED,
174 WebappDataStorage.LAST_USED_INVALID); 171 WebappDataStorage.LAST_USED_INVALID);
175 assertTrue("Timestamp is out of range", actual <= after); 172 assertTrue("Timestamp is out of range", actual <= after);
176
177 assertTrue(!webAppPrefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, false ));
178 } 173 }
179 174
180 @Test 175 @Test
181 @Feature({"Webapp"}) 176 @Feature({"Webapp"})
182 public void testWebappIdsRetrieval() throws Exception { 177 public void testWebappIdsRetrieval() throws Exception {
183 final Set<String> expected = addWebappsToRegistry("first", "second"); 178 final Set<String> expected = addWebappsToRegistry("first", "second");
184 179
185 FetchCallback callback = new FetchCallback(expected); 180 FetchCallback callback = new FetchCallback(expected);
186 WebappRegistry.getRegisteredWebappIds(Robolectric.application, callback) ; 181 WebappRegistry.getRegisteredWebappIds(Robolectric.application, callback) ;
187 BackgroundShadowAsyncTask.runBackgroundTasks(); 182 BackgroundShadowAsyncTask.runBackgroundTasks();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 361 }
367 362
368 @Test 363 @Test
369 @Feature({"Webapp"}) 364 @Feature({"Webapp"})
370 public void testClearWebappHistory() throws Exception { 365 public void testClearWebappHistory() throws Exception {
371 final String webapp1Url = "https://www.google.com"; 366 final String webapp1Url = "https://www.google.com";
372 final String webapp2Url = "https://drive.google.com"; 367 final String webapp2Url = "https://drive.google.com";
373 Intent shortcutIntent1 = createShortcutIntent(webapp1Url); 368 Intent shortcutIntent1 = createShortcutIntent(webapp1Url);
374 Intent shortcutIntent2 = createShortcutIntent(webapp2Url); 369 Intent shortcutIntent2 = createShortcutIntent(webapp2Url);
375 370
376 FetchStorageCallback storageCallback1 = new FetchStorageCallback(shortcu tIntent1, true); 371 FetchStorageCallback storageCallback1 = new FetchStorageCallback(shortcu tIntent1);
377 WebappRegistry.registerWebapp(Robolectric.application, "webapp1", storag eCallback1); 372 WebappRegistry.registerWebapp(Robolectric.application, "webapp1", storag eCallback1);
378 BackgroundShadowAsyncTask.runBackgroundTasks(); 373 BackgroundShadowAsyncTask.runBackgroundTasks();
379 Robolectric.runUiThreadTasks(); 374 Robolectric.runUiThreadTasks();
380 assertTrue(storageCallback1.getCallbackCalled()); 375 assertTrue(storageCallback1.getCallbackCalled());
381 376
382 FetchStorageCallback storageCallback2 = new FetchStorageCallback(shortcu tIntent2, false); 377 FetchStorageCallback storageCallback2 = new FetchStorageCallback(shortcu tIntent2);
383 WebappRegistry.registerWebapp(Robolectric.application, "webapp2", storag eCallback2); 378 WebappRegistry.registerWebapp(Robolectric.application, "webapp2", storag eCallback2);
384 BackgroundShadowAsyncTask.runBackgroundTasks(); 379 BackgroundShadowAsyncTask.runBackgroundTasks();
385 Robolectric.runUiThreadTasks(); 380 Robolectric.runUiThreadTasks();
386 assertTrue(storageCallback2.getCallbackCalled()); 381 assertTrue(storageCallback2.getCallbackCalled());
387 382
388 SharedPreferences webapp1Prefs = Robolectric.application.getSharedPrefer ences( 383 SharedPreferences webapp1Prefs = Robolectric.application.getSharedPrefer ences(
389 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp1", Context. MODE_PRIVATE); 384 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp1", Context. MODE_PRIVATE);
390 SharedPreferences webapp2Prefs = Robolectric.application.getSharedPrefer ences( 385 SharedPreferences webapp2Prefs = Robolectric.application.getSharedPrefer ences(
391 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp2", Context. MODE_PRIVATE); 386 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp2", Context. MODE_PRIVATE);
392 387
(...skipping 10 matching lines...) Expand all
403 assertTrue(actual.contains("webapp2")); 398 assertTrue(actual.contains("webapp2"));
404 399
405 // Verify that the last used time for both web apps is WebappDataStorage .LAST_USED_UNSET. 400 // Verify that the last used time for both web apps is WebappDataStorage .LAST_USED_UNSET.
406 long actualLastUsed = webapp1Prefs.getLong( 401 long actualLastUsed = webapp1Prefs.getLong(
407 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNS ET); 402 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNS ET);
408 assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed); 403 assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed);
409 actualLastUsed = webapp2Prefs.getLong( 404 actualLastUsed = webapp2Prefs.getLong(
410 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNS ET); 405 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_UNS ET);
411 assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed); 406 assertEquals(WebappDataStorage.LAST_USED_UNSET, actualLastUsed);
412 407
413 // Verify that neither web app is marked as launched.
414 assertTrue(!webapp1Prefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, fals e));
415 assertTrue(!webapp2Prefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, fals e));
416
417 // Verify that the URL and scope for both web apps is WebappDataStorage. URL_INVALID. 408 // Verify that the URL and scope for both web apps is WebappDataStorage. URL_INVALID.
418 String actualScope = webapp1Prefs.getString( 409 String actualScope = webapp1Prefs.getString(
419 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID); 410 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID);
420 assertEquals(WebappDataStorage.URL_INVALID, actualScope); 411 assertEquals(WebappDataStorage.URL_INVALID, actualScope);
421 String actualUrl = webapp1Prefs.getString( 412 String actualUrl = webapp1Prefs.getString(
422 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID); 413 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID);
423 assertEquals(WebappDataStorage.URL_INVALID, actualUrl); 414 assertEquals(WebappDataStorage.URL_INVALID, actualUrl);
424 actualScope = webapp2Prefs.getString( 415 actualScope = webapp2Prefs.getString(
425 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID); 416 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID);
426 assertEquals(WebappDataStorage.URL_INVALID, actualScope); 417 assertEquals(WebappDataStorage.URL_INVALID, actualScope);
427 actualUrl = webapp2Prefs.getString( 418 actualUrl = webapp2Prefs.getString(
428 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID); 419 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID);
429 assertEquals(WebappDataStorage.URL_INVALID, actualUrl); 420 assertEquals(WebappDataStorage.URL_INVALID, actualUrl);
430 } 421 }
431 422
432 @Test 423 @Test
433 @Feature({"Webapp"}) 424 @Feature({"Webapp"})
434 public void testGetAfterClearWebappHistory() throws Exception { 425 public void testGetAfterClearWebappHistory() throws Exception {
435 WebappRegistry.registerWebapp(Robolectric.application, "webapp", null); 426 WebappRegistry.registerWebapp(Robolectric.application, "webapp", null);
436 BackgroundShadowAsyncTask.runBackgroundTasks(); 427 BackgroundShadowAsyncTask.runBackgroundTasks();
437 428
438 SharedPreferences webappPrefs = Robolectric.application.getSharedPrefere nces( 429 SharedPreferences webappPrefs = Robolectric.application.getSharedPrefere nces(
439 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp", Context.M ODE_PRIVATE); 430 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp", Context.M ODE_PRIVATE);
440 CallbackRunner callback = new CallbackRunner(); 431 CallbackRunner callback = new CallbackRunner();
441 WebappRegistry.clearWebappHistory(Robolectric.application, callback); 432 WebappRegistry.clearWebappHistory(Robolectric.application, callback);
442 BackgroundShadowAsyncTask.runBackgroundTasks(); 433 BackgroundShadowAsyncTask.runBackgroundTasks();
443 Robolectric.runUiThreadTasks(); 434 Robolectric.runUiThreadTasks();
444 assertTrue(callback.getCallbackCalled()); 435 assertTrue(callback.getCallbackCalled());
445 436
446 // Open the webapp up to set the last used time and launched. 437 // Open the webapp up to set the last used time.
447 FetchStorageCallback storageCallback = new FetchStorageCallback(null, tr ue); 438 FetchStorageCallback storageCallback = new FetchStorageCallback(null);
448 WebappRegistry.getWebappDataStorage(Robolectric.application, "webapp", s torageCallback); 439 WebappRegistry.getWebappDataStorage(Robolectric.application, "webapp", s torageCallback);
449 BackgroundShadowAsyncTask.runBackgroundTasks(); 440 BackgroundShadowAsyncTask.runBackgroundTasks();
450 Robolectric.runUiThreadTasks(); 441 Robolectric.runUiThreadTasks();
451 assertTrue(storageCallback.getCallbackCalled()); 442 assertTrue(storageCallback.getCallbackCalled());
452 443
453 // Verify that the last used time is valid. 444 // Verify that the last used time is valid.
454 long actualLastUsed = webappPrefs.getLong( 445 long actualLastUsed = webappPrefs.getLong(
455 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_INV ALID); 446 WebappDataStorage.KEY_LAST_USED, WebappDataStorage.LAST_USED_INV ALID);
456 assertTrue(WebappDataStorage.LAST_USED_INVALID != actualLastUsed); 447 assertTrue(WebappDataStorage.LAST_USED_INVALID != actualLastUsed);
457 assertTrue(WebappDataStorage.LAST_USED_UNSET != actualLastUsed); 448 assertTrue(WebappDataStorage.LAST_USED_UNSET != actualLastUsed);
458
459 // Verify that the app is marked as launched.
460 assertTrue(webappPrefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, false) );
461 } 449 }
462 450
463 @Test 451 @Test
464 @Feature({"Webapp"}) 452 @Feature({"Webapp"})
465 public void testUpdateAfterClearWebappHistory() throws Exception { 453 public void testUpdateAfterClearWebappHistory() throws Exception {
466 final String webappUrl = "http://www.google.com"; 454 final String webappUrl = "http://www.google.com";
467 final String webappScope = "http://www.google.com/"; 455 final String webappScope = "http://www.google.com/";
468 final Intent shortcutIntent = createShortcutIntent(webappUrl); 456 final Intent shortcutIntent = createShortcutIntent(webappUrl);
469 WebappRegistry.registerWebapp(Robolectric.application, "webapp", 457 WebappRegistry.registerWebapp(Robolectric.application, "webapp",
470 new FetchStorageCallback(shortcutIntent, false)); 458 new FetchStorageCallback(shortcutIntent));
471 BackgroundShadowAsyncTask.runBackgroundTasks(); 459 BackgroundShadowAsyncTask.runBackgroundTasks();
472 Robolectric.runUiThreadTasks(); 460 Robolectric.runUiThreadTasks();
473 461
474 SharedPreferences webappPrefs = Robolectric.application.getSharedPrefere nces( 462 SharedPreferences webappPrefs = Robolectric.application.getSharedPrefere nces(
475 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp", Context.M ODE_PRIVATE); 463 WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "webapp", Context.M ODE_PRIVATE);
476 464
477 // Verify that the app is not marked as launched.
478 assertTrue(!webappPrefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, false ));
479
480 // Verify that the URL and scope match the original in the intent. 465 // Verify that the URL and scope match the original in the intent.
481 String actualUrl = webappPrefs.getString( 466 String actualUrl = webappPrefs.getString(
482 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID); 467 WebappDataStorage.KEY_URL, WebappDataStorage.URL_INVALID);
483 assertEquals(webappUrl, actualUrl); 468 assertEquals(webappUrl, actualUrl);
484 String actualScope = webappPrefs.getString( 469 String actualScope = webappPrefs.getString(
485 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID); 470 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID);
486 assertEquals(webappScope, actualScope); 471 assertEquals(webappScope, actualScope);
487 472
488 WebappRegistry.clearWebappHistory(Robolectric.application, new CallbackR unner()); 473 WebappRegistry.clearWebappHistory(Robolectric.application, new CallbackR unner());
489 BackgroundShadowAsyncTask.runBackgroundTasks(); 474 BackgroundShadowAsyncTask.runBackgroundTasks();
490 Robolectric.runUiThreadTasks(); 475 Robolectric.runUiThreadTasks();
491 476
492 // Update the webapp from the intent again. 477 // Update the webapp from the intent again.
493 WebappRegistry.getWebappDataStorage(Robolectric.application, "webapp", 478 WebappRegistry.getWebappDataStorage(Robolectric.application, "webapp",
494 new FetchStorageCallback(shortcutIntent, true)); 479 new FetchStorageCallback(shortcutIntent));
495 BackgroundShadowAsyncTask.runBackgroundTasks(); 480 BackgroundShadowAsyncTask.runBackgroundTasks();
496 Robolectric.runUiThreadTasks(); 481 Robolectric.runUiThreadTasks();
497 482
498 // Verify that the app is marked as launched.
499 assertTrue(webappPrefs.getBoolean(WebappDataStorage.KEY_LAUNCHED, false) );
500
501 // Verify that the URL and scope match the original in the intent. 483 // Verify that the URL and scope match the original in the intent.
502 actualUrl = webappPrefs.getString(WebappDataStorage.KEY_URL, WebappDataS torage.URL_INVALID); 484 actualUrl = webappPrefs.getString(WebappDataStorage.KEY_URL, WebappDataS torage.URL_INVALID);
503 assertEquals(webappUrl, actualUrl); 485 assertEquals(webappUrl, actualUrl);
504 actualScope = webappPrefs.getString( 486 actualScope = webappPrefs.getString(
505 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID); 487 WebappDataStorage.KEY_SCOPE, WebappDataStorage.URL_INVALID);
506 assertEquals(webappScope, actualScope); 488 assertEquals(webappScope, actualScope);
507 } 489 }
508 490
509 @Test 491 @Test
510 @Feature({"Webapp"}) 492 @Feature({"Webapp"})
(...skipping 15 matching lines...) Expand all
526 final String test5Url = "https://drive.google.com/docs/recent/trash"; 508 final String test5Url = "https://drive.google.com/docs/recent/trash";
527 final String test6Url = "https://maps.google.com/"; 509 final String test6Url = "https://maps.google.com/";
528 510
529 Intent shortcutIntent1 = createShortcutIntent(webapp1Url); 511 Intent shortcutIntent1 = createShortcutIntent(webapp1Url);
530 Intent shortcutIntent2 = createShortcutIntent(webapp2Url); 512 Intent shortcutIntent2 = createShortcutIntent(webapp2Url);
531 Intent shortcutIntent3 = createShortcutIntent(webapp3Url); 513 Intent shortcutIntent3 = createShortcutIntent(webapp3Url);
532 Intent shortcutIntent4 = createShortcutIntent(webapp4Url); 514 Intent shortcutIntent4 = createShortcutIntent(webapp4Url);
533 515
534 // Register the four web apps. 516 // Register the four web apps.
535 WebappRegistry.registerWebapp(Robolectric.application, "webapp1", 517 WebappRegistry.registerWebapp(Robolectric.application, "webapp1",
536 new FetchStorageCallback(shortcutIntent1, true)); 518 new FetchStorageCallback(shortcutIntent1));
537 BackgroundShadowAsyncTask.runBackgroundTasks(); 519 BackgroundShadowAsyncTask.runBackgroundTasks();
538 Robolectric.runUiThreadTasks(); 520 Robolectric.runUiThreadTasks();
539 521
540 WebappRegistry.registerWebapp(Robolectric.application, "webapp2", 522 WebappRegistry.registerWebapp(Robolectric.application, "webapp2",
541 new FetchStorageCallback(shortcutIntent2, false)); 523 new FetchStorageCallback(shortcutIntent2));
542 BackgroundShadowAsyncTask.runBackgroundTasks(); 524 BackgroundShadowAsyncTask.runBackgroundTasks();
543 Robolectric.runUiThreadTasks(); 525 Robolectric.runUiThreadTasks();
544 526
545 WebappRegistry.registerWebapp(Robolectric.application, "webapp3", 527 WebappRegistry.registerWebapp(Robolectric.application, "webapp3",
546 new FetchStorageCallback(shortcutIntent3, true)); 528 new FetchStorageCallback(shortcutIntent3));
547 BackgroundShadowAsyncTask.runBackgroundTasks(); 529 BackgroundShadowAsyncTask.runBackgroundTasks();
548 Robolectric.runUiThreadTasks(); 530 Robolectric.runUiThreadTasks();
549 531
550 WebappRegistry.registerWebapp(Robolectric.application, "webapp4", 532 WebappRegistry.registerWebapp(Robolectric.application, "webapp4",
551 new FetchStorageCallback(shortcutIntent4, false)); 533 new FetchStorageCallback(shortcutIntent4));
552 BackgroundShadowAsyncTask.runBackgroundTasks(); 534 BackgroundShadowAsyncTask.runBackgroundTasks();
553 Robolectric.runUiThreadTasks(); 535 Robolectric.runUiThreadTasks();
554 536
555 // test1Url should return webapp1. 537 // test1Url should return webapp1.
556 FetchStorageByUrlCallback callback = new FetchStorageByUrlCallback(webap p1Url, webapp1Url); 538 FetchStorageByUrlCallback callback = new FetchStorageByUrlCallback(webap p1Url, webapp1Url);
557 WebappRegistry.getWebappDataStorageForUrl(Robolectric.application, test1 Url, callback); 539 WebappRegistry.getWebappDataStorageForUrl(Robolectric.application, test1 Url, callback);
558 BackgroundShadowAsyncTask.runBackgroundTasks(); 540 BackgroundShadowAsyncTask.runBackgroundTasks();
559 Robolectric.runUiThreadTasks(); 541 Robolectric.runUiThreadTasks();
560 assertTrue(callback.getCallbackCalled()); 542 assertTrue(callback.getCallbackCalled());
561 543
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return mSharedPreferences.getStringSet( 599 return mSharedPreferences.getStringSet(
618 WebappRegistry.KEY_WEBAPP_SET, Collections.<String>emptySet()); 600 WebappRegistry.KEY_WEBAPP_SET, Collections.<String>emptySet());
619 } 601 }
620 602
621 private Intent createShortcutIntent(String url) { 603 private Intent createShortcutIntent(String url) {
622 return ShortcutHelper.createWebappShortcutIntent("id", "action", url, 604 return ShortcutHelper.createWebappShortcutIntent("id", "action", url,
623 ShortcutHelper.getScopeFromUrl(url), "name", "shortName", null, 605 ShortcutHelper.getScopeFromUrl(url), "name", "shortName", null,
624 ShortcutHelper.WEBAPP_SHORTCUT_VERSION, 0, 0, 0, false); 606 ShortcutHelper.WEBAPP_SHORTCUT_VERSION, 0, 0, 0, false);
625 } 607 }
626 } 608 }
OLDNEW
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698