| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stack> | 5 #include <stack> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 using browser_sync::SyncBackendHost; | 47 using browser_sync::SyncBackendHost; |
| 48 using browser_sync::SyncBackendHostMock; | 48 using browser_sync::SyncBackendHostMock; |
| 49 using browser_sync::UnrecoverableErrorHandler; | 49 using browser_sync::UnrecoverableErrorHandler; |
| 50 using testing::_; | 50 using testing::_; |
| 51 using testing::Return; | 51 using testing::Return; |
| 52 using testing::WithArg; | 52 using testing::WithArg; |
| 53 using testing::Invoke; | 53 using testing::Invoke; |
| 54 | 54 |
| 55 class TestBookmarkModelAssociator : public BookmarkModelAssociator { | 55 class TestBookmarkModelAssociator : public BookmarkModelAssociator { |
| 56 public: | 56 public: |
| 57 TestBookmarkModelAssociator(ProfileSyncService* service, | 57 TestBookmarkModelAssociator(TestProfileSyncService* service, |
| 58 UnrecoverableErrorHandler* persist_ids_error_handler) | 58 UnrecoverableErrorHandler* persist_ids_error_handler) |
| 59 : BookmarkModelAssociator(service, persist_ids_error_handler), | 59 : BookmarkModelAssociator(service, persist_ids_error_handler), |
| 60 helper_(new TestModelAssociatorHelper()) { | 60 helper_(new TestModelAssociatorHelper(service->id_factory())) { |
| 61 } | 61 } |
| 62 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { | 62 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { |
| 63 return helper_->GetSyncIdForTaggedNode(this, tag, sync_id); | 63 return helper_->GetSyncIdForTaggedNode(this, tag, sync_id); |
| 64 } | 64 } |
| 65 private: | 65 private: |
| 66 scoped_ptr<TestModelAssociatorHelper> helper_; | 66 scoped_ptr<TestModelAssociatorHelper> helper_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // FakeServerChange constructs a list of sync_api::ChangeRecords while modifying | 69 // FakeServerChange constructs a list of sync_api::ChangeRecords while modifying |
| 70 // the sync model, and can pass the ChangeRecord list to a | 70 // the sync model, and can pass the ChangeRecord list to a |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 // This file should have been deleted when the whole directory was nuked. | 1408 // This file should have been deleted when the whole directory was nuked. |
| 1409 ASSERT_FALSE(file_util::PathExists(sync_file3)); | 1409 ASSERT_FALSE(file_util::PathExists(sync_file3)); |
| 1410 ASSERT_FALSE(file_util::PathExists(sync_file1)); | 1410 ASSERT_FALSE(file_util::PathExists(sync_file1)); |
| 1411 | 1411 |
| 1412 // This will still exist, but the text should have changed. | 1412 // This will still exist, but the text should have changed. |
| 1413 ASSERT_TRUE(file_util::PathExists(sync_file2)); | 1413 ASSERT_TRUE(file_util::PathExists(sync_file2)); |
| 1414 std::string file2text; | 1414 std::string file2text; |
| 1415 file_util::ReadFileToString(sync_file2, &file2text); | 1415 file_util::ReadFileToString(sync_file2, &file2text); |
| 1416 ASSERT_FALSE(file2text.compare(nonsense2) == 0); | 1416 ASSERT_FALSE(file2text.compare(nonsense2) == 0); |
| 1417 } | 1417 } |
| OLD | NEW |