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

Side by Side Diff: chrome/browser/geolocation/wifi_data_provider_unittest_chromeos.cc

Issue 7633055: base: Fix the TODO in string_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_mini_installer.cc Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/version_loader.cc ('k') | chrome/browser/google/google_update.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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/stringprintf.h"
5 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/chromeos/cros/mock_network_library.h" 7 #include "chrome/browser/chromeos/cros/mock_network_library.h"
7 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h" 8 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 using ::testing::DoAll; 11 using ::testing::DoAll;
11 using ::testing::NotNull; 12 using ::testing::NotNull;
12 using ::testing::Return; 13 using ::testing::Return;
13 using ::testing::ReturnRef; 14 using ::testing::ReturnRef;
14 using ::testing::SetArgumentPointee; 15 using ::testing::SetArgumentPointee;
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 class GeolocationChromeOsWifiDataProviderTest : public testing::Test { 19 class GeolocationChromeOsWifiDataProviderTest : public testing::Test {
19 protected: 20 protected:
20 GeolocationChromeOsWifiDataProviderTest() 21 GeolocationChromeOsWifiDataProviderTest()
21 : api_(WifiDataProviderChromeOs::NewWlanApi(&net_lib_)) { 22 : api_(WifiDataProviderChromeOs::NewWlanApi(&net_lib_)) {
22 } 23 }
23 24
24 static WifiAccessPointVector MakeWifiAps(int ssids, int aps_per_ssid) { 25 static WifiAccessPointVector MakeWifiAps(int ssids, int aps_per_ssid) {
25 WifiAccessPointVector ret; 26 WifiAccessPointVector ret;
26 for (int i = 0; i < ssids; ++i) { 27 for (int i = 0; i < ssids; ++i) {
27 for (int j = 0; j < aps_per_ssid; ++j) { 28 for (int j = 0; j < aps_per_ssid; ++j) {
28 WifiAccessPoint ap; 29 WifiAccessPoint ap;
29 ap.name = StringPrintf("SSID %d", i); 30 ap.name = base::StringPrintf("SSID %d", i);
30 ap.channel = i * 10 + j; 31 ap.channel = i * 10 + j;
31 ap.mac_address = StringPrintf("%02X:%02X:%02X:%02X:%02X:%02X", 32 ap.mac_address = base::StringPrintf("%02X:%02X:%02X:%02X:%02X:%02X",
32 i, j, 3, 4, 5, 6); 33 i, j, 3, 4, 5, 6);
33 ap.signal_strength = j; 34 ap.signal_strength = j;
34 ap.signal_to_noise = i; 35 ap.signal_to_noise = i;
35 ret.push_back(ap); 36 ret.push_back(ap);
36 } 37 }
37 } 38 }
38 return ret; 39 return ret;
39 } 40 }
40 41
41 chromeos::MockNetworkLibrary net_lib_; 42 chromeos::MockNetworkLibrary net_lib_;
42 scoped_ptr<WifiDataProviderCommon::WlanApiInterface> api_; 43 scoped_ptr<WifiDataProviderCommon::WlanApiInterface> api_;
(...skipping 26 matching lines...) Expand all
69 } 70 }
70 71
71 TEST_F(GeolocationChromeOsWifiDataProviderTest, GetManyAccessPoints) { 72 TEST_F(GeolocationChromeOsWifiDataProviderTest, GetManyAccessPoints) {
72 EXPECT_CALL(net_lib_, GetWifiAccessPoints(NotNull())) 73 EXPECT_CALL(net_lib_, GetWifiAccessPoints(NotNull()))
73 .WillOnce(DoAll(SetArgumentPointee<0>(MakeWifiAps(3, 4)), Return(true))); 74 .WillOnce(DoAll(SetArgumentPointee<0>(MakeWifiAps(3, 4)), Return(true)));
74 EXPECT_TRUE(api_->GetAccessPointData(&ap_data_)); 75 EXPECT_TRUE(api_->GetAccessPointData(&ap_data_));
75 ASSERT_EQ(12u, ap_data_.size()); 76 ASSERT_EQ(12u, ap_data_.size());
76 } 77 }
77 78
78 } // namespace chromeos 79 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/version_loader.cc ('k') | chrome/browser/google/google_update.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698