OLD | NEW |
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 <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 "base/task.h" | 9 #include "base/task.h" |
10 #include "content/browser/device_orientation/data_fetcher.h" | 10 #include "content/browser/device_orientation/data_fetcher.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 if (expected.can_provide_alpha_) | 38 if (expected.can_provide_alpha_) |
39 EXPECT_EQ(expected.alpha_, orientation.alpha_); | 39 EXPECT_EQ(expected.alpha_, orientation.alpha_); |
40 if (expected.can_provide_beta_) | 40 if (expected.can_provide_beta_) |
41 EXPECT_EQ(expected.beta_, orientation.beta_); | 41 EXPECT_EQ(expected.beta_, orientation.beta_); |
42 if (expected.can_provide_gamma_) | 42 if (expected.can_provide_gamma_) |
43 EXPECT_EQ(expected.gamma_, orientation.gamma_); | 43 EXPECT_EQ(expected.gamma_, orientation.gamma_); |
44 | 44 |
45 --(*expectations_count_ptr_); | 45 --(*expectations_count_ptr_); |
46 | 46 |
47 if (*expectations_count_ptr_ == 0) { | 47 if (*expectations_count_ptr_ == 0) { |
48 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 48 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 void AddExpectation(const Orientation& orientation) { | 52 void AddExpectation(const Orientation& orientation) { |
53 expectations_queue_.push(orientation); | 53 expectations_queue_.push(orientation); |
54 ++(*expectations_count_ptr_); | 54 ++(*expectations_count_ptr_); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 // Set up by the test fixture, which then blocks while it is accessed | 58 // Set up by the test fixture, which then blocks while it is accessed |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 checker_b->AddExpectation(third_orientation); | 372 checker_b->AddExpectation(third_orientation); |
373 MessageLoop::current()->Run(); | 373 MessageLoop::current()->Run(); |
374 | 374 |
375 provider_->RemoveObserver(checker_a.get()); | 375 provider_->RemoveObserver(checker_a.get()); |
376 provider_->RemoveObserver(checker_b.get()); | 376 provider_->RemoveObserver(checker_b.get()); |
377 } | 377 } |
378 | 378 |
379 } // namespace | 379 } // namespace |
380 | 380 |
381 } // namespace device_orientation | 381 } // namespace device_orientation |
OLD | NEW |