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

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

Issue 12902044: Enable SyncFileSystem API on Stable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 9 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
« no previous file with comments | « no previous file | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 6 #include "base/file_util.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/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" 11 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
12 #include "chrome/browser/sync_file_system/file_status_observer.h" 12 #include "chrome/browser/sync_file_system/file_status_observer.h"
13 #include "chrome/browser/sync_file_system/local_change_processor.h" 13 #include "chrome/browser/sync_file_system/local_change_processor.h"
14 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" 14 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h"
15 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 15 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
16 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" 16 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
17 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
18 #include "chrome/common/extensions/features/feature.h"
19 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
21 #include "webkit/fileapi/file_system_url.h" 20 #include "webkit/fileapi/file_system_url.h"
22 #include "webkit/fileapi/syncable/sync_status_code.h" 21 #include "webkit/fileapi/syncable/sync_status_code.h"
23 #include "webkit/fileapi/syncable/syncable_file_system_util.h" 22 #include "webkit/fileapi/syncable/syncable_file_system_util.h"
24 #include "webkit/quota/quota_manager.h" 23 #include "webkit/quota/quota_manager.h"
25 24
26 using ::testing::_; 25 using ::testing::_;
27 using ::testing::Eq; 26 using ::testing::Eq;
28 using ::testing::Ne; 27 using ::testing::Ne;
29 using ::testing::Property; 28 using ::testing::Property;
30 using ::testing::Return; 29 using ::testing::Return;
31 using fileapi::FileSystemURL; 30 using fileapi::FileSystemURL;
32 using sync_file_system::MockRemoteFileSyncService; 31 using sync_file_system::MockRemoteFileSyncService;
33 using sync_file_system::RemoteFileSyncService; 32 using sync_file_system::RemoteFileSyncService;
34 using sync_file_system::SyncFileSystemServiceFactory; 33 using sync_file_system::SyncFileSystemServiceFactory;
35 34
36 namespace chrome { 35 namespace chrome {
37 36
38 namespace { 37 namespace {
39 38
40 class SyncFileSystemApiTest : public ExtensionApiTest { 39 class SyncFileSystemApiTest : public ExtensionApiTest {
41 public: 40 public:
42 // Override the current channel to "trunk" as syncFileSystem is currently 41 SyncFileSystemApiTest() {}
43 // available only on trunk channel.
44 SyncFileSystemApiTest()
45 : current_channel_(VersionInfo::CHANNEL_UNKNOWN) {
46 }
47 42
48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
49 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>; 44 mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>;
50 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service( 45 SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service(
51 scoped_ptr<RemoteFileSyncService>(mock_remote_service_)); 46 scoped_ptr<RemoteFileSyncService>(mock_remote_service_));
52 47
53 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 48 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
54 // TODO(calvinlo): Update test code after default quota is made const 49 // TODO(calvinlo): Update test code after default quota is made const
55 // (http://crbug.com/155488). 50 // (http://crbug.com/155488).
56 real_default_quota_ = quota::QuotaManager::kSyncableStorageDefaultHostQuota; 51 real_default_quota_ = quota::QuotaManager::kSyncableStorageDefaultHostQuota;
57 quota::QuotaManager::kSyncableStorageDefaultHostQuota = 123456789; 52 quota::QuotaManager::kSyncableStorageDefaultHostQuota = 123456789;
58 } 53 }
59 54
60 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { 55 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
61 quota::QuotaManager::kSyncableStorageDefaultHostQuota = real_default_quota_; 56 quota::QuotaManager::kSyncableStorageDefaultHostQuota = real_default_quota_;
62 } 57 }
63 58
64 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service() { 59 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service() {
65 return mock_remote_service_; 60 return mock_remote_service_;
66 } 61 }
67 62
68 private: 63 private:
69 extensions::Feature::ScopedCurrentChannel current_channel_;
70 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service_; 64 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service_;
71 int64 real_default_quota_; 65 int64 real_default_quota_;
72 }; 66 };
73 67
74 ACTION_P(NotifyOkStateAndCallback, mock_remote_service) { 68 ACTION_P(NotifyOkStateAndCallback, mock_remote_service) {
75 mock_remote_service->NotifyRemoteServiceStateUpdated( 69 mock_remote_service->NotifyRemoteServiceStateUpdated(
76 sync_file_system::REMOTE_SERVICE_OK, "Test event description."); 70 sync_file_system::REMOTE_SERVICE_OK, "Test event description.");
77 base::MessageLoopProxy::current()->PostTask( 71 base::MessageLoopProxy::current()->PostTask(
78 FROM_HERE, base::Bind(arg1, sync_file_system::SYNC_STATUS_OK)); 72 FROM_HERE, base::Bind(arg1, sync_file_system::SYNC_STATUS_OK));
79 } 73 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/write_file_then_get_usage")) 180 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/write_file_then_get_usage"))
187 << message_; 181 << message_;
188 } 182 }
189 183
190 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, ConflictResolutionPolicy) { 184 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, ConflictResolutionPolicy) {
191 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) 185 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy"))
192 << message_; 186 << message_;
193 } 187 }
194 188
195 } // namespace chrome 189 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698