| Index: third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
|
| index 8b2935b84e9beedacb29f3054524342131745e73..aedbd448eb5ebe567268027fb380d624025ef057 100644
|
| --- a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
|
| @@ -25,15 +25,15 @@
|
| namespace blink {
|
| namespace {
|
|
|
| -constexpr char kBaseUrl[] = "http://test.com/";
|
| -constexpr char kBaseDir[] = "notifications/";
|
| -constexpr char kIcon48x48[] = "48x48.png";
|
| -constexpr char kIcon100x100[] = "100x100.png";
|
| -constexpr char kIcon110x110[] = "110x110.png";
|
| -constexpr char kIcon120x120[] = "120x120.png";
|
| -constexpr char kIcon500x500[] = "500x500.png";
|
| -constexpr char kIcon3000x1000[] = "3000x1000.png";
|
| -constexpr char kIcon3000x2000[] = "3000x2000.png";
|
| +constexpr char kResourcesLoaderBaseUrl[] = "http://test.com/";
|
| +constexpr char kResourcesLoaderBaseDir[] = "notifications/";
|
| +constexpr char kResourcesLoaderIcon48x48[] = "48x48.png";
|
| +constexpr char kResourcesLoaderIcon100x100[] = "100x100.png";
|
| +constexpr char kResourcesLoaderIcon110x110[] = "110x110.png";
|
| +constexpr char kResourcesLoaderIcon120x120[] = "120x120.png";
|
| +constexpr char kResourcesLoaderIcon500x500[] = "500x500.png";
|
| +constexpr char kResourcesLoaderIcon3000x1000[] = "3000x1000.png";
|
| +constexpr char kResourcesLoaderIcon3000x2000[] = "3000x2000.png";
|
|
|
| class NotificationResourcesLoaderTest : public ::testing::Test {
|
| public:
|
| @@ -67,13 +67,15 @@ class NotificationResourcesLoaderTest : public ::testing::Test {
|
| // test data directory.
|
| WebURL RegisterMockedURL(const String& file_name) {
|
| WebURL registered_url = URLTestHelpers::RegisterMockedURLLoadFromBase(
|
| - kBaseUrl, testing::CoreTestDataPath(kBaseDir), file_name, "image/png");
|
| + kResourcesLoaderBaseUrl,
|
| + testing::CoreTestDataPath(kResourcesLoaderBaseDir), file_name,
|
| + "image/png");
|
| return registered_url;
|
| }
|
|
|
| // Registers a mocked url that will fail to be fetched, with a 404 error.
|
| WebURL RegisterMockedErrorURL(const String& file_name) {
|
| - WebURL url(KURL(kParsedURLString, kBaseUrl + file_name));
|
| + WebURL url(KURL(kParsedURLString, kResourcesLoaderBaseUrl + file_name));
|
| URLTestHelpers::RegisterMockedErrorURLLoad(url);
|
| return url;
|
| }
|
| @@ -86,13 +88,15 @@ class NotificationResourcesLoaderTest : public ::testing::Test {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, LoadMultipleResources) {
|
| WebNotificationData notification_data;
|
| - notification_data.image = RegisterMockedURL(kIcon500x500);
|
| - notification_data.icon = RegisterMockedURL(kIcon100x100);
|
| - notification_data.badge = RegisterMockedURL(kIcon48x48);
|
| + notification_data.image = RegisterMockedURL(kResourcesLoaderIcon500x500);
|
| + notification_data.icon = RegisterMockedURL(kResourcesLoaderIcon100x100);
|
| + notification_data.badge = RegisterMockedURL(kResourcesLoaderIcon48x48);
|
| notification_data.actions =
|
| WebVector<WebNotificationAction>(static_cast<size_t>(2));
|
| - notification_data.actions[0].icon = RegisterMockedURL(kIcon110x110);
|
| - notification_data.actions[1].icon = RegisterMockedURL(kIcon120x120);
|
| + notification_data.actions[0].icon =
|
| + RegisterMockedURL(kResourcesLoaderIcon110x110);
|
| + notification_data.actions[1].icon =
|
| + RegisterMockedURL(kResourcesLoaderIcon120x120);
|
|
|
| ASSERT_FALSE(Resources());
|
|
|
| @@ -120,7 +124,7 @@ TEST_F(NotificationResourcesLoaderTest, LoadMultipleResources) {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, LargeIconsAreScaledDown) {
|
| WebNotificationData notification_data;
|
| - notification_data.icon = RegisterMockedURL(kIcon500x500);
|
| + notification_data.icon = RegisterMockedURL(kResourcesLoaderIcon500x500);
|
| notification_data.badge = notification_data.icon;
|
| notification_data.actions =
|
| WebVector<WebNotificationAction>(static_cast<size_t>(1));
|
| @@ -151,7 +155,7 @@ TEST_F(NotificationResourcesLoaderTest, LargeIconsAreScaledDown) {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, DownscalingPreserves3_1AspectRatio) {
|
| WebNotificationData notification_data;
|
| - notification_data.image = RegisterMockedURL(kIcon3000x1000);
|
| + notification_data.image = RegisterMockedURL(kResourcesLoaderIcon3000x1000);
|
|
|
| ASSERT_FALSE(Resources());
|
|
|
| @@ -167,7 +171,7 @@ TEST_F(NotificationResourcesLoaderTest, DownscalingPreserves3_1AspectRatio) {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, DownscalingPreserves3_2AspectRatio) {
|
| WebNotificationData notification_data;
|
| - notification_data.image = RegisterMockedURL(kIcon3000x2000);
|
| + notification_data.image = RegisterMockedURL(kResourcesLoaderIcon3000x2000);
|
|
|
| ASSERT_FALSE(Resources());
|
|
|
| @@ -201,7 +205,7 @@ TEST_F(NotificationResourcesLoaderTest, EmptyDataYieldsEmptyResources) {
|
| TEST_F(NotificationResourcesLoaderTest, EmptyResourcesIfAllImagesFailToLoad) {
|
| WebNotificationData notification_data;
|
| notification_data.image = notification_data.icon;
|
| - notification_data.icon = RegisterMockedErrorURL(kIcon100x100);
|
| + notification_data.icon = RegisterMockedErrorURL(kResourcesLoaderIcon100x100);
|
| notification_data.badge = notification_data.icon;
|
| notification_data.actions =
|
| WebVector<WebNotificationAction>(static_cast<size_t>(1));
|
| @@ -225,8 +229,8 @@ TEST_F(NotificationResourcesLoaderTest, EmptyResourcesIfAllImagesFailToLoad) {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, OneImageFailsToLoad) {
|
| WebNotificationData notification_data;
|
| - notification_data.icon = RegisterMockedURL(kIcon100x100);
|
| - notification_data.badge = RegisterMockedErrorURL(kIcon48x48);
|
| + notification_data.icon = RegisterMockedURL(kResourcesLoaderIcon100x100);
|
| + notification_data.badge = RegisterMockedErrorURL(kResourcesLoaderIcon48x48);
|
|
|
| ASSERT_FALSE(Resources());
|
|
|
| @@ -246,13 +250,15 @@ TEST_F(NotificationResourcesLoaderTest, OneImageFailsToLoad) {
|
|
|
| TEST_F(NotificationResourcesLoaderTest, StopYieldsNoResources) {
|
| WebNotificationData notification_data;
|
| - notification_data.image = RegisterMockedURL(kIcon500x500);
|
| - notification_data.icon = RegisterMockedURL(kIcon100x100);
|
| - notification_data.badge = RegisterMockedURL(kIcon48x48);
|
| + notification_data.image = RegisterMockedURL(kResourcesLoaderIcon500x500);
|
| + notification_data.icon = RegisterMockedURL(kResourcesLoaderIcon100x100);
|
| + notification_data.badge = RegisterMockedURL(kResourcesLoaderIcon48x48);
|
| notification_data.actions =
|
| WebVector<WebNotificationAction>(static_cast<size_t>(2));
|
| - notification_data.actions[0].icon = RegisterMockedURL(kIcon110x110);
|
| - notification_data.actions[1].icon = RegisterMockedURL(kIcon120x120);
|
| + notification_data.actions[0].icon =
|
| + RegisterMockedURL(kResourcesLoaderIcon110x110);
|
| + notification_data.actions[1].icon =
|
| + RegisterMockedURL(kResourcesLoaderIcon120x120);
|
|
|
| ASSERT_FALSE(Resources());
|
|
|
|
|