| 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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 MessageLoopQuitListener() | 34 MessageLoopQuitListener() |
| 35 : client_message_loop_(base::MessageLoop::current()), | 35 : client_message_loop_(base::MessageLoop::current()), |
| 36 updated_provider_(NULL) { | 36 updated_provider_(NULL) { |
| 37 CHECK(client_message_loop_); | 37 CHECK(client_message_loop_); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void OnLocationUpdate(const LocationProvider* provider, | 40 void OnLocationUpdate(const LocationProvider* provider, |
| 41 const Geoposition& position) { | 41 const Geoposition& position) { |
| 42 EXPECT_EQ(client_message_loop_, base::MessageLoop::current()); | 42 EXPECT_EQ(client_message_loop_, base::MessageLoop::current()); |
| 43 updated_provider_ = provider; | 43 updated_provider_ = provider; |
| 44 client_message_loop_->Quit(); | 44 client_message_loop_->QuitWhenIdle(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 base::MessageLoop* client_message_loop_; | 47 base::MessageLoop* client_message_loop_; |
| 48 const LocationProvider* updated_provider_; | 48 const LocationProvider* updated_provider_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // A mock implementation of WifiDataProvider for testing. Adapted from | 51 // A mock implementation of WifiDataProvider for testing. Adapted from |
| 52 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation_test.cc | 52 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation_test.cc |
| 53 class MockWifiDataProvider : public WifiDataProvider { | 53 class MockWifiDataProvider : public WifiDataProvider { |
| 54 public: | 54 public: |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); | 545 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); |
| 546 } else { | 546 } else { |
| 547 const int evicted = i - kCacheSize; | 547 const int evicted = i - kCacheSize; |
| 548 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); | 548 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); |
| 549 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); | 549 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace content | 554 } // namespace content |
| OLD | NEW |