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

Side by Side Diff: content/browser/device_orientation/provider_unittest.cc

Issue 10698046: Implements part of Device Motion in the Renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 <queue> 5 #include <queue>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "content/browser/device_orientation/data_fetcher.h" 9 #include "content/browser/device_orientation/data_fetcher.h"
10 #include "content/browser/device_orientation/orientation.h" 10 #include "content/browser/device_orientation/orientation.h"
11 #include "content/browser/device_orientation/provider.h" 11 #include "content/browser/device_orientation/provider.h"
12 #include "content/browser/device_orientation/provider_impl.h" 12 #include "content/browser/device_orientation/provider_impl.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace device_orientation { 15 namespace device_orientation {
16 namespace { 16 namespace {
17 17
18 // Class for checking expectations on orientation updates from the Provider. 18 // Class for checking expectations on orientation updates from the Provider.
19 class UpdateChecker : public Provider::Observer { 19 class UpdateChecker : public Provider::OrientationObserver {
20 public: 20 public:
21 explicit UpdateChecker(int* expectations_count_ptr) 21 explicit UpdateChecker(int* expectations_count_ptr)
22 : expectations_count_ptr_(expectations_count_ptr) { 22 : expectations_count_ptr_(expectations_count_ptr) {
23 } 23 }
24 24
25 virtual ~UpdateChecker() {} 25 virtual ~UpdateChecker() {}
26 26
27 // From Provider::Observer. 27 // From Provider::OrientationObserver.
28 virtual void OnOrientationUpdate(const Orientation& orientation) { 28 virtual void OnOrientationUpdate(const Orientation& orientation) {
29 ASSERT_FALSE(expectations_queue_.empty()); 29 ASSERT_FALSE(expectations_queue_.empty());
30 30
31 Orientation expected = expectations_queue_.front(); 31 Orientation expected = expectations_queue_.front();
32 expectations_queue_.pop(); 32 expectations_queue_.pop();
33 33
34 EXPECT_EQ(expected.can_provide_alpha_, orientation.can_provide_alpha_); 34 EXPECT_EQ(expected.can_provide_alpha_, orientation.can_provide_alpha_);
35 EXPECT_EQ(expected.can_provide_beta_, orientation.can_provide_beta_); 35 EXPECT_EQ(expected.can_provide_beta_, orientation.can_provide_beta_);
36 EXPECT_EQ(expected.can_provide_gamma_, orientation.can_provide_gamma_); 36 EXPECT_EQ(expected.can_provide_gamma_, orientation.can_provide_gamma_);
37 EXPECT_EQ(expected.can_provide_absolute_, 37 EXPECT_EQ(expected.can_provide_absolute_,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 instance_ = NULL; 96 instance_ = NULL;
97 } 97 }
98 98
99 // Owned by ProviderImpl. Holds a reference back to MockOrientationFactory. 99 // Owned by ProviderImpl. Holds a reference back to MockOrientationFactory.
100 class MockDataFetcher : public DataFetcher { 100 class MockDataFetcher : public DataFetcher {
101 public: 101 public:
102 explicit MockDataFetcher(MockOrientationFactory* orientation_factory) 102 explicit MockDataFetcher(MockOrientationFactory* orientation_factory)
103 : orientation_factory_(orientation_factory) { } 103 : orientation_factory_(orientation_factory) { }
104 104
105 // From DataFetcher. Called by the Provider. 105 // From DataFetcher. Called by the Provider.
106 virtual bool GetMotion(Motion *motion) {
107 return false;
108 }
109
106 virtual bool GetOrientation(Orientation* orientation) { 110 virtual bool GetOrientation(Orientation* orientation) {
107 base::AutoLock auto_lock(orientation_factory_->lock_); 111 base::AutoLock auto_lock(orientation_factory_->lock_);
108 if (orientation_factory_->is_failing_) 112 if (orientation_factory_->is_failing_)
109 return false; 113 return false;
110 *orientation = orientation_factory_->orientation_; 114 *orientation = orientation_factory_->orientation_;
111 return true; 115 return true;
112 } 116 }
113 117
114 private: 118 private:
115 scoped_refptr<MockOrientationFactory> orientation_factory_; 119 scoped_refptr<MockOrientationFactory> orientation_factory_;
116 }; 120 };
117 121
118 static MockOrientationFactory* instance_; 122 static MockOrientationFactory* instance_;
119 Orientation orientation_; 123 Orientation orientation_;
120 bool is_failing_; 124 bool is_failing_;
121 base::Lock lock_; 125 base::Lock lock_;
122 }; 126 };
123 127
124 MockOrientationFactory* MockOrientationFactory::instance_; 128 MockOrientationFactory* MockOrientationFactory::instance_;
125 129
126 // Mock DataFetcher that always fails to provide any orientation data. 130 // Mock DataFetcher that always fails to provide any orientation data.
127 class FailingDataFetcher : public DataFetcher { 131 class FailingDataFetcher : public DataFetcher {
128 public: 132 public:
129 // Factory method; passed to and called by the ProviderImpl. 133 // Factory method; passed to and called by the ProviderImpl.
130 static DataFetcher* Create() { 134 static DataFetcher* Create() {
131 return new FailingDataFetcher(); 135 return new FailingDataFetcher();
132 } 136 }
133 137
134 // From DataFetcher. 138 // From DataFetcher.
139 virtual bool GetMotion(Motion* motion) {
140 return false;
141 }
135 virtual bool GetOrientation(Orientation* orientation) { 142 virtual bool GetOrientation(Orientation* orientation) {
136 return false; 143 return false;
137 } 144 }
138 145
139 private: 146 private:
140 FailingDataFetcher() {} 147 FailingDataFetcher() {}
141 }; 148 };
142 149
143 class DeviceOrientationProviderTest : public testing::Test { 150 class DeviceOrientationProviderTest : public testing::Test {
144 public: 151 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 190
184 TEST_F(DeviceOrientationProviderTest, FailingTest) { 191 TEST_F(DeviceOrientationProviderTest, FailingTest) {
185 Init(FailingDataFetcher::Create); 192 Init(FailingDataFetcher::Create);
186 193
187 scoped_ptr<UpdateChecker> checker_a( 194 scoped_ptr<UpdateChecker> checker_a(
188 new UpdateChecker(&pending_expectations_)); 195 new UpdateChecker(&pending_expectations_));
189 scoped_ptr<UpdateChecker> checker_b( 196 scoped_ptr<UpdateChecker> checker_b(
190 new UpdateChecker(&pending_expectations_)); 197 new UpdateChecker(&pending_expectations_));
191 198
192 checker_a->AddExpectation(Orientation::Empty()); 199 checker_a->AddExpectation(Orientation::Empty());
193 provider_->AddObserver(checker_a.get()); 200 provider_->AddOrientationObserver(checker_a.get());
194 MessageLoop::current()->Run(); 201 MessageLoop::current()->Run();
195 202
196 checker_b->AddExpectation(Orientation::Empty()); 203 checker_b->AddExpectation(Orientation::Empty());
197 provider_->AddObserver(checker_b.get()); 204 provider_->AddOrientationObserver(checker_b.get());
198 MessageLoop::current()->Run(); 205 MessageLoop::current()->Run();
199 } 206 }
200 207
201 TEST_F(DeviceOrientationProviderTest, ProviderIsSingleton) { 208 TEST_F(DeviceOrientationProviderTest, ProviderIsSingleton) {
202 Init(FailingDataFetcher::Create); 209 Init(FailingDataFetcher::Create);
203 210
204 scoped_refptr<Provider> provider_a(Provider::GetInstance()); 211 scoped_refptr<Provider> provider_a(Provider::GetInstance());
205 scoped_refptr<Provider> provider_b(Provider::GetInstance()); 212 scoped_refptr<Provider> provider_b(Provider::GetInstance());
206 213
207 EXPECT_EQ(provider_a.get(), provider_b.get()); 214 EXPECT_EQ(provider_a.get(), provider_b.get());
208 } 215 }
209 216
210 TEST_F(DeviceOrientationProviderTest, BasicPushTest) { 217 TEST_F(DeviceOrientationProviderTest, BasicPushTest) {
211 scoped_refptr<MockOrientationFactory> orientation_factory( 218 scoped_refptr<MockOrientationFactory> orientation_factory(
212 new MockOrientationFactory()); 219 new MockOrientationFactory());
213 Init(MockOrientationFactory::CreateDataFetcher); 220 Init(MockOrientationFactory::CreateDataFetcher);
214 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true); 221 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true);
215 222
216 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_)); 223 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_));
217 checker->AddExpectation(kTestOrientation); 224 checker->AddExpectation(kTestOrientation);
218 orientation_factory->SetOrientation(kTestOrientation); 225 orientation_factory->SetOrientation(kTestOrientation);
219 provider_->AddObserver(checker.get()); 226 provider_->AddOrientationObserver(checker.get());
220 MessageLoop::current()->Run(); 227 MessageLoop::current()->Run();
221 228
222 provider_->RemoveObserver(checker.get()); 229 provider_->RemoveOrientationObserver(checker.get());
223 } 230 }
224 231
225 TEST_F(DeviceOrientationProviderTest, MultipleObserversPushTest) { 232 TEST_F(DeviceOrientationProviderTest, MultipleOrientationObserversPushTest) {
226 scoped_refptr<MockOrientationFactory> orientation_factory( 233 scoped_refptr<MockOrientationFactory> orientation_factory(
227 new MockOrientationFactory()); 234 new MockOrientationFactory());
228 Init(MockOrientationFactory::CreateDataFetcher); 235 Init(MockOrientationFactory::CreateDataFetcher);
229 const Orientation kTestOrientations[] = { 236 const Orientation kTestOrientations[] = {
230 Orientation(true, 1, true, 2, true, 3, true, true), 237 Orientation(true, 1, true, 2, true, 3, true, true),
231 Orientation(true, 4, true, 5, true, 6, true, false), 238 Orientation(true, 4, true, 5, true, 6, true, false),
232 Orientation(true, 7, true, 8, true, 9, false, true)}; 239 Orientation(true, 7, true, 8, true, 9, false, true)};
233 240
234 scoped_ptr<UpdateChecker> checker_a( 241 scoped_ptr<UpdateChecker> checker_a(
235 new UpdateChecker(&pending_expectations_)); 242 new UpdateChecker(&pending_expectations_));
236 scoped_ptr<UpdateChecker> checker_b( 243 scoped_ptr<UpdateChecker> checker_b(
237 new UpdateChecker(&pending_expectations_)); 244 new UpdateChecker(&pending_expectations_));
238 scoped_ptr<UpdateChecker> checker_c( 245 scoped_ptr<UpdateChecker> checker_c(
239 new UpdateChecker(&pending_expectations_)); 246 new UpdateChecker(&pending_expectations_));
240 247
241 checker_a->AddExpectation(kTestOrientations[0]); 248 checker_a->AddExpectation(kTestOrientations[0]);
242 orientation_factory->SetOrientation(kTestOrientations[0]); 249 orientation_factory->SetOrientation(kTestOrientations[0]);
243 provider_->AddObserver(checker_a.get()); 250 provider_->AddOrientationObserver(checker_a.get());
244 MessageLoop::current()->Run(); 251 MessageLoop::current()->Run();
245 252
246 checker_a->AddExpectation(kTestOrientations[1]); 253 checker_a->AddExpectation(kTestOrientations[1]);
247 checker_b->AddExpectation(kTestOrientations[0]); 254 checker_b->AddExpectation(kTestOrientations[0]);
248 checker_b->AddExpectation(kTestOrientations[1]); 255 checker_b->AddExpectation(kTestOrientations[1]);
249 orientation_factory->SetOrientation(kTestOrientations[1]); 256 orientation_factory->SetOrientation(kTestOrientations[1]);
250 provider_->AddObserver(checker_b.get()); 257 provider_->AddOrientationObserver(checker_b.get());
251 MessageLoop::current()->Run(); 258 MessageLoop::current()->Run();
252 259
253 provider_->RemoveObserver(checker_a.get()); 260 provider_->RemoveOrientationObserver(checker_a.get());
254 checker_b->AddExpectation(kTestOrientations[2]); 261 checker_b->AddExpectation(kTestOrientations[2]);
255 checker_c->AddExpectation(kTestOrientations[1]); 262 checker_c->AddExpectation(kTestOrientations[1]);
256 checker_c->AddExpectation(kTestOrientations[2]); 263 checker_c->AddExpectation(kTestOrientations[2]);
257 orientation_factory->SetOrientation(kTestOrientations[2]); 264 orientation_factory->SetOrientation(kTestOrientations[2]);
258 provider_->AddObserver(checker_c.get()); 265 provider_->AddOrientationObserver(checker_c.get());
259 MessageLoop::current()->Run(); 266 MessageLoop::current()->Run();
260 267
261 provider_->RemoveObserver(checker_b.get()); 268 provider_->RemoveOrientationObserver(checker_b.get());
262 provider_->RemoveObserver(checker_c.get()); 269 provider_->RemoveOrientationObserver(checker_c.get());
263 } 270 }
264 271
265 #if defined(OS_LINUX) || defined(OS_WIN) 272 #if defined(OS_LINUX) || defined(OS_WIN)
266 // Flakily DCHECKs on Linux. See crbug.com/104950. 273 // Flakily DCHECKs on Linux. See crbug.com/104950.
267 // FLAKY on Win. See crbug.com/104950. 274 // FLAKY on Win. See crbug.com/104950.
268 #define MAYBE_ObserverNotRemoved DISABLED_ObserverNotRemoved 275 #define MAYBE_OrientationObserverNotRemoved DISABLED_OrientationObserverNotRemov ed
269 #else 276 #else
270 #define MAYBE_ObserverNotRemoved ObserverNotRemoved 277 #define MAYBE_OrientationObserverNotRemoved OrientationObserverNotRemoved
271 #endif 278 #endif
272 TEST_F(DeviceOrientationProviderTest, MAYBE_ObserverNotRemoved) { 279 TEST_F(DeviceOrientationProviderTest, MAYBE_OrientationObserverNotRemoved) {
273 scoped_refptr<MockOrientationFactory> orientation_factory( 280 scoped_refptr<MockOrientationFactory> orientation_factory(
274 new MockOrientationFactory()); 281 new MockOrientationFactory());
275 Init(MockOrientationFactory::CreateDataFetcher); 282 Init(MockOrientationFactory::CreateDataFetcher);
276 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true); 283 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true);
277 const Orientation kTestOrientation2(true, 4, true, 5, true, 6, true, false); 284 const Orientation kTestOrientation2(true, 4, true, 5, true, 6, true, false);
278 285
279 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_)); 286 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_));
280 checker->AddExpectation(kTestOrientation); 287 checker->AddExpectation(kTestOrientation);
281 orientation_factory->SetOrientation(kTestOrientation); 288 orientation_factory->SetOrientation(kTestOrientation);
282 provider_->AddObserver(checker.get()); 289 provider_->AddOrientationObserver(checker.get());
283 MessageLoop::current()->Run(); 290 MessageLoop::current()->Run();
284 291
285 checker->AddExpectation(kTestOrientation2); 292 checker->AddExpectation(kTestOrientation2);
286 orientation_factory->SetOrientation(kTestOrientation2); 293 orientation_factory->SetOrientation(kTestOrientation2);
287 MessageLoop::current()->Run(); 294 MessageLoop::current()->Run();
288 295
289 // Note that checker is not removed. This should not be a problem. 296 // Note that checker is not removed. This should not be a problem.
290 } 297 }
291 298
292 #if defined(OS_WIN) 299 #if defined(OS_WIN)
293 // FLAKY on Win. See crbug.com/104950. 300 // FLAKY on Win. See crbug.com/104950.
294 #define MAYBE_StartFailing DISABLED_StartFailing 301 #define MAYBE_StartFailing DISABLED_StartFailing
295 #else 302 #else
296 #define MAYBE_StartFailing StartFailing 303 #define MAYBE_StartFailing StartFailing
297 #endif 304 #endif
298 TEST_F(DeviceOrientationProviderTest, MAYBE_StartFailing) { 305 TEST_F(DeviceOrientationProviderTest, MAYBE_StartFailing) {
299 scoped_refptr<MockOrientationFactory> orientation_factory( 306 scoped_refptr<MockOrientationFactory> orientation_factory(
300 new MockOrientationFactory()); 307 new MockOrientationFactory());
301 Init(MockOrientationFactory::CreateDataFetcher); 308 Init(MockOrientationFactory::CreateDataFetcher);
302 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true); 309 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true);
303 310
304 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker( 311 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker(
305 &pending_expectations_)); 312 &pending_expectations_));
306 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker( 313 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker(
307 &pending_expectations_)); 314 &pending_expectations_));
308 315
309 orientation_factory->SetOrientation(kTestOrientation); 316 orientation_factory->SetOrientation(kTestOrientation);
310 checker_a->AddExpectation(kTestOrientation); 317 checker_a->AddExpectation(kTestOrientation);
311 provider_->AddObserver(checker_a.get()); 318 provider_->AddOrientationObserver(checker_a.get());
312 MessageLoop::current()->Run(); 319 MessageLoop::current()->Run();
313 320
314 checker_a->AddExpectation(Orientation::Empty()); 321 checker_a->AddExpectation(Orientation::Empty());
315 orientation_factory->SetFailing(true); 322 orientation_factory->SetFailing(true);
316 MessageLoop::current()->Run(); 323 MessageLoop::current()->Run();
317 324
318 checker_b->AddExpectation(Orientation::Empty()); 325 checker_b->AddExpectation(Orientation::Empty());
319 provider_->AddObserver(checker_b.get()); 326 provider_->AddOrientationObserver(checker_b.get());
320 MessageLoop::current()->Run(); 327 MessageLoop::current()->Run();
321 328
322 provider_->RemoveObserver(checker_a.get()); 329 provider_->RemoveOrientationObserver(checker_a.get());
323 provider_->RemoveObserver(checker_b.get()); 330 provider_->RemoveOrientationObserver(checker_b.get());
324 } 331 }
325 332
326 TEST_F(DeviceOrientationProviderTest, StartStopStart) { 333 TEST_F(DeviceOrientationProviderTest, StartStopStart) {
327 scoped_refptr<MockOrientationFactory> orientation_factory( 334 scoped_refptr<MockOrientationFactory> orientation_factory(
328 new MockOrientationFactory()); 335 new MockOrientationFactory());
329 Init(MockOrientationFactory::CreateDataFetcher); 336 Init(MockOrientationFactory::CreateDataFetcher);
330 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true); 337 const Orientation kTestOrientation(true, 1, true, 2, true, 3, true, true);
331 const Orientation kTestOrientation2(true, 4, true, 5, true, 6, true, false); 338 const Orientation kTestOrientation2(true, 4, true, 5, true, 6, true, false);
332 339
333 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker( 340 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker(
334 &pending_expectations_)); 341 &pending_expectations_));
335 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker( 342 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker(
336 &pending_expectations_)); 343 &pending_expectations_));
337 344
338 checker_a->AddExpectation(kTestOrientation); 345 checker_a->AddExpectation(kTestOrientation);
339 orientation_factory->SetOrientation(kTestOrientation); 346 orientation_factory->SetOrientation(kTestOrientation);
340 provider_->AddObserver(checker_a.get()); 347 provider_->AddOrientationObserver(checker_a.get());
341 MessageLoop::current()->Run(); 348 MessageLoop::current()->Run();
342 349
343 provider_->RemoveObserver(checker_a.get()); // This stops the Provider. 350 // This stops the Provider.
351 provider_->RemoveOrientationObserver(checker_a.get());
344 352
345 checker_b->AddExpectation(kTestOrientation2); 353 checker_b->AddExpectation(kTestOrientation2);
346 orientation_factory->SetOrientation(kTestOrientation2); 354 orientation_factory->SetOrientation(kTestOrientation2);
347 provider_->AddObserver(checker_b.get()); 355 provider_->AddOrientationObserver(checker_b.get());
348 MessageLoop::current()->Run(); 356 MessageLoop::current()->Run();
349 357
350 provider_->RemoveObserver(checker_b.get()); 358 provider_->RemoveOrientationObserver(checker_b.get());
351 } 359 }
352 360
353 TEST_F(DeviceOrientationProviderTest, SignificantlyDifferent) { 361 TEST_F(DeviceOrientationProviderTest, SignificantlyDifferent) {
354 scoped_refptr<MockOrientationFactory> orientation_factory( 362 scoped_refptr<MockOrientationFactory> orientation_factory(
355 new MockOrientationFactory()); 363 new MockOrientationFactory());
356 Init(MockOrientationFactory::CreateDataFetcher); 364 Init(MockOrientationFactory::CreateDataFetcher);
357 365
358 // Values that should be well below or above the implementation's 366 // Values that should be well below or above the implementation's
359 // significane threshold. 367 // significane threshold.
360 const double kInsignificantDifference = 1e-6; 368 const double kInsignificantDifference = 1e-6;
(...skipping 14 matching lines...) Expand all
375 false, true); 383 false, true);
376 384
377 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker( 385 scoped_ptr<UpdateChecker> checker_a(new UpdateChecker(
378 &pending_expectations_)); 386 &pending_expectations_));
379 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker( 387 scoped_ptr<UpdateChecker> checker_b(new UpdateChecker(
380 &pending_expectations_)); 388 &pending_expectations_));
381 389
382 390
383 orientation_factory->SetOrientation(first_orientation); 391 orientation_factory->SetOrientation(first_orientation);
384 checker_a->AddExpectation(first_orientation); 392 checker_a->AddExpectation(first_orientation);
385 provider_->AddObserver(checker_a.get()); 393 provider_->AddOrientationObserver(checker_a.get());
386 MessageLoop::current()->Run(); 394 MessageLoop::current()->Run();
387 395
388 // The observers should not see this insignificantly different orientation. 396 // The observers should not see this insignificantly different orientation.
389 orientation_factory->SetOrientation(second_orientation); 397 orientation_factory->SetOrientation(second_orientation);
390 checker_b->AddExpectation(first_orientation); 398 checker_b->AddExpectation(first_orientation);
391 provider_->AddObserver(checker_b.get()); 399 provider_->AddOrientationObserver(checker_b.get());
392 MessageLoop::current()->Run(); 400 MessageLoop::current()->Run();
393 401
394 orientation_factory->SetOrientation(third_orientation); 402 orientation_factory->SetOrientation(third_orientation);
395 checker_a->AddExpectation(third_orientation); 403 checker_a->AddExpectation(third_orientation);
396 checker_b->AddExpectation(third_orientation); 404 checker_b->AddExpectation(third_orientation);
397 MessageLoop::current()->Run(); 405 MessageLoop::current()->Run();
398 406
399 provider_->RemoveObserver(checker_a.get()); 407 provider_->RemoveOrientationObserver(checker_a.get());
400 provider_->RemoveObserver(checker_b.get()); 408 provider_->RemoveOrientationObserver(checker_b.get());
401 } 409 }
402 410
403 } // namespace 411 } // namespace
404 412
405 } // namespace device_orientation 413 } // namespace device_orientation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698