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

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

Issue 8400060: Switch content tests to use BrowserThreadImpl directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr 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 | Annotate | Revision Log
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_impl.h"
5 #include "content/browser/geolocation/gps_location_provider_linux.h" 6 #include "content/browser/geolocation/gps_location_provider_linux.h"
6 #include "content/browser/geolocation/libgps_wrapper_linux.h" 7 #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 using content::BrowserThreadImpl;
11
10 struct gps_data_t { 12 struct gps_data_t {
11 }; 13 };
12 14
13 namespace { 15 namespace {
14 class MockLibGps : public LibGps { 16 class MockLibGps : public LibGps {
15 public: 17 public:
16 MockLibGps(); 18 MockLibGps();
17 ~MockLibGps(); 19 ~MockLibGps();
18 20
19 virtual bool StartStreaming() { 21 virtual bool StartStreaming() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 61
60 static LibGps* NewMockLibGps() { 62 static LibGps* NewMockLibGps() {
61 return new MockLibGps; 63 return new MockLibGps;
62 } 64 }
63 static LibGps* NoLibGpsFactory() { 65 static LibGps* NoLibGpsFactory() {
64 return NULL; 66 return NULL;
65 } 67 }
66 68
67 protected: 69 protected:
68 MessageLoop message_loop_; 70 MessageLoop message_loop_;
69 content::TestBrowserThread ui_thread_; 71 BrowserThreadImpl ui_thread_;
70 LocaionProviderListenerLoopQuitter location_listener_; 72 LocaionProviderListenerLoopQuitter location_listener_;
71 scoped_ptr<GpsLocationProviderLinux> provider_; 73 scoped_ptr<GpsLocationProviderLinux> provider_;
72 }; 74 };
73 75
74 gps_data_t* gps_open_stub(const char*, const char*) { 76 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 77 // 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. 78 // need (or want) a valid pointer as it should never be dereferenced.
77 return static_cast<gps_data_t*>(NULL) + 1; 79 return static_cast<gps_data_t*>(NULL) + 1;
78 } 80 }
79 int gps_close_stub(gps_data_t*) { 81 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_); 182 EXPECT_EQ(2, MockLibGps::g_instance_->get_position_calls_);
181 CheckValidPosition(MockLibGps::g_instance_->get_position_, position); 183 CheckValidPosition(MockLibGps::g_instance_->get_position_, position);
182 } 184 }
183 185
184 // TODO(joth): Add a test for LibGps::Start() returning false (i.e. gpsd not 186 // 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 187 // 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 188 // a shorter retry interval, or adapt MessageLoop / Time::Now to be more test
187 // friendly). 189 // friendly).
188 190
189 } // namespace 191 } // namespace
OLDNEW
« no previous file with comments | « content/browser/download/save_package_unittest.cc ('k') | content/browser/in_process_webkit/dom_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698