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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp

Issue 2442323002: Update NotificationImageLoaderTest with better timeout values. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 Chromium Authors. All rights reserved. 1 // Copyright 2016 Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/notifications/NotificationImageLoader.h" 5 #include "modules/notifications/NotificationImageLoader.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/fetch/MemoryCache.h" 8 #include "core/fetch/MemoryCache.h"
9 #include "core/testing/DummyPageHolder.h" 9 #include "core/testing/DummyPageHolder.h"
10 #include "platform/testing/TestingPlatformSupport.h" 10 #include "platform/testing/TestingPlatformSupport.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 TestingPlatformSupportWithMockScheduler testingPlatform; 89 TestingPlatformSupportWithMockScheduler testingPlatform;
90 KURL url = registerMockedURL(kIcon500x500); 90 KURL url = registerMockedURL(kIcon500x500);
91 loadImage(url); 91 loadImage(url);
92 92
93 // Run the platform for kImageFetchTimeoutInMs-1 seconds. This should not 93 // Run the platform for kImageFetchTimeoutInMs-1 seconds. This should not
94 // result in a timeout. 94 // result in a timeout.
95 testingPlatform.runForPeriodSeconds(kImageFetchTimeoutInMs / 1000 - 1); 95 testingPlatform.runForPeriodSeconds(kImageFetchTimeoutInMs / 1000 - 1);
96 EXPECT_EQ(LoadState::kNotLoaded, loaded()); 96 EXPECT_EQ(LoadState::kNotLoaded, loaded());
97 97
98 // Now advance time until a timeout should be expected. 98 // Now advance time until a timeout should be expected.
99 // Note: Because of crbug.com/657517, the platform's time doesn't 99 testingPlatform.runForPeriodSeconds(2);
100 // actually update unless a task runs, so the platform still thinks it's the
101 // start time. To trigger a timeout, we have to advance the full time again.
102 testingPlatform.runForPeriodSeconds(kImageFetchTimeoutInMs / 1000 + 1);
103 100
104 // If the loader times out, it calls the callback and returns an empty bitmap. 101 // If the loader times out, it calls the callback and returns an empty bitmap.
105 EXPECT_EQ(LoadState::kLoadFailed, loaded()); 102 EXPECT_EQ(LoadState::kLoadFailed, loaded());
106 } 103 }
107 104
108 } // namspace 105 } // namspace
109 } // namespace blink 106 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698