OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "screen_orientation_dispatcher.h" | 5 #include "screen_orientation_dispatcher.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 LockOrientationResultHolder* results_; | 53 LockOrientationResultHolder* results_; |
54 }; | 54 }; |
55 | 55 |
56 class ScreenOrientationDispatcherWithSink : public ScreenOrientationDispatcher { | 56 class ScreenOrientationDispatcherWithSink : public ScreenOrientationDispatcher { |
57 public: | 57 public: |
58 explicit ScreenOrientationDispatcherWithSink(IPC::TestSink* sink) | 58 explicit ScreenOrientationDispatcherWithSink(IPC::TestSink* sink) |
59 :ScreenOrientationDispatcher(NULL) , sink_(sink) { | 59 :ScreenOrientationDispatcher(NULL) , sink_(sink) { |
60 } | 60 } |
61 | 61 |
62 virtual bool Send(IPC::Message* message) override { | 62 bool Send(IPC::Message* message) override { return sink_->Send(message); } |
63 return sink_->Send(message); | |
64 } | |
65 | 63 |
66 IPC::TestSink* sink_; | 64 IPC::TestSink* sink_; |
67 }; | 65 }; |
68 | 66 |
69 class ScreenOrientationDispatcherTest : public testing::Test { | 67 class ScreenOrientationDispatcherTest : public testing::Test { |
70 protected: | 68 protected: |
71 virtual void SetUp() override { | 69 virtual void SetUp() override { |
72 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); | 70 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); |
73 } | 71 } |
74 | 72 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_FALSE(callback_results1.succeeded_); | 235 EXPECT_FALSE(callback_results1.succeeded_); |
238 EXPECT_TRUE(callback_results1.failed_); | 236 EXPECT_TRUE(callback_results1.failed_); |
239 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); | 237 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); |
240 | 238 |
241 // Second request is still pending. | 239 // Second request is still pending. |
242 EXPECT_FALSE(callback_results2.succeeded_); | 240 EXPECT_FALSE(callback_results2.succeeded_); |
243 EXPECT_FALSE(callback_results2.failed_); | 241 EXPECT_FALSE(callback_results2.failed_); |
244 } | 242 } |
245 | 243 |
246 } // namespace content | 244 } // namespace content |
OLD | NEW |