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

Unified Diff: chrome/browser/extensions/web_view_browsertest.cc

Issue 15741014: Fix WebViewTest.MediaAccessAPIAllow* flakiness/timeout on chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 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 | chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/web_view_browsertest.cc
diff --git a/chrome/browser/extensions/web_view_browsertest.cc b/chrome/browser/extensions/web_view_browsertest.cc
index 4d830c5779866a5250c1747e60a4b3bcabdbbf2a..c9135e280c91a4f097a5584eeea87ec1efc5ed42 100644
--- a/chrome/browser/extensions/web_view_browsertest.cc
+++ b/chrome/browser/extensions/web_view_browsertest.cc
@@ -404,6 +404,8 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
return guest_web_contents;
}
+ void MediaAccessAPIAllowTestHelper(const std::string& test_name);
+
private:
scoped_ptr<content::FakeSpeechRecognitionManager>
fake_speech_recognition_manager_;
@@ -845,13 +847,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_MediaAccessAPIDeny) {
"platform_apps/web_view/media_access/deny")) << message_;
}
-// Disabled for being flaky: http://crbug.com/238662
-#if defined(OS_CHROMEOS)
-#define MAYBE_MediaAccessAPIAllow DISABLED_MediaAccessAPIAllow
-#else
-#define MAYBE_MediaAccessAPIAllow MediaAccessAPIAllow
-#endif
-IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_MediaAccessAPIAllow) {
+void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) {
ASSERT_TRUE(StartTestServer()); // For serving guest pages.
ExtensionTestMessageListener launched_listener("Launched", false);
LoadAndLaunchPlatformApp("web_view/media_access/allow");
@@ -863,31 +859,32 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_MediaAccessAPIAllow) {
MockWebContentsDelegate* mock = new MockWebContentsDelegate;
embedder_web_contents->SetDelegate(mock);
- const size_t num_tests = 4;
- std::string test_names[num_tests] = {
- "testAllow",
- "testAllowAndThenDeny",
- "testAllowTwice",
- "testAllowAsync",
- };
- for (size_t i = 0; i < num_tests; ++i) {
- ExtensionTestMessageListener done_listener("DoneMediaTest", false);
- EXPECT_TRUE(
- content::ExecuteScript(
- embedder_web_contents,
- base::StringPrintf("startAllowTest('%s')",
- test_names[i].c_str())));
- done_listener.WaitUntilSatisfied();
+ ExtensionTestMessageListener done_listener("DoneMediaTest.PASSED", false);
+ done_listener.AlsoListenForFailureMessage("DoneMediaTest.FAILED");
+ EXPECT_TRUE(
+ content::ExecuteScript(
+ embedder_web_contents,
+ base::StringPrintf("startAllowTest('%s')",
+ test_name.c_str())));
+ ASSERT_TRUE(done_listener.WaitUntilSatisfied());
- std::string result;
- EXPECT_TRUE(
- content::ExecuteScriptAndExtractString(
- embedder_web_contents,
- "window.domAutomationController.send(getTestStatus())", &result));
- ASSERT_EQ(std::string("PASSED"), result);
+ mock->WaitForSetMediaPermission();
+}
- mock->WaitForSetMediaPermission();
- }
+IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllow) {
+ MediaAccessAPIAllowTestHelper("testAllow");
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAndThenDeny) {
+ MediaAccessAPIAllowTestHelper("testAllowAndThenDeny");
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowTwice) {
+ MediaAccessAPIAllowTestHelper("testAllowTwice");
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAsync) {
+ MediaAccessAPIAllowTestHelper("testAllowAsync");
}
// Checks that window.screenX/screenY/screenLeft/screenTop works correctly for
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698