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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/login/login_manager_test.h" | 10 #include "chrome/browser/chromeos/login/login_manager_test.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 void WaitAndReset() { | 68 void WaitAndReset() { |
69 run_loop_->Run(); | 69 run_loop_->Run(); |
70 run_loop_.reset(new base::RunLoop()); | 70 run_loop_.reset(new base::RunLoop()); |
71 } | 71 } |
72 | 72 |
73 virtual void OnNotificationDisplayed( | 73 virtual void OnNotificationDisplayed( |
74 const std::string& notification_id, | 74 const std::string& notification_id, |
75 const message_center::DisplaySource source) | 75 const message_center::DisplaySource source) |
76 OVERRIDE { | 76 override { |
77 if (notification_id == kNotificationId) | 77 if (notification_id == kNotificationId) |
78 MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); | 78 MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); |
79 } | 79 } |
80 | 80 |
81 virtual void OnNotificationRemoved(const std::string& notification_id, | 81 virtual void OnNotificationRemoved(const std::string& notification_id, |
82 bool by_user) OVERRIDE { | 82 bool by_user) override { |
83 if (notification_id == kNotificationId && by_user) | 83 if (notification_id == kNotificationId && by_user) |
84 MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); | 84 MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 scoped_ptr<base::RunLoop> run_loop_; | 88 scoped_ptr<base::RunLoop> run_loop_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 90 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 class NetworkPortalDetectorImplBrowserTest | 95 class NetworkPortalDetectorImplBrowserTest |
96 : public LoginManagerTest, | 96 : public LoginManagerTest, |
97 public captive_portal::CaptivePortalDetectorTestBase { | 97 public captive_portal::CaptivePortalDetectorTestBase { |
98 public: | 98 public: |
99 NetworkPortalDetectorImplBrowserTest() | 99 NetworkPortalDetectorImplBrowserTest() |
100 : LoginManagerTest(false), network_portal_detector_(NULL) {} | 100 : LoginManagerTest(false), network_portal_detector_(NULL) {} |
101 virtual ~NetworkPortalDetectorImplBrowserTest() {} | 101 virtual ~NetworkPortalDetectorImplBrowserTest() {} |
102 | 102 |
103 virtual void SetUpOnMainThread() OVERRIDE { | 103 virtual void SetUpOnMainThread() override { |
104 LoginManagerTest::SetUpOnMainThread(); | 104 LoginManagerTest::SetUpOnMainThread(); |
105 | 105 |
106 ShillServiceClient::TestInterface* service_test = | 106 ShillServiceClient::TestInterface* service_test = |
107 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 107 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
108 service_test->ClearServices(); | 108 service_test->ClearServices(); |
109 service_test->AddService(kWifiServicePath, | 109 service_test->AddService(kWifiServicePath, |
110 kWifiGuid, | 110 kWifiGuid, |
111 "wifi", | 111 "wifi", |
112 shill::kTypeEthernet, | 112 shill::kTypeEthernet, |
113 shill::kStateIdle, | 113 shill::kStateIdle, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 // Wait until notification is closed. | 198 // Wait until notification is closed. |
199 observer.WaitAndReset(); | 199 observer.WaitAndReset(); |
200 | 200 |
201 ASSERT_TRUE(ui_checker.Check()); | 201 ASSERT_TRUE(ui_checker.Check()); |
202 ASSERT_TRUE( | 202 ASSERT_TRUE( |
203 action_checker.Expect(Controller::USER_ACTION_METRIC_CLOSED, 1)->Check()); | 203 action_checker.Expect(Controller::USER_ACTION_METRIC_CLOSED, 1)->Check()); |
204 } | 204 } |
205 | 205 |
206 } // namespace chromeos | 206 } // namespace chromeos |
OLD | NEW |