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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 10 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
OLDNEW
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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 138 }
151 139
152 private: 140 private:
153 base::ScopedTempDir base_dir_; 141 base::ScopedTempDir base_dir_;
154 std::unique_ptr<leveldb::Env> in_memory_env_; 142 std::unique_ptr<leveldb::Env> in_memory_env_;
155 143
156 std::unique_ptr<FakeSigninManagerForTesting> fake_signin_manager_; 144 std::unique_ptr<FakeSigninManagerForTesting> fake_signin_manager_;
157 145
158 drive_backend::SyncEngine* remote_service_; 146 drive_backend::SyncEngine* remote_service_;
159 147
160 int64_t real_minimum_preserved_space_;
161
162 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemTest); 148 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemTest);
163 }; 149 };
164 150
165 IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) { 151 IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) {
166 ExtensionTestMessageListener open_failure( 152 ExtensionTestMessageListener open_failure(
167 "checkpoint: Failed to get syncfs", true); 153 "checkpoint: Failed to get syncfs", true);
168 ExtensionTestMessageListener bar_created( 154 ExtensionTestMessageListener bar_created(
169 "checkpoint: \"/bar\" created", true); 155 "checkpoint: \"/bar\" created", true);
170 ExtensionTestMessageListener foo_created( 156 ExtensionTestMessageListener foo_created(
171 "checkpoint: \"/foo\" created", true); 157 "checkpoint: \"/foo\" created", true);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 190
205 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); 191 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing");
206 WaitUntilIdle(); 192 WaitUntilIdle();
207 193
208 bar_created.Reply("resume"); 194 bar_created.Reply("resume");
209 195
210 EXPECT_TRUE(catcher.GetNextResult()); 196 EXPECT_TRUE(catcher.GetNextResult());
211 } 197 }
212 198
213 } // namespace sync_file_system 199 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698