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

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

Issue 2588403002: TestingPlatformSupport: register Platform instance correctly (Closed)
Patch Set: review #16 and merge master Created 3 years, 11 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 8b31a76e72c963070cad95b28ead9461cb46ce63..bbcd58224462f5102e32aee44413ec877efe4a54 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
@@ -17,6 +17,7 @@
#include "third_party/WebKit/Source/platform/weborigin/KURL.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "wtf/Functional.h"
+#include "wtf/PtrUtil.h"
namespace blink {
namespace {
@@ -99,20 +100,22 @@ TEST_F(NotificationImageLoaderTest, SuccessTest) {
TEST_F(NotificationImageLoaderTest, TimeoutTest) {
// To test for a timeout, this needs to override the clock in the platform.
// Just creating the mock platform will do everything to set it up.
- TestingPlatformSupportWithMockScheduler testingPlatform;
+ ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
+ testingPlatform(
+ WTF::makeUnique<TestingPlatformSupportWithMockScheduler>());
KURL url = registerMockedURL(kIcon500x500);
loadImage(url);
// Run the platform for kImageFetchTimeoutInMs-1 seconds. This should not
// result in a timeout.
- testingPlatform.runForPeriodSeconds(kImageFetchTimeoutInMs / 1000 - 1);
+ testingPlatform->runForPeriodSeconds(kImageFetchTimeoutInMs / 1000 - 1);
EXPECT_EQ(LoadState::kNotLoaded, loaded());
m_histogramTester.expectTotalCount("Notifications.LoadFinishTime.Icon", 0);
m_histogramTester.expectTotalCount("Notifications.LoadFileSize.Icon", 0);
m_histogramTester.expectTotalCount("Notifications.LoadFailTime.Icon", 0);
// Now advance time until a timeout should be expected.
- testingPlatform.runForPeriodSeconds(2);
+ testingPlatform->runForPeriodSeconds(2);
// If the loader times out, it calls the callback and returns an empty bitmap.
EXPECT_EQ(LoadState::kLoadFailed, loaded());

Powered by Google App Engine
This is Rietveld 408576698