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

Unified Diff: components/sync/test/fake_server/fake_server_verifier.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
Index: components/sync/test/fake_server/fake_server_verifier.cc
diff --git a/components/sync/test/fake_server/fake_server_verifier.cc b/components/sync/test/fake_server/fake_server_verifier.cc
index daccde28b70c60bd04b1e8b7790b7b0597c22ce0..10f68c812f6c1a66c7b0fe17100c5072baf5460f 100644
--- a/components/sync/test/fake_server/fake_server_verifier.cc
+++ b/components/sync/test/fake_server/fake_server_verifier.cc
@@ -147,10 +147,21 @@ AssertionResult FakeServerVerifier::VerifySessions(
if (session_specifics.has_header()) {
session_header = session_specifics.header();
} else if (session_specifics.has_tab()) {
- sync_pb::SessionTab tab = session_specifics.tab();
- tab_ids_to_window_ids[tab.tab_id()] = tab.window_id();
- tab_ids_to_urls[tab.tab_id()] =
- tab.navigation(tab.current_navigation_index()).virtual_url();
+ const sync_pb::SessionTab& tab = session_specifics.tab();
+ const sync_pb::TabNavigation& nav =
+ tab.navigation(tab.current_navigation_index());
+ // Only read from tabs that have a title on their current navigation
+ // entry. This the result of an oddity around the timing of sessions
+ // related changes. Sometimes when opening a new window, the first
+ // navigation will be committed before the title has been set. Then a
+ // subsequent commit will go through for that same navigation. Because
+ // this logic is used to ensure synchronization, we are going to exclude
+ // partially omitted navigations. The full navigation should typically be
+ // committed in full immediately after we fail a check because of this.
+ if (nav.has_title()) {
+ tab_ids_to_window_ids[tab.tab_id()] = tab.window_id();
+ tab_ids_to_urls[tab.tab_id()] = nav.virtual_url();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698