Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: chrome/browser/sync/syncable/syncable_unittest.cc

Issue 7016011: iwyu: Include stringprintf.h where appropriate, part 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/syncable.h" 5 #include "chrome/browser/sync/syncable/syncable.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
11 #include <limits> 11 #include <limits>
12 #include <string> 12 #include <string>
13 13
14 #if !defined(OS_WIN) 14 #if !defined(OS_WIN)
15 #define MAX_PATH PATH_MAX 15 #define MAX_PATH PATH_MAX
16 #include <ostream> 16 #include <ostream>
17 #include <stdio.h> 17 #include <stdio.h>
18 #include <sys/ipc.h> 18 #include <sys/ipc.h>
19 #include <sys/sem.h> 19 #include <sys/sem.h>
20 #include <sys/times.h> 20 #include <sys/times.h>
21 #endif // !defined(OS_WIN) 21 #endif // !defined(OS_WIN)
22 22
23 #include "base/file_path.h" 23 #include "base/file_path.h"
24 #include "base/file_util.h" 24 #include "base/file_util.h"
25 #include "base/logging.h" 25 #include "base/logging.h"
26 #include "base/memory/scoped_ptr.h" 26 #include "base/memory/scoped_ptr.h"
27 #include "base/memory/scoped_temp_dir.h" 27 #include "base/memory/scoped_temp_dir.h"
28 #include "base/string_util.h" 28 #include "base/stringprintf.h"
29 #include "base/threading/platform_thread.h" 29 #include "base/threading/platform_thread.h"
30 #include "base/values.h" 30 #include "base/values.h"
31 #include "chrome/browser/sync/engine/syncproto.h" 31 #include "chrome/browser/sync/engine/syncproto.h"
32 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 32 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
33 #include "chrome/browser/sync/syncable/directory_backing_store.h" 33 #include "chrome/browser/sync/syncable/directory_backing_store.h"
34 #include "chrome/browser/sync/syncable/directory_manager.h" 34 #include "chrome/browser/sync/syncable/directory_manager.h"
35 #include "chrome/common/deprecated/event_sys-inl.h" 35 #include "chrome/common/deprecated/event_sys-inl.h"
36 #include "chrome/test/sync/engine/test_id_factory.h" 36 #include "chrome/test/sync/engine/test_id_factory.h"
37 #include "chrome/test/sync/engine/test_syncable_utils.h" 37 #include "chrome/test/sync/engine/test_syncable_utils.h"
38 #include "chrome/test/values_test_util.h" 38 #include "chrome/test/values_test_util.h"
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 int entry_count = 0; 1638 int entry_count = 0;
1639 std::string path_name; 1639 std::string path_name;
1640 1640
1641 for (int i = 0; i < 20; ++i) { 1641 for (int i = 0; i < 20; ++i) {
1642 const int rand_action = rand() % 10; 1642 const int rand_action = rand() % 10;
1643 if (rand_action < 4 && !path_name.empty()) { 1643 if (rand_action < 4 && !path_name.empty()) {
1644 ReadTransaction trans(dir, __FILE__, __LINE__); 1644 ReadTransaction trans(dir, __FILE__, __LINE__);
1645 CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name)); 1645 CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name));
1646 base::PlatformThread::Sleep(rand() % 10); 1646 base::PlatformThread::Sleep(rand() % 10);
1647 } else { 1647 } else {
1648 std::string unique_name = StringPrintf("%d.%d", thread_number_, 1648 std::string unique_name =
1649 entry_count++); 1649 base::StringPrintf("%d.%d", thread_number_, entry_count++);
1650 path_name.assign(unique_name.begin(), unique_name.end()); 1650 path_name.assign(unique_name.begin(), unique_name.end());
1651 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); 1651 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__);
1652 MutableEntry e(&trans, CREATE, trans.root_id(), path_name); 1652 MutableEntry e(&trans, CREATE, trans.root_id(), path_name);
1653 CHECK(e.good()); 1653 CHECK(e.good());
1654 base::PlatformThread::Sleep(rand() % 20); 1654 base::PlatformThread::Sleep(rand() % 20);
1655 e.Put(IS_UNSYNCED, true); 1655 e.Put(IS_UNSYNCED, true);
1656 if (e.Put(ID, TestIdFactory::FromNumber(rand())) && 1656 if (e.Put(ID, TestIdFactory::FromNumber(rand())) &&
1657 e.Get(ID).ServerKnows() && !e.Get(ID).IsRoot()) { 1657 e.Get(ID).ServerKnows() && !e.Get(ID).IsRoot()) {
1658 e.Put(BASE_VERSION, 1); 1658 e.Put(BASE_VERSION, 1);
1659 } 1659 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { 1781 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) {
1782 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); 1782 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true));
1783 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); 1783 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true));
1784 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); 1784 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false));
1785 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); 1785 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false));
1786 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); 1786 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true));
1787 } 1787 }
1788 1788
1789 } // namespace 1789 } // namespace
1790 } // namespace syncable 1790 } // namespace syncable
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/visitedlink/visitedlink_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698