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

Unified Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 2781413002: [Push API] Fix flaky PushEventNotificationWithoutEventWaitUntil (Closed)
Patch Set: Created 3 years, 9 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/browser/push_messaging/push_messaging_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/push_messaging/push_messaging_browsertest.cc
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index 2223632e9af962ed3ffbbc501f7f1731866bcb01..4195749f189102835ab8558f715b7cce71851fd0 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -1466,10 +1466,11 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
ASSERT_TRUE(RunScript("isControlled()", &script_result));
ASSERT_EQ("true - is controlled", script_result);
- scoped_refptr<content::MessageLoopRunner> message_loop_runner =
- new content::MessageLoopRunner;
- notification_manager()->SetNotificationAddedCallback(
- message_loop_runner->QuitClosure());
+ base::RunLoop run_loop;
+ base::Closure quit_barrier =
+ base::BarrierClosure(2 /* num_closures */, run_loop.QuitClosure());
+ push_service()->SetMessageCallbackForTesting(quit_barrier);
+ notification_manager()->SetNotificationAddedCallback(quit_barrier);
gcm::IncomingMessage message;
message.sender_id = GetTestApplicationServerKey();
@@ -1481,7 +1482,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("immediate:shownotification-without-waituntil", script_result);
- message_loop_runner->Run();
+ run_loop.Run();
EXPECT_TRUE(IsRegisteredKeepAliveEqualTo(false));
ASSERT_EQ(1u, notification_manager()->GetNotificationCount());
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698