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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 protected: | 68 protected: |
69 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 Tuple<blink::WebScreenOrientationLockType,int> params; |
79 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); | 79 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); |
80 return params.b; | 80 return get<1>(params); |
81 } | 81 } |
82 | 82 |
83 IPC::TestSink& sink() { | 83 IPC::TestSink& sink() { |
84 return sink_; | 84 return sink_; |
85 } | 85 } |
86 | 86 |
87 void LockOrientation(blink::WebScreenOrientationLockType orientation, | 87 void LockOrientation(blink::WebScreenOrientationLockType orientation, |
88 blink::WebLockOrientationCallback* callback) { | 88 blink::WebLockOrientationCallback* callback) { |
89 dispatcher_->lockOrientation(orientation, callback); | 89 dispatcher_->lockOrientation(orientation, callback); |
90 } | 90 } |
(...skipping 144 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 |