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

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

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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/network_location_provider.h" 5 #include "content/browser/geolocation/network_location_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility>
10 11
11 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "content/browser/geolocation/fake_access_token_store.h" 20 #include "content/browser/geolocation/fake_access_token_store.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ap.ssid = base::ASCIIToUTF16("Some nice+network|name\\"); 169 ap.ssid = base::ASCIIToUTF16("Some nice+network|name\\");
169 data.access_point_data.insert(ap); 170 data.access_point_data.insert(ap);
170 } 171 }
171 return data; 172 return data;
172 } 173 }
173 174
174 static void CreateReferenceWifiScanDataJson( 175 static void CreateReferenceWifiScanDataJson(
175 int ap_count, int start_index, base::ListValue* wifi_access_point_list) { 176 int ap_count, int start_index, base::ListValue* wifi_access_point_list) {
176 std::vector<std::string> wifi_data; 177 std::vector<std::string> wifi_data;
177 for (int i = 0; i < ap_count; ++i) { 178 for (int i = 0; i < ap_count; ++i) {
178 base::DictionaryValue* ap = new base::DictionaryValue(); 179 std::unique_ptr<base::DictionaryValue> ap(new base::DictionaryValue());
179 ap->SetString("macAddress", base::StringPrintf("%02d-34-56-78-54-32", i)); 180 ap->SetString("macAddress", base::StringPrintf("%02d-34-56-78-54-32", i));
180 ap->SetInteger("signalStrength", start_index + ap_count - i); 181 ap->SetInteger("signalStrength", start_index + ap_count - i);
181 ap->SetInteger("age", 0); 182 ap->SetInteger("age", 0);
182 ap->SetInteger("channel", IndexToChannel(i)); 183 ap->SetInteger("channel", IndexToChannel(i));
183 ap->SetInteger("signalToNoiseRatio", i + 42); 184 ap->SetInteger("signalToNoiseRatio", i + 42);
184 wifi_access_point_list->Append(ap); 185 wifi_access_point_list->Append(std::move(ap));
185 } 186 }
186 } 187 }
187 188
188 static Geoposition CreateReferencePosition(int id) { 189 static Geoposition CreateReferencePosition(int id) {
189 Geoposition pos; 190 Geoposition pos;
190 pos.latitude = id; 191 pos.latitude = id;
191 pos.longitude = -(id + 1); 192 pos.longitude = -(id + 1);
192 pos.altitude = 2 * id; 193 pos.altitude = 2 * id;
193 pos.timestamp = base::Time::Now(); 194 pos.timestamp = base::Time::Now();
194 return pos; 195 return pos;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); 552 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1)));
552 } else { 553 } else {
553 const int evicted = i - kCacheSize; 554 const int evicted = i - kCacheSize;
554 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); 555 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted)));
555 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); 556 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1)));
556 } 557 }
557 } 558 }
558 } 559 }
559 560
560 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « components/url_matcher/url_matcher_factory_unittest.cc ('k') | content/browser/gpu/compositor_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698