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 <stdint.h> | 5 #include <stdint.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/apps/app_browsertest_util.h" | 13 #include "chrome/browser/apps/app_browsertest_util.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 15 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
16 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" | 16 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" |
17 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" | 17 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" |
18 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 18 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
19 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" | 19 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" |
20 #include "components/drive/service/fake_drive_service.h" | 20 #include "components/drive/service/fake_drive_service.h" |
| 21 #include "content/public/browser/storage_partition.h" |
21 #include "extensions/test/extension_test_message_listener.h" | 22 #include "extensions/test/extension_test_message_listener.h" |
22 #include "extensions/test/result_catcher.h" | 23 #include "extensions/test/result_catcher.h" |
23 #include "storage/browser/quota/quota_manager.h" | 24 #include "storage/browser/quota/quota_manager.h" |
24 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 25 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
25 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 26 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
26 | 27 |
27 namespace sync_file_system { | 28 namespace sync_file_system { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
(...skipping 23 matching lines...) Expand all Loading... |
54 | 55 |
55 } // namespace | 56 } // namespace |
56 | 57 |
57 class SyncFileSystemTest : public extensions::PlatformAppBrowserTest, | 58 class SyncFileSystemTest : public extensions::PlatformAppBrowserTest, |
58 public drive::FakeDriveService::ChangeObserver { | 59 public drive::FakeDriveService::ChangeObserver { |
59 public: | 60 public: |
60 SyncFileSystemTest() | 61 SyncFileSystemTest() |
61 : remote_service_(NULL) { | 62 : remote_service_(NULL) { |
62 } | 63 } |
63 | 64 |
64 void SetUpInProcessBrowserTestFixture() override { | |
65 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | |
66 real_minimum_preserved_space_ = | |
67 storage::QuotaManager::kMinimumPreserveForSystem; | |
68 storage::QuotaManager::kMinimumPreserveForSystem = 0; | |
69 } | |
70 | |
71 void TearDownInProcessBrowserTestFixture() override { | |
72 storage::QuotaManager::kMinimumPreserveForSystem = | |
73 real_minimum_preserved_space_; | |
74 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | |
75 } | |
76 | |
77 scoped_refptr<base::SequencedTaskRunner> MakeSequencedTaskRunner() { | 65 scoped_refptr<base::SequencedTaskRunner> MakeSequencedTaskRunner() { |
78 scoped_refptr<base::SequencedWorkerPool> worker_pool = | 66 scoped_refptr<base::SequencedWorkerPool> worker_pool = |
79 content::BrowserThread::GetBlockingPool(); | 67 content::BrowserThread::GetBlockingPool(); |
80 | 68 |
81 return worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 69 return worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
82 worker_pool->GetSequenceToken(), | 70 worker_pool->GetSequenceToken(), |
83 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 71 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
84 } | 72 } |
85 | 73 |
86 void SetUpOnMainThread() override { | 74 void SetUpOnMainThread() override { |
(...skipping 19 matching lines...) Expand all Loading... |
106 NULL, // task_logger | 94 NULL, // task_logger |
107 NULL, // notification_manager | 95 NULL, // notification_manager |
108 extension_service, | 96 extension_service, |
109 fake_signin_manager_.get(), // signin_manager | 97 fake_signin_manager_.get(), // signin_manager |
110 NULL, // token_service | 98 NULL, // token_service |
111 NULL, // request_context | 99 NULL, // request_context |
112 std::move(drive_service_factory), in_memory_env_.get()); | 100 std::move(drive_service_factory), in_memory_env_.get()); |
113 remote_service_->SetSyncEnabled(true); | 101 remote_service_->SetSyncEnabled(true); |
114 factory->set_mock_remote_file_service( | 102 factory->set_mock_remote_file_service( |
115 std::unique_ptr<RemoteFileSyncService>(remote_service_)); | 103 std::unique_ptr<RemoteFileSyncService>(remote_service_)); |
| 104 |
| 105 const int kMeg = 1000 * 1024; |
| 106 storage::TemporaryStorageConfiguration config; |
| 107 config.pool_size = 25 * kMeg; |
| 108 config.per_host_quota = 5 * kMeg; |
| 109 config.must_remain_available = 0; |
| 110 config.refresh_interval = base::TimeDelta::Max(); |
| 111 content::BrowserContext::GetDefaultStoragePartition(context)-> |
| 112 GetQuotaManager()->SetTemporaryStorageConfiguration(config); |
116 } | 113 } |
117 | 114 |
118 // drive::FakeDriveService::ChangeObserver override. | 115 // drive::FakeDriveService::ChangeObserver override. |
119 void OnNewChangeAvailable() override { | 116 void OnNewChangeAvailable() override { |
120 sync_engine()->OnNotificationReceived(); | 117 sync_engine()->OnNotificationReceived(); |
121 } | 118 } |
122 | 119 |
123 SyncFileSystemService* sync_file_system_service() { | 120 SyncFileSystemService* sync_file_system_service() { |
124 return SyncFileSystemServiceFactory::GetForProfile(browser()->profile()); | 121 return SyncFileSystemServiceFactory::GetForProfile(browser()->profile()); |
125 } | 122 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 200 |
204 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); | 201 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); |
205 WaitUntilIdle(); | 202 WaitUntilIdle(); |
206 | 203 |
207 bar_created.Reply("resume"); | 204 bar_created.Reply("resume"); |
208 | 205 |
209 EXPECT_TRUE(catcher.GetNextResult()); | 206 EXPECT_TRUE(catcher.GetNextResult()); |
210 } | 207 } |
211 | 208 |
212 } // namespace sync_file_system | 209 } // namespace sync_file_system |
OLD | NEW |