| Index: third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html
|
| diff --git a/third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html b/third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html
|
| index 4c13b6cebb012ce83d41a30d4dab96c36b0873a9..66fedf26de334107207b4cd3d1ddc8acd9f5cf25 100644
|
| --- a/third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html
|
| +++ b/third_party/WebKit/LayoutTests/installedapp/getinstalledrelatedapps.html
|
| @@ -2,19 +2,56 @@
|
| <link rel="manifest" href="resources/manifest.json">
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| +<script src="../resources/mojo-helpers.js"></script>
|
| <script src="resources/installedapp-test-helper.js"></script>
|
| <script>
|
|
|
| -promise_test(() => {
|
| - // The manifest for this file has two related apps, but for now we can only
|
| - // expect to see an empty list in response (since we do not check whether any
|
| - // of the apps are installed).
|
| +installedapp_test((t, mock) => {
|
| + // The expected input to the Mojo method FilterInstalledRelatedApps is the
|
| + // list of related_applications from this page's manifest. The mock service
|
| + // returns the empty list, implying that none are installed.
|
| + mock.pushExpectedCall(
|
| + [{platform: 'play', url: null, id: 'com.test'},
|
| + {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
|
| + []);
|
| return navigator.getInstalledRelatedApps().then(result => {
|
| assert_array_relatedapplication_equals(result, []);
|
| });
|
| }, 'getInstalledRelatedApps with related apps, none installed');
|
|
|
| -// TODO(mgiuca): Add another test for when the browser returns a non-empty list
|
| -// of installed apps.
|
| +installedapp_test((t, mock) => {
|
| + // The expected input to the Mojo method FilterInstalledRelatedApps is the
|
| + // list of related_applications from this page's manifest. The mock service
|
| + // returns just the 'play' entry. Expect that result to be returned by
|
| + // getInstalledRelatedApps.
|
| + mock.pushExpectedCall(
|
| + [{platform: 'play', url: null, id: 'com.test'},
|
| + {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
|
| + [{platform: 'play', url: null, id: 'com.test'}]);
|
| + // TODO(mgiuca): The |url| field should be omitted from the result, not ''.
|
| + return navigator.getInstalledRelatedApps().then(result => {
|
| + assert_array_relatedapplication_equals(
|
| + result, [{platform: 'play', url: '', id: 'com.test'}]);
|
| + });
|
| +}, 'getInstalledRelatedApps with related and installed apps (no url)');
|
| +
|
| +installedapp_test((t, mock) => {
|
| + // The expected input to the Mojo method FilterInstalledRelatedApps is the
|
| + // list of related_applications from this page's manifest. The mock service
|
| + // returns both entries. Expect that result to be returned by
|
| + // getInstalledRelatedApps.
|
| + mock.pushExpectedCall(
|
| + [{platform: 'play', url: null, id: 'com.test'},
|
| + {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}],
|
| + [{platform: 'play', url: null, id: 'com.test'},
|
| + {platform: 'itunes', url: 'https://itunes.apple.com/', id: null}]);
|
| + // TODO(mgiuca): The null fields should be omitted from the result, not ''.
|
| + return navigator.getInstalledRelatedApps().then(result => {
|
| + assert_array_relatedapplication_equals(
|
| + result,
|
| + [{platform: 'play', url: '', id: 'com.test'},
|
| + {platform: 'itunes', url: 'https://itunes.apple.com/', id: ''}]);
|
| + });
|
| +}, 'getInstalledRelatedApps with multiple related and installed apps');
|
|
|
| </script>
|
|
|