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

Side by Side Diff: third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html

Issue 2671683002: getInstalledRelatedApps: Add browser-side Mojo service (stub). (Closed)
Patch Set: Added TODO. Created 3 years, 9 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <link rel="manifest" href="resources/manifest.json"> 2 <link rel="manifest" href="resources/manifest.json">
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/installedapp-test-helper.js"></script> 6 <script src="resources/installedapp-test-helper.js"></script>
6 <script> 7 <script>
7 8
8 promise_test(() => { 9 installedapp_test((t, mock) => {
9 // The manifest for this file has two related apps, but for now we can only 10 // The expected input to the Mojo method FilterInstalledRelatedApps is the
10 // expect to see an empty list in response (since we do not check whether any 11 // list of related_applications from this page's manifest. The mock service
11 // of the apps are installed). 12 // returns the empty list, implying that none are installed.
13 mock.pushExpectedCall(
14 [{platform: 'play', url: null, id: 'com.test'},
15 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
16 []);
12 return navigator.getInstalledRelatedApps().then(result => { 17 return navigator.getInstalledRelatedApps().then(result => {
13 assert_array_relatedapplication_equals(result, []); 18 assert_array_relatedapplication_equals(result, []);
14 }); 19 });
15 }, 'getInstalledRelatedApps with related apps, none installed'); 20 }, 'getInstalledRelatedApps with related apps, none installed');
16 21
17 // TODO(mgiuca): Add another test for when the browser returns a non-empty list 22 installedapp_test((t, mock) => {
18 // of installed apps. 23 // The expected input to the Mojo method FilterInstalledRelatedApps is the
24 // list of related_applications from this page's manifest. The mock service
25 // returns just the 'play' entry. Expect that result to be returned by
26 // getInstalledRelatedApps.
27 mock.pushExpectedCall(
28 [{platform: 'play', url: null, id: 'com.test'},
29 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
30 [{platform: 'play', url: null, id: 'com.test'}]);
31 // TODO(mgiuca): The |url| field should be omitted from the result, not ''.
32 return navigator.getInstalledRelatedApps().then(result => {
33 assert_array_relatedapplication_equals(
34 result, [{platform: 'play', url: '', id: 'com.test'}]);
35 });
36 }, 'getInstalledRelatedApps with related and installed apps (no url)');
37
38 installedapp_test((t, mock) => {
39 // The expected input to the Mojo method FilterInstalledRelatedApps is the
40 // list of related_applications from this page's manifest. The mock service
41 // returns both entries. Expect that result to be returned by
42 // getInstalledRelatedApps.
43 mock.pushExpectedCall(
44 [{platform: 'play', url: null, id: 'com.test'},
45 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
46 [{platform: 'play', url: null, id: 'com.test'},
47 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}]);
48 // TODO(mgiuca): The null fields should be omitted from the result, not ''.
49 return navigator.getInstalledRelatedApps().then(result => {
50 assert_array_relatedapplication_equals(
51 result,
52 [{platform: 'play', url: '', id: 'com.test'},
53 {platform: 'itunes', url: 'https://itunes.apple.com/', id: ''}]);
54 });
55 }, 'getInstalledRelatedApps with multiple related and installed apps');
19 56
20 </script> 57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698