Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/scoped_nsautorelease_pool.h" 7 #include "base/mac/scoped_nsautorelease_pool.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "content/browser/renderer_host/test_render_view_host.h" 9 #include "content/browser/renderer_host/test_render_view_host.h"
10 #include "content/common/gpu/gpu_messages.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/base/test/cocoa_test_event_utils.h" 12 #include "ui/base/test/cocoa_test_event_utils.h"
12 #import "ui/base/test/ui_cocoa_test_helper.h" 13 #import "ui/base/test/ui_cocoa_test_helper.h"
13 #include "webkit/plugins/npapi/webplugin.h" 14 #include "webkit/plugins/npapi/webplugin.h"
14 15
15 class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness { 16 class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness {
16 public: 17 public:
17 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {} 18 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {}
18 19
19 virtual void SetUp() { 20 virtual void SetUp() {
(...skipping 27 matching lines...) Expand all
47 gfx::PluginWindowHandle AddAcceleratedPluginView(int w, int h) { 48 gfx::PluginWindowHandle AddAcceleratedPluginView(int w, int h) {
48 // Create an accelerated view the size of the rhwvmac. 49 // Create an accelerated view the size of the rhwvmac.
49 [rwhv_cocoa_.get() setFrame:NSMakeRect(0, 0, w, h)]; 50 [rwhv_cocoa_.get() setFrame:NSMakeRect(0, 0, w, h)];
50 gfx::PluginWindowHandle accelerated_handle = 51 gfx::PluginWindowHandle accelerated_handle =
51 rwhv_mac_->AllocateFakePluginWindowHandle(/*opaque=*/false, 52 rwhv_mac_->AllocateFakePluginWindowHandle(/*opaque=*/false,
52 /*root=*/false); 53 /*root=*/false);
53 rwhv_mac_->AcceleratedSurfaceSetIOSurface(accelerated_handle, w, h, 0); 54 rwhv_mac_->AcceleratedSurfaceSetIOSurface(accelerated_handle, w, h, 0);
54 55
55 // The accelerated view isn't shown until it has a valid rect and has been 56 // The accelerated view isn't shown until it has a valid rect and has been
56 // painted to. 57 // painted to.
57 rwhv_mac_->AcceleratedSurfaceBuffersSwapped(accelerated_handle, 58 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
58 0, 0, 0, 0); 59 params.window = accelerated_handle;
60 rwhv_mac_->AcceleratedSurfaceBuffersSwapped(params, 0);
59 webkit::npapi::WebPluginGeometry geom; 61 webkit::npapi::WebPluginGeometry geom;
60 gfx::Rect rect(0, 0, w, h); 62 gfx::Rect rect(0, 0, w, h);
61 geom.window = accelerated_handle; 63 geom.window = accelerated_handle;
62 geom.window_rect = rect; 64 geom.window_rect = rect;
63 geom.clip_rect = rect; 65 geom.clip_rect = rect;
64 geom.visible = true; 66 geom.visible = true;
65 geom.rects_valid = true; 67 geom.rects_valid = true;
66 rwhv_mac_->MovePluginWindows( 68 rwhv_mac_->MovePluginWindows(
67 std::vector<webkit::npapi::WebPluginGeometry>(1, geom)); 69 std::vector<webkit::npapi::WebPluginGeometry>(1, geom));
68 70
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 187
186 // A click on the accelerated view should focus the RWHVCocoa. 188 // A click on the accelerated view should focus the RWHVCocoa.
187 std::pair<NSEvent*, NSEvent*> clicks = 189 std::pair<NSEvent*, NSEvent*> clicks =
188 cocoa_test_event_utils::MouseClickInView(accelerated_view, 1); 190 cocoa_test_event_utils::MouseClickInView(accelerated_view, 1);
189 [rwhv_cocoa_.get() mouseDown:clicks.first]; 191 [rwhv_cocoa_.get() mouseDown:clicks.first];
190 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]); 192 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]);
191 193
192 // Clean up. 194 // Clean up.
193 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle); 195 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle);
194 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698