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 return Win7LocationApi::CreateForTesting(&MockPropVariantToDoubleFunction, |
297 &MockPropVariantToDoubleFunction, | 297 locator); |
298 locator); | |
299 } | 298 } |
300 | 299 |
301 scoped_ptr<Win7LocationApi> api_; | 300 scoped_ptr<Win7LocationApi> api_; |
302 MockLatLongReport* lat_long_report_; | 301 MockLatLongReport* lat_long_report_; |
303 MockLocation* locator_; | 302 MockLocation* locator_; |
304 MockReport* report_; | 303 MockReport* report_; |
305 }; | 304 }; |
306 | 305 |
307 TEST_F(GeolocationApiWin7Tests, PermissionDenied) { | 306 TEST_F(GeolocationApiWin7Tests, PermissionDenied) { |
308 EXPECT_CALL(*locator_, GetReport(_, _)) | 307 EXPECT_CALL(*locator_, GetReport(_, _)) |
(...skipping 16 matching lines...) Expand all Loading... |
325 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { | 324 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { |
326 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) | 325 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) |
327 .Times(AtLeast(1)) | 326 .Times(AtLeast(1)) |
328 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); | 327 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); |
329 EXPECT_CALL(*locator_, GetReport(_, _)) | 328 EXPECT_CALL(*locator_, GetReport(_, _)) |
330 .Times(AtLeast(1)); | 329 .Times(AtLeast(1)); |
331 Geoposition position; | 330 Geoposition position; |
332 api_->GetPosition(&position); | 331 api_->GetPosition(&position); |
333 EXPECT_FALSE(position.IsValidFix()); | 332 EXPECT_FALSE(position.IsValidFix()); |
334 } | 333 } |
OLD | NEW |