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

Unified Diff: ios/web/webui/web_ui_mojo_inttest.mm

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: rebase 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
Index: ios/web/webui/web_ui_mojo_inttest.mm
diff --git a/ios/web/webui/web_ui_mojo_inttest.mm b/ios/web/webui/web_ui_mojo_inttest.mm
index 64a3d1ea39bf64c7f3ca406ac382f0137b4d323b..ae881f143eba665cdcdc261259350957a85684a0 100644
--- a/ios/web/webui/web_ui_mojo_inttest.mm
+++ b/ios/web/webui/web_ui_mojo_inttest.mm
@@ -7,6 +7,7 @@
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#import "base/test/ios/wait_util.h"
+#include "base/threading/thread_task_runner_handle.h"
#import "ios/web/public/navigation_manager.h"
#include "ios/web/public/web_ui_ios_data_source.h"
#include "ios/web/public/webui/web_ui_ios_controller.h"
@@ -161,7 +162,16 @@ TEST_F(WebUIMojoTest, MessageExchange) {
// Wait until |TestUIHandler| receives "ack" message from WebUI page.
base::test::ios::WaitUntilCondition(^{
- base::RunLoop().RunUntilIdle();
+ // Flush any pending tasks. Don't RunUntilIdle() because
+ // RunUntilIdle() is incompatible with mojo::SimpleWatcher's
+ // automatic arming behavior, which Mojo JS still depends upon.
+ //
+ // TODO(rockot): Introduce the full watcher API to JS and get rid
+ // of this hack.
+ base::RunLoop loop;
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ loop.QuitClosure());
+ loop.Run();
return test_ui_handler()->IsFinReceived();
});
}

Powered by Google App Engine
This is Rietveld 408576698