| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/syncable/directory_unittest.h" | 5 #include "sync/syncable/directory_unittest.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/test/values_test_util.h" | 8 #include "base/test/values_test_util.h" |
| 9 #include "sync/internal_api/public/base/attachment_id_proto.h" | 9 #include "sync/internal_api/public/base/attachment_id_proto.h" |
| 10 #include "sync/syncable/syncable_proto_util.h" | 10 #include "sync/syncable/syncable_proto_util.h" |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 class StressTransactionsDelegate : public base::PlatformThread::Delegate { | 1527 class StressTransactionsDelegate : public base::PlatformThread::Delegate { |
| 1528 public: | 1528 public: |
| 1529 StressTransactionsDelegate(Directory* dir, int thread_number) | 1529 StressTransactionsDelegate(Directory* dir, int thread_number) |
| 1530 : dir_(dir), thread_number_(thread_number) {} | 1530 : dir_(dir), thread_number_(thread_number) {} |
| 1531 | 1531 |
| 1532 private: | 1532 private: |
| 1533 Directory* const dir_; | 1533 Directory* const dir_; |
| 1534 const int thread_number_; | 1534 const int thread_number_; |
| 1535 | 1535 |
| 1536 // PlatformThread::Delegate methods: | 1536 // PlatformThread::Delegate methods: |
| 1537 virtual void ThreadMain() OVERRIDE { | 1537 virtual void ThreadMain() override { |
| 1538 int entry_count = 0; | 1538 int entry_count = 0; |
| 1539 std::string path_name; | 1539 std::string path_name; |
| 1540 | 1540 |
| 1541 for (int i = 0; i < 20; ++i) { | 1541 for (int i = 0; i < 20; ++i) { |
| 1542 const int rand_action = rand() % 10; | 1542 const int rand_action = rand() % 10; |
| 1543 if (rand_action < 4 && !path_name.empty()) { | 1543 if (rand_action < 4 && !path_name.empty()) { |
| 1544 ReadTransaction trans(FROM_HERE, dir_); | 1544 ReadTransaction trans(FROM_HERE, dir_); |
| 1545 CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name)); | 1545 CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name)); |
| 1546 base::PlatformThread::Sleep( | 1546 base::PlatformThread::Sleep( |
| 1547 base::TimeDelta::FromMilliseconds(rand() % 10)); | 1547 base::TimeDelta::FromMilliseconds(rand() % 10)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 { | 1762 { |
| 1763 ReadTransaction trans(FROM_HERE, dir().get()); | 1763 ReadTransaction trans(FROM_HERE, dir().get()); |
| 1764 dir()->GetAttachmentIdsToUpload(&trans, PREFERENCES, &id_set); | 1764 dir()->GetAttachmentIdsToUpload(&trans, PREFERENCES, &id_set); |
| 1765 } | 1765 } |
| 1766 ASSERT_TRUE(id_set.empty()); | 1766 ASSERT_TRUE(id_set.empty()); |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 } // namespace syncable | 1769 } // namespace syncable |
| 1770 | 1770 |
| 1771 } // namespace syncer | 1771 } // namespace syncer |
| OLD | NEW |