Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: content/browser/geolocation/win7_location_api_unittest_win.cc

Issue 10316007: Make the Geoposition helper class public (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix forward-declaration of struct as class. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <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/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "content/browser/geolocation/win7_location_api_win.h" 15 #include "content/browser/geolocation/win7_location_api_win.h"
16 #include "content/common/geoposition.h" 16 #include "content/public/common/geoposition.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::NiceMock; 24 using testing::NiceMock;
25 using testing::Return; 25 using testing::Return;
26 26
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 scoped_ptr<Win7LocationApi> api_; 304 scoped_ptr<Win7LocationApi> api_;
305 MockLatLongReport* lat_long_report_; 305 MockLatLongReport* lat_long_report_;
306 NiceMock<MockLocation>* locator_; 306 NiceMock<MockLocation>* locator_;
307 MockReport* report_; 307 MockReport* report_;
308 }; 308 };
309 309
310 TEST_F(GeolocationApiWin7Tests, PermissionDenied) { 310 TEST_F(GeolocationApiWin7Tests, PermissionDenied) {
311 EXPECT_CALL(*locator_, GetReport(_, _)) 311 EXPECT_CALL(*locator_, GetReport(_, _))
312 .Times(AtLeast(1)) 312 .Times(AtLeast(1))
313 .WillRepeatedly(Return(E_ACCESSDENIED)); 313 .WillRepeatedly(Return(E_ACCESSDENIED));
314 Geoposition position; 314 content::Geoposition position;
315 api_->GetPosition(&position); 315 api_->GetPosition(&position);
316 EXPECT_EQ(Geoposition::ERROR_CODE_PERMISSION_DENIED, 316 EXPECT_EQ(content::Geoposition::ERROR_CODE_PERMISSION_DENIED,
317 position.error_code); 317 position.error_code);
318 } 318 }
319 319
320 TEST_F(GeolocationApiWin7Tests, GetValidPosition) { 320 TEST_F(GeolocationApiWin7Tests, GetValidPosition) {
321 EXPECT_CALL(*locator_, GetReport(_, _)) 321 EXPECT_CALL(*locator_, GetReport(_, _))
322 .Times(AtLeast(1)); 322 .Times(AtLeast(1));
323 Geoposition position; 323 content::Geoposition position;
324 api_->GetPosition(&position); 324 api_->GetPosition(&position);
325 EXPECT_TRUE(position.IsValidFix()); 325 EXPECT_TRUE(position.Validate());
326 } 326 }
327 327
328 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) { 328 TEST_F(GeolocationApiWin7Tests, GetInvalidPosition) {
329 EXPECT_CALL(*lat_long_report_, GetLatitude(_)) 329 EXPECT_CALL(*lat_long_report_, GetLatitude(_))
330 .Times(AtLeast(1)) 330 .Times(AtLeast(1))
331 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA))); 331 .WillRepeatedly(Return(HRESULT_FROM_WIN32(ERROR_NO_DATA)));
332 EXPECT_CALL(*locator_, GetReport(_, _)) 332 EXPECT_CALL(*locator_, GetReport(_, _))
333 .Times(AtLeast(1)); 333 .Times(AtLeast(1));
334 Geoposition position; 334 content::Geoposition position;
335 api_->GetPosition(&position); 335 api_->GetPosition(&position);
336 EXPECT_FALSE(position.IsValidFix()); 336 EXPECT_FALSE(position.Validate());
337 } 337 }
338 338
339 } // namespace 339 } // namespace
OLDNEW
« no previous file with comments | « content/browser/geolocation/network_location_request.cc ('k') | content/browser/geolocation/win7_location_api_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698