OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/sync_file_system/file_status_observer.h" | 10 #include "chrome/browser/sync_file_system/file_status_observer.h" |
11 #include "chrome/browser/sync_file_system/local_change_processor.h" | 11 #include "chrome/browser/sync_file_system/local_change_processor.h" |
12 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" | 12 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
13 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 13 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
14 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" | 14 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" |
15 #include "chrome/browser/sync_file_system/sync_status_code.h" | 15 #include "chrome/browser/sync_file_system/sync_status_code.h" |
16 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 16 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
17 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
18 #include "chrome/test/base/test_switches.h" | 18 #include "chrome/test/base/test_switches.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "webkit/browser/fileapi/file_system_url.h" | 21 #include "webkit/browser/fileapi/file_system_url.h" |
22 #include "webkit/browser/quota/quota_manager.h" | 22 #include "webkit/browser/quota/quota_manager.h" |
23 | 23 |
24 using ::testing::_; | 24 using ::testing::_; |
25 using ::testing::Eq; | 25 using ::testing::Eq; |
26 using ::testing::Ne; | 26 using ::testing::Ne; |
27 using ::testing::Property; | 27 using ::testing::Property; |
28 using ::testing::Return; | 28 using ::testing::Return; |
29 using fileapi::FileSystemURL; | 29 using storage::FileSystemURL; |
30 using sync_file_system::MockRemoteFileSyncService; | 30 using sync_file_system::MockRemoteFileSyncService; |
31 using sync_file_system::RemoteFileSyncService; | 31 using sync_file_system::RemoteFileSyncService; |
32 using sync_file_system::SyncFileSystemServiceFactory; | 32 using sync_file_system::SyncFileSystemServiceFactory; |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 class SyncFileSystemApiTest : public ExtensionApiTest { | 36 class SyncFileSystemApiTest : public ExtensionApiTest { |
37 public: | 37 public: |
38 SyncFileSystemApiTest() | 38 SyncFileSystemApiTest() |
39 : mock_remote_service_(NULL), | 39 : mock_remote_service_(NULL), |
40 real_minimum_preserved_space_(0), | 40 real_minimum_preserved_space_(0), |
41 real_default_quota_(0) {} | 41 real_default_quota_(0) {} |
42 | 42 |
43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
44 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 44 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
45 | 45 |
46 real_minimum_preserved_space_ = | 46 real_minimum_preserved_space_ = |
47 quota::QuotaManager::kMinimumPreserveForSystem; | 47 storage::QuotaManager::kMinimumPreserveForSystem; |
48 quota::QuotaManager::kMinimumPreserveForSystem = 0; | 48 storage::QuotaManager::kMinimumPreserveForSystem = 0; |
49 | 49 |
50 // TODO(calvinlo): Update test code after default quota is made const | 50 // TODO(calvinlo): Update test code after default quota is made const |
51 // (http://crbug.com/155488). | 51 // (http://crbug.com/155488). |
52 real_default_quota_ = quota::QuotaManager::kSyncableStorageDefaultHostQuota; | 52 real_default_quota_ = |
53 quota::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; | 53 storage::QuotaManager::kSyncableStorageDefaultHostQuota; |
| 54 storage::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; |
54 } | 55 } |
55 | 56 |
56 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 57 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
57 quota::QuotaManager::kMinimumPreserveForSystem = | 58 storage::QuotaManager::kMinimumPreserveForSystem = |
58 real_minimum_preserved_space_; | 59 real_minimum_preserved_space_; |
59 quota::QuotaManager::kSyncableStorageDefaultHostQuota = real_default_quota_; | 60 storage::QuotaManager::kSyncableStorageDefaultHostQuota = |
| 61 real_default_quota_; |
60 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 62 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
61 } | 63 } |
62 | 64 |
63 virtual void SetUpOnMainThread() OVERRIDE { | 65 virtual void SetUpOnMainThread() OVERRIDE { |
64 // Must happen after the browser process is created because instantiating | 66 // Must happen after the browser process is created because instantiating |
65 // the factory will instantiate ExtensionSystemFactory which depends on | 67 // the factory will instantiate ExtensionSystemFactory which depends on |
66 // ExtensionsBrowserClient setup in BrowserProcessImpl. | 68 // ExtensionsBrowserClient setup in BrowserProcessImpl. |
67 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>; | 69 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>; |
68 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service( | 70 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service( |
69 scoped_ptr<RemoteFileSyncService>(mock_remote_service_)); | 71 scoped_ptr<RemoteFileSyncService>(mock_remote_service_)); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) | 186 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) |
185 << message_; | 187 << message_; |
186 } | 188 } |
187 | 189 |
188 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) { | 190 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) { |
189 mock_remote_service()->SetServiceState( | 191 mock_remote_service()->SetServiceState( |
190 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED); | 192 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED); |
191 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status")) | 193 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status")) |
192 << message_; | 194 << message_; |
193 } | 195 } |
OLD | NEW |