OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/rand_util.h" | 5 #include "base/rand_util.h" |
6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
10 #include "sync/sessions/session_state.h" | 10 #include "sync/sessions/session_state.h" |
11 | 11 |
12 using bookmarks_helper::AddFolder; | 12 using bookmarks_helper::AddFolder; |
13 using bookmarks_helper::AddURL; | 13 using bookmarks_helper::AddURL; |
14 using bookmarks_helper::AllModelsMatch; | 14 using bookmarks_helper::AllModelsMatch; |
15 using bookmarks_helper::AllModelsMatchVerifier; | 15 using bookmarks_helper::AllModelsMatchVerifier; |
16 using bookmarks_helper::ContainsDuplicateBookmarks; | 16 using bookmarks_helper::ContainsDuplicateBookmarks; |
17 using bookmarks_helper::CountBookmarksWithTitlesMatching; | 17 using bookmarks_helper::CountBookmarksWithTitlesMatching; |
18 using bookmarks_helper::CreateFavicon; | 18 using bookmarks_helper::CreateFavicon; |
19 using bookmarks_helper::GetBookmarkBarNode; | 19 using bookmarks_helper::GetBookmarkBarNode; |
20 using bookmarks_helper::GetOtherNode; | 20 using bookmarks_helper::GetOtherNode; |
| 21 using bookmarks_helper::GetSyncedBookmarksNode; |
21 using bookmarks_helper::GetUniqueNodeByURL; | 22 using bookmarks_helper::GetUniqueNodeByURL; |
22 using bookmarks_helper::HasNodeWithURL; | 23 using bookmarks_helper::HasNodeWithURL; |
23 using bookmarks_helper::IndexedFolderName; | 24 using bookmarks_helper::IndexedFolderName; |
24 using bookmarks_helper::IndexedSubfolderName; | 25 using bookmarks_helper::IndexedSubfolderName; |
25 using bookmarks_helper::IndexedSubsubfolderName; | 26 using bookmarks_helper::IndexedSubsubfolderName; |
26 using bookmarks_helper::IndexedURL; | 27 using bookmarks_helper::IndexedURL; |
27 using bookmarks_helper::IndexedURLTitle; | 28 using bookmarks_helper::IndexedURLTitle; |
28 using bookmarks_helper::Move; | 29 using bookmarks_helper::Move; |
29 using bookmarks_helper::Remove; | 30 using bookmarks_helper::Remove; |
30 using bookmarks_helper::ReverseChildOrder; | 31 using bookmarks_helper::ReverseChildOrder; |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 1915 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
1915 ASSERT_TRUE(AllModelsMatchVerifier()); | 1916 ASSERT_TRUE(AllModelsMatchVerifier()); |
1916 | 1917 |
1917 RestartSyncService(0); | 1918 RestartSyncService(0); |
1918 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Restarted sync.")); | 1919 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Restarted sync.")); |
1919 ASSERT_TRUE(AllModelsMatchVerifier()); | 1920 ASSERT_TRUE(AllModelsMatchVerifier()); |
1920 ASSERT_EQ(ProfileSyncService::Status::READY, | 1921 ASSERT_EQ(ProfileSyncService::Status::READY, |
1921 GetClient(0)->GetStatus().summary); | 1922 GetClient(0)->GetStatus().summary); |
1922 ASSERT_EQ(0, GetClient(0)->GetStatus().unsynced_count); | 1923 ASSERT_EQ(0, GetClient(0)->GetStatus().unsynced_count); |
1923 } | 1924 } |
| 1925 |
| 1926 // Trigger the server side creation of Synced Bookmarks. Ensure both clients |
| 1927 // remain syncing afterwards. Add bookmarks to the synced bookmarks folder |
| 1928 // and ensure both clients receive the boomkmark. |
| 1929 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, CreateSyncedBookmarks) { |
| 1930 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 1931 ASSERT_TRUE(AllModelsMatchVerifier()); |
| 1932 |
| 1933 TriggerCreateSyncedBookmarks(); |
| 1934 |
| 1935 // Add a bookmark on Client 0 and ensure it syncs over. This will also trigger |
| 1936 // both clients downloading the new Synced Bookmarks folder. |
| 1937 ASSERT_TRUE(AddURL(0, L"Google", GURL("http://www.google.com"))); |
| 1938 ASSERT_TRUE(AwaitQuiescence()); |
| 1939 ASSERT_TRUE(AllModelsMatch()); |
| 1940 |
| 1941 // Now add a bookmark within the Synced Bookmarks folder and ensure it syncs |
| 1942 // over. |
| 1943 const BookmarkNode* synced_bookmarks = GetSyncedBookmarksNode(0); |
| 1944 ASSERT_TRUE(synced_bookmarks); |
| 1945 ASSERT_TRUE(AddURL(0, synced_bookmarks, 0, L"Google2", |
| 1946 GURL("http://www.google2.com"))); |
| 1947 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 1948 ASSERT_TRUE(AllModelsMatch()); |
| 1949 } |
OLD | NEW |