OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include "base/mac/scoped_nsautorelease_pool.h" | 7 #include "base/mac/scoped_nsautorelease_pool.h" |
8 #include "chrome/browser/browser_thread.h" | 8 #include "chrome/browser/browser_thread.h" |
9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Create an accelerated view the size of the rhwvmac. | 50 // Create an accelerated view the size of the rhwvmac. |
51 [rwhv_cocoa_.get() setFrame:NSMakeRect(0, 0, w, h)]; | 51 [rwhv_cocoa_.get() setFrame:NSMakeRect(0, 0, w, h)]; |
52 gfx::PluginWindowHandle accelerated_handle = | 52 gfx::PluginWindowHandle accelerated_handle = |
53 rwhv_mac_->AllocateFakePluginWindowHandle(/*opaque=*/false, | 53 rwhv_mac_->AllocateFakePluginWindowHandle(/*opaque=*/false, |
54 /*root=*/false); | 54 /*root=*/false); |
55 rwhv_mac_->AcceleratedSurfaceSetIOSurface(accelerated_handle, w, h, 0); | 55 rwhv_mac_->AcceleratedSurfaceSetIOSurface(accelerated_handle, w, h, 0); |
56 | 56 |
57 // The accelerated view isn't shown until it has a valid rect and has been | 57 // The accelerated view isn't shown until it has a valid rect and has been |
58 // painted to. | 58 // painted to. |
59 rwhv_mac_->AcceleratedSurfaceBuffersSwapped(accelerated_handle, 0, 0, 0, 0); | 59 rwhv_mac_->AcceleratedSurfaceBuffersSwapped(accelerated_handle, 0, 0, 0, 0); |
60 webkit::npapi::WebPluginGeometry geom; | 60 webkit_glue::WebPluginGeometry geom; |
61 gfx::Rect rect(0, 0, w, h); | 61 gfx::Rect rect(0, 0, w, h); |
62 geom.window = accelerated_handle; | 62 geom.window = accelerated_handle; |
63 geom.window_rect = rect; | 63 geom.window_rect = rect; |
64 geom.clip_rect = rect; | 64 geom.clip_rect = rect; |
65 geom.visible = true; | 65 geom.visible = true; |
66 geom.rects_valid = true; | 66 geom.rects_valid = true; |
67 rwhv_mac_->MovePluginWindows( | 67 rwhv_mac_->MovePluginWindows( |
68 std::vector<webkit::npapi::WebPluginGeometry>(1, geom)); | 68 std::vector<webkit_glue::WebPluginGeometry>(1, geom)); |
69 | 69 |
70 return accelerated_handle; | 70 return accelerated_handle; |
71 } | 71 } |
72 private: | 72 private: |
73 // This class isn't derived from PlatformTest. | 73 // This class isn't derived from PlatformTest. |
74 base::mac::ScopedNSAutoreleasePool pool_; | 74 base::mac::ScopedNSAutoreleasePool pool_; |
75 | 75 |
76 RenderWidgetHostView* old_rwhv_; | 76 RenderWidgetHostView* old_rwhv_; |
77 | 77 |
78 protected: | 78 protected: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // A click on the accelerated view should focus the RWHVCocoa. | 183 // A click on the accelerated view should focus the RWHVCocoa. |
184 std::pair<NSEvent*, NSEvent*> clicks = | 184 std::pair<NSEvent*, NSEvent*> clicks = |
185 test_event_utils::MouseClickInView(accelerated_view, 1); | 185 test_event_utils::MouseClickInView(accelerated_view, 1); |
186 [rwhv_cocoa_.get() mouseDown:clicks.first]; | 186 [rwhv_cocoa_.get() mouseDown:clicks.first]; |
187 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]); | 187 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]); |
188 | 188 |
189 // Clean up. | 189 // Clean up. |
190 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle); | 190 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle); |
191 } | 191 } |
OLD | NEW |