| 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 // TODO(akalin): This file is basically just a unit test for | 5 // TODO(akalin): This file is basically just a unit test for |
| 6 // BookmarkChangeProcessor. Write unit tests for | 6 // BookmarkChangeProcessor. Write unit tests for |
| 7 // BookmarkModelAssociator separately. | 7 // BookmarkModelAssociator separately. |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 using testing::StrictMock; | 48 using testing::StrictMock; |
| 49 using content::BrowserThread; | 49 using content::BrowserThread; |
| 50 | 50 |
| 51 class TestBookmarkModelAssociator : public BookmarkModelAssociator { | 51 class TestBookmarkModelAssociator : public BookmarkModelAssociator { |
| 52 public: | 52 public: |
| 53 TestBookmarkModelAssociator( | 53 TestBookmarkModelAssociator( |
| 54 BookmarkModel* bookmark_model, | 54 BookmarkModel* bookmark_model, |
| 55 sync_api::UserShare* user_share, | 55 sync_api::UserShare* user_share, |
| 56 DataTypeErrorHandler* error_handler) | 56 DataTypeErrorHandler* error_handler) |
| 57 : BookmarkModelAssociator(bookmark_model, user_share, | 57 : BookmarkModelAssociator(bookmark_model, user_share, |
| 58 error_handler), | 58 error_handler, |
| 59 true /* expect_mobile_bookmarks_folder */), |
| 59 user_share_(user_share) {} | 60 user_share_(user_share) {} |
| 60 | 61 |
| 61 // TODO(akalin): This logic lazily creates any tagged node that is | 62 // TODO(akalin): This logic lazily creates any tagged node that is |
| 62 // requested. A better way would be to have utility functions to | 63 // requested. A better way would be to have utility functions to |
| 63 // create sync nodes from some bookmark structure and to use that. | 64 // create sync nodes from some bookmark structure and to use that. |
| 64 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { | 65 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { |
| 65 std::string tag_str = std::string(tag.c_str(), tag.length()); | 66 std::string tag_str = std::string(tag.c_str(), tag.length()); |
| 66 bool root_exists = false; | 67 bool root_exists = false; |
| 67 syncable::ModelType type = model_type(); | 68 syncable::ModelType type = model_type(); |
| 68 { | 69 { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 model_(NULL) { | 326 model_(NULL) { |
| 326 } | 327 } |
| 327 | 328 |
| 328 virtual ~ProfileSyncServiceBookmarkTest() { | 329 virtual ~ProfileSyncServiceBookmarkTest() { |
| 329 StopSync(); | 330 StopSync(); |
| 330 UnloadBookmarkModel(); | 331 UnloadBookmarkModel(); |
| 331 } | 332 } |
| 332 | 333 |
| 333 virtual void SetUp() { | 334 virtual void SetUp() { |
| 334 test_user_share_.SetUp(); | 335 test_user_share_.SetUp(); |
| 335 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 336 switches::kCreateMobileBookmarksFolder); | |
| 337 } | 336 } |
| 338 | 337 |
| 339 virtual void TearDown() { | 338 virtual void TearDown() { |
| 340 test_user_share_.TearDown(); | 339 test_user_share_.TearDown(); |
| 341 } | 340 } |
| 342 | 341 |
| 343 // Load (or re-load) the bookmark model. |load| controls use of the | 342 // Load (or re-load) the bookmark model. |load| controls use of the |
| 344 // bookmarks file on disk. |save| controls whether the newly loaded | 343 // bookmarks file on disk. |save| controls whether the newly loaded |
| 345 // bookmark model will write out a bookmark file as it goes. | 344 // bookmark model will write out a bookmark file as it goes. |
| 346 void LoadBookmarkModel(LoadOption load, SaveOption save) { | 345 void LoadBookmarkModel(LoadOption load, SaveOption save) { |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 EXPECT_EQ(1, observer.get_started()); | 1486 EXPECT_EQ(1, observer.get_started()); |
| 1488 EXPECT_EQ(0, observer.get_completed_count_at_started()); | 1487 EXPECT_EQ(0, observer.get_completed_count_at_started()); |
| 1489 EXPECT_EQ(1, observer.get_completed()); | 1488 EXPECT_EQ(1, observer.get_completed()); |
| 1490 | 1489 |
| 1491 model_->RemoveObserver(&observer); | 1490 model_->RemoveObserver(&observer); |
| 1492 } | 1491 } |
| 1493 | 1492 |
| 1494 } // namespace | 1493 } // namespace |
| 1495 | 1494 |
| 1496 } // namespace browser_sync | 1495 } // namespace browser_sync |
| OLD | NEW |