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

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

Issue 8392042: Split BrowserThread into public API and private implementation, step 1. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/browser_thread.h"
6 #include "content/browser/geolocation/gps_location_provider_linux.h" 5 #include "content/browser/geolocation/gps_location_provider_linux.h"
7 #include "content/browser/geolocation/libgps_wrapper_linux.h" 6 #include "content/browser/geolocation/libgps_wrapper_linux.h"
7 #include "content/test/test_browser_thread.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 struct gps_data_t { 10 struct gps_data_t {
11 }; 11 };
12 12
13 namespace { 13 namespace {
14 class MockLibGps : public LibGps { 14 class MockLibGps : public LibGps {
15 public: 15 public:
16 MockLibGps(); 16 MockLibGps();
17 ~MockLibGps(); 17 ~MockLibGps();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 static LibGps* NewMockLibGps() { 60 static LibGps* NewMockLibGps() {
61 return new MockLibGps; 61 return new MockLibGps;
62 } 62 }
63 static LibGps* NoLibGpsFactory() { 63 static LibGps* NoLibGpsFactory() {
64 return NULL; 64 return NULL;
65 } 65 }
66 66
67 protected: 67 protected:
68 MessageLoop message_loop_; 68 MessageLoop message_loop_;
69 BrowserThread ui_thread_; 69 content::TestBrowserThread ui_thread_;
70 LocaionProviderListenerLoopQuitter location_listener_; 70 LocaionProviderListenerLoopQuitter location_listener_;
71 scoped_ptr<GpsLocationProviderLinux> provider_; 71 scoped_ptr<GpsLocationProviderLinux> provider_;
72 }; 72 };
73 73
74 gps_data_t* gps_open_stub(const char*, const char*) { 74 gps_data_t* gps_open_stub(const char*, const char*) {
75 // Need to return a non-NULL value here to indicate success, however we don't 75 // Need to return a non-NULL value here to indicate success, however we don't
76 // need (or want) a valid pointer as it should never be dereferenced. 76 // need (or want) a valid pointer as it should never be dereferenced.
77 return static_cast<gps_data_t*>(NULL) + 1; 77 return static_cast<gps_data_t*>(NULL) + 1;
78 } 78 }
79 int gps_close_stub(gps_data_t*) { 79 int gps_close_stub(gps_data_t*) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EXPECT_EQ(2, MockLibGps::g_instance_->get_position_calls_); 180 EXPECT_EQ(2, MockLibGps::g_instance_->get_position_calls_);
181 CheckValidPosition(MockLibGps::g_instance_->get_position_, position); 181 CheckValidPosition(MockLibGps::g_instance_->get_position_, position);
182 } 182 }
183 183
184 // TODO(joth): Add a test for LibGps::Start() returning false (i.e. gpsd not 184 // TODO(joth): Add a test for LibGps::Start() returning false (i.e. gpsd not
185 // running). Need to work around the 10s reconnect delay (either by injecting 185 // running). Need to work around the 10s reconnect delay (either by injecting
186 // a shorter retry interval, or adapt MessageLoop / Time::Now to be more test 186 // a shorter retry interval, or adapt MessageLoop / Time::Now to be more test
187 // friendly). 187 // friendly).
188 188
189 } // namespace 189 } // namespace
OLDNEW
« no previous file with comments | « content/browser/geolocation/core_location_data_provider_mac.h ('k') | content/browser/gpu/gpu_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698