OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 entry. | 3 // found in the LICENSE entry. |
4 // | 4 // |
5 // Syncer unit tests. Unfortunately a lot of these tests | 5 // Syncer unit tests. Unfortunately a lot of these tests |
6 // are outdated and need to be reworked and updated. | 6 // are outdated and need to be reworked and updated. |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
13 | 13 |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/sync/engine/client_command_channel.h" | 16 #include "chrome/browser/sync/engine/client_command_channel.h" |
17 #include "chrome/browser/sync/engine/conflict_resolution_view.h" | 17 #include "chrome/browser/sync/engine/conflict_resolution_view.h" |
18 #include "chrome/browser/sync/engine/conflict_resolver.h" | 18 #include "chrome/browser/sync/engine/conflict_resolver.h" |
19 #include "chrome/browser/sync/engine/get_commit_ids_command.h" | 19 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
20 #include "chrome/browser/sync/engine/model_safe_worker.h" | 20 #include "chrome/browser/sync/engine/model_safe_worker.h" |
21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
22 #include "chrome/browser/sync/engine/process_updates_command.h" | 22 #include "chrome/browser/sync/engine/process_updates_command.h" |
23 #include "chrome/browser/sync/engine/syncer.h" | 23 #include "chrome/browser/sync/engine/syncer.h" |
24 #include "chrome/browser/sync/engine/syncer_util.h" | 24 #include "chrome/browser/sync/engine/syncer_util.h" |
25 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 25 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
26 #include "chrome/browser/sync/engine/syncer_session.h" | 26 #include "chrome/browser/sync/engine/syncer_session.h" |
27 #include "chrome/browser/sync/protocol/sync.pb.h" | 27 #include "chrome/browser/sync/protocol/sync.pb.h" |
28 #include "chrome/browser/sync/syncable/directory_manager.h" | 28 #include "chrome/browser/sync/syncable/directory_manager.h" |
29 #include "chrome/browser/sync/syncable/syncable.h" | 29 #include "chrome/browser/sync/syncable/syncable.h" |
30 #include "chrome/browser/sync/util/character_set_converters.h" | |
31 #include "chrome/browser/sync/util/compat_file.h" | |
32 #include "chrome/browser/sync/util/event_sys-inl.h" | 30 #include "chrome/browser/sync/util/event_sys-inl.h" |
33 #include "chrome/test/sync/engine/mock_server_connection.h" | 31 #include "chrome/test/sync/engine/mock_server_connection.h" |
34 #include "chrome/test/sync/engine/test_directory_setter_upper.h" | 32 #include "chrome/test/sync/engine/test_directory_setter_upper.h" |
35 #include "chrome/test/sync/engine/test_id_factory.h" | 33 #include "chrome/test/sync/engine/test_id_factory.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
37 | 35 |
38 using std::map; | 36 using std::map; |
39 using std::multimap; | 37 using std::multimap; |
40 using std::set; | 38 using std::set; |
41 using std::string; | 39 using std::string; |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 } | 1383 } |
1386 | 1384 |
1387 // Mix in a directory creation too for later. | 1385 // Mix in a directory creation too for later. |
1388 mock_server_->AddUpdateDirectory(2, 0, "dir_in_root", 10, 10); | 1386 mock_server_->AddUpdateDirectory(2, 0, "dir_in_root", 10, 10); |
1389 mock_server_->SetCommitTimeRename(i18nString); | 1387 mock_server_->SetCommitTimeRename(i18nString); |
1390 syncer_->SyncShare(); | 1388 syncer_->SyncShare(); |
1391 | 1389 |
1392 // Verify it was correctly renamed. | 1390 // Verify it was correctly renamed. |
1393 { | 1391 { |
1394 ReadTransaction trans(dir, __FILE__, __LINE__); | 1392 ReadTransaction trans(dir, __FILE__, __LINE__); |
1395 PathString expectedFolder; | 1393 PathString expectedFolder(i18nString); |
1396 AppendUTF8ToPathString(i18nString, &expectedFolder); | 1394 expectedFolder.append("Folder"); |
1397 AppendUTF8ToPathString("Folder", &expectedFolder); | |
1398 Entry entry_folder(&trans, GET_BY_PATH, expectedFolder); | 1395 Entry entry_folder(&trans, GET_BY_PATH, expectedFolder); |
1399 ASSERT_TRUE(entry_folder.good()); | 1396 ASSERT_TRUE(entry_folder.good()); |
1400 PathString expected = expectedFolder + PathString(kPathSeparator); | 1397 PathString expected = expectedFolder + PathString(kPathSeparator); |
1401 AppendUTF8ToPathString(i18nString, &expected); | 1398 expected.append(i18nString); |
1402 AppendUTF8ToPathString("new_entry", &expected); | 1399 expected.append("new_entry"); |
1403 | 1400 |
1404 Entry entry_new(&trans, GET_BY_PATH, expected); | 1401 Entry entry_new(&trans, GET_BY_PATH, expected); |
1405 ASSERT_TRUE(entry_new.good()); | 1402 ASSERT_TRUE(entry_new.good()); |
1406 | 1403 |
1407 // And that the unrelated directory creation worked without a rename. | 1404 // And that the unrelated directory creation worked without a rename. |
1408 Entry new_dir(&trans, GET_BY_PATH, PSTR("dir_in_root")); | 1405 Entry new_dir(&trans, GET_BY_PATH, PSTR("dir_in_root")); |
1409 EXPECT_TRUE(new_dir.good()); | 1406 EXPECT_TRUE(new_dir.good()); |
1410 } | 1407 } |
1411 } | 1408 } |
1412 | 1409 |
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4557 Add(low_id_); | 4554 Add(low_id_); |
4558 Add(high_id_); | 4555 Add(high_id_); |
4559 syncer_->SyncShare(); | 4556 syncer_->SyncShare(); |
4560 ExpectLocalOrderIsByServerId(); | 4557 ExpectLocalOrderIsByServerId(); |
4561 } | 4558 } |
4562 | 4559 |
4563 const SyncerTest::CommitOrderingTest | 4560 const SyncerTest::CommitOrderingTest |
4564 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 4561 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
4565 | 4562 |
4566 } // namespace browser_sync | 4563 } // namespace browser_sync |
OLD | NEW |