| 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" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 virtual void TearDown() { | 286 virtual void TearDown() { |
| 287 locator_->Release(); | 287 locator_->Release(); |
| 288 api_.reset(); | 288 api_.reset(); |
| 289 } | 289 } |
| 290 ~GeolocationApiWin7Tests() { | 290 ~GeolocationApiWin7Tests() { |
| 291 } | 291 } |
| 292 protected: | 292 protected: |
| 293 Win7LocationApi* CreateMock() { | 293 Win7LocationApi* CreateMock() { |
| 294 MockLocation* locator = new MockLocation(); | 294 MockLocation* locator = new MockLocation(); |
| 295 locator_ = locator; | 295 locator_ = locator; |
| 296 return new Win7LocationApi(NULL, | 296 Win7LocationApi* api = new Win7LocationApi(); |
| 297 &MockPropVariantToDoubleFunction, | 297 api->Init(NULL, &MockPropVariantToDoubleFunction, locator); |
| 298 locator); | 298 return api; |
| 299 } | 299 } |
| 300 | 300 |
| 301 scoped_ptr<Win7LocationApi> api_; | 301 scoped_ptr<Win7LocationApi> api_; |
| 302 MockLatLongReport* lat_long_report_; | 302 MockLatLongReport* lat_long_report_; |
| 303 MockLocation* locator_; | 303 MockLocation* locator_; |
| 304 MockReport* report_; | 304 MockReport* report_; |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 TEST_F(GeolocationApiWin7Tests, PermissionDenied) { | 307 TEST_F(GeolocationApiWin7Tests, PermissionDenied) { |
| 308 EXPECT_CALL(*locator_, GetReport(_, _)) | 308 EXPECT_CALL(*locator_, GetReport(_, _)) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 325 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { | 325 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { |
| 326 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) | 326 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) |
| 327 .Times(AtLeast(1)) | 327 .Times(AtLeast(1)) |
| 328 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); | 328 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); |
| 329 EXPECT_CALL(*locator_, GetReport(_, _)) | 329 EXPECT_CALL(*locator_, GetReport(_, _)) |
| 330 .Times(AtLeast(1)); | 330 .Times(AtLeast(1)); |
| 331 Geoposition position; | 331 Geoposition position; |
| 332 api_->GetPosition(&position); | 332 api_->GetPosition(&position); |
| 333 EXPECT_FALSE(position.IsValidFix()); | 333 EXPECT_FALSE(position.IsValidFix()); |
| 334 } | 334 } |
| OLD | NEW |