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