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

Unified Diff: chrome/browser/plugins/plugin_power_saver_browsertest.cc

Issue 1132873002: Plugin Power Saver: Fix poster-click flaky test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0275-plugin-power-saver-preserve-js-access-for-throttled-plugins
Patch Set: Created 5 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 | « no previous file | components/plugins/renderer/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_power_saver_browsertest.cc
diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
index 9b0df992ea8d2ae0fcb23ace7fa55d7c704983ef..0f63182b72ebe0163cb11346039fd69fd64e1ff2 100644
--- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc
+++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/ppapi_test_utils.h"
#include "ppapi/shared_impl/ppapi_switches.h"
@@ -97,6 +98,7 @@ class PluginPowerSaverBrowserTest : virtual public InProcessBrowserTest {
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(switches::kEnablePluginPowerSaver);
command_line->AppendSwitch(switches::kEnablePepperTesting);
+ command_line->AppendSwitch(switches::kEnablePluginPlaceholderTesting);
ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line));
}
@@ -123,6 +125,22 @@ class PluginPowerSaverBrowserTest : virtual public InProcessBrowserTest {
// test has missed the above two events.
void SimulateClickAndAwaitMarkedEssential(const char* element_id,
const gfx::Point& point) {
+ // Waits for the placeholder to be ready to be clicked first.
+ std::string result = RunTestScript(
+ "function handleEvent(event) {"
+ " if (event.data === 'placeholderLoaded') {"
+ " window.domAutomationController.send('ready');"
+ " plugin.removeEventListener('message', handleEvent);"
+ " }"
+ "}"
+ "plugin.addEventListener('message', handleEvent);"
+ "if (plugin.hasAttribute('placeholderLoaded')) {"
Lei Zhang 2015/05/11 22:26:20 Just do this instead? if (plugin.hasAttribute('pl
tommycli 2015/05/11 23:24:10 Hi. That's what I initially did, but it flaked out
+ " window.domAutomationController.send('ready');"
+ " plugin.removeEventListener('message', handleEvent);"
+ "}",
+ GetActiveWebContents(), element_id);
+ EXPECT_EQ("ready", result);
Lei Zhang 2015/05/11 22:26:20 ASSERT_EQ() ? Otherwise, if this fails, you would
tommycli 2015/05/11 23:24:10 Done. good call
+
content::SimulateMouseClickAt(GetActiveWebContents(), 0 /* modifiers */,
blink::WebMouseEvent::ButtonLeft, point);
@@ -181,9 +199,8 @@ IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest,
EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_embed_srcset"));
}
-// flaky: crbug.com/481687
IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest,
- DISABLED_PluginMarkedEssentialAfterPosterClicked) {
+ PluginMarkedEssentialAfterPosterClicked) {
LoadHTML(
"<object id='plugin' type='application/x-ppapi-tests' "
" width='400' height='100' poster='snapshot1x.png'></object>");
« no previous file with comments | « no previous file | components/plugins/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698