| OLD | NEW |
| 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 "device/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 #include <utility> |
| 11 | 11 |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "device/geolocation/fake_access_token_store.h" | 21 #include "content/browser/geolocation/fake_access_token_store.h" |
| 22 #include "device/geolocation/location_arbitrator_impl.h" | 22 #include "content/browser/geolocation/location_arbitrator_impl.h" |
| 23 #include "device/geolocation/wifi_data_provider.h" | 23 #include "content/browser/geolocation/wifi_data_provider.h" |
| 24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/url_request/test_url_fetcher_factory.h" | 25 #include "net/url_request/test_url_fetcher_factory.h" |
| 26 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 | 28 |
| 29 namespace device { | 29 namespace content { |
| 30 | 30 |
| 31 // Constants used in multiple tests. | 31 // Constants used in multiple tests. |
| 32 const char kTestServerUrl[] = "https://www.geolocation.test/service"; | 32 const char kTestServerUrl[] = "https://www.geolocation.test/service"; |
| 33 const char kAccessTokenString[] = "accessToken"; | 33 const char kAccessTokenString[] = "accessToken"; |
| 34 | 34 |
| 35 // Using #define so we can easily paste this into various other strings. | 35 // Using #define so we can easily paste this into various other strings. |
| 36 #define REFERENCE_ACCESS_TOKEN "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe" | 36 #define REFERENCE_ACCESS_TOKEN "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe" |
| 37 | 37 |
| 38 // Stops the specified (nested) message loop when the listener is called back. | 38 // Stops the specified (nested) message loop when the listener is called back. |
| 39 class MessageLoopQuitListener { | 39 class MessageLoopQuitListener { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 // Nothing should have spilled yet; check oldest item is still there. | 549 // Nothing should have spilled yet; check oldest item is still there. |
| 550 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); | 550 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); |
| 551 } else { | 551 } else { |
| 552 const int evicted = i - kCacheSize; | 552 const int evicted = i - kCacheSize; |
| 553 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); | 553 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); |
| 554 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); | 554 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 } // namespace device | 559 } // namespace content |
| OLD | NEW |