| 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 "content/renderer/screen_orientation/screen_orientation_dispatcher.h" | 5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <tuple> |
| 9 | 10 |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "content/common/screen_orientation_messages.h" | 12 #include "content/common/screen_orientation_messages.h" |
| 12 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
| 13 #include "ipc/ipc_test_sink.h" | 14 #include "ipc/ipc_test_sink.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockO
rientationCallback.h" | 16 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockO
rientationCallback.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 protected: | 66 protected: |
| 66 void SetUp() override { | 67 void SetUp() override { |
| 67 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); | 68 dispatcher_.reset(new ScreenOrientationDispatcherWithSink(&sink_)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 int GetFirstLockRequestIdFromSink() { | 71 int GetFirstLockRequestIdFromSink() { |
| 71 const IPC::Message* msg = sink().GetFirstMessageMatching( | 72 const IPC::Message* msg = sink().GetFirstMessageMatching( |
| 72 ScreenOrientationHostMsg_LockRequest::ID); | 73 ScreenOrientationHostMsg_LockRequest::ID); |
| 73 EXPECT_TRUE(msg != NULL); | 74 EXPECT_TRUE(msg != NULL); |
| 74 | 75 |
| 75 base::Tuple<blink::WebScreenOrientationLockType, int> params; | 76 std::tuple<blink::WebScreenOrientationLockType, int> params; |
| 76 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); | 77 ScreenOrientationHostMsg_LockRequest::Read(msg, ¶ms); |
| 77 return base::get<1>(params); | 78 return std::get<1>(params); |
| 78 } | 79 } |
| 79 | 80 |
| 80 IPC::TestSink& sink() { | 81 IPC::TestSink& sink() { |
| 81 return sink_; | 82 return sink_; |
| 82 } | 83 } |
| 83 | 84 |
| 84 void LockOrientation(blink::WebScreenOrientationLockType orientation, | 85 void LockOrientation(blink::WebScreenOrientationLockType orientation, |
| 85 blink::WebLockOrientationCallback* callback) { | 86 blink::WebLockOrientationCallback* callback) { |
| 86 dispatcher_->lockOrientation(orientation, callback); | 87 dispatcher_->lockOrientation(orientation, callback); |
| 87 } | 88 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 EXPECT_FALSE(callback_results1.succeeded_); | 233 EXPECT_FALSE(callback_results1.succeeded_); |
| 233 EXPECT_TRUE(callback_results1.failed_); | 234 EXPECT_TRUE(callback_results1.failed_); |
| 234 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); | 235 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); |
| 235 | 236 |
| 236 // Second request is still pending. | 237 // Second request is still pending. |
| 237 EXPECT_FALSE(callback_results2.succeeded_); | 238 EXPECT_FALSE(callback_results2.succeeded_); |
| 238 EXPECT_FALSE(callback_results2.failed_); | 239 EXPECT_FALSE(callback_results2.failed_); |
| 239 } | 240 } |
| 240 | 241 |
| 241 } // namespace content | 242 } // namespace content |
| OLD | NEW |