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(). | 23 // The fake object will be manually deleted in TearDown(). |
24 fake_drive_service_.reset(new FakeDriveService); | 24 fake_drive_service_.reset(new FakeDriveService); |
25 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json"); | 25 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
26 | 26 |
27 scheduler_.reset(new JobScheduler(profile_.get(), fake_drive_service_.get(), | 27 scheduler_.reset(new JobScheduler(profile_.get(), fake_drive_service_.get(), |
28 base::MessageLoopProxy::current())); | 28 base::MessageLoopProxy::current())); |
29 | 29 |
30 web_apps_registry_.reset(new DriveAppRegistry(scheduler_.get())); | 30 web_apps_registry_.reset(new DriveAppRegistry(scheduler_.get())); |
31 web_apps_registry_->Update(); | 31 web_apps_registry_->Update(); |
32 base::RunLoop().RunUntilIdle(); | 32 base::RunLoop().RunUntilIdle(); |
33 } | 33 } |
34 | 34 |
35 bool VerifyApp(const ScopedVector<DriveAppInfo>& list, | 35 bool VerifyApp(const ScopedVector<DriveAppInfo>& list, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Find by secondary MIME type. | 83 // Find by secondary MIME type. |
84 ScopedVector<DriveAppInfo> secondary_app; | 84 ScopedVector<DriveAppInfo> secondary_app; |
85 web_apps_registry_->GetAppsForFile( | 85 web_apps_registry_->GetAppsForFile( |
86 base::FilePath(), "text/html", &secondary_app); | 86 base::FilePath(), "text/html", &secondary_app); |
87 ASSERT_EQ(1U, secondary_app.size()); | 87 ASSERT_EQ(1U, secondary_app.size()); |
88 VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", | 88 VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", |
89 "Drive app 1", "", false); | 89 "Drive app 1", "", false); |
90 } | 90 } |
91 | 91 |
92 } // namespace drive | 92 } // namespace drive |
OLD | NEW |