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 "chrome/browser/chromeos/drive/drive_sync_client.h" | 5 #include "chrome/browser/chromeos/drive/drive_sync_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/scoped_temp_dir.h" | |
17 #include "base/test/test_timeouts.h" | 17 #include "base/test/test_timeouts.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
19 #include "chrome/browser/chromeos/drive/drive.pb.h" | 19 #include "chrome/browser/chromeos/drive/drive.pb.h" |
20 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 20 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
21 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h" | 21 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h" |
22 #include "chrome/browser/chromeos/drive/drive_test_util.h" | 22 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
23 #include "chrome/browser/chromeos/drive/mock_drive_file_system.h" | 23 #include "chrome/browser/chromeos/drive/mock_drive_file_system.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Helper function for verifying that observer is correctly notified the | 306 // Helper function for verifying that observer is correctly notified the |
307 // start of sync client in SetExpectationForGetFileByResourceId. | 307 // start of sync client in SetExpectationForGetFileByResourceId. |
308 void VerifyStartNotified() { | 308 void VerifyStartNotified() { |
309 EXPECT_EQ(TestObserver::STARTED, observer_.state()); | 309 EXPECT_EQ(TestObserver::STARTED, observer_.state()); |
310 } | 310 } |
311 | 311 |
312 protected: | 312 protected: |
313 MessageLoopForUI message_loop_; | 313 MessageLoopForUI message_loop_; |
314 content::TestBrowserThread ui_thread_; | 314 content::TestBrowserThread ui_thread_; |
315 content::TestBrowserThread io_thread_; | 315 content::TestBrowserThread io_thread_; |
316 ScopedTempDir temp_dir_; | 316 base::ScopedTempDir temp_dir_; |
317 scoped_ptr<TestingProfile> profile_; | 317 scoped_ptr<TestingProfile> profile_; |
318 scoped_ptr<StrictMock<MockDriveFileSystem> > mock_file_system_; | 318 scoped_ptr<StrictMock<MockDriveFileSystem> > mock_file_system_; |
319 DriveCache* cache_; | 319 DriveCache* cache_; |
320 scoped_ptr<DriveSyncClient> sync_client_; | 320 scoped_ptr<DriveSyncClient> sync_client_; |
321 scoped_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_; | 321 scoped_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_; |
322 TestObserver observer_; | 322 TestObserver observer_; |
323 }; | 323 }; |
324 | 324 |
325 TEST_F(DriveSyncClientTest, StartInitialScan) { | 325 TEST_F(DriveSyncClientTest, StartInitialScan) { |
326 SetUpTestFiles(); | 326 SetUpTestFiles(); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 EXPECT_EQ(TestObserver::STOPPED, observer_.state()); | 700 EXPECT_EQ(TestObserver::STOPPED, observer_.state()); |
701 | 701 |
702 // So as the resume from the disconnection. | 702 // So as the resume from the disconnection. |
703 SetExpectationForGetFileByResourceId("resource_id_bar"); | 703 SetExpectationForGetFileByResourceId("resource_id_bar"); |
704 SetExpectationForGetFileByResourceId("resource_id_buz"); | 704 SetExpectationForGetFileByResourceId("resource_id_buz"); |
705 ConnectToWifi(); | 705 ConnectToWifi(); |
706 EXPECT_EQ(TestObserver::IDLE, observer_.state()); | 706 EXPECT_EQ(TestObserver::IDLE, observer_.state()); |
707 } | 707 } |
708 | 708 |
709 } // namespace drive | 709 } // namespace drive |
OLD | NEW |