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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 public: | 94 public: |
95 MockRenderWidgetHostDelegate() {} | 95 MockRenderWidgetHostDelegate() {} |
96 virtual ~MockRenderWidgetHostDelegate() {} | 96 virtual ~MockRenderWidgetHostDelegate() {} |
97 }; | 97 }; |
98 | 98 |
99 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl { | 99 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl { |
100 public: | 100 public: |
101 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, | 101 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
102 RenderProcessHost* process, | 102 RenderProcessHost* process, |
103 int routing_id) | 103 int routing_id) |
104 : RenderWidgetHostImpl(delegate, process, routing_id) { | 104 : RenderWidgetHostImpl(delegate, process, routing_id, false) { |
105 } | 105 } |
106 | 106 |
107 MOCK_METHOD0(Focus, void()); | 107 MOCK_METHOD0(Focus, void()); |
108 MOCK_METHOD0(Blur, void()); | 108 MOCK_METHOD0(Blur, void()); |
109 }; | 109 }; |
110 | 110 |
111 // Generates the |length| of composition rectangle vector and save them to | 111 // Generates the |length| of composition rectangle vector and save them to |
112 // |output|. It starts from |origin| and each rectangle contains |unit_size|. | 112 // |output|. It starts from |origin| and each rectangle contains |unit_size|. |
113 void GenerateCompositionRectArray(const gfx::Point& origin, | 113 void GenerateCompositionRectArray(const gfx::Point& origin, |
114 const gfx::Size& unit_size, | 114 const gfx::Size& unit_size, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Verify that escape key down in fullscreen mode suppressed the keyup event on | 257 // Verify that escape key down in fullscreen mode suppressed the keyup event on |
258 // the parent. | 258 // the parent. |
259 TEST_F(RenderWidgetHostViewMacTest, FullscreenCloseOnEscape) { | 259 TEST_F(RenderWidgetHostViewMacTest, FullscreenCloseOnEscape) { |
260 // Use our own RWH since we need to destroy it. | 260 // Use our own RWH since we need to destroy it. |
261 MockRenderWidgetHostDelegate delegate; | 261 MockRenderWidgetHostDelegate delegate; |
262 TestBrowserContext browser_context; | 262 TestBrowserContext browser_context; |
263 MockRenderProcessHost* process_host = | 263 MockRenderProcessHost* process_host = |
264 new MockRenderProcessHost(&browser_context); | 264 new MockRenderProcessHost(&browser_context); |
265 // Owned by its |cocoa_view()|. | 265 // Owned by its |cocoa_view()|. |
266 RenderWidgetHostImpl* rwh = new RenderWidgetHostImpl( | 266 RenderWidgetHostImpl* rwh = new RenderWidgetHostImpl( |
267 &delegate, process_host, MSG_ROUTING_NONE); | 267 &delegate, process_host, MSG_ROUTING_NONE, false); |
268 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( | 268 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( |
269 RenderWidgetHostView::CreateViewForWidget(rwh)); | 269 RenderWidgetHostView::CreateViewForWidget(rwh)); |
270 | 270 |
271 view->InitAsFullscreen(rwhv_mac_); | 271 view->InitAsFullscreen(rwhv_mac_); |
272 | 272 |
273 WindowedNotificationObserver observer( | 273 WindowedNotificationObserver observer( |
274 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 274 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
275 Source<RenderWidgetHost>(rwh)); | 275 Source<RenderWidgetHost>(rwh)); |
276 EXPECT_FALSE([rwhv_mac_->cocoa_view() suppressNextEscapeKeyUp]); | 276 EXPECT_FALSE([rwhv_mac_->cocoa_view() suppressNextEscapeKeyUp]); |
277 | 277 |
(...skipping 13 matching lines...) Expand all Loading... |
291 // Test that command accelerators which destroy the fullscreen window | 291 // Test that command accelerators which destroy the fullscreen window |
292 // don't crash when forwarded via the window's responder machinery. | 292 // don't crash when forwarded via the window's responder machinery. |
293 TEST_F(RenderWidgetHostViewMacTest, AcceleratorDestroy) { | 293 TEST_F(RenderWidgetHostViewMacTest, AcceleratorDestroy) { |
294 // Use our own RWH since we need to destroy it. | 294 // Use our own RWH since we need to destroy it. |
295 MockRenderWidgetHostDelegate delegate; | 295 MockRenderWidgetHostDelegate delegate; |
296 TestBrowserContext browser_context; | 296 TestBrowserContext browser_context; |
297 MockRenderProcessHost* process_host = | 297 MockRenderProcessHost* process_host = |
298 new MockRenderProcessHost(&browser_context); | 298 new MockRenderProcessHost(&browser_context); |
299 // Owned by its |cocoa_view()|. | 299 // Owned by its |cocoa_view()|. |
300 RenderWidgetHostImpl* rwh = new RenderWidgetHostImpl( | 300 RenderWidgetHostImpl* rwh = new RenderWidgetHostImpl( |
301 &delegate, process_host, MSG_ROUTING_NONE); | 301 &delegate, process_host, MSG_ROUTING_NONE, false); |
302 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( | 302 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( |
303 RenderWidgetHostView::CreateViewForWidget(rwh)); | 303 RenderWidgetHostView::CreateViewForWidget(rwh)); |
304 | 304 |
305 view->InitAsFullscreen(rwhv_mac_); | 305 view->InitAsFullscreen(rwhv_mac_); |
306 | 306 |
307 WindowedNotificationObserver observer( | 307 WindowedNotificationObserver observer( |
308 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 308 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
309 Source<RenderWidgetHost>(rwh)); | 309 Source<RenderWidgetHost>(rwh)); |
310 | 310 |
311 // Command-ESC will destroy the view, while the window is still in | 311 // Command-ESC will destroy the view, while the window is still in |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 host->OnMessageReceived(*response2); | 776 host->OnMessageReceived(*response2); |
777 | 777 |
778 // Check that the view delegate ignored the empty unhandled wheel event. | 778 // Check that the view delegate ignored the empty unhandled wheel event. |
779 ASSERT_EQ(NO, view_delegate.get().unhandledWheelEventReceived); | 779 ASSERT_EQ(NO, view_delegate.get().unhandledWheelEventReceived); |
780 | 780 |
781 // Clean up. | 781 // Clean up. |
782 host->Shutdown(); | 782 host->Shutdown(); |
783 } | 783 } |
784 | 784 |
785 } // namespace content | 785 } // namespace content |
OLD | NEW |