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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 11361052: Browser Plugin: Implement autosize (Embedder-side code) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: BrowserPluginHostMsg_AutoSize_Params had an int instead of bool for enable: fixed Created 8 years, 1 month 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 namespace content { 84 namespace content {
85 85
86 // Test factory for creating test instances of BrowserPluginEmbedder and 86 // Test factory for creating test instances of BrowserPluginEmbedder and
87 // BrowserPluginGuest. 87 // BrowserPluginGuest.
88 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { 88 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory {
89 public: 89 public:
90 virtual BrowserPluginGuest* CreateBrowserPluginGuest( 90 virtual BrowserPluginGuest* CreateBrowserPluginGuest(
91 int instance_id, 91 int instance_id,
92 WebContentsImpl* web_contents, 92 WebContentsImpl* web_contents,
93 RenderViewHost* render_view_host, 93 RenderViewHost* render_view_host,
94 bool focused, 94 const BrowserPluginHostMsg_CreateGuest_Params& params) OVERRIDE {
95 bool visible) OVERRIDE {
96 return new TestBrowserPluginGuest(instance_id, 95 return new TestBrowserPluginGuest(instance_id,
97 web_contents, 96 web_contents,
98 render_view_host, 97 render_view_host,
99 focused, 98 params);
100 visible);
101 } 99 }
102 100
103 // Also keeps track of number of instances created. 101 // Also keeps track of number of instances created.
104 virtual BrowserPluginEmbedder* CreateBrowserPluginEmbedder( 102 virtual BrowserPluginEmbedder* CreateBrowserPluginEmbedder(
105 WebContentsImpl* web_contents, 103 WebContentsImpl* web_contents,
106 RenderViewHost* render_view_host) OVERRIDE { 104 RenderViewHost* render_view_host) OVERRIDE {
107 embedder_instance_count_++; 105 embedder_instance_count_++;
108 if (message_loop_runner_) 106 if (message_loop_runner_)
109 message_loop_runner_->Quit(); 107 message_loop_runner_->Quit();
110 108
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 }; 140 };
143 141
144 // Test factory class for browser plugin that creates guests with short hang 142 // Test factory class for browser plugin that creates guests with short hang
145 // timeout. 143 // timeout.
146 class TestShortHangTimeoutGuestFactory : public TestBrowserPluginHostFactory { 144 class TestShortHangTimeoutGuestFactory : public TestBrowserPluginHostFactory {
147 public: 145 public:
148 virtual BrowserPluginGuest* CreateBrowserPluginGuest( 146 virtual BrowserPluginGuest* CreateBrowserPluginGuest(
149 int instance_id, 147 int instance_id,
150 WebContentsImpl* web_contents, 148 WebContentsImpl* web_contents,
151 RenderViewHost* render_view_host, 149 RenderViewHost* render_view_host,
152 bool focused, 150 const BrowserPluginHostMsg_CreateGuest_Params& params) OVERRIDE {
153 bool visible) OVERRIDE { 151 BrowserPluginGuest* guest =
154 BrowserPluginGuest* guest = new TestBrowserPluginGuest(instance_id, 152 new TestBrowserPluginGuest(instance_id,
155 web_contents, 153 web_contents,
156 render_view_host, 154 render_view_host,
157 focused, 155 params);
158 visible);
159 guest->set_guest_hang_timeout_for_testing(TestTimeouts::tiny_timeout()); 156 guest->set_guest_hang_timeout_for_testing(TestTimeouts::tiny_timeout());
160 return guest; 157 return guest;
161 } 158 }
162 159
163 // Singleton getter. 160 // Singleton getter.
164 static TestShortHangTimeoutGuestFactory* GetInstance() { 161 static TestShortHangTimeoutGuestFactory* GetInstance() {
165 return Singleton<TestShortHangTimeoutGuestFactory>::get(); 162 return Singleton<TestShortHangTimeoutGuestFactory>::get();
166 } 163 }
167 164
168 protected: 165 protected:
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 scoped_ptr<base::Value> value( 1100 scoped_ptr<base::Value> value(
1104 guest_rvh->ExecuteJavascriptAndGetValue(string16(), 1101 guest_rvh->ExecuteJavascriptAndGetValue(string16(),
1105 ASCIIToUTF16("document.hasFocus()"))); 1102 ASCIIToUTF16("document.hasFocus()")));
1106 bool result = false; 1103 bool result = false;
1107 ASSERT_TRUE(value->GetAsBoolean(&result)); 1104 ASSERT_TRUE(value->GetAsBoolean(&result));
1108 EXPECT_TRUE(result); 1105 EXPECT_TRUE(result);
1109 } 1106 }
1110 } 1107 }
1111 1108
1112 } // namespace content 1109 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/browser_plugin/browser_plugin_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698