Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/test/histogram_tester.h" | 6 #include "base/test/histogram_tester.h" |
| 7 #include "chrome/browser/sessions/session_service.h" | 7 #include "chrome/browser/sessions/session_service.h" |
| 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 11 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" | 11 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" |
| 12 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h " | 12 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h " |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "components/browser_sync/profile_sync_service.h" | 15 #include "components/browser_sync/profile_sync_service.h" |
| 16 #include "components/history/core/browser/history_types.h" | 16 #include "components/history/core/browser/history_types.h" |
| 17 #include "components/sessions/core/session_types.h" | 17 #include "components/sessions/core/session_types.h" |
| 18 #include "components/sync/base/time.h" | 18 #include "components/sync/base/time.h" |
| 19 #include "components/sync/driver/sync_driver_switches.h" | 19 #include "components/sync/driver/sync_driver_switches.h" |
| 20 #include "components/sync/test/fake_server/fake_server_verifier.h" | 20 #include "components/sync/test/fake_server/fake_server_verifier.h" |
| 21 #include "components/sync/test/fake_server/sessions_hierarchy.h" | 21 #include "components/sync/test/fake_server/sessions_hierarchy.h" |
| 22 | 22 |
| 23 #if defined(OS_CHROMEOS) | |
| 24 #include "chromeos/chromeos_switches.h" | |
| 25 #endif | |
| 26 | |
| 23 using base::HistogramBase; | 27 using base::HistogramBase; |
| 24 using base::HistogramSamples; | 28 using base::HistogramSamples; |
| 25 using base::HistogramTester; | 29 using base::HistogramTester; |
| 26 using fake_server::SessionsHierarchy; | 30 using fake_server::SessionsHierarchy; |
| 27 using sessions_helper::CheckInitialState; | 31 using sessions_helper::CheckInitialState; |
| 28 using sessions_helper::GetLocalWindows; | 32 using sessions_helper::GetLocalWindows; |
| 29 using sessions_helper::GetSessionData; | 33 using sessions_helper::GetSessionData; |
| 30 using sessions_helper::ModelAssociatorHasTabWithUrl; | 34 using sessions_helper::ModelAssociatorHasTabWithUrl; |
| 31 using sessions_helper::OpenTabAndGetLocalWindows; | 35 using sessions_helper::OpenTabAndGetLocalWindows; |
| 32 using sessions_helper::ScopedWindowMap; | 36 using sessions_helper::ScopedWindowMap; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 59 void SetUpCommandLine(base::CommandLine* cl) override { | 63 void SetUpCommandLine(base::CommandLine* cl) override { |
| 60 // This is a hacky override of the switches set in | 64 // This is a hacky override of the switches set in |
| 61 // SyncTest::SetUpCommandLine() to avoid the switch that speeds up nudge | 65 // SyncTest::SetUpCommandLine() to avoid the switch that speeds up nudge |
| 62 // delays. CookieJarMismatch asserts exact histogram counts assuming that | 66 // delays. CookieJarMismatch asserts exact histogram counts assuming that |
| 63 // sync is relatively slow, so we preserve that assumption. | 67 // sync is relatively slow, so we preserve that assumption. |
| 64 if (!cl->HasSwitch(switches::kDisableBackgroundNetworking)) | 68 if (!cl->HasSwitch(switches::kDisableBackgroundNetworking)) |
| 65 cl->AppendSwitch(switches::kDisableBackgroundNetworking); | 69 cl->AppendSwitch(switches::kDisableBackgroundNetworking); |
| 66 | 70 |
| 67 if (!cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) | 71 if (!cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) |
| 68 cl->AppendSwitch(switches::kSyncShortInitialRetryOverride); | 72 cl->AppendSwitch(switches::kSyncShortInitialRetryOverride); |
| 73 | |
| 74 SyncTest::SetUpCommandLine(cl); | |
|
Patrick Noland
2017/02/22 01:04:43
This will probably make CookieJarMismatch flaky ag
Gang Wu
2017/02/22 06:32:03
Done.
| |
| 69 } | 75 } |
| 70 | 76 |
| 71 private: | 77 private: |
| 72 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); | 78 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) { | 81 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) { |
| 76 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 82 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 77 | 83 |
| 78 ASSERT_TRUE(CheckInitialState(0)); | 84 ASSERT_TRUE(CheckInitialState(0)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 // Verify the cookie jar mismatch bool is set to false. | 242 // Verify the cookie jar mismatch bool is set to false. |
| 237 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); | 243 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); |
| 238 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); | 244 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); |
| 239 | 245 |
| 240 // Verify the histograms were recorded properly. | 246 // Verify the histograms were recorded properly. |
| 241 ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation", | 247 ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation", |
| 242 true, 1); | 248 true, 1); |
| 243 histogram_tester.ExpectTotalCount("Sync.CookieJarEmptyOnMismatch", 0); | 249 histogram_tester.ExpectTotalCount("Sync.CookieJarEmptyOnMismatch", 0); |
| 244 } | 250 } |
| 245 } | 251 } |
| OLD | NEW |