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 "chrome/browser/geolocation/network_location_provider.h" | 5 #include "chrome/browser/geolocation/network_location_provider.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/geolocation/fake_access_token_store.h" | 11 #include "chrome/browser/geolocation/fake_access_token_store.h" |
12 #include "chrome/common/net/test_url_fetcher_factory.h" | 12 #include "chrome/common/net/test_url_fetcher_factory.h" |
13 #include "net/url_request/url_request_status.h" | 13 #include "net/url_request/url_request_status.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace { | 16 namespace { |
| 17 |
17 // Constants used in multiple tests. | 18 // Constants used in multiple tests. |
18 const char kTestServerUrl[] = "https://www.geolocation.test/service"; | 19 const char kTestServerUrl[] = "https://www.geolocation.test/service"; |
19 const char kTestHost[] = "myclienthost.test"; | 20 const char kTestHost[] = "myclienthost.test"; |
20 const char kTestHostUrl[] = "http://myclienthost.test/some/path"; | 21 const char kTestHostUrl[] = "http://myclienthost.test/some/path"; |
21 // Using #define so we can easily paste this into various other strings. | 22 // Using #define so we can easily paste this into various other strings. |
22 #define REFERENCE_ACCESS_TOKEN "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe" | 23 #define REFERENCE_ACCESS_TOKEN "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe" |
23 | 24 |
24 } // namespace | |
25 | |
26 // Stops the specified (nested) message loop when the listener is called back. | 25 // Stops the specified (nested) message loop when the listener is called back. |
27 class MessageLoopQuitListener | 26 class MessageLoopQuitListener |
28 : public LocationProviderBase::ListenerInterface { | 27 : public LocationProviderBase::ListenerInterface { |
29 public: | 28 public: |
30 MessageLoopQuitListener() | 29 MessageLoopQuitListener() |
31 : client_message_loop_(MessageLoop::current()), | 30 : client_message_loop_(MessageLoop::current()), |
32 updated_provider_(NULL), | 31 updated_provider_(NULL), |
33 movement_provider_(NULL) { | 32 movement_provider_(NULL) { |
34 CHECK(client_message_loop_); | 33 CHECK(client_message_loop_); |
35 } | 34 } |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } else { | 771 } else { |
773 const int evicted = i - kCacheSize; | 772 const int evicted = i - kCacheSize; |
774 EXPECT_FALSE(cache.FindPosition(CreateReferenceRouterData(2), | 773 EXPECT_FALSE(cache.FindPosition(CreateReferenceRouterData(2), |
775 CreateReferenceWifiScanData(evicted))); | 774 CreateReferenceWifiScanData(evicted))); |
776 EXPECT_TRUE(cache.FindPosition(CreateReferenceRouterData(2), | 775 EXPECT_TRUE(cache.FindPosition(CreateReferenceRouterData(2), |
777 CreateReferenceWifiScanData(evicted + 1))); | 776 CreateReferenceWifiScanData(evicted + 1))); |
778 } | 777 } |
779 } | 778 } |
780 } | 779 } |
781 | 780 |
| 781 } // namespace |
OLD | NEW |