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

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

Issue 9420007: Move RenderWidgetHostView into content namespace. Fix include paths. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux_chromeos_gtk build issue not caught by trybots. Created 8 years, 10 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) 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/scoped_nsautorelease_pool.h" 7 #include "base/mac/scoped_nsautorelease_pool.h"
8 #include "content/browser/browser_thread_impl.h" 8 #include "content/browser/browser_thread_impl.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 "content/common/gpu/gpu_messages.h"
(...skipping 12 matching lines...) Expand all
23 virtual void SetUp() { 23 virtual void SetUp() {
24 RenderViewHostTestHarness::SetUp(); 24 RenderViewHostTestHarness::SetUp();
25 25
26 // TestRenderViewHost's destruction assumes that its view is a 26 // TestRenderViewHost's destruction assumes that its view is a
27 // TestRenderWidgetHostView, so store its view and reset it back to the 27 // TestRenderWidgetHostView, so store its view and reset it back to the
28 // stored view in |TearDown()|. 28 // stored view in |TearDown()|.
29 old_rwhv_ = rvh()->view(); 29 old_rwhv_ = rvh()->view();
30 30
31 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. 31 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|.
32 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>( 32 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>(
33 RenderWidgetHostView::CreateViewForWidget(rvh())); 33 content::RenderWidgetHostView::CreateViewForWidget(rvh()));
34 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); 34 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]);
35 } 35 }
36 virtual void TearDown() { 36 virtual void TearDown() {
37 // See comment in SetUp(). 37 // See comment in SetUp().
38 rvh()->SetView(old_rwhv_); 38 rvh()->SetView(old_rwhv_);
39 39
40 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. 40 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs.
41 rwhv_cocoa_.reset(); 41 rwhv_cocoa_.reset();
42 pool_.Recycle(); 42 pool_.Recycle();
43 MessageLoop::current()->RunAllPending(); 43 MessageLoop::current()->RunAllPending();
(...skipping 27 matching lines...) Expand all
71 geom.rects_valid = true; 71 geom.rects_valid = true;
72 rwhv_mac_->MovePluginWindows( 72 rwhv_mac_->MovePluginWindows(
73 std::vector<webkit::npapi::WebPluginGeometry>(1, geom)); 73 std::vector<webkit::npapi::WebPluginGeometry>(1, geom));
74 74
75 return accelerated_handle; 75 return accelerated_handle;
76 } 76 }
77 private: 77 private:
78 // This class isn't derived from PlatformTest. 78 // This class isn't derived from PlatformTest.
79 base::mac::ScopedNSAutoreleasePool pool_; 79 base::mac::ScopedNSAutoreleasePool pool_;
80 80
81 RenderWidgetHostView* old_rwhv_; 81 content::RenderWidgetHostView* old_rwhv_;
82 82
83 protected: 83 protected:
84 RenderWidgetHostViewMac* rwhv_mac_; 84 RenderWidgetHostViewMac* rwhv_mac_;
85 scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa_; 85 scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa_;
86 86
87 private: 87 private:
88 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacTest); 88 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacTest);
89 }; 89 };
90 90
91 TEST_F(RenderWidgetHostViewMacTest, Basic) { 91 TEST_F(RenderWidgetHostViewMacTest, Basic) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 // A click on the accelerated view should focus the RWHVCocoa. 194 // A click on the accelerated view should focus the RWHVCocoa.
195 std::pair<NSEvent*, NSEvent*> clicks = 195 std::pair<NSEvent*, NSEvent*> clicks =
196 cocoa_test_event_utils::MouseClickInView(accelerated_view, 1); 196 cocoa_test_event_utils::MouseClickInView(accelerated_view, 1);
197 [rwhv_cocoa_.get() mouseDown:clicks.first]; 197 [rwhv_cocoa_.get() mouseDown:clicks.first];
198 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]); 198 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]);
199 199
200 // Clean up. 200 // Clean up.
201 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle); 201 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle);
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698