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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 namespace browser_sync { | 45 namespace browser_sync { |
46 | 46 |
47 using content::BrowserThread; | 47 using content::BrowserThread; |
48 using syncer::BaseNode; | 48 using syncer::BaseNode; |
49 using testing::_; | 49 using testing::_; |
50 using testing::InvokeWithoutArgs; | 50 using testing::InvokeWithoutArgs; |
51 using testing::Mock; | 51 using testing::Mock; |
52 using testing::StrictMock; | 52 using testing::StrictMock; |
53 | 53 |
| 54 #if defined(OS_ANDROID) |
| 55 static const bool kExpectMobileBookmarks = true; |
| 56 #else |
| 57 static const bool kExpectMobileBookmarks = false; |
| 58 #endif // defined(OS_ANDROID) |
| 59 |
54 class TestBookmarkModelAssociator : public BookmarkModelAssociator { | 60 class TestBookmarkModelAssociator : public BookmarkModelAssociator { |
55 public: | 61 public: |
56 TestBookmarkModelAssociator( | 62 TestBookmarkModelAssociator( |
57 BookmarkModel* bookmark_model, | 63 BookmarkModel* bookmark_model, |
58 syncer::UserShare* user_share, | 64 syncer::UserShare* user_share, |
59 DataTypeErrorHandler* error_handler) | 65 DataTypeErrorHandler* error_handler) |
60 : BookmarkModelAssociator(bookmark_model, user_share, | 66 : BookmarkModelAssociator(bookmark_model, user_share, |
61 error_handler, | 67 error_handler, |
62 true /* expect_mobile_bookmarks_folder */), | 68 kExpectMobileBookmarks), |
63 user_share_(user_share) {} | 69 user_share_(user_share) {} |
64 | 70 |
65 // TODO(akalin): This logic lazily creates any tagged node that is | 71 // TODO(akalin): This logic lazily creates any tagged node that is |
66 // requested. A better way would be to have utility functions to | 72 // requested. A better way would be to have utility functions to |
67 // create sync nodes from some bookmark structure and to use that. | 73 // create sync nodes from some bookmark structure and to use that. |
68 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { | 74 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { |
69 std::string tag_str = std::string(tag.c_str(), tag.length()); | 75 std::string tag_str = std::string(tag.c_str(), tag.length()); |
70 bool root_exists = false; | 76 bool root_exists = false; |
71 syncer::ModelType type = model_type(); | 77 syncer::ModelType type = model_type(); |
72 { | 78 { |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 EXPECT_EQ(1, observer.get_started()); | 1498 EXPECT_EQ(1, observer.get_started()); |
1493 EXPECT_EQ(0, observer.get_completed_count_at_started()); | 1499 EXPECT_EQ(0, observer.get_completed_count_at_started()); |
1494 EXPECT_EQ(1, observer.get_completed()); | 1500 EXPECT_EQ(1, observer.get_completed()); |
1495 | 1501 |
1496 model_->RemoveObserver(&observer); | 1502 model_->RemoveObserver(&observer); |
1497 } | 1503 } |
1498 | 1504 |
1499 } // namespace | 1505 } // namespace |
1500 | 1506 |
1501 } // namespace browser_sync | 1507 } // namespace browser_sync |
OLD | NEW |