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 "content/renderer/screen_orientation/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" |
11 #include "content/common/screen_orientation_messages.h" | 11 #include "content/common/screen_orientation_messages.h" |
12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
13 #include "ipc/ipc_test_sink.h" | 13 #include "ipc/ipc_test_sink.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "third_party/WebKit/public/platform/WebLockOrientationCallback.h" | 15 #include "third_party/WebKit/public/platform/WebLockOrientationCallback.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 // MockLockOrientationCallback is an implementation of | 19 // MockLockOrientationCallback is an implementation of |
20 // WebLockOrientationCallback and takes a LockOrientationResultHolder* as a | 20 // WebLockOrientationCallback and takes a LockOrientationResultHolder* as a |
21 // parameter when being constructed. The |results_| pointer is owned by the | 21 // parameter when being constructed. The |results_| pointer is owned by the |
22 // caller and not by the callback object. The intent being that as soon as the | 22 // caller and not by the callback object. The intent being that as soon as the |
23 // callback is resolved, it will be killed so we use the | 23 // callback is resolved, it will be killed so we use the |
24 // LockOrientationResultHolder to know in which state the callback object is at | 24 // LockOrientationResultHolder to know in which state the callback object is at |
25 // any time. | 25 // any time. |
26 class MockLockOrientationCallback : | 26 class MockLockOrientationCallback : public blink::WebLockOrientationCallback { |
27 public blink::WebLockOrientationCallback { | |
28 public: | 27 public: |
29 struct LockOrientationResultHolder { | 28 struct LockOrientationResultHolder { |
30 LockOrientationResultHolder() | 29 LockOrientationResultHolder() |
31 : succeeded_(false), failed_(false) {} | 30 : succeeded_(false), failed_(false) {} |
32 | 31 |
33 bool succeeded_; | 32 bool succeeded_; |
34 bool failed_; | 33 bool failed_; |
35 blink::WebLockOrientationError error_; | 34 blink::WebLockOrientationError error_; |
36 }; | 35 }; |
37 | 36 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 EXPECT_FALSE(callback_results1.succeeded_); | 234 EXPECT_FALSE(callback_results1.succeeded_); |
236 EXPECT_TRUE(callback_results1.failed_); | 235 EXPECT_TRUE(callback_results1.failed_); |
237 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); | 236 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); |
238 | 237 |
239 // Second request is still pending. | 238 // Second request is still pending. |
240 EXPECT_FALSE(callback_results2.succeeded_); | 239 EXPECT_FALSE(callback_results2.succeeded_); |
241 EXPECT_FALSE(callback_results2.failed_); | 240 EXPECT_FALSE(callback_results2.failed_); |
242 } | 241 } |
243 | 242 |
244 } // namespace content | 243 } // namespace content |
OLD | NEW |