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_system_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/chromeos/drive/mock_drive_file_system.h" | 8 #include "chrome/browser/chromeos/drive/mock_file_system.h" |
9 #include "chrome/browser/chromeos/drive/test_util.h" | 9 #include "chrome/browser/chromeos/drive/test_util.h" |
10 #include "chrome/browser/google_apis/dummy_drive_service.h" | 10 #include "chrome/browser/google_apis/dummy_drive_service.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "content/public/test/test_browser_thread.h" | 12 #include "content/public/test/test_browser_thread.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace drive { | 16 namespace drive { |
17 | 17 |
18 class DriveSystemServiceTest : public testing::Test { | 18 class DriveSystemServiceTest : public testing::Test { |
19 public: | 19 public: |
20 DriveSystemServiceTest() : | 20 DriveSystemServiceTest() : |
21 ui_thread_(content::BrowserThread::UI, &message_loop_), | 21 ui_thread_(content::BrowserThread::UI, &message_loop_), |
22 file_system_(NULL), | 22 file_system_(NULL), |
23 system_service_(NULL) {} | 23 system_service_(NULL) {} |
24 | 24 |
25 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() OVERRIDE { |
26 profile_.reset(new TestingProfile); | 26 profile_.reset(new TestingProfile); |
27 file_system_ = new MockDriveFileSystem; | 27 file_system_ = new MockFileSystem; |
28 system_service_ = new DriveSystemService(profile_.get(), | 28 system_service_ = new DriveSystemService(profile_.get(), |
29 new google_apis::DummyDriveService, | 29 new google_apis::DummyDriveService, |
30 base::FilePath(), | 30 base::FilePath(), |
31 file_system_); | 31 file_system_); |
32 } | 32 } |
33 | 33 |
34 virtual void TearDown() OVERRIDE { | 34 virtual void TearDown() OVERRIDE { |
35 delete system_service_; | 35 delete system_service_; |
36 file_system_ = NULL; | 36 file_system_ = NULL; |
37 google_apis::test_util::RunBlockingPoolTask(); | 37 google_apis::test_util::RunBlockingPoolTask(); |
38 profile_.reset(); | 38 profile_.reset(); |
39 } | 39 } |
40 | 40 |
41 protected: | 41 protected: |
42 MessageLoopForUI message_loop_; | 42 MessageLoopForUI message_loop_; |
43 content::TestBrowserThread ui_thread_; | 43 content::TestBrowserThread ui_thread_; |
44 | 44 |
45 scoped_ptr<TestingProfile> profile_; | 45 scoped_ptr<TestingProfile> profile_; |
46 | 46 |
47 MockDriveFileSystem* file_system_; | 47 MockFileSystem* file_system_; |
48 DriveSystemService* system_service_; | 48 DriveSystemService* system_service_; |
49 }; | 49 }; |
50 | 50 |
51 TEST_F(DriveSystemServiceTest, InitializeAndShutdown) { | 51 TEST_F(DriveSystemServiceTest, InitializeAndShutdown) { |
52 system_service_->Initialize(); | 52 system_service_->Initialize(); |
53 google_apis::test_util::RunBlockingPoolTask(); | 53 google_apis::test_util::RunBlockingPoolTask(); |
54 system_service_->Shutdown(); | 54 system_service_->Shutdown(); |
55 } | 55 } |
56 | 56 |
57 } // namespace drive | 57 } // namespace drive |
OLD | NEW |