| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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 storage::QuotaManager::kMinimumPreserveForSystem; | 47 storage::QuotaManager::kMinimumPreserveForSystem; |
| 48 storage::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_ = | 52 real_default_quota_ = |
| 53 storage::QuotaManager::kSyncableStorageDefaultHostQuota; | 53 storage::QuotaManager::kSyncableStorageDefaultHostQuota; |
| 54 storage::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; | 54 storage::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 57 virtual void TearDownInProcessBrowserTestFixture() override { |
| 58 storage::QuotaManager::kMinimumPreserveForSystem = | 58 storage::QuotaManager::kMinimumPreserveForSystem = |
| 59 real_minimum_preserved_space_; | 59 real_minimum_preserved_space_; |
| 60 storage::QuotaManager::kSyncableStorageDefaultHostQuota = | 60 storage::QuotaManager::kSyncableStorageDefaultHostQuota = |
| 61 real_default_quota_; | 61 real_default_quota_; |
| 62 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 62 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void SetUpOnMainThread() OVERRIDE { | 65 virtual void SetUpOnMainThread() override { |
| 66 // Must happen after the browser process is created because instantiating | 66 // Must happen after the browser process is created because instantiating |
| 67 // the factory will instantiate ExtensionSystemFactory which depends on | 67 // the factory will instantiate ExtensionSystemFactory which depends on |
| 68 // ExtensionsBrowserClient setup in BrowserProcessImpl. | 68 // ExtensionsBrowserClient setup in BrowserProcessImpl. |
| 69 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>; | 69 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>; |
| 70 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service( | 70 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service( |
| 71 scoped_ptr<RemoteFileSyncService>(mock_remote_service_)); | 71 scoped_ptr<RemoteFileSyncService>(mock_remote_service_)); |
| 72 ExtensionApiTest::SetUpOnMainThread(); | 72 ExtensionApiTest::SetUpOnMainThread(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service() { | 75 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service() { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) | 193 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) |
| 194 << message_; | 194 << message_; |
| 195 } | 195 } |
| 196 | 196 |
| 197 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) { | 197 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) { |
| 198 mock_remote_service()->SetServiceState( | 198 mock_remote_service()->SetServiceState( |
| 199 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED); | 199 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED); |
| 200 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status")) | 200 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status")) |
| 201 << message_; | 201 << message_; |
| 202 } | 202 } |
| OLD | NEW |