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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_fake_unittest.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h" 5 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 21 matching lines...) Expand all
32 #include "content/public/test/test_browser_thread_bundle.h" 32 #include "content/public/test/test_browser_thread_bundle.h"
33 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
34 #include "extensions/common/extension_builder.h" 34 #include "extensions/common/extension_builder.h"
35 #include "extensions/common/id_util.h" 35 #include "extensions/common/id_util.h"
36 #include "google_apis/drive/drive_api_parser.h" 36 #include "google_apis/drive/drive_api_parser.h"
37 #include "google_apis/drive/gdata_errorcode.h" 37 #include "google_apis/drive/gdata_errorcode.h"
38 #include "google_apis/drive/gdata_wapi_parser.h" 38 #include "google_apis/drive/gdata_wapi_parser.h"
39 #include "google_apis/drive/test_util.h" 39 #include "google_apis/drive/test_util.h"
40 #include "testing/gmock/include/gmock/gmock.h" 40 #include "testing/gmock/include/gmock/gmock.h"
41 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
42 #include "webkit/common/fileapi/file_system_util.h" 42 #include "storage/common/fileapi/file_system_util.h"
43 43
44 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
45 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" 45 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
46 #include "chrome/browser/chromeos/settings/cros_settings.h" 46 #include "chrome/browser/chromeos/settings/cros_settings.h"
47 #include "chrome/browser/chromeos/settings/device_settings_service.h" 47 #include "chrome/browser/chromeos/settings/device_settings_service.h"
48 #endif 48 #endif
49 49
50 #define FPL(x) FILE_PATH_LITERAL(x) 50 #define FPL(x) FILE_PATH_LITERAL(x)
51 51
52 using ::testing::StrictMock; 52 using ::testing::StrictMock;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #endif // !defined(OS_ANDROID) 153 #endif // !defined(OS_ANDROID)
154 154
155 } // namespace 155 } // namespace
156 156
157 class MockFileStatusObserver: public FileStatusObserver { 157 class MockFileStatusObserver: public FileStatusObserver {
158 public: 158 public:
159 MockFileStatusObserver() {} 159 MockFileStatusObserver() {}
160 virtual ~MockFileStatusObserver() {} 160 virtual ~MockFileStatusObserver() {}
161 161
162 MOCK_METHOD4(OnFileStatusChanged, 162 MOCK_METHOD4(OnFileStatusChanged,
163 void(const fileapi::FileSystemURL& url, 163 void(const storage::FileSystemURL& url,
164 SyncFileStatus sync_status, 164 SyncFileStatus sync_status,
165 SyncAction action_taken, 165 SyncAction action_taken,
166 SyncDirection direction)); 166 SyncDirection direction));
167 }; 167 };
168 168
169 class DriveFileSyncServiceFakeTest : public testing::Test { 169 class DriveFileSyncServiceFakeTest : public testing::Test {
170 public: 170 public:
171 DriveFileSyncServiceFakeTest() 171 DriveFileSyncServiceFakeTest()
172 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 172 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
173 profile_manager_(TestingBrowserProcess::GetGlobal()), 173 profile_manager_(TestingBrowserProcess::GetGlobal()),
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 DriveFileSyncService* sync_service() { return sync_service_.get(); } 302 DriveFileSyncService* sync_service() { return sync_service_.get(); }
303 std::map<GURL, std::string>* pending_batch_sync_origins() { 303 std::map<GURL, std::string>* pending_batch_sync_origins() {
304 return &(sync_service()->pending_batch_sync_origins_); 304 return &(sync_service()->pending_batch_sync_origins_);
305 } 305 }
306 306
307 const RemoteChangeHandler& remote_change_handler() const { 307 const RemoteChangeHandler& remote_change_handler() const {
308 return sync_service_->remote_change_handler_; 308 return sync_service_->remote_change_handler_;
309 } 309 }
310 310
311 fileapi::FileSystemURL CreateURL(const GURL& origin, 311 storage::FileSystemURL CreateURL(const GURL& origin,
312 const std::string& filename) { 312 const std::string& filename) {
313 return CreateSyncableFileSystemURL( 313 return CreateSyncableFileSystemURL(
314 origin, base::FilePath::FromUTF8Unsafe(filename)); 314 origin, base::FilePath::FromUTF8Unsafe(filename));
315 } 315 }
316 316
317 void ProcessRemoteChange(SyncStatusCode expected_status, 317 void ProcessRemoteChange(SyncStatusCode expected_status,
318 const fileapi::FileSystemURL& expected_url, 318 const storage::FileSystemURL& expected_url,
319 SyncFileStatus expected_sync_file_status, 319 SyncFileStatus expected_sync_file_status,
320 SyncAction expected_sync_action, 320 SyncAction expected_sync_action,
321 SyncDirection expected_sync_direction) { 321 SyncDirection expected_sync_direction) {
322 SyncStatusCode actual_status = SYNC_STATUS_UNKNOWN; 322 SyncStatusCode actual_status = SYNC_STATUS_UNKNOWN;
323 fileapi::FileSystemURL actual_url; 323 storage::FileSystemURL actual_url;
324 324
325 if (expected_sync_file_status != SYNC_FILE_STATUS_UNKNOWN) { 325 if (expected_sync_file_status != SYNC_FILE_STATUS_UNKNOWN) {
326 EXPECT_CALL(*mock_file_status_observer(), 326 EXPECT_CALL(*mock_file_status_observer(),
327 OnFileStatusChanged(expected_url, 327 OnFileStatusChanged(expected_url,
328 expected_sync_file_status, 328 expected_sync_file_status,
329 expected_sync_action, 329 expected_sync_action,
330 expected_sync_direction)) 330 expected_sync_direction))
331 .Times(1); 331 .Times(1);
332 } 332 }
333 333
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // [5] Re-enable Extension 1. It moves back to batch and not to incremental. 564 // [5] Re-enable Extension 1. It moves back to batch and not to incremental.
565 EnableExtension(ExtensionNameToId(kExtensionName1)); 565 EnableExtension(ExtensionNameToId(kExtensionName1));
566 UpdateRegisteredOrigins(); 566 UpdateRegisteredOrigins();
567 VerifySizeOfRegisteredOrigins(1u, 0u, 0u); 567 VerifySizeOfRegisteredOrigins(1u, 0u, 0u);
568 } 568 }
569 569
570 void DriveFileSyncServiceFakeTest::TestRemoteChange_NoChange() { 570 void DriveFileSyncServiceFakeTest::TestRemoteChange_NoChange() {
571 SetUpDriveSyncService(true); 571 SetUpDriveSyncService(true);
572 572
573 ProcessRemoteChange(SYNC_STATUS_NO_CHANGE_TO_SYNC, 573 ProcessRemoteChange(SYNC_STATUS_NO_CHANGE_TO_SYNC,
574 fileapi::FileSystemURL(), 574 storage::FileSystemURL(),
575 SYNC_FILE_STATUS_UNKNOWN, 575 SYNC_FILE_STATUS_UNKNOWN,
576 SYNC_ACTION_NONE, 576 SYNC_ACTION_NONE,
577 SYNC_DIRECTION_NONE); 577 SYNC_DIRECTION_NONE);
578 VerifySizeOfRegisteredOrigins(0u, 0u, 0u); 578 VerifySizeOfRegisteredOrigins(0u, 0u, 0u);
579 EXPECT_TRUE(!remote_change_handler().HasChanges()); 579 EXPECT_TRUE(!remote_change_handler().HasChanges());
580 } 580 }
581 581
582 void DriveFileSyncServiceFakeTest::TestRemoteChange_Busy() { 582 void DriveFileSyncServiceFakeTest::TestRemoteChange_Busy() {
583 const char kFileName[] = "File 1.txt"; 583 const char kFileName[] = "File 1.txt";
584 const GURL origin = ExtensionNameToGURL(kExtensionName1); 584 const GURL origin = ExtensionNameToGURL(kExtensionName1);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 } 851 }
852 852
853 TEST_F(DriveFileSyncServiceFakeTest, RemoteChange_Folder_WAPI) { 853 TEST_F(DriveFileSyncServiceFakeTest, RemoteChange_Folder_WAPI) {
854 ScopedDisableDriveAPI disable_drive_api; 854 ScopedDisableDriveAPI disable_drive_api;
855 TestRemoteChange_Folder(); 855 TestRemoteChange_Folder();
856 } 856 }
857 857
858 #endif // !defined(OS_ANDROID) 858 #endif // !defined(OS_ANDROID)
859 859
860 } // namespace sync_file_system 860 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698