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

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

Issue 11035070: <browser> Disable browser plugin in content_shell by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync @tott + fix one include order. Created 8 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) 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/memory/singleton.h" 6 #include "base/memory/singleton.h"
6 #include "base/run_loop.h" 7 #include "base/run_loop.h"
7 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
8 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 11 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
11 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" 12 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h"
12 #include "content/browser/browser_plugin/test_browser_plugin_guest.h" 13 #include "content/browser/browser_plugin/test_browser_plugin_guest.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/render_view_host_observer.h" 19 #include "content/public/browser/render_view_host_observer.h"
20 #include "content/public/common/content_switches.h"
19 #include "content/public/test/browser_test_utils.h" 21 #include "content/public/test/browser_test_utils.h"
20 #include "content/public/test/test_utils.h" 22 #include "content/public/test/test_utils.h"
21 #include "content/shell/shell.h" 23 #include "content/shell/shell.h"
22 #include "content/test/content_browser_test_utils.h" 24 #include "content/test/content_browser_test_utils.h"
23 #include "content/test/content_browser_test.h" 25 #include "content/test/content_browser_test.h"
24 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
25 #include "net/test/test_server.h" 27 #include "net/test/test_server.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
27 29
28 using WebKit::WebInputEvent; 30 using WebKit::WebInputEvent;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 212
211 ContentBrowserTest::SetUp(); 213 ContentBrowserTest::SetUp();
212 } 214 }
213 virtual void TearDown() OVERRIDE { 215 virtual void TearDown() OVERRIDE {
214 content::BrowserPluginEmbedder::set_factory_for_testing(NULL); 216 content::BrowserPluginEmbedder::set_factory_for_testing(NULL);
215 content::BrowserPluginGuest::set_factory_for_testing(NULL); 217 content::BrowserPluginGuest::set_factory_for_testing(NULL);
216 218
217 ContentBrowserTest::TearDown(); 219 ContentBrowserTest::TearDown();
218 } 220 }
219 221
222 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
223 // Enable browser plugin in content_shell for running test.
224 command_line->AppendSwitch(switches::kEnableBrowserPluginForAllViewTypes);
225 }
226
220 static void SimulateTabKeyPress(WebContents* web_contents) { 227 static void SimulateTabKeyPress(WebContents* web_contents) {
221 SimulateKeyPress(web_contents, 228 SimulateKeyPress(web_contents,
222 ui::VKEY_TAB, 229 ui::VKEY_TAB,
223 false, // control. 230 false, // control.
224 false, // shift. 231 false, // shift.
225 false, // alt. 232 false, // alt.
226 false); // command. 233 false); // command.
227 } 234 }
228 235
229 // This helper method does the following: 236 // This helper method does the following:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 instance_map.begin()->second); 285 instance_map.begin()->second);
279 test_guest_ = static_cast<TestBrowserPluginGuest*>( 286 test_guest_ = static_cast<TestBrowserPluginGuest*>(
280 test_guest_web_contents->GetBrowserPluginGuest()); 287 test_guest_web_contents->GetBrowserPluginGuest());
281 test_guest_->WaitForUpdateRectMsg(); 288 test_guest_->WaitForUpdateRectMsg();
282 } 289 }
283 290
284 TestBrowserPluginEmbedder* test_embedder() const { return test_embedder_; } 291 TestBrowserPluginEmbedder* test_embedder() const { return test_embedder_; }
285 TestBrowserPluginGuest* test_guest() const { return test_guest_; } 292 TestBrowserPluginGuest* test_guest() const { return test_guest_; }
286 293
287 private: 294 private:
288 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest);
289 TestBrowserPluginEmbedder* test_embedder_; 295 TestBrowserPluginEmbedder* test_embedder_;
290 TestBrowserPluginGuest* test_guest_; 296 TestBrowserPluginGuest* test_guest_;
297 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest);
291 }; 298 };
292 299
293 // This test loads a guest that has infinite loop, therefore it hangs the guest 300 // This test loads a guest that has infinite loop, therefore it hangs the guest
294 // and eventually gets killed. 301 // and eventually gets killed.
295 // TODO(lazyboy): This test is flaky on Windows, since this relies on 302 // TODO(lazyboy): This test is flaky on Windows, since this relies on
296 // RenderViewGone to be called and times out. http://crbug.com/151190. 303 // RenderViewGone to be called and times out. http://crbug.com/151190.
297 #if defined(OS_WIN) 304 #if defined(OS_WIN)
298 #define MAYBE_NavigateGuest DISABLED_NavigateGuest 305 #define MAYBE_NavigateGuest DISABLED_NavigateGuest
299 #else 306 #else
300 #define MAYBE_NavigateGuest NavigateGuest 307 #define MAYBE_NavigateGuest NavigateGuest
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 EXPECT_TRUE(v->GetAsString(&result)); 703 EXPECT_TRUE(v->GetAsString(&result));
697 EXPECT_EQ(redirect_url.spec().c_str(), result); 704 EXPECT_EQ(redirect_url.spec().c_str(), result);
698 705
699 v = rvh->ExecuteJavascriptAndGetValue( 706 v = rvh->ExecuteJavascriptAndGetValue(
700 string16(), ASCIIToUTF16("redirectNewUrl")); 707 string16(), ASCIIToUTF16("redirectNewUrl"));
701 EXPECT_TRUE(v->GetAsString(&result)); 708 EXPECT_TRUE(v->GetAsString(&result));
702 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); 709 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result);
703 } 710 }
704 711
705 } // namespace content 712 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698