OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/renderer/mouse_lock_dispatcher.h" | 8 #include "content/renderer/mouse_lock_dispatcher.h" |
9 #include "content/renderer/render_view_impl.h" | 9 #include "content/renderer/render_view_impl.h" |
10 #include "content/test/render_view_test.h" | 10 #include "content/test/render_view_test.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 bool(const WebKit::WebMouseEvent&)); | 23 bool(const WebKit::WebMouseEvent&)); |
24 }; | 24 }; |
25 | 25 |
26 // MouseLockDispatcher is a RenderViewObserver, and we test it by creating a | 26 // MouseLockDispatcher is a RenderViewObserver, and we test it by creating a |
27 // fixture containing a RenderViewImpl view() and interacting to that interface. | 27 // fixture containing a RenderViewImpl view() and interacting to that interface. |
28 class MouseLockDispatcherTest | 28 class MouseLockDispatcherTest |
29 : public content::RenderViewTest { | 29 : public content::RenderViewTest { |
30 public: | 30 public: |
31 virtual void SetUp() { | 31 virtual void SetUp() { |
32 content::RenderViewTest::SetUp(); | 32 content::RenderViewTest::SetUp(); |
33 route_id_ = view()->GetRoutingId(); | 33 route_id_ = view()->GetRoutingID(); |
34 target_ = new MockLockTarget(); | 34 target_ = new MockLockTarget(); |
35 alternate_target_ = new MockLockTarget(); | 35 alternate_target_ = new MockLockTarget(); |
36 } | 36 } |
37 | 37 |
38 virtual void TearDown() { | 38 virtual void TearDown() { |
39 content::RenderViewTest::TearDown(); | 39 content::RenderViewTest::TearDown(); |
40 delete target_; | 40 delete target_; |
41 delete alternate_target_; | 41 delete alternate_target_; |
42 } | 42 } |
43 | 43 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_TRUE(dispatcher()->IsMouseLockedTo(target_)); | 223 EXPECT_TRUE(dispatcher()->IsMouseLockedTo(target_)); |
224 EXPECT_FALSE(dispatcher()->IsMouseLockedTo(alternate_target_)); | 224 EXPECT_FALSE(dispatcher()->IsMouseLockedTo(alternate_target_)); |
225 | 225 |
226 // Though the call to UnlockMouse should not unlock any target, we will | 226 // Though the call to UnlockMouse should not unlock any target, we will |
227 // cause an unlock (as if e.g. user escaped mouse lock) and verify the | 227 // cause an unlock (as if e.g. user escaped mouse lock) and verify the |
228 // correct target is unlocked. | 228 // correct target is unlocked. |
229 view()->OnMessageReceived(ViewMsg_MouseLockLost(route_id_)); | 229 view()->OnMessageReceived(ViewMsg_MouseLockLost(route_id_)); |
230 EXPECT_FALSE(dispatcher()->IsMouseLockedTo(target_)); | 230 EXPECT_FALSE(dispatcher()->IsMouseLockedTo(target_)); |
231 } | 231 } |
232 | 232 |
OLD | NEW |