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

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

Issue 2266483002: [Sync] Fix account id comparison for cookie jar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 4 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 | components/browser_sync/browser/profile_sync_service.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_integration_test_util.h" 10 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // web content signin flow). 173 // web content signin flow).
174 sync_pb::ClientToServerMessage message; 174 sync_pb::ClientToServerMessage message;
175 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); 175 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message));
176 ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch()); 176 ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch());
177 histogram_tester.ExpectUniqueSample("Sync.CookieJarMatchOnNavigation", false, 177 histogram_tester.ExpectUniqueSample("Sync.CookieJarMatchOnNavigation", false,
178 1); 178 1);
179 histogram_tester.ExpectUniqueSample("Sync.CookieJarEmptyOnMismatch", true, 1); 179 histogram_tester.ExpectUniqueSample("Sync.CookieJarEmptyOnMismatch", true, 1);
180 180
181 // Trigger a cookie jar change (user signing in to content area). 181 // Trigger a cookie jar change (user signing in to content area).
182 gaia::ListedAccount signed_in_account; 182 gaia::ListedAccount signed_in_account;
183 signed_in_account.gaia_id = 183 signed_in_account.id =
184 GetClient(0)->service()->signin()->GetAuthenticatedAccountId(); 184 GetClient(0)->service()->signin()->GetAuthenticatedAccountId();
185 std::vector<gaia::ListedAccount> accounts; 185 std::vector<gaia::ListedAccount> accounts;
186 std::vector<gaia::ListedAccount> signed_out_accounts; 186 std::vector<gaia::ListedAccount> signed_out_accounts;
187 accounts.push_back(signed_in_account); 187 accounts.push_back(signed_in_account);
188 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); 188 GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
189 GetClient(0)->service()->OnGaiaAccountsInCookieUpdated( 189 GetClient(0)->service()->OnGaiaAccountsInCookieUpdated(
190 accounts, signed_out_accounts, error); 190 accounts, signed_out_accounts, error);
191 191
192 // Trigger a sync and wait for it. 192 // Trigger a sync and wait for it.
193 url = GURL("http://127.0.0.1/bubba2"); 193 url = GURL("http://127.0.0.1/bubba2");
194 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); 194 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable()));
195 TriggerSyncForModelTypes(0, syncer::ModelTypeSet(syncer::SESSIONS)); 195 TriggerSyncForModelTypes(0, syncer::ModelTypeSet(syncer::SESSIONS));
196 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); 196 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
197 197
198 // Verify the cookie jar mismatch bool is set to false. 198 // Verify the cookie jar mismatch bool is set to false.
199 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); 199 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message));
200 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); 200 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch());
201 201
202 // Verify the histograms were recorded properly. 202 // Verify the histograms were recorded properly.
203 histogram_tester.ExpectTotalCount("Sync.CookieJarMatchOnNavigation", 2); 203 histogram_tester.ExpectTotalCount("Sync.CookieJarMatchOnNavigation", 2);
204 histogram_tester.ExpectBucketCount("Sync.CookieJarMatchOnNavigation", true, 204 histogram_tester.ExpectBucketCount("Sync.CookieJarMatchOnNavigation", true,
205 1); 205 1);
206 histogram_tester.ExpectUniqueSample("Sync.CookieJarEmptyOnMismatch", true, 1); 206 histogram_tester.ExpectUniqueSample("Sync.CookieJarEmptyOnMismatch", true, 1);
207 } 207 }
OLDNEW
« no previous file with comments | « no previous file | components/browser_sync/browser/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698