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