| 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/sessions_helper.h" | 8 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" | 11 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" |
| 11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 12 #include "components/browser_sync/browser/profile_sync_service.h" | 13 #include "components/browser_sync/browser/profile_sync_service.h" |
| 13 #include "components/history/core/browser/history_types.h" | 14 #include "components/history/core/browser/history_types.h" |
| 14 #include "components/sessions/core/session_types.h" | 15 #include "components/sessions/core/session_types.h" |
| 15 #include "sync/test/fake_server/fake_server_verifier.h" | 16 #include "sync/test/fake_server/fake_server_verifier.h" |
| 16 #include "sync/test/fake_server/sessions_hierarchy.h" | 17 #include "sync/test/fake_server/sessions_hierarchy.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator | 146 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator |
| 146 it3 = (*it2)->navigations.begin(); | 147 it3 = (*it2)->navigations.begin(); |
| 147 it3 != (*it2)->navigations.end(); ++it3) { | 148 it3 != (*it2)->navigations.end(); ++it3) { |
| 148 EXPECT_EQ(200, it3->http_status_code()); | 149 EXPECT_EQ(200, it3->http_status_code()); |
| 149 ++found_navigations; | 150 ++found_navigations; |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 } | 153 } |
| 153 ASSERT_EQ(1, found_navigations); | 154 ASSERT_EQ(1, found_navigations); |
| 154 } | 155 } |
| 156 |
| 157 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CookieJarMismatch) { |
| 158 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 159 |
| 160 ASSERT_TRUE(CheckInitialState(0)); |
| 161 |
| 162 // Add a new session to client 0 and wait for it to sync. |
| 163 ScopedWindowMap old_windows; |
| 164 GURL url = GURL("http://127.0.0.1/bubba"); |
| 165 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); |
| 166 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 167 |
| 168 // 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 // web content signin flow). |
| 171 sync_pb::ClientToServerMessage message; |
| 172 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); |
| 173 ASSERT_TRUE(message.commit().config_params().cookie_jar_mismatch()); |
| 174 |
| 175 // Trigger a cookie jar change (user signing in to content area). |
| 176 gaia::ListedAccount signed_in_account; |
| 177 signed_in_account.gaia_id = |
| 178 GetClient(0)->service()->signin()->GetAuthenticatedAccountId(); |
| 179 std::vector<gaia::ListedAccount> accounts; |
| 180 accounts.push_back(signed_in_account); |
| 181 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); |
| 182 GetClient(0)->service()->OnGaiaAccountsInCookieUpdated(accounts, error); |
| 183 |
| 184 // Trigger a sync and wait for it. |
| 185 url = GURL("http://127.0.0.1/bubba2"); |
| 186 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, old_windows.GetMutable())); |
| 187 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 188 |
| 189 // Verify the cookie jar mismatch bool is set to false. |
| 190 ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); |
| 191 ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); |
| 192 } |
| OLD | NEW |