Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp

Issue 2654933003: platform/testing/{URL|Unit}TestHelpers improvements (Closed)
Patch Set: header changes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
index 1868f906c6618cd9a9b2ef8d3f8d2d42ed356c90..19d5fe9ccae2489429946daf8feb0dcc687dc980 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
@@ -10,6 +10,7 @@
#include "platform/testing/HistogramTester.h"
#include "platform/testing/TestingPlatformSupport.h"
#include "platform/testing/URLTestHelpers.h"
+#include "platform/testing/UnitTestHelpers.h"
#include "public/platform/Platform.h"
#include "public/platform/WebURL.h"
#include "public/platform/WebURLLoaderMockFactory.h"
@@ -23,11 +24,12 @@ namespace {
enum class LoadState { kNotLoaded, kLoadFailed, kLoadSuccessful };
-const char kBaseUrl[] = "http://test.com/";
-const char kIcon500x500[] = "500x500.png";
+constexpr char kBaseUrl[] = "http://test.com/";
+constexpr char kBaseDir[] = "notifications/";
+constexpr char kIcon500x500[] = "500x500.png";
// This mirrors the definition in NotificationImageLoader.cpp.
-const unsigned long kImageFetchTimeoutInMs = 90000;
+constexpr unsigned long kImageFetchTimeoutInMs = 90000;
static_assert(kImageFetchTimeoutInMs > 1000.0,
"kImageFetchTimeoutInMs must be greater than 1000ms.");
@@ -49,10 +51,9 @@ class NotificationImageLoaderTest : public ::testing::Test {
// Registers a mocked URL. When fetched it will be loaded form the test data
// directory.
WebURL registerMockedURL(const String& fileName) {
- WebURL url(KURL(ParsedURLString, kBaseUrl + fileName));
- URLTestHelpers::registerMockedURLLoad(url, fileName, "notifications/",
- "image/png");
- return url;
+ WebURL registeredUrl = URLTestHelpers::registerMockedURLLoadFromBase(
+ kBaseUrl, testing::webTestDataPath(kBaseDir), fileName, "image/png");
+ return registeredUrl;
}
// Callback for the NotificationImageLoader. This will set the state of the

Powered by Google App Engine
This is Rietveld 408576698