| 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 "chrome/browser/sessions/session_service.h" | 6 #include "chrome/browser/sessions/session_service.h" |
| 7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 8 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 8 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CookieJarMismatch) { | 157 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CookieJarMismatch) { |
| 158 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 158 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 159 | 159 |
| 160 ASSERT_TRUE(CheckInitialState(0)); | 160 ASSERT_TRUE(CheckInitialState(0)); |
| 161 | 161 |
| 162 // Add a new session to client 0 and wait for it to sync. | 162 // Add a new session to client 0 and wait for it to sync. |
| 163 ScopedWindowMap old_windows; | 163 ScopedWindowMap old_windows; |
| 164 GURL url = GURL("http://127.0.0.1/bubba"); | 164 GURL url = GURL("http://127.0.0.1/bubba"); |
| 165 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); | 165 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); |
| 166 TriggerSyncForModelTypes(0, syncer::ModelTypeSet(syncer::SESSIONS)); |
| 166 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); | 167 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 167 | 168 |
| 168 // The cookie jar mismatch value will be true by default due to | 169 // The cookie jar mismatch value will be true by default due to |
| 169 // the way integration tests trigger signin (which does not involve a normal | 170 // the way integration tests trigger signin (which does not involve a normal |
| 170 // web content signin flow). | 171 // web content signin flow). |
| 171 sync_pb::ClientToServerMessage message; | 172 sync_pb::ClientToServerMessage message; |
| 172 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); | 173 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); |
| 173 ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch()); | 174 ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch()); |
| 174 | 175 |
| 175 // Trigger a cookie jar change (user signing in to content area). | 176 // Trigger a cookie jar change (user signing in to content area). |
| 176 gaia::ListedAccount signed_in_account; | 177 gaia::ListedAccount signed_in_account; |
| 177 signed_in_account.gaia_id = | 178 signed_in_account.gaia_id = |
| 178 GetClient(0)->service()->signin()->GetAuthenticatedAccountId(); | 179 GetClient(0)->service()->signin()->GetAuthenticatedAccountId(); |
| 179 std::vector<gaia::ListedAccount> accounts; | 180 std::vector<gaia::ListedAccount> accounts; |
| 180 accounts.push_back(signed_in_account); | 181 accounts.push_back(signed_in_account); |
| 181 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); | 182 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); |
| 182 GetClient(0)->service()->OnGaiaAccountsInCookieUpdated(accounts, error); | 183 GetClient(0)->service()->OnGaiaAccountsInCookieUpdated(accounts, error); |
| 183 | 184 |
| 184 // Trigger a sync and wait for it. | 185 // Trigger a sync and wait for it. |
| 185 url = GURL("http://127.0.0.1/bubba2"); | 186 url = GURL("http://127.0.0.1/bubba2"); |
| 186 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); | 187 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); |
| 188 TriggerSyncForModelTypes(0, syncer::ModelTypeSet(syncer::SESSIONS)); |
| 187 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); | 189 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 188 | 190 |
| 189 // Verify the cookie jar mismatch bool is set to false. | 191 // Verify the cookie jar mismatch bool is set to false. |
| 190 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); | 192 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); |
| 191 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); | 193 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); |
| 192 } | 194 } |
| OLD | NEW |