| 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 #include <tuple> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // TODO(lunalu): When available, test mojo service without needing a | 54 // TODO(lunalu): When available, test mojo service without needing a |
| 55 // RenderViewTest. | 55 // RenderViewTest. |
| 56 class ScreenOrientationDispatcherTest : public RenderViewTest { | 56 class ScreenOrientationDispatcherTest : public RenderViewTest { |
| 57 protected: | 57 protected: |
| 58 void SetUp() override { | 58 void SetUp() override { |
| 59 RenderViewTest::SetUp(); | 59 RenderViewTest::SetUp(); |
| 60 dispatcher_.reset(new ScreenOrientationDispatcher(nullptr)); | 60 dispatcher_.reset(new ScreenOrientationDispatcher(nullptr)); |
| 61 ScreenOrientationAssociatedPtr screen_orientation; | 61 ScreenOrientationAssociatedPtr screen_orientation; |
| 62 mojo::GetIsolatedProxy(&screen_orientation); | 62 mojo::MakeIsolatedRequest(&screen_orientation); |
| 63 dispatcher_->SetScreenOrientationForTests(screen_orientation); | 63 dispatcher_->SetScreenOrientationForTests(screen_orientation); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void LockOrientation( | 66 void LockOrientation( |
| 67 blink::WebScreenOrientationLockType orientation, | 67 blink::WebScreenOrientationLockType orientation, |
| 68 std::unique_ptr<blink::WebLockOrientationCallback> callback) { | 68 std::unique_ptr<blink::WebLockOrientationCallback> callback) { |
| 69 dispatcher_->lockOrientation(orientation, std::move(callback)); | 69 dispatcher_->lockOrientation(orientation, std::move(callback)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void UnlockOrientation() { dispatcher_->unlockOrientation(); } | 72 void UnlockOrientation() { dispatcher_->unlockOrientation(); } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EXPECT_FALSE(callback_results1.succeeded_); | 182 EXPECT_FALSE(callback_results1.succeeded_); |
| 183 EXPECT_TRUE(callback_results1.failed_); | 183 EXPECT_TRUE(callback_results1.failed_); |
| 184 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); | 184 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); |
| 185 | 185 |
| 186 // Second request is still pending. | 186 // Second request is still pending. |
| 187 EXPECT_FALSE(callback_results2.succeeded_); | 187 EXPECT_FALSE(callback_results2.succeeded_); |
| 188 EXPECT_FALSE(callback_results2.failed_); | 188 EXPECT_FALSE(callback_results2.failed_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace content | 191 } // namespace content |
| OLD | NEW |