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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 :ScreenOrientationDispatcher(NULL) , sink_(sink) { | 59 :ScreenOrientationDispatcher(NULL) , sink_(sink) { |
60 } | 60 } |
61 | 61 |
62 bool Send(IPC::Message* message) override { return sink_->Send(message); } | 62 bool Send(IPC::Message* message) override { return sink_->Send(message); } |
63 | 63 |
64 IPC::TestSink* sink_; | 64 IPC::TestSink* sink_; |
65 }; | 65 }; |
66 | 66 |
67 class ScreenOrientationDispatcherTest : public testing::Test { | 67 class ScreenOrientationDispatcherTest : public testing::Test { |
68 protected: | 68 protected: |
69 virtual void SetUp() override { | 69 void SetUp() override { |
70 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); | 70 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); |
71 } | 71 } |
72 | 72 |
73 int GetFirstLockRequestIdFromSink() { | 73 int GetFirstLockRequestIdFromSink() { |
74 const IPC::Message* msg = sink().GetFirstMessageMatching( | 74 const IPC::Message* msg = sink().GetFirstMessageMatching( |
75 ScreenOrientationHostMsg_LockRequest::ID); | 75 ScreenOrientationHostMsg_LockRequest::ID); |
76 EXPECT_TRUE(msg != NULL); | 76 EXPECT_TRUE(msg != NULL); |
77 | 77 |
78 Tuple2<blink::WebScreenOrientationLockType,int> params; | 78 Tuple2<blink::WebScreenOrientationLockType,int> params; |
79 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); | 79 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 EXPECT_FALSE(callback_results1.succeeded_); | 235 EXPECT_FALSE(callback_results1.succeeded_); |
236 EXPECT_TRUE(callback_results1.failed_); | 236 EXPECT_TRUE(callback_results1.failed_); |
237 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); | 237 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); |
238 | 238 |
239 // Second request is still pending. | 239 // Second request is still pending. |
240 EXPECT_FALSE(callback_results2.succeeded_); | 240 EXPECT_FALSE(callback_results2.succeeded_); |
241 EXPECT_FALSE(callback_results2.failed_); | 241 EXPECT_FALSE(callback_results2.failed_); |
242 } | 242 } |
243 | 243 |
244 } // namespace content | 244 } // namespace content |
OLD | NEW |