| 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 6816ff489a25c7007f2d6961d460d769f77ed744..af2afb56d1c9c499f605b38678858e521ff63b0f 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,7 +3,9 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/macros.h"
|
| +#include "base/run_loop.h"
|
| #include "base/test/histogram_tester.h"
|
| +#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/sessions/session_service.h"
|
| #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
|
| #include "chrome/browser/sync/test/integration/session_hierarchy_match_checker.h"
|
| @@ -18,6 +20,9 @@
|
| #include "components/sync/base/time.h"
|
| #include "components/sync/driver/sync_driver_switches.h"
|
| #include "components/sync/test/fake_server/sessions_hierarchy.h"
|
| +#include "components/sync_sessions/sessions_sync_manager.h"
|
| +#include "content/public/browser/notification_service.h"
|
| +#include "content/public/test/test_utils.h"
|
|
|
| using base::HistogramBase;
|
| using base::HistogramSamples;
|
| @@ -282,6 +287,51 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, OpenNewTab) {
|
| SessionsHierarchy({{base_url.spec(), new_tab_url.spec()}}));
|
| }
|
|
|
| +IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
|
| + DoNotSyncTabsOnBrowserShutdown) {
|
| + ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| + ASSERT_TRUE(CheckInitialState(0));
|
| + ASSERT_TRUE(OpenTab(0, GURL(kURL1)));
|
| +
|
| + sync_sessions::SessionsSyncManager* sessions_sync_manager =
|
| + static_cast<sync_sessions::SessionsSyncManager*>(
|
| + GetSyncService(0)->GetSessionsSyncableService());
|
| + EXPECT_FALSE(sessions_sync_manager->GetAllBrowsersClosingForTesting());
|
| +
|
| + content::WindowedNotificationObserver close_all_observer(
|
| + chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
|
| + content::NotificationService::AllSources());
|
| + content::NotificationService::current()->Notify(
|
| + chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
|
| + content::NotificationService::AllSources(),
|
| + content::NotificationService::NoDetails());
|
| + close_all_observer.Wait();
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_TRUE(sessions_sync_manager->GetAllBrowsersClosingForTesting());
|
| +
|
| + content::WindowedNotificationObserver cancel_observer(
|
| + chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
|
| + content::NotificationService::AllSources());
|
| + content::NotificationService::current()->Notify(
|
| + chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
|
| + content::NotificationService::AllSources(),
|
| + content::NotificationService::NoDetails());
|
| + cancel_observer.Wait();
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_FALSE(sessions_sync_manager->GetAllBrowsersClosingForTesting());
|
| +
|
| + content::WindowedNotificationObserver close_observer(
|
| + chrome::NOTIFICATION_BROWSER_CLOSING,
|
| + content::NotificationService::AllSources());
|
| + content::NotificationService::current()->Notify(
|
| + chrome::NOTIFICATION_BROWSER_CLOSING,
|
| + content::Source<Browser>(GetBrowser(0)),
|
| + content::NotificationService::NoDetails());
|
| + close_observer.Wait();
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_TRUE(sessions_sync_manager->GetAllBrowsersClosingForTesting());
|
| +}
|
| +
|
| IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, OpenNewWindow) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(CheckInitialState(0));
|
|
|