OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_file_system/drive_backend/register_app_task.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/register_app_task.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <vector> | 10 #include <vector> |
8 | 11 |
9 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
10 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 14 #include "base/macros.h" |
11 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
14 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
15 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" | 19 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" |
16 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" | 20 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" |
17 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helpe
r.h" | 21 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helpe
r.h" |
18 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" | 22 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" |
19 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 23 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
20 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" | 24 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" |
21 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 25 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
22 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 26 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
23 #include "components/drive/drive_uploader.h" | 27 #include "components/drive/drive_uploader.h" |
24 #include "components/drive/service/fake_drive_service.h" | 28 #include "components/drive/service/fake_drive_service.h" |
25 #include "content/public/test/test_browser_thread_bundle.h" | 29 #include "content/public/test/test_browser_thread_bundle.h" |
26 #include "google_apis/drive/drive_api_parser.h" | 30 #include "google_apis/drive/drive_api_parser.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
28 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 32 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
29 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 33 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
30 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 34 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
31 | 35 |
32 namespace sync_file_system { | 36 namespace sync_file_system { |
33 namespace drive_backend { | 37 namespace drive_backend { |
34 | 38 |
35 namespace { | 39 namespace { |
36 const int64 kSyncRootTrackerID = 100; | 40 const int64_t kSyncRootTrackerID = 100; |
37 } // namespace | 41 } // namespace |
38 | 42 |
39 class RegisterAppTaskTest : public testing::Test { | 43 class RegisterAppTaskTest : public testing::Test { |
40 public: | 44 public: |
41 RegisterAppTaskTest() | 45 RegisterAppTaskTest() |
42 : next_file_id_(1000), | 46 : next_file_id_(1000), |
43 next_tracker_id_(10000) {} | 47 next_tracker_id_(10000) {} |
44 ~RegisterAppTaskTest() override {} | 48 ~RegisterAppTaskTest() override {} |
45 | 49 |
46 void SetUp() override { | 50 void SetUp() override { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 258 |
255 private: | 259 private: |
256 std::string GenerateFileID() { | 260 std::string GenerateFileID() { |
257 return base::StringPrintf("file_id_%" PRId64, next_file_id_++); | 261 return base::StringPrintf("file_id_%" PRId64, next_file_id_++); |
258 } | 262 } |
259 | 263 |
260 scoped_ptr<leveldb::Env> in_memory_env_; | 264 scoped_ptr<leveldb::Env> in_memory_env_; |
261 | 265 |
262 std::string sync_root_folder_id_; | 266 std::string sync_root_folder_id_; |
263 | 267 |
264 int64 next_file_id_; | 268 int64_t next_file_id_; |
265 int64 next_tracker_id_; | 269 int64_t next_tracker_id_; |
266 | 270 |
267 content::TestBrowserThreadBundle browser_threads_; | 271 content::TestBrowserThreadBundle browser_threads_; |
268 base::ScopedTempDir database_dir_; | 272 base::ScopedTempDir database_dir_; |
269 | 273 |
270 scoped_ptr<SyncEngineContext> context_; | 274 scoped_ptr<SyncEngineContext> context_; |
271 scoped_ptr<FakeDriveServiceHelper> fake_drive_service_helper_; | 275 scoped_ptr<FakeDriveServiceHelper> fake_drive_service_helper_; |
272 | 276 |
273 DISALLOW_COPY_AND_ASSIGN(RegisterAppTaskTest); | 277 DISALLOW_COPY_AND_ASSIGN(RegisterAppTaskTest); |
274 }; | 278 }; |
275 | 279 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 335 |
332 CreateMetadataDatabase(db.Pass()); | 336 CreateMetadataDatabase(db.Pass()); |
333 RunRegisterAppTask(kAppID); | 337 RunRegisterAppTask(kAppID); |
334 | 338 |
335 EXPECT_EQ(1u, CountRegisteredAppRoot()); | 339 EXPECT_EQ(1u, CountRegisteredAppRoot()); |
336 EXPECT_TRUE(IsAppRegistered(kAppID)); | 340 EXPECT_TRUE(IsAppRegistered(kAppID)); |
337 } | 341 } |
338 | 342 |
339 } // namespace drive_backend | 343 } // namespace drive_backend |
340 } // namespace sync_file_system | 344 } // namespace sync_file_system |
OLD | NEW |