Commit 761bbfa3 authored by Rayan Kanso's avatar Rayan Kanso Committed by Commit Bot

[ContentIndex] Rename ContentIndexDescription's launchUrl to url

https://github.com/WICG/content-index/issues/21

Change-Id: I829db49bc39ae49288c198f4080e334c226c33f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144077Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758853}
parent 9346d615
...@@ -22,7 +22,7 @@ async function AddContent(id) { ...@@ -22,7 +22,7 @@ async function AddContent(id) {
icons: [{ icons: [{
src: '/anchor_download_test.png', src: '/anchor_download_test.png',
}], }],
launchUrl: '/content_index/content_index.html?launch', url: '/content_index/content_index.html?launch',
}); });
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
description: 'Description!', description: 'Description!',
category: 'article', category: 'article',
icons, icons,
launchUrl: '/content_index/test.html', url: '/content_index/test.html',
}); });
sendResultToTest('ok'); sendResultToTest('ok');
} catch (e) { } catch (e) {
......
...@@ -18,5 +18,5 @@ dictionary ContentDescription { ...@@ -18,5 +18,5 @@ dictionary ContentDescription {
required DOMString description; required DOMString description;
ContentCategory category = ""; ContentCategory category = "";
sequence<ContentIconDefinition> icons = []; sequence<ContentIconDefinition> icons = [];
required USVString launchUrl; required USVString url;
}; };
...@@ -59,7 +59,7 @@ blink::mojom::blink::ContentDescriptionPtr TypeConverter< ...@@ -59,7 +59,7 @@ blink::mojom::blink::ContentDescriptionPtr TypeConverter<
result->icons.push_back(blink::mojom::blink::ContentIconDefinition::New( result->icons.push_back(blink::mojom::blink::ContentIconDefinition::New(
icon->src(), icon->sizes(), icon->type())); icon->src(), icon->sizes(), icon->type()));
} }
result->launch_url = description->launchUrl(); result->launch_url = description->url();
return result; return result;
} }
...@@ -85,7 +85,7 @@ TypeConverter<blink::ContentDescription*, ...@@ -85,7 +85,7 @@ TypeConverter<blink::ContentDescription*,
} }
result->setIcons(blink_icons); result->setIcons(blink_icons);
result->setLaunchUrl(description->launch_url); result->setUrl(description->launch_url);
return result; return result;
} }
......
...@@ -26,7 +26,7 @@ const blink::ContentDescription* CreateDescription(const WTF::String& category, ...@@ -26,7 +26,7 @@ const blink::ContentDescription* CreateDescription(const WTF::String& category,
icon_definition->setSrc(url); icon_definition->setSrc(url);
description->setIcons({icon_definition}); description->setIcons({icon_definition});
description->setLaunchUrl(url); description->setUrl(url);
return description; return description;
} }
...@@ -40,7 +40,7 @@ bool operator==(const ContentDescription& cd1, const ContentDescription& cd2) { ...@@ -40,7 +40,7 @@ bool operator==(const ContentDescription& cd1, const ContentDescription& cd2) {
return cd1.id() == cd2.id() && cd1.title() == cd2.title() && return cd1.id() == cd2.id() && cd1.title() == cd2.title() &&
cd1.description() == cd2.description() && cd1.description() == cd2.description() &&
cd1.category() == cd2.category() && cd1.icons() == cd2.icons() && cd1.category() == cd2.category() && cd1.icons() == cd2.icons() &&
cd1.launchUrl() == cd2.launchUrl(); cd1.url() == cd2.url();
} }
TEST(ContentDescriptionConversionTest, RoundTrip) { TEST(ContentDescriptionConversionTest, RoundTrip) {
......
...@@ -38,7 +38,7 @@ WTF::String ValidateDescription(const ContentDescription& description, ...@@ -38,7 +38,7 @@ WTF::String ValidateDescription(const ContentDescription& description,
if (description.description().IsEmpty()) if (description.description().IsEmpty())
return "Description cannot be empty"; return "Description cannot be empty";
if (description.launchUrl().IsEmpty()) if (description.url().IsEmpty())
return "Invalid launch URL provided"; return "Invalid launch URL provided";
for (const auto& icon : description.icons()) { for (const auto& icon : description.icons()) {
...@@ -51,7 +51,7 @@ WTF::String ValidateDescription(const ContentDescription& description, ...@@ -51,7 +51,7 @@ WTF::String ValidateDescription(const ContentDescription& description,
} }
KURL launch_url = KURL launch_url =
registration->GetExecutionContext()->CompleteURL(description.launchUrl()); registration->GetExecutionContext()->CompleteURL(description.url());
auto* security_origin = auto* security_origin =
registration->GetExecutionContext()->GetSecurityOrigin(); registration->GetExecutionContext()->GetSecurityOrigin();
if (!security_origin->CanRequest(launch_url)) if (!security_origin->CanRequest(launch_url))
......
...@@ -22,8 +22,8 @@ contentIndexTest(async (t, index) => { ...@@ -22,8 +22,8 @@ contentIndexTest(async (t, index) => {
await expectTypeError(index.add(createDescription({iconUrl: '/non-existent-icon.png'}))); await expectTypeError(index.add(createDescription({iconUrl: '/non-existent-icon.png'})));
await expectTypeError(index.add(createDescription({iconUrl: '/images/broken.png'}))); await expectTypeError(index.add(createDescription({iconUrl: '/images/broken.png'})));
await expectTypeError(index.add(createDescription({launchUrl: 'https://other-domain.com/'}))); await expectTypeError(index.add(createDescription({url: 'https://other-domain.com/'})));
await expectTypeError(index.add(createDescription({launchUrl: '/different-scope'}))); await expectTypeError(index.add(createDescription({url: '/different-scope'})));
await index.add(createDescription({})); await index.add(createDescription({}));
......
...@@ -14,8 +14,8 @@ async function expectTypeError(promise) { ...@@ -14,8 +14,8 @@ async function expectTypeError(promise) {
function createDescription({id = 'id', title = 'title', description = 'description', function createDescription({id = 'id', title = 'title', description = 'description',
category = 'homepage', iconUrl = '/images/green-256x256.png', category = 'homepage', iconUrl = '/images/green-256x256.png',
launchUrl = scope, includeIcons = true}) { url = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], launchUrl}; return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], url};
} }
// Creates a Promise test for |func| given the |description|. The |func| will be // Creates a Promise test for |func| given the |description|. The |func| will be
......
...@@ -35,10 +35,10 @@ contentIndexTest(async (t, index) => { ...@@ -35,10 +35,10 @@ contentIndexTest(async (t, index) => {
'Icon could not be loaded'); 'Icon could not be loaded');
await expectTypeErrorWithMessage( await expectTypeErrorWithMessage(
index.add(createDescription({launchUrl: 'https://other-domain.com/'})), index.add(createDescription({url: 'https://other-domain.com/'})),
`Failed to execute 'add' on 'ContentIndex': Service Worker cannot request provided launch URL`); `Failed to execute 'add' on 'ContentIndex': Service Worker cannot request provided launch URL`);
await expectTypeErrorWithMessage( await expectTypeErrorWithMessage(
index.add(createDescription({launchUrl: '/different-scope'})), index.add(createDescription({url: '/different-scope'})),
`Failed to execute 'add' on 'ContentIndex': Launch URL must belong to the Service Worker's scope`); `Failed to execute 'add' on 'ContentIndex': Launch URL must belong to the Service Worker's scope`);
await index.add(createDescription({})); await index.add(createDescription({}));
......
...@@ -21,8 +21,8 @@ async function expectTypeErrorWithMessage(promise, message) { ...@@ -21,8 +21,8 @@ async function expectTypeErrorWithMessage(promise, message) {
function createDescription({id = 'id', title = 'title', description = 'description', function createDescription({id = 'id', title = 'title', description = 'description',
category = 'homepage', iconUrl = '/resources/square.png', category = 'homepage', iconUrl = '/resources/square.png',
launchUrl = scope, includeIcons = true}) { url = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], launchUrl}; return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], url};
} }
// Creates a Promise test for |func| given the |description|. The |func| will be // Creates a Promise test for |func| given the |description|. The |func| will be
......
...@@ -17,7 +17,7 @@ async function reregisterContent() { ...@@ -17,7 +17,7 @@ async function reregisterContent() {
icons: [{ icons: [{
src: '/resources/square.png', src: '/resources/square.png',
}], }],
launchUrl: 'resources/', url: 'resources/',
}); });
await postMessageToWindow('Successfully registered'); await postMessageToWindow('Successfully registered');
} catch (e) { } catch (e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment