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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DictionaryValue* entry_value; | 101 DictionaryValue* entry_value; |
102 ASSERT_TRUE(reinterpret_cast<DictionaryValue*>(document.get())->GetDictionary( | 102 ASSERT_TRUE(reinterpret_cast<DictionaryValue*>(document.get())->GetDictionary( |
103 std::string("entry"), &entry_value)); | 103 std::string("entry"), &entry_value)); |
104 ASSERT_TRUE(entry_value); | 104 ASSERT_TRUE(entry_value); |
105 | 105 |
106 // Load feed. | 106 // Load feed. |
107 scoped_ptr<AccountMetadataFeed> feed( | 107 scoped_ptr<AccountMetadataFeed> feed( |
108 AccountMetadataFeed::CreateFrom(*document)); | 108 AccountMetadataFeed::CreateFrom(*document)); |
109 ASSERT_TRUE(feed.get()); | 109 ASSERT_TRUE(feed.get()); |
110 scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); | 110 scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); |
111 web_apps->UpdateFromFeed(feed.get()); | 111 web_apps->UpdateFromFeed(*feed.get()); |
112 | 112 |
113 // Find by extension 'ext_1'. | 113 // Find by extension 'ext_1'. |
114 ScopedVector<DriveWebAppInfo> ext_1_results; | 114 ScopedVector<DriveWebAppInfo> ext_1_results; |
115 FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); | 115 FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); |
116 web_apps->GetWebAppsForFile(ext1_file, std::string(), &ext_1_results); | 116 web_apps->GetWebAppsForFile(ext1_file, std::string(), &ext_1_results); |
117 IF_EXPECT_EQ(1U, ext_1_results.size()) { | 117 IF_EXPECT_EQ(1U, ext_1_results.size()) { |
118 EXPECT_TRUE(VerifyApp1(ext_1_results, true)); | 118 EXPECT_TRUE(VerifyApp1(ext_1_results, true)); |
119 } | 119 } |
120 | 120 |
121 // Find by extension 'ext_3'. | 121 // Find by extension 'ext_3'. |
(...skipping 18 matching lines...) Expand all Loading... |
140 FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); | 140 FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); |
141 web_apps->GetWebAppsForFile(mime_file, "application/test_type_2", | 141 web_apps->GetWebAppsForFile(mime_file, "application/test_type_2", |
142 &mime_ext_results); | 142 &mime_ext_results); |
143 IF_EXPECT_EQ(2U, mime_ext_results.size()) { | 143 IF_EXPECT_EQ(2U, mime_ext_results.size()) { |
144 EXPECT_TRUE(VerifyApp1(mime_ext_results, true)); | 144 EXPECT_TRUE(VerifyApp1(mime_ext_results, true)); |
145 EXPECT_TRUE(VerifyApp2(mime_ext_results, true)); | 145 EXPECT_TRUE(VerifyApp2(mime_ext_results, true)); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 } // namespace gdata | 149 } // namespace gdata |
OLD | NEW |