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

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

Issue 2671683002: getInstalledRelatedApps: Add browser-side Mojo service (stub). (Closed)
Patch Set: Added self to OWNERS. 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 location.origin, []);
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 location.origin,
31 [{platform: 'play', url: null, id: 'com.test'}]);
32 // TODO(mgiuca): The |url| field should be omitted from the result, not ''.
33 return navigator.getInstalledRelatedApps().then(result => {
34 assert_array_relatedapplication_equals(
35 result, [{platform: 'play', url: '', id: 'com.test'}]);
36 });
37 }, 'getInstalledRelatedApps with related and installed apps (no url)');
38
39 installedapp_test((t, mock) => {
40 // The expected input to the Mojo method FilterInstalledRelatedApps is the
41 // list of related_applications from this page's manifest. The mock service
42 // returns just the 'play' entry. Expect that result to be returned by
43 // getInstalledRelatedApps.
44 mock.pushExpectedCall(
45 [{platform: 'play', url: null, id: 'com.test'},
46 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
47 location.origin,
48 [{platform: 'itunes', url: 'https://itunes.apple.com/', id: null}]);
49 // TODO(mgiuca): The |id| field should be omitted from the result, not ''.
50 return navigator.getInstalledRelatedApps().then(result => {
51 assert_array_relatedapplication_equals(
52 result,
53 [{platform: 'itunes', url: 'https://itunes.apple.com/', id: ''}]);
54 });
55 }, 'getInstalledRelatedApps with related and installed apps (no id)');
19 56
20 </script> 57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698