OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <Objbase.h> | 5 #include <Objbase.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "chrome/common/geoposition.h" | 15 #include "chrome/common/geoposition.h" |
16 #include "chrome/browser/geolocation/win7_location_api_win.h" | 16 #include "chrome/browser/geolocation/win7_location_api_win.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using testing::_; | 20 using testing::_; |
21 using testing::AtLeast; | 21 using testing::AtLeast; |
22 using testing::DoDefault; | 22 using testing::DoDefault; |
23 using testing::Invoke; | 23 using testing::Invoke; |
24 using testing::Return; | 24 using testing::Return; |
25 | 25 |
| 26 namespace { |
| 27 |
26 class MockLatLongReport : public ILatLongReport { | 28 class MockLatLongReport : public ILatLongReport { |
27 public: | 29 public: |
28 MockLatLongReport() : ref_count_(1) { | 30 MockLatLongReport() : ref_count_(1) { |
29 ON_CALL(*this, GetAltitude(_)) | 31 ON_CALL(*this, GetAltitude(_)) |
30 .WillByDefault(Invoke(this, &MockLatLongReport::GetAltitudeValid)); | 32 .WillByDefault(Invoke(this, &MockLatLongReport::GetAltitudeValid)); |
31 ON_CALL(*this, GetAltitudeError(_)) | 33 ON_CALL(*this, GetAltitudeError(_)) |
32 .WillByDefault(Invoke(this, | 34 .WillByDefault(Invoke(this, |
33 &MockLatLongReport::GetAltitudeErrorValid)); | 35 &MockLatLongReport::GetAltitudeErrorValid)); |
34 ON_CALL(*this, GetErrorRadius(_)) | 36 ON_CALL(*this, GetErrorRadius(_)) |
35 .WillByDefault(Invoke(this, &MockLatLongReport::GetErrorRadiusValid)); | 37 .WillByDefault(Invoke(this, &MockLatLongReport::GetErrorRadiusValid)); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { | 326 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { |
325 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) | 327 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) |
326 .Times(AtLeast(1)) | 328 .Times(AtLeast(1)) |
327 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); | 329 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); |
328 EXPECT_CALL(*locator_, GetReport(_, _)) | 330 EXPECT_CALL(*locator_, GetReport(_, _)) |
329 .Times(AtLeast(1)); | 331 .Times(AtLeast(1)); |
330 Geoposition position; | 332 Geoposition position; |
331 api_->GetPosition(&position); | 333 api_->GetPosition(&position); |
332 EXPECT_FALSE(position.IsValidFix()); | 334 EXPECT_FALSE(position.IsValidFix()); |
333 } | 335 } |
| 336 |
| 337 } // namespace |
OLD | NEW |