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

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

Issue 7087028: roll clang 131935:132017 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 6 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
11 #include "content/browser/device_orientation/orientation.h" 11 #include "content/browser/device_orientation/orientation.h"
12 #include "content/browser/device_orientation/provider.h" 12 #include "content/browser/device_orientation/provider.h"
13 #include "content/browser/device_orientation/provider_impl.h" 13 #include "content/browser/device_orientation/provider_impl.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace device_orientation { 16 namespace device_orientation {
17 namespace { 17 namespace {
18 18
19 // Class for checking expectations on orientation updates from the Provider. 19 // Class for checking expectations on orientation updates from the Provider.
20 class UpdateChecker : public Provider::Observer { 20 class UpdateChecker : public Provider::Observer {
21 public: 21 public:
22 explicit UpdateChecker(int* expectations_count_ptr) 22 explicit UpdateChecker(int* expectations_count_ptr)
23 : expectations_count_ptr_(expectations_count_ptr) { 23 : expectations_count_ptr_(expectations_count_ptr) {
24 } 24 }
25 25
26 virtual ~UpdateChecker() {}
27
26 // From Provider::Observer. 28 // From Provider::Observer.
27 virtual void OnOrientationUpdate(const Orientation& orientation) { 29 virtual void OnOrientationUpdate(const Orientation& orientation) {
28 ASSERT_FALSE(expectations_queue_.empty()); 30 ASSERT_FALSE(expectations_queue_.empty());
29 31
30 Orientation expected = expectations_queue_.front(); 32 Orientation expected = expectations_queue_.front();
31 expectations_queue_.pop(); 33 expectations_queue_.pop();
32 34
33 EXPECT_EQ(expected.can_provide_alpha_, orientation.can_provide_alpha_); 35 EXPECT_EQ(expected.can_provide_alpha_, orientation.can_provide_alpha_);
34 EXPECT_EQ(expected.can_provide_beta_, orientation.can_provide_beta_); 36 EXPECT_EQ(expected.can_provide_beta_, orientation.can_provide_beta_);
35 EXPECT_EQ(expected.can_provide_gamma_, orientation.can_provide_gamma_); 37 EXPECT_EQ(expected.can_provide_gamma_, orientation.can_provide_gamma_);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 checker_b->AddExpectation(third_orientation); 366 checker_b->AddExpectation(third_orientation);
365 MessageLoop::current()->Run(); 367 MessageLoop::current()->Run();
366 368
367 provider_->RemoveObserver(checker_a.get()); 369 provider_->RemoveObserver(checker_a.get());
368 provider_->RemoveObserver(checker_b.get()); 370 provider_->RemoveObserver(checker_b.get());
369 } 371 }
370 372
371 } // namespace 373 } // namespace
372 374
373 } // namespace device_orientation 375 } // namespace device_orientation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698