OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/upgrade_detector_impl.h" | 5 #include "chrome/browser/upgrade_detector_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "base/macros.h" |
9 #include "content/public/browser/notification_details.h" | 10 #include "content/public/browser/notification_details.h" |
10 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
12 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
13 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 class TestUpgradeDetectorImpl : public UpgradeDetectorImpl { | 17 class TestUpgradeDetectorImpl : public UpgradeDetectorImpl { |
17 public: | 18 public: |
18 TestUpgradeDetectorImpl() : trigger_critical_update_call_count_(0) {} | 19 TestUpgradeDetectorImpl() : trigger_critical_update_call_count_(0) {} |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 EXPECT_FALSE(detector.notify_upgrade()); | 103 EXPECT_FALSE(detector.notify_upgrade()); |
103 EXPECT_TRUE(notifications_listener.notifications_received().empty()); | 104 EXPECT_TRUE(notifications_listener.notifications_received().empty()); |
104 | 105 |
105 detector.NotifyOnUpgradeWithTimePassed(base::TimeDelta::FromDays(30)); | 106 detector.NotifyOnUpgradeWithTimePassed(base::TimeDelta::FromDays(30)); |
106 EXPECT_TRUE(detector.notify_upgrade()); | 107 EXPECT_TRUE(detector.notify_upgrade()); |
107 ASSERT_EQ(1U, notifications_listener.notifications_received().size()); | 108 ASSERT_EQ(1U, notifications_listener.notifications_received().size()); |
108 EXPECT_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 109 EXPECT_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
109 notifications_listener.notifications_received().front()); | 110 notifications_listener.notifications_received().front()); |
110 EXPECT_EQ(1, detector.trigger_critical_update_call_count()); | 111 EXPECT_EQ(1, detector.trigger_critical_update_call_count()); |
111 } | 112 } |
OLD | NEW |