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

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

Issue 10804031: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/base/test/cocoa_test_event_utils.h" 12 #include "ui/base/test/cocoa_test_event_utils.h"
13 #import "ui/base/test/ui_cocoa_test_helper.h" 13 #import "ui/base/test/ui_cocoa_test_helper.h"
14 #include "webkit/plugins/npapi/webplugin.h" 14 #include "webkit/plugins/npapi/webplugin.h"
15 15
16 using content::BrowserThread; 16 namespace content {
17 using content::BrowserThreadImpl;
18 using content::RenderViewHostImplTestHarness;
19 17
20 class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness { 18 class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness {
21 public: 19 public:
22 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {} 20 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {}
23 21
24 virtual void SetUp() { 22 virtual void SetUp() {
25 RenderViewHostImplTestHarness::SetUp(); 23 RenderViewHostImplTestHarness::SetUp();
26 24
27 // TestRenderViewHost's destruction assumes that its view is a 25 // TestRenderViewHost's destruction assumes that its view is a
28 // TestRenderWidgetHostView, so store its view and reset it back to the 26 // TestRenderWidgetHostView, so store its view and reset it back to the
29 // stored view in |TearDown()|. 27 // stored view in |TearDown()|.
30 old_rwhv_ = rvh()->GetView(); 28 old_rwhv_ = rvh()->GetView();
31 29
32 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. 30 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|.
33 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>( 31 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>(
34 content::RenderWidgetHostView::CreateViewForWidget(rvh())); 32 RenderWidgetHostView::CreateViewForWidget(rvh()));
35 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); 33 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]);
36 } 34 }
37 virtual void TearDown() { 35 virtual void TearDown() {
38 // See comment in SetUp(). 36 // See comment in SetUp().
39 test_rvh()->SetView(old_rwhv_); 37 test_rvh()->SetView(old_rwhv_);
40 38
41 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. 39 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs.
42 rwhv_cocoa_.reset(); 40 rwhv_cocoa_.reset();
43 pool_.Recycle(); 41 pool_.Recycle();
44 MessageLoop::current()->RunAllPending(); 42 MessageLoop::current()->RunAllPending();
(...skipping 27 matching lines...) Expand all
72 geom.rects_valid = true; 70 geom.rects_valid = true;
73 rwhv_mac_->MovePluginWindows( 71 rwhv_mac_->MovePluginWindows(
74 std::vector<webkit::npapi::WebPluginGeometry>(1, geom)); 72 std::vector<webkit::npapi::WebPluginGeometry>(1, geom));
75 73
76 return accelerated_handle; 74 return accelerated_handle;
77 } 75 }
78 private: 76 private:
79 // This class isn't derived from PlatformTest. 77 // This class isn't derived from PlatformTest.
80 base::mac::ScopedNSAutoreleasePool pool_; 78 base::mac::ScopedNSAutoreleasePool pool_;
81 79
82 content::RenderWidgetHostView* old_rwhv_; 80 RenderWidgetHostView* old_rwhv_;
83 81
84 protected: 82 protected:
85 RenderWidgetHostViewMac* rwhv_mac_; 83 RenderWidgetHostViewMac* rwhv_mac_;
86 scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa_; 84 scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa_;
87 85
88 private: 86 private:
89 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacTest); 87 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacTest);
90 }; 88 };
91 89
92 TEST_F(RenderWidgetHostViewMacTest, Basic) { 90 TEST_F(RenderWidgetHostViewMacTest, Basic) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]); 197 EXPECT_EQ(rwhv_cocoa_.get(), [window firstResponder]);
200 198
201 // Clean up. 199 // Clean up.
202 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle); 200 rwhv_mac_->DestroyFakePluginWindowHandle(accelerated_handle);
203 } 201 }
204 202
205 TEST_F(RenderWidgetHostViewMacTest, Fullscreen) { 203 TEST_F(RenderWidgetHostViewMacTest, Fullscreen) {
206 rwhv_mac_->InitAsFullscreen(NULL); 204 rwhv_mac_->InitAsFullscreen(NULL);
207 EXPECT_TRUE(rwhv_mac_->pepper_fullscreen_window()); 205 EXPECT_TRUE(rwhv_mac_->pepper_fullscreen_window());
208 } 206 }
207
208 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698