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

Side by Side Diff: chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc

Issue 2694503002: [USS] Fix USS in sync_integration_tests in chromeos (Closed)
Patch Set: add comments Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/two_client_uss_sync_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // kIgnoreUserProfileMappingForTests will let UserManager always return active
skym 2017/02/22 15:45:40 This indentation is wrong now.
Gang Wu 2017/02/22 16:02:08 Done.
75 // user. If not set this switch, sync test's profile will not match
skym 2017/02/22 15:45:40 If this switch is not set,
Gang Wu 2017/02/22 16:02:08 Done.
76 // UserManager's active user, then UserManager won't return active user to our
77 // tests.
78 #if defined(OS_CHROMEOS)
79 if (!cl->HasSwitch(chromeos::switches::kIgnoreUserProfileMappingForTests))
80 cl->AppendSwitch(chromeos::switches::kIgnoreUserProfileMappingForTests);
81 #endif
69 } 82 }
70 83
71 private: 84 private:
72 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); 85 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest);
73 }; 86 };
74 87
75 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) { 88 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) {
76 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 89 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
77 90
78 ASSERT_TRUE(CheckInitialState(0)); 91 ASSERT_TRUE(CheckInitialState(0));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Verify the cookie jar mismatch bool is set to false. 249 // Verify the cookie jar mismatch bool is set to false.
237 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); 250 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message));
238 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); 251 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch());
239 252
240 // Verify the histograms were recorded properly. 253 // Verify the histograms were recorded properly.
241 ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation", 254 ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation",
242 true, 1); 255 true, 1);
243 histogram_tester.ExpectTotalCount("Sync.CookieJarEmptyOnMismatch", 0); 256 histogram_tester.ExpectTotalCount("Sync.CookieJarEmptyOnMismatch", 0);
244 } 257 }
245 } 258 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/two_client_uss_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698