Commit 8cf27f85 authored by Alexandre Frechette's avatar Alexandre Frechette Committed by Commit Bot

Enabling NotifySyncOnLanguageDetermined and fix related sync integration tests.

Try to eliminate race condition identified in https://crbug.com/972871#c32 by waiting for the expected navigations on the UI thread.

Bug: 957657, 972871
Change-Id: I54623c37061aabbb81b570572d03f9dede642863
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724662Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Commit-Queue: Alexandre Frechette <frechette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682312}
parent 44454712
......@@ -34,6 +34,7 @@
#include "components/sync_sessions/session_sync_service.h"
#include "components/sync_sessions/session_sync_test_helper.h"
#include "components/sync_sessions/synced_session_tracker.h"
#include "content/public/test/test_navigation_observer.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -485,19 +486,29 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
ASSERT_TRUE(CheckInitialState(0));
GURL first_url = GURL(kURL1);
content::TestNavigationObserver first_url_observer(first_url);
first_url_observer.StartWatchingNewWebContents();
ASSERT_TRUE(OpenTab(0, first_url));
first_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(first_url);
GURL second_url = GURL(kURL2);
content::TestNavigationObserver second_url_observer(second_url);
second_url_observer.WatchExistingWebContents();
NavigateTab(0, second_url);
second_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(second_url);
first_url_observer.WatchExistingWebContents();
NavigateTabBack(0);
first_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(first_url);
ExpectNavigationChain({first_url, second_url});
second_url_observer.WatchExistingWebContents();
NavigateTabForward(0);
second_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(second_url);
ExpectNavigationChain({first_url, second_url});
......@@ -509,25 +520,38 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
ASSERT_TRUE(CheckInitialState(0));
GURL base_url = GURL(kURL1);
content::TestNavigationObserver base_url_observer(base_url);
base_url_observer.StartWatchingNewWebContents();
ASSERT_TRUE(OpenTab(0, base_url));
base_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(base_url);
GURL first_url = GURL(kURL2);
content::TestNavigationObserver first_url_observer(first_url);
first_url_observer.WatchExistingWebContents();
NavigateTab(0, first_url);
first_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(first_url);
// Check that the navigation chain matches the above sequence of {base_url,
// first_url}.
ExpectNavigationChain({base_url, first_url});
base_url_observer.WatchExistingWebContents();
NavigateTabBack(0);
base_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(base_url);
GURL second_url = GURL(kURL3);
content::TestNavigationObserver second_url_observer(second_url);
second_url_observer.WatchExistingWebContents();
NavigateTab(0, second_url);
first_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(second_url);
base_url_observer.WatchExistingWebContents();
NavigateTabBack(0);
base_url_observer.WaitForNavigationFinished();
WaitForURLOnServer(base_url);
// Check that the navigation chain contains second_url where first_url was
......
......@@ -24,7 +24,7 @@ const base::Feature kImprovedGeoLanguageData{"ImprovedGeoLanguageData",
const base::Feature kUseFluentLanguageModel{"UseFluentLanguageModel",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kNotifySyncOnLanguageDetermined{
"NotifySyncOnLanguageDetermined", base::FEATURE_DISABLED_BY_DEFAULT};
"NotifySyncOnLanguageDetermined", base::FEATURE_ENABLED_BY_DEFAULT};
// Base feature for Translate desktop UI experiment
const base::Feature kUseButtonTranslateBubbleUi{
......
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