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 <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "content/browser/device_orientation/data_fetcher.h" | 10 #include "content/browser/device_orientation/data_fetcher.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 ~MockDeviceDataFactory() { | 272 ~MockDeviceDataFactory() { |
273 } | 273 } |
274 | 274 |
275 // Owned by ProviderImpl. Holds a reference back to MockDeviceDataFactory. | 275 // Owned by ProviderImpl. Holds a reference back to MockDeviceDataFactory. |
276 class MockDataFetcher : public DataFetcher { | 276 class MockDataFetcher : public DataFetcher { |
277 public: | 277 public: |
278 explicit MockDataFetcher(MockDeviceDataFactory* device_data_factory) | 278 explicit MockDataFetcher(MockDeviceDataFactory* device_data_factory) |
279 : device_data_factory_(device_data_factory) { } | 279 : device_data_factory_(device_data_factory) { } |
280 | 280 |
281 // From DataFetcher. Called by the Provider. | 281 // From DataFetcher. Called by the Provider. |
282 virtual const DeviceData* GetDeviceData(DeviceData::Type device_data_type) { | 282 virtual const DeviceData* GetDeviceData( |
| 283 DeviceData::Type device_data_type) OVERRIDE { |
283 base::AutoLock auto_lock(device_data_factory_->lock_); | 284 base::AutoLock auto_lock(device_data_factory_->lock_); |
284 if (device_data_factory_->is_failing_) | 285 if (device_data_factory_->is_failing_) |
285 return NULL; | 286 return NULL; |
286 return device_data_factory_->device_data_map_[device_data_type]; | 287 return device_data_factory_->device_data_map_[device_data_type]; |
287 } | 288 } |
288 | 289 |
289 private: | 290 private: |
290 scoped_refptr<MockDeviceDataFactory> device_data_factory_; | 291 scoped_refptr<MockDeviceDataFactory> device_data_factory_; |
291 }; | 292 }; |
292 | 293 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 MessageLoop::current()->Run(); | 701 MessageLoop::current()->Run(); |
701 | 702 |
702 provider_->RemoveObserver(checker_a.get()); | 703 provider_->RemoveObserver(checker_a.get()); |
703 provider_->RemoveObserver(checker_b.get()); | 704 provider_->RemoveObserver(checker_b.get()); |
704 MockDeviceDataFactory::SetCurInstance(NULL); | 705 MockDeviceDataFactory::SetCurInstance(NULL); |
705 } | 706 } |
706 | 707 |
707 } // namespace | 708 } // namespace |
708 | 709 |
709 } // namespace content | 710 } // namespace content |
OLD | NEW |