Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: content/browser/geolocation/wifi_data_provider_linux_unittest.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/geolocation/wifi_data_provider_linux.h" 5 #include "content/browser/geolocation/wifi_data_provider_linux.h"
6 6
7 #include <stdint.h>
8
9 #include "base/macros.h"
7 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
11 #include "dbus/message.h" 14 #include "dbus/message.h"
12 #include "dbus/mock_bus.h" 15 #include "dbus/mock_bus.h"
13 #include "dbus/mock_object_proxy.h" 16 #include "dbus/mock_object_proxy.h"
14 #include "dbus/object_path.h" 17 #include "dbus/object_path.h"
15 #include "dbus/object_proxy.h" 18 #include "dbus/object_proxy.h"
16 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 dbus::MessageReader reader(method_call); 182 dbus::MessageReader reader(method_call);
180 183
181 std::string interface_name; 184 std::string interface_name;
182 std::string property_name; 185 std::string property_name;
183 if (reader.PopString(&interface_name) && 186 if (reader.PopString(&interface_name) &&
184 reader.PopString(&property_name)) { 187 reader.PopString(&property_name)) {
185 scoped_ptr<dbus::Response> response = dbus::Response::CreateEmpty(); 188 scoped_ptr<dbus::Response> response = dbus::Response::CreateEmpty();
186 dbus::MessageWriter writer(response.get()); 189 dbus::MessageWriter writer(response.get());
187 190
188 if (property_name == "Ssid") { 191 if (property_name == "Ssid") {
189 const uint8 kSsid[] = {0x74, 0x65, 0x73, 0x74}; // "test" 192 const uint8_t kSsid[] = {0x74, 0x65, 0x73, 0x74}; // "test"
190 dbus::MessageWriter variant_writer(response.get()); 193 dbus::MessageWriter variant_writer(response.get());
191 writer.OpenVariant("ay", &variant_writer); 194 writer.OpenVariant("ay", &variant_writer);
192 variant_writer.AppendArrayOfBytes(kSsid, arraysize(kSsid)); 195 variant_writer.AppendArrayOfBytes(kSsid, arraysize(kSsid));
193 writer.CloseContainer(&variant_writer); 196 writer.CloseContainer(&variant_writer);
194 } else if (property_name == "HwAddress") { 197 } else if (property_name == "HwAddress") {
195 // This will be converted to "00-11-22-33-44-55". 198 // This will be converted to "00-11-22-33-44-55".
196 const std::string kMacAddress = "00:11:22:33:44:55"; 199 const std::string kMacAddress = "00:11:22:33:44:55";
197 writer.AppendVariantOfString(kMacAddress); 200 writer.AppendVariantOfString(kMacAddress);
198 } else if (property_name == "Strength") { 201 } else if (property_name == "Strength") {
199 // This will be converted to -50. 202 // This will be converted to -50.
200 const uint8 kStrength = 100; 203 const uint8_t kStrength = 100;
201 writer.AppendVariantOfByte(kStrength); 204 writer.AppendVariantOfByte(kStrength);
202 } else if (property_name == "Frequency") { 205 } else if (property_name == "Frequency") {
203 // This will be converted to channel 4. 206 // This will be converted to channel 4.
204 const uint32 kFrequency = 2427; 207 const uint32_t kFrequency = 2427;
205 writer.AppendVariantOfUint32(kFrequency); 208 writer.AppendVariantOfUint32(kFrequency);
206 } 209 }
207 return response.release(); 210 return response.release();
208 } 211 }
209 } 212 }
210 213
211 LOG(ERROR) << "Unexpected method call: " << method_call->ToString(); 214 LOG(ERROR) << "Unexpected method call: " << method_call->ToString();
212 return NULL; 215 return NULL;
213 } 216 }
214 }; 217 };
215 218
216 TEST_F(GeolocationWifiDataProviderLinuxTest, GetAccessPointData) { 219 TEST_F(GeolocationWifiDataProviderLinuxTest, GetAccessPointData) {
217 WifiData::AccessPointDataSet access_point_data_set; 220 WifiData::AccessPointDataSet access_point_data_set;
218 ASSERT_TRUE(wlan_api_->GetAccessPointData(&access_point_data_set)); 221 ASSERT_TRUE(wlan_api_->GetAccessPointData(&access_point_data_set));
219 222
220 ASSERT_EQ(1U, access_point_data_set.size()); 223 ASSERT_EQ(1U, access_point_data_set.size());
221 AccessPointData access_point_data = *access_point_data_set.begin(); 224 AccessPointData access_point_data = *access_point_data_set.begin();
222 225
223 // Check the contents of the access point data. 226 // Check the contents of the access point data.
224 // The expected values come from CreateAccessPointProxyResponse() above. 227 // The expected values come from CreateAccessPointProxyResponse() above.
225 EXPECT_EQ("test", base::UTF16ToUTF8(access_point_data.ssid)); 228 EXPECT_EQ("test", base::UTF16ToUTF8(access_point_data.ssid));
226 EXPECT_EQ("00-11-22-33-44-55", 229 EXPECT_EQ("00-11-22-33-44-55",
227 base::UTF16ToUTF8(access_point_data.mac_address)); 230 base::UTF16ToUTF8(access_point_data.mac_address));
228 EXPECT_EQ(-50, access_point_data.radio_signal_strength); 231 EXPECT_EQ(-50, access_point_data.radio_signal_strength);
229 EXPECT_EQ(4, access_point_data.channel); 232 EXPECT_EQ(4, access_point_data.channel);
230 } 233 }
231 234
232 } // namespace content 235 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_linux.cc ('k') | content/browser/geolocation/wifi_data_provider_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698