OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
9 #include "chromeos/dbus/shill_manager_client.h" | 9 #include "chromeos/dbus/shill_manager_client.h" |
10 #include "chromeos/network/geolocation_handler.h" | 10 #include "chromeos/network/geolocation_handler.h" |
11 #include "content/browser/geolocation/wifi_data_provider_chromeos.h" | 11 #include "content/browser/geolocation/wifi_data_provider_chromeos.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 13 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class GeolocationChromeOsWifiDataProviderTest : public testing::Test { | 17 class GeolocationChromeOsWifiDataProviderTest : public testing::Test { |
18 protected: | 18 protected: |
19 GeolocationChromeOsWifiDataProviderTest() { | 19 GeolocationChromeOsWifiDataProviderTest() { |
20 } | 20 } |
21 | 21 |
22 virtual void SetUp() override { | 22 void SetUp() override { |
23 chromeos::DBusThreadManager::Initialize(); | 23 chromeos::DBusThreadManager::Initialize(); |
24 chromeos::NetworkHandler::Initialize(); | 24 chromeos::NetworkHandler::Initialize(); |
25 manager_client_ = | 25 manager_client_ = |
26 chromeos::DBusThreadManager::Get()->GetShillManagerClient(); | 26 chromeos::DBusThreadManager::Get()->GetShillManagerClient(); |
27 manager_test_ = manager_client_->GetTestInterface(); | 27 manager_test_ = manager_client_->GetTestInterface(); |
28 provider_ = new WifiDataProviderChromeOs(); | 28 provider_ = new WifiDataProviderChromeOs(); |
29 message_loop_.RunUntilIdle(); | 29 message_loop_.RunUntilIdle(); |
30 } | 30 } |
31 | 31 |
32 virtual void TearDown() override { | 32 void TearDown() override { |
33 provider_ = NULL; | 33 provider_ = NULL; |
34 chromeos::NetworkHandler::Shutdown(); | 34 chromeos::NetworkHandler::Shutdown(); |
35 chromeos::DBusThreadManager::Shutdown(); | 35 chromeos::DBusThreadManager::Shutdown(); |
36 } | 36 } |
37 | 37 |
38 bool GetAccessPointData() { | 38 bool GetAccessPointData() { |
39 return provider_->GetAccessPointData(&ap_data_); | 39 return provider_->GetAccessPointData(&ap_data_); |
40 } | 40 } |
41 | 41 |
42 void AddAccessPoints(int ssids, int aps_per_ssid) { | 42 void AddAccessPoints(int ssids, int aps_per_ssid) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 TEST_F(GeolocationChromeOsWifiDataProviderTest, GetManyAccessPoints) { | 91 TEST_F(GeolocationChromeOsWifiDataProviderTest, GetManyAccessPoints) { |
92 message_loop_.RunUntilIdle(); | 92 message_loop_.RunUntilIdle(); |
93 EXPECT_FALSE(GetAccessPointData()); | 93 EXPECT_FALSE(GetAccessPointData()); |
94 | 94 |
95 AddAccessPoints(3, 4); | 95 AddAccessPoints(3, 4); |
96 EXPECT_TRUE(GetAccessPointData()); | 96 EXPECT_TRUE(GetAccessPointData()); |
97 ASSERT_EQ(12u, ap_data_.size()); | 97 ASSERT_EQ(12u, ap_data_.size()); |
98 } | 98 } |
99 | 99 |
100 } // namespace content | 100 } // namespace content |
OLD | NEW |