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

Unified Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 271593009: Rewrite AcceptTouchEvents test from content_browsertests to browser_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove repeat macro + remove content_browsertests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/accept_touch_events/test.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_plugin/browser_plugin_host_browsertest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
index d693b8abe3bfe53c62b7b551ef8ab9299eccfb8e..97203e2fe0fb73df95ad332f482649ce615c9602 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -54,20 +54,6 @@ using content::WebContentsImpl;
const char kHTMLForGuest[] =
"data:text/html,<html><body>hello world</body></html>";
-const char kHTMLForGuestTouchHandler[] =
- "data:text/html,<html><body><div id=\"touch\">With touch</div></body>"
- "<script type=\"text/javascript\">"
- "function handler() {}"
- "function InstallTouchHandler() { "
- " document.getElementById(\"touch\").addEventListener(\"touchstart\", "
- " handler);"
- "}"
- "function UninstallTouchHandler() { "
- " document.getElementById(\"touch\").removeEventListener(\"touchstart\", "
- " handler);"
- "}"
- "</script></html>";
-
const char kHTMLForGuestAcceptDrag[] =
"data:text/html,<html><body>"
"<script>"
@@ -161,47 +147,6 @@ class TestShortHangTimeoutGuestFactory : public TestBrowserPluginHostFactory {
DISALLOW_COPY_AND_ASSIGN(TestShortHangTimeoutGuestFactory);
};
-// A transparent observer that can be used to verify that a RenderViewHost
-// received a specific message.
-class MessageObserver : public WebContentsObserver {
- public:
- MessageObserver(WebContents* web_contents, uint32 message_id)
- : WebContentsObserver(web_contents),
- message_id_(message_id),
- message_received_(false) {
- }
-
- virtual ~MessageObserver() {}
-
- void WaitUntilMessageReceived() {
- if (message_received_)
- return;
- message_loop_runner_ = new MessageLoopRunner();
- message_loop_runner_->Run();
- }
-
- void ResetState() {
- message_received_ = false;
- }
-
- // IPC::Listener implementation.
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
- if (message.type() == message_id_) {
- message_received_ = true;
- if (message_loop_runner_)
- message_loop_runner_->Quit();
- }
- return false;
- }
-
- private:
- scoped_refptr<MessageLoopRunner> message_loop_runner_;
- uint32 message_id_;
- bool message_received_;
-
- DISALLOW_COPY_AND_ASSIGN(MessageObserver);
-};
-
class BrowserPluginHostTest : public ContentBrowserTest {
public:
BrowserPluginHostTest()
@@ -424,36 +369,6 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, MAYBE_EmbedderSameAfterNav) {
ASSERT_EQ(test_embedder_after_nav, test_embedder());
}
-// Verifies that installing/uninstalling touch-event handlers in the guest
-// plugin correctly updates the touch-event handling state in the embedder.
-IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AcceptTouchEvents) {
- const char kEmbedderURL[] = "/browser_plugin_embedder.html";
- StartBrowserPluginTest(
- kEmbedderURL, kHTMLForGuestTouchHandler, true, std::string());
-
- RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
- test_embedder()->web_contents()->GetRenderViewHost());
- // The embedder should not have any touch event handlers at this point.
- EXPECT_FALSE(rvh->has_touch_handler());
-
- // Install the touch handler in the guest. This should cause the embedder to
- // start listening for touch events too.
- MessageObserver observer(test_embedder()->web_contents(),
- ViewHostMsg_HasTouchEventHandlers::ID);
- ExecuteSyncJSFunction(test_guest()->web_contents()->GetMainFrame(),
- "InstallTouchHandler();");
- observer.WaitUntilMessageReceived();
- EXPECT_TRUE(rvh->has_touch_handler());
-
- // Uninstalling the touch-handler in guest should cause the embedder to stop
- // listening for touch events.
- observer.ResetState();
- ExecuteSyncJSFunction(test_guest()->web_contents()->GetMainFrame(),
- "UninstallTouchHandler();");
- observer.WaitUntilMessageReceived();
- EXPECT_FALSE(rvh->has_touch_handler());
-}
-
// This tests verifies that reloading the embedder does not crash the browser
// and that the guest is reset.
IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DISABLED_ReloadEmbedder) {
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/accept_touch_events/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698