| 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_app_registry.h" | 5 #include "chrome/browser/chromeos/drive/drive_app_registry.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 11 #include "chrome/browser/drive/fake_drive_service.h" | 11 #include "chrome/browser/drive/fake_drive_service.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.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 DriveAppRegistryTest : public testing::Test { | 18 class DriveAppRegistryTest : public testing::Test { |
| 19 protected: | 19 protected: |
| 20 virtual void SetUp() OVERRIDE { | 20 virtual void SetUp() OVERRIDE { |
| 21 profile_.reset(new TestingProfile); | 21 profile_.reset(new TestingProfile); |
| 22 | 22 |
| 23 // The fake object will be manually deleted in TearDown(). | |
| 24 fake_drive_service_.reset(new FakeDriveService); | 23 fake_drive_service_.reset(new FakeDriveService); |
| 25 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 24 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
| 26 | 25 |
| 27 scheduler_.reset(new JobScheduler(profile_.get(), fake_drive_service_.get(), | 26 scheduler_.reset(new JobScheduler(profile_.get(), fake_drive_service_.get(), |
| 28 base::MessageLoopProxy::current())); | 27 base::MessageLoopProxy::current())); |
| 29 | 28 |
| 30 web_apps_registry_.reset(new DriveAppRegistry(scheduler_.get())); | 29 web_apps_registry_.reset(new DriveAppRegistry(scheduler_.get())); |
| 31 web_apps_registry_->Update(); | 30 web_apps_registry_->Update(); |
| 32 base::RunLoop().RunUntilIdle(); | 31 base::RunLoop().RunUntilIdle(); |
| 33 } | 32 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Find by secondary MIME type. | 82 // Find by secondary MIME type. |
| 84 ScopedVector<DriveAppInfo> secondary_app; | 83 ScopedVector<DriveAppInfo> secondary_app; |
| 85 web_apps_registry_->GetAppsForFile( | 84 web_apps_registry_->GetAppsForFile( |
| 86 base::FilePath(), "text/html", &secondary_app); | 85 base::FilePath(), "text/html", &secondary_app); |
| 87 ASSERT_EQ(1U, secondary_app.size()); | 86 ASSERT_EQ(1U, secondary_app.size()); |
| 88 VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", | 87 VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", |
| 89 "Drive app 1", "", false); | 88 "Drive app 1", "", false); |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace drive | 91 } // namespace drive |
| OLD | NEW |