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

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

Issue 477633002: Rename various Geolocation bits for clarity and consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more rename. Created 6 years, 4 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 | Annotate | Revision Log
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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 MOCK_METHOD0(NoWifiInterval, int()); 55 MOCK_METHOD0(NoWifiInterval, int());
56 56
57 virtual void UpdatePollingInterval(bool) {} 57 virtual void UpdatePollingInterval(bool) {}
58 }; 58 };
59 59
60 // Stops the specified (nested) message loop when the callback is called. 60 // Stops the specified (nested) message loop when the callback is called.
61 class MessageLoopQuitter { 61 class MessageLoopQuitter {
62 public: 62 public:
63 explicit MessageLoopQuitter(base::MessageLoop* message_loop) 63 explicit MessageLoopQuitter(base::MessageLoop* message_loop)
64 : message_loop_to_quit_(message_loop), 64 : message_loop_to_quit_(message_loop),
65 callback_(base::Bind(&MessageLoopQuitter::WifiDataUpdateAvailable, 65 callback_(base::Bind(&MessageLoopQuitter::OnWifiDataUpdate,
66 base::Unretained(this))) { 66 base::Unretained(this))) {
67 CHECK(message_loop_to_quit_ != NULL); 67 CHECK(message_loop_to_quit_ != NULL);
68 } 68 }
69 69
70 void WifiDataUpdateAvailable(WifiDataProvider* provider) { 70 void OnWifiDataUpdate(WifiDataProvider* provider) {
71 // Provider should call back on client's thread. 71 // Provider should call back on client's thread.
72 EXPECT_EQ(base::MessageLoop::current(), message_loop_to_quit_); 72 EXPECT_EQ(base::MessageLoop::current(), message_loop_to_quit_);
73 message_loop_to_quit_->QuitNow(); 73 message_loop_to_quit_->QuitNow();
74 } 74 }
75 base::MessageLoop* message_loop_to_quit_; 75 base::MessageLoop* message_loop_to_quit_;
76 WifiDataProvider::WifiDataUpdateCallback callback_; 76 WifiDataProvider::WifiDataUpdateCallback callback_;
77 }; 77 };
78 78
79 class WifiDataProviderCommonWithMock : public WifiDataProviderCommon { 79 class WifiDataProviderCommonWithMock : public WifiDataProviderCommon {
80 public: 80 public:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 TEST_F(GeolocationWifiDataProviderCommonTest, RegisterUnregister) { 219 TEST_F(GeolocationWifiDataProviderCommonTest, RegisterUnregister) {
220 MessageLoopQuitter loop_quitter(&main_message_loop_); 220 MessageLoopQuitter loop_quitter(&main_message_loop_);
221 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); 221 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock);
222 WifiDataProvider::Register(&loop_quitter.callback_); 222 WifiDataProvider::Register(&loop_quitter.callback_);
223 main_message_loop_.Run(); 223 main_message_loop_.Run();
224 WifiDataProvider::Unregister(&loop_quitter.callback_); 224 WifiDataProvider::Unregister(&loop_quitter.callback_);
225 WifiDataProvider::ResetFactory(); 225 WifiDataProvider::ResetFactory();
226 } 226 }
227 227
228 } // namespace content 228 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698