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

Unified Diff: components/arc/test/fake_app_instance.cc

Issue 1551763002: arc-bridge: Expose the Mojo version number of the interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Created 5 years 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: components/arc/test/fake_app_instance.cc
diff --git a/components/arc/test/fake_app_instance.cc b/components/arc/test/fake_app_instance.cc
index 15a49c7456257163cf68badbc0764c281d1f76ab..2ea1ff0255e0e529c187991612e32f6341a9a144 100644
--- a/components/arc/test/fake_app_instance.cc
+++ b/components/arc/test/fake_app_instance.cc
@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "base/run_loop.h"
#include "mojo/common/common_type_converters.h"
namespace mojo {
@@ -109,8 +110,18 @@ void FakeAppInstance::WaitForIncomingMethodCall() {
}
void FakeAppInstance::WaitForOnAppInstanceReady() {
- WaitForIncomingMethodCall(); // Wait for Init().
- WaitForIncomingMethodCall(); // Wait for RefreshAppList().
+ // Several messages are sent back and forth when OnAppInstanceReady() is
+ // called. Normally, it would be preferred to use a single
+ // WaitForIncomingMethodCall() to wait for each method individually, but
+ // QueryVersion() does require processing on the I/O thread, so
+ // RunUntilIdle() is required to correctly dispatch it. On slower machines
+ // (and when running under Valgrind), the two thread hops needed to send and
+ // dispatch each Mojo message might not be picked up by a single
+ // RunUntilIdle(), so keep pumping the message loop until all expected
+ // messages are.
+ while (refresh_app_list_count_ != 1) {
+ base::RunLoop().RunUntilIdle();
+ }
}
} // namespace arc
« components/arc/arc_bridge_service.h ('K') | « components/arc/arc_bridge_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698