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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" | 6 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" |
7 #include "chromeos/chromeos_switches.h" | 7 #include "chromeos/chromeos_switches.h" |
8 #include "chromeos/network/network_state.h" | 8 #include "chromeos/network/network_state.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/message_center/message_center.h" | 10 #include "ui/message_center/message_center.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 }; | 60 }; |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 class NetworkPortalNotificationControllerTest : public testing::Test { | 64 class NetworkPortalNotificationControllerTest : public testing::Test { |
65 public: | 65 public: |
66 NetworkPortalNotificationControllerTest() {} | 66 NetworkPortalNotificationControllerTest() {} |
67 virtual ~NetworkPortalNotificationControllerTest() {} | 67 virtual ~NetworkPortalNotificationControllerTest() {} |
68 | 68 |
69 virtual void SetUp() override { | 69 virtual void SetUp() override { |
70 CommandLine* cl = CommandLine::ForCurrentProcess(); | 70 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
71 cl->AppendSwitch(switches::kEnableNetworkPortalNotification); | 71 cl->AppendSwitch(switches::kEnableNetworkPortalNotification); |
72 MessageCenter::Initialize(); | 72 MessageCenter::Initialize(); |
73 MessageCenter::Get()->AddObserver(&observer_); | 73 MessageCenter::Get()->AddObserver(&observer_); |
74 } | 74 } |
75 | 75 |
76 virtual void TearDown() override { | 76 virtual void TearDown() override { |
77 MessageCenter::Get()->RemoveObserver(&observer_); | 77 MessageCenter::Get()->RemoveObserver(&observer_); |
78 MessageCenter::Shutdown(); | 78 MessageCenter::Shutdown(); |
79 } | 79 } |
80 | 80 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Network was switched (by shill or by user) to wifi1. Notification | 191 // Network was switched (by shill or by user) to wifi1. Notification |
192 // should be displayed. | 192 // should be displayed. |
193 OnPortalDetectionCompleted(&wifi1, portal_state); | 193 OnPortalDetectionCompleted(&wifi1, portal_state); |
194 ASSERT_TRUE(HasNotification()); | 194 ASSERT_TRUE(HasNotification()); |
195 EXPECT_EQ(2u, observer().add_count()); | 195 EXPECT_EQ(2u, observer().add_count()); |
196 EXPECT_EQ(1u, observer().remove_count()); | 196 EXPECT_EQ(1u, observer().remove_count()); |
197 EXPECT_EQ(1u, observer().update_count()); | 197 EXPECT_EQ(1u, observer().update_count()); |
198 } | 198 } |
199 | 199 |
200 } // namespace chromeos | 200 } // namespace chromeos |
OLD | NEW |