| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/location.h" |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" | 13 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" |
| 12 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" | 14 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" |
| 13 #include "chrome/browser/extensions/extension_apitest.h" | 15 #include "chrome/browser/extensions/extension_apitest.h" |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "chromeos/dbus/shill_device_client.h" | 17 #include "chromeos/dbus/shill_device_client.h" |
| 16 #include "chromeos/dbus/shill_profile_client.h" | 18 #include "chromeos/dbus/shill_profile_client.h" |
| 17 #include "chromeos/dbus/shill_service_client.h" | 19 #include "chromeos/dbus/shill_service_client.h" |
| 18 #include "components/captive_portal/captive_portal_testing_utils.h" | 20 #include "components/captive_portal/captive_portal_testing_utils.h" |
| 19 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
| 20 #include "extensions/test/result_catcher.h" | 22 #include "extensions/test/result_catcher.h" |
| 21 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 22 #include "third_party/cros_system_api/dbus/service_constants.h" | 24 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 23 #include "ui/message_center/message_center.h" | 25 #include "ui/message_center/message_center.h" |
| 24 #include "ui/message_center/message_center_observer.h" | 26 #include "ui/message_center/message_center_observer.h" |
| 25 | 27 |
| 26 using base::MessageLoop; | |
| 27 using chromeos::DBusThreadManager; | 28 using chromeos::DBusThreadManager; |
| 28 using chromeos::NetworkPortalDetector; | 29 using chromeos::NetworkPortalDetector; |
| 29 using chromeos::NetworkPortalDetectorImpl; | 30 using chromeos::NetworkPortalDetectorImpl; |
| 30 using chromeos::NetworkPortalNotificationController; | 31 using chromeos::NetworkPortalNotificationController; |
| 31 using chromeos::ShillDeviceClient; | 32 using chromeos::ShillDeviceClient; |
| 32 using chromeos::ShillProfileClient; | 33 using chromeos::ShillProfileClient; |
| 33 using chromeos::ShillServiceClient; | 34 using chromeos::ShillServiceClient; |
| 34 using message_center::MessageCenter; | 35 using message_center::MessageCenter; |
| 35 using message_center::MessageCenterObserver; | 36 using message_center::MessageCenterObserver; |
| 36 | 37 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 | 53 |
| 53 void WaitForNotificationToDisplay() { | 54 void WaitForNotificationToDisplay() { |
| 54 run_loop_.Run(); | 55 run_loop_.Run(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void OnNotificationDisplayed( | 58 void OnNotificationDisplayed( |
| 58 const std::string& notification_id, | 59 const std::string& notification_id, |
| 59 const message_center::DisplaySource source) override { | 60 const message_center::DisplaySource source) override { |
| 60 if (notification_id == | 61 if (notification_id == |
| 61 NetworkPortalNotificationController::kNotificationId) { | 62 NetworkPortalNotificationController::kNotificationId) { |
| 62 MessageLoop::current()->PostTask(FROM_HERE, run_loop_.QuitClosure()); | 63 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 64 run_loop_.QuitClosure()); |
| 63 } | 65 } |
| 64 } | 66 } |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 base::RunLoop run_loop_; | 69 base::RunLoop run_loop_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(TestNotificationObserver); | 71 DISALLOW_COPY_AND_ASSIGN(TestNotificationObserver); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace | 74 } // namespace |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 186 |
| 185 extensions::ResultCatcher catcher; | 187 extensions::ResultCatcher catcher; |
| 186 EXPECT_TRUE(catcher.GetNextResult()); | 188 EXPECT_TRUE(catcher.GetNextResult()); |
| 187 | 189 |
| 188 // Simulate the captive portal vanishing. | 190 // Simulate the captive portal vanishing. |
| 189 SimulateSuccessfulCaptivePortalAuth(); | 191 SimulateSuccessfulCaptivePortalAuth(); |
| 190 | 192 |
| 191 ASSERT_EQ(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, | 193 ASSERT_EQ(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, |
| 192 GetCaptivePortalStatus(kWifi1ServiceGUID)); | 194 GetCaptivePortalStatus(kWifi1ServiceGUID)); |
| 193 } | 195 } |
| OLD | NEW |