OLD | NEW |
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/mojo-helpers.js"></script> |
6 <script src="resources/installedapp-test-helper.js"></script> | 6 <script src="resources/installedapp-test-helper.js"></script> |
7 <script> | 7 <script> |
8 | 8 |
9 installedapp_test((t, mock) => { | 9 installedapp_test((t, mock) => { |
| 10 let itunesUrl = mock.makeUrl('https://itunes.apple.com/'); |
10 // The expected input to the Mojo method FilterInstalledRelatedApps is the | 11 // The expected input to the Mojo method FilterInstalledRelatedApps is the |
11 // list of related_applications from this page's manifest. The mock service | 12 // list of related_applications from this page's manifest. The mock service |
12 // returns the empty list, implying that none are installed. | 13 // returns the empty list, implying that none are installed. |
13 mock.pushExpectedCall( | 14 mock.pushExpectedCall( |
14 [{platform: 'play', url: null, id: 'com.test'}, | 15 [{platform: 'play', url: null, id: 'com.test'}, |
15 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}], | 16 {platform: 'itunes', url: itunesUrl, id: null}], |
16 []); | 17 []); |
17 return navigator.getInstalledRelatedApps().then(result => { | 18 return navigator.getInstalledRelatedApps().then(result => { |
18 assert_array_relatedapplication_equals(result, []); | 19 assert_array_relatedapplication_equals(result, []); |
19 }); | 20 }); |
20 }, 'getInstalledRelatedApps with related apps, none installed'); | 21 }, 'getInstalledRelatedApps with related apps, none installed'); |
21 | 22 |
22 installedapp_test((t, mock) => { | 23 installedapp_test((t, mock) => { |
| 24 let itunesUrl = mock.makeUrl('https://itunes.apple.com/'); |
23 // The expected input to the Mojo method FilterInstalledRelatedApps is the | 25 // The expected input to the Mojo method FilterInstalledRelatedApps is the |
24 // list of related_applications from this page's manifest. The mock service | 26 // 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 | 27 // returns just the 'play' entry. Expect that result to be returned by |
26 // getInstalledRelatedApps. | 28 // getInstalledRelatedApps. |
27 mock.pushExpectedCall( | 29 mock.pushExpectedCall( |
28 [{platform: 'play', url: null, id: 'com.test'}, | 30 [{platform: 'play', url: null, id: 'com.test'}, |
29 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}], | 31 {platform: 'itunes', url: itunesUrl, id: null}], |
30 [{platform: 'play', url: null, id: 'com.test'}]); | 32 [{platform: 'play', url: null, id: 'com.test'}]); |
31 // TODO(mgiuca): The |url| field should be omitted from the result, not ''. | 33 // TODO(mgiuca): The |url| field should be omitted from the result, not ''. |
32 return navigator.getInstalledRelatedApps().then(result => { | 34 return navigator.getInstalledRelatedApps().then(result => { |
33 assert_array_relatedapplication_equals( | 35 assert_array_relatedapplication_equals( |
34 result, [{platform: 'play', url: '', id: 'com.test'}]); | 36 result, [{platform: 'play', url: '', id: 'com.test'}]); |
35 }); | 37 }); |
36 }, 'getInstalledRelatedApps with related and installed apps (no url)'); | 38 }, 'getInstalledRelatedApps with related and installed apps (no url)'); |
37 | 39 |
38 installedapp_test((t, mock) => { | 40 installedapp_test((t, mock) => { |
| 41 let itunesUrl = mock.makeUrl('https://itunes.apple.com/'); |
39 // The expected input to the Mojo method FilterInstalledRelatedApps is the | 42 // The expected input to the Mojo method FilterInstalledRelatedApps is the |
40 // list of related_applications from this page's manifest. The mock service | 43 // list of related_applications from this page's manifest. The mock service |
41 // returns both entries. Expect that result to be returned by | 44 // returns both entries. Expect that result to be returned by |
42 // getInstalledRelatedApps. | 45 // getInstalledRelatedApps. |
43 mock.pushExpectedCall( | 46 mock.pushExpectedCall( |
44 [{platform: 'play', url: null, id: 'com.test'}, | 47 [{platform: 'play', url: null, id: 'com.test'}, |
45 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}], | 48 {platform: 'itunes', url: itunesUrl, id: null}], |
46 [{platform: 'play', url: null, id: 'com.test'}, | 49 [{platform: 'play', url: null, id: 'com.test'}, |
47 {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}]); | 50 {platform: 'itunes', url: itunesUrl, id: null}]); |
48 // TODO(mgiuca): The null fields should be omitted from the result, not ''. | 51 // TODO(mgiuca): The null fields should be omitted from the result, not ''. |
49 return navigator.getInstalledRelatedApps().then(result => { | 52 return navigator.getInstalledRelatedApps().then(result => { |
50 assert_array_relatedapplication_equals( | 53 assert_array_relatedapplication_equals( |
51 result, | 54 result, |
52 [{platform: 'play', url: '', id: 'com.test'}, | 55 [{platform: 'play', url: '', id: 'com.test'}, |
53 {platform: 'itunes', url: 'https://itunes.apple.com/', id: ''}]); | 56 {platform: 'itunes', url: 'https://itunes.apple.com/', id: ''}]); |
54 }); | 57 }); |
55 }, 'getInstalledRelatedApps with multiple related and installed apps'); | 58 }, 'getInstalledRelatedApps with multiple related and installed apps'); |
56 | 59 |
57 </script> | 60 </script> |
OLD | NEW |