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

Unified Diff: chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc

Issue 2751333007: [Sync] Try to fix race conditions in CookieJarMismatch. (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 | components/browser_sync/profile_sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
index 92be5ac0857c7914241041c20d3e04922c918960..6003ec8a0ff4d03079a1e96f92b406997d357fc4 100644
--- a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/macros.h"
+#include "base/run_loop.h"
#include "base/test/histogram_tester.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
@@ -324,7 +325,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TabMovedToOtherWindow) {
}
// crbug.com/689662
-#if defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_CHROMEOS)
#define MAYBE_CookieJarMismatch DISABLED_CookieJarMismatch
#else
#define MAYBE_CookieJarMismatch CookieJarMismatch
@@ -351,25 +352,32 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, MAYBE_CookieJarMismatch) {
ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message));
ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch());
- // It is possible that multiple sync cycles occured during the call to
+ // It is possible that multiple sync cycles occurred during the call to
// OpenTab, which would cause multiple identical samples.
ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation",
false, 1);
ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarEmptyOnMismatch",
true, 1);
-
- // Trigger a cookie jar change (user signing in to content area).
- gaia::ListedAccount signed_in_account;
- signed_in_account.id =
- GetClient(0)->service()->signin()->GetAuthenticatedAccountId();
- std::vector<gaia::ListedAccount> accounts;
- std::vector<gaia::ListedAccount> signed_out_accounts;
- accounts.push_back(signed_in_account);
- GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
- GetClient(0)->service()->OnGaiaAccountsInCookieUpdated(
- accounts, signed_out_accounts, error);
}
+ // Trigger a cookie jar change (user signing in to content area).
+ gaia::ListedAccount signed_in_account;
+ signed_in_account.id =
+ GetClient(0)->service()->signin()->GetAuthenticatedAccountId();
+ std::vector<gaia::ListedAccount> accounts;
+ std::vector<gaia::ListedAccount> signed_out_accounts;
+ accounts.push_back(signed_in_account);
+ GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
+
+ // Updating the cookie jar has to travel to the sync engine. It is possible
+ // something is already running or scheduled to run on the sync thread. We
+ // want to block here and not create the HistogramTester below until we know
+ // the cookie jar stats have been updated.
+ base::RunLoop run_loop;
+ GetClient(0)->service()->OnGaiaAccountsInCookieUpdatedWithCallback(
+ accounts, signed_out_accounts, error, run_loop.QuitClosure());
+ run_loop.Run();
pavely 2017/03/20 04:32:02 Waiting for values to arrive on sync thread doesn'
+
{
HistogramTester histogram_tester;
« no previous file with comments | « no previous file | components/browser_sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698