| 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 bcb59f4d19f6523ba1a2570ff293250865609682..8b31a76e72c963070cad95b28ead9461cb46ce63 100644
 | 
| --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
 | 
| +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoaderTest.cpp
 | 
| @@ -7,6 +7,7 @@
 | 
|  #include "core/dom/ExecutionContext.h"
 | 
|  #include "core/fetch/MemoryCache.h"
 | 
|  #include "core/testing/DummyPageHolder.h"
 | 
| +#include "platform/testing/HistogramTester.h"
 | 
|  #include "platform/testing/TestingPlatformSupport.h"
 | 
|  #include "platform/testing/URLTestHelpers.h"
 | 
|  #include "public/platform/Platform.h"
 | 
| @@ -35,7 +36,9 @@ class NotificationImageLoaderTest : public ::testing::Test {
 | 
|   public:
 | 
|    NotificationImageLoaderTest()
 | 
|        : m_page(DummyPageHolder::create()),
 | 
| -        m_loader(new NotificationImageLoader()) {}
 | 
| +        // Use an arbitrary type, since it only affects which UMA bucket we use.
 | 
| +        m_loader(
 | 
| +            new NotificationImageLoader(NotificationImageLoader::Type::Icon)) {}
 | 
|  
 | 
|    ~NotificationImageLoaderTest() override {
 | 
|      m_loader->stop();
 | 
| @@ -70,6 +73,9 @@ class NotificationImageLoaderTest : public ::testing::Test {
 | 
|    ExecutionContext* context() const { return &m_page->document(); }
 | 
|    LoadState loaded() const { return m_loaded; }
 | 
|  
 | 
| + protected:
 | 
| +  HistogramTester m_histogramTester;
 | 
| +
 | 
|   private:
 | 
|    std::unique_ptr<DummyPageHolder> m_page;
 | 
|    Persistent<NotificationImageLoader> m_loader;
 | 
| @@ -79,8 +85,15 @@ class NotificationImageLoaderTest : public ::testing::Test {
 | 
|  TEST_F(NotificationImageLoaderTest, SuccessTest) {
 | 
|    KURL url = registerMockedURL(kIcon500x500);
 | 
|    loadImage(url);
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFinishTime.Icon", 0);
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFileSize.Icon", 0);
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFailTime.Icon", 0);
 | 
|    Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
 | 
|    EXPECT_EQ(LoadState::kLoadSuccessful, loaded());
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFinishTime.Icon", 1);
 | 
| +  m_histogramTester.expectUniqueSample("Notifications.LoadFileSize.Icon", 7439,
 | 
| +                                       1);
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFailTime.Icon", 0);
 | 
|  }
 | 
|  
 | 
|  TEST_F(NotificationImageLoaderTest, TimeoutTest) {
 | 
| @@ -94,12 +107,20 @@ TEST_F(NotificationImageLoaderTest, TimeoutTest) {
 | 
|    // result in a timeout.
 | 
|    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);
 | 
|  
 | 
|    // If the loader times out, it calls the callback and returns an empty bitmap.
 | 
|    EXPECT_EQ(LoadState::kLoadFailed, loaded());
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFinishTime.Icon", 0);
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFileSize.Icon", 0);
 | 
| +  // Should log a non-zero failure time.
 | 
| +  m_histogramTester.expectTotalCount("Notifications.LoadFailTime.Icon", 1);
 | 
| +  m_histogramTester.expectBucketCount("Notifications.LoadFailTime.Icon", 0, 0);
 | 
|  }
 | 
|  
 | 
|  }  // namspace
 | 
| 
 |