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