Commit 03adc7f4 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

Attempt to deflake UkmBrowserTest.RegularPlusIncognitoCheck

crrev.com/c/2340417 replaced a C++ method call with a mojo method call.
Apparently, the method, GetUserDataForAllRegistrations(), is called when
a profile is created on weblayer. It seems we need to wait for the
callback of GetUserDataForAllRegistrations() to be completed when a
profile is created or updated.

Bug: 1115172
Change-Id: I2b5f6614171b3502130127109bbe6822493f5497
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352268Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799383}
parent 4daf6317
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/android/jni_android.h" #include "base/android/jni_android.h"
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/run_loop.h"
#include "weblayer/browser/profile_impl.h" #include "weblayer/browser/profile_impl.h"
#include "weblayer/test/weblayer_browsertests_jni/MetricsTestHelper_jni.h" #include "weblayer/test/weblayer_browsertests_jni/MetricsTestHelper_jni.h"
...@@ -48,7 +49,11 @@ ProfileImpl* CreateProfile(const std::string& name) { ...@@ -48,7 +49,11 @@ ProfileImpl* CreateProfile(const std::string& name) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
Java_MetricsTestHelper_createProfile( Java_MetricsTestHelper_createProfile(
env, base::android::ConvertUTF8ToJavaString(env, name)); env, base::android::ConvertUTF8ToJavaString(env, name));
return GetProfileByName(name); ProfileImpl* profile = GetProfileByName(name);
// Creating a profile may involve storage partition initialization. Wait for
// the initialization to be completed.
base::RunLoop().RunUntilIdle();
return profile;
} }
void DestroyProfile(const std::string& name) { void DestroyProfile(const std::string& name) {
DCHECK(GetProfileByName(name)); DCHECK(GetProfileByName(name));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment