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) {
icons: [{
src: '/anchor_download_test.png',
}],
launchUrl: '/content_index/content_index.html?launch',
url: '/content_index/content_index.html?launch',
});
}
......
......@@ -18,7 +18,7 @@
description: 'Description!',
category: 'article',
icons,
launchUrl: '/content_index/test.html',
url: '/content_index/test.html',
});
sendResultToTest('ok');
} catch (e) {
......
......@@ -18,5 +18,5 @@ dictionary ContentDescription {
required DOMString description;
ContentCategory category = "";
sequence<ContentIconDefinition> icons = [];
required USVString launchUrl;
required USVString url;
};
......@@ -59,7 +59,7 @@ blink::mojom::blink::ContentDescriptionPtr TypeConverter<
result->icons.push_back(blink::mojom::blink::ContentIconDefinition::New(
icon->src(), icon->sizes(), icon->type()));
}
result->launch_url = description->launchUrl();
result->launch_url = description->url();
return result;
}
......@@ -85,7 +85,7 @@ TypeConverter<blink::ContentDescription*,
}
result->setIcons(blink_icons);
result->setLaunchUrl(description->launch_url);
result->setUrl(description->launch_url);
return result;
}
......
......@@ -26,7 +26,7 @@ const blink::ContentDescription* CreateDescription(const WTF::String& category,
icon_definition->setSrc(url);
description->setIcons({icon_definition});
description->setLaunchUrl(url);
description->setUrl(url);
return description;
}
......@@ -40,7 +40,7 @@ bool operator==(const ContentDescription& cd1, const ContentDescription& cd2) {
return cd1.id() == cd2.id() && cd1.title() == cd2.title() &&
cd1.description() == cd2.description() &&
cd1.category() == cd2.category() && cd1.icons() == cd2.icons() &&
cd1.launchUrl() == cd2.launchUrl();
cd1.url() == cd2.url();
}
TEST(ContentDescriptionConversionTest, RoundTrip) {
......
......@@ -38,7 +38,7 @@ WTF::String ValidateDescription(const ContentDescription& description,
if (description.description().IsEmpty())
return "Description cannot be empty";
if (description.launchUrl().IsEmpty())
if (description.url().IsEmpty())
return "Invalid launch URL provided";
for (const auto& icon : description.icons()) {
......@@ -51,7 +51,7 @@ WTF::String ValidateDescription(const ContentDescription& description,
}
KURL launch_url =
registration->GetExecutionContext()->CompleteURL(description.launchUrl());
registration->GetExecutionContext()->CompleteURL(description.url());
auto* security_origin =
registration->GetExecutionContext()->GetSecurityOrigin();
if (!security_origin->CanRequest(launch_url))
......
......@@ -22,8 +22,8 @@ contentIndexTest(async (t, index) => {
await expectTypeError(index.add(createDescription({iconUrl: '/non-existent-icon.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({launchUrl: '/different-scope'})));
await expectTypeError(index.add(createDescription({url: 'https://other-domain.com/'})));
await expectTypeError(index.add(createDescription({url: '/different-scope'})));
await index.add(createDescription({}));
......
......@@ -14,8 +14,8 @@ async function expectTypeError(promise) {
function createDescription({id = 'id', title = 'title', description = 'description',
category = 'homepage', iconUrl = '/images/green-256x256.png',
launchUrl = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], launchUrl};
url = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], url};
}
// Creates a Promise test for |func| given the |description|. The |func| will be
......
......@@ -35,10 +35,10 @@ contentIndexTest(async (t, index) => {
'Icon could not be loaded');
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`);
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`);
await index.add(createDescription({}));
......
......@@ -21,8 +21,8 @@ async function expectTypeErrorWithMessage(promise, message) {
function createDescription({id = 'id', title = 'title', description = 'description',
category = 'homepage', iconUrl = '/resources/square.png',
launchUrl = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], launchUrl};
url = scope, includeIcons = true}) {
return {id, title, description, category, icons: includeIcons ? [{src: iconUrl}] : [], url};
}
// Creates a Promise test for |func| given the |description|. The |func| will be
......
......@@ -17,7 +17,7 @@ async function reregisterContent() {
icons: [{
src: '/resources/square.png',
}],
launchUrl: 'resources/',
url: 'resources/',
});
await postMessageToWindow('Successfully registered');
} 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