OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The 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/NotificationResourcesLoader.h" | 5 #include "modules/notifications/NotificationResourcesLoader.h" |
6 | 6 |
7 #include "core/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
10 #include "platform/testing/URLTestHelpers.h" | 10 #include "platform/testing/URLTestHelpers.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Registers a mocked url that will fail to be fetched, with a 404 error. | 78 // Registers a mocked url that will fail to be fetched, with a 404 error. |
79 WebURL registerMockedErrorURL(const String& fileName) | 79 WebURL registerMockedErrorURL(const String& fileName) |
80 { | 80 { |
81 WebURL url(KURL(ParsedURLString, kBaseUrl + fileName)); | 81 WebURL url(KURL(ParsedURLString, kBaseUrl + fileName)); |
82 URLTestHelpers::registerMockedErrorURLLoad(url); | 82 URLTestHelpers::registerMockedErrorURLLoad(url); |
83 return url; | 83 return url; |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 OwnPtr<DummyPageHolder> m_page; | 87 std::unique_ptr<DummyPageHolder> m_page; |
88 Persistent<NotificationResourcesLoader> m_loader; | 88 Persistent<NotificationResourcesLoader> m_loader; |
89 std::unique_ptr<WebNotificationResources> m_resources; | 89 std::unique_ptr<WebNotificationResources> m_resources; |
90 }; | 90 }; |
91 | 91 |
92 TEST_F(NotificationResourcesLoaderTest, LoadMultipleResources) | 92 TEST_F(NotificationResourcesLoaderTest, LoadMultipleResources) |
93 { | 93 { |
94 WebNotificationData notificationData; | 94 WebNotificationData notificationData; |
95 notificationData.icon = registerMockedURL(kIcon100x100); | 95 notificationData.icon = registerMockedURL(kIcon100x100); |
96 notificationData.badge = registerMockedURL(kIcon48x48); | 96 notificationData.badge = registerMockedURL(kIcon48x48); |
97 notificationData.actions = WebVector<WebNotificationAction>(static_cast<size
_t>(2)); | 97 notificationData.actions = WebVector<WebNotificationAction>(static_cast<size
_t>(2)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); | 231 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); |
232 | 232 |
233 // Loading should have been cancelled when |stop| was called so no resources | 233 // Loading should have been cancelled when |stop| was called so no resources |
234 // should have been received by the test even though | 234 // should have been received by the test even though |
235 // |serveAsynchronousRequests| was called. | 235 // |serveAsynchronousRequests| was called. |
236 ASSERT_FALSE(resources()); | 236 ASSERT_FALSE(resources()); |
237 } | 237 } |
238 | 238 |
239 } // namespace | 239 } // namespace |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |