OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/drive/search_metadata.h" | 5 #include "components/drive/search_metadata.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
9 #include "base/i18n/string_search.h" | 12 #include "base/i18n/string_search.h" |
| 13 #include "base/macros.h" |
10 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
11 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
12 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
14 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
15 #include "components/drive/drive_api_util.h" | 19 #include "components/drive/drive_api_util.h" |
16 #include "components/drive/drive_test_util.h" | 20 #include "components/drive/drive_test_util.h" |
17 #include "components/drive/fake_free_disk_space_getter.h" | 21 #include "components/drive/fake_free_disk_space_getter.h" |
18 #include "components/drive/file_cache.h" | 22 #include "components/drive/file_cache.h" |
19 #include "components/drive/file_system_core_util.h" | 23 #include "components/drive/file_system_core_util.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 "Document 1 excludeDir-test", "doc1", 8, root_local_id); | 129 "Document 1 excludeDir-test", "doc1", 8, root_local_id); |
126 entry.mutable_file_specific_info()->set_is_hosted_document(true); | 130 entry.mutable_file_specific_info()->set_is_hosted_document(true); |
127 entry.mutable_file_specific_info()->set_document_extension(".gdoc"); | 131 entry.mutable_file_specific_info()->set_document_extension(".gdoc"); |
128 entry.mutable_file_specific_info()->set_content_mime_type( | 132 entry.mutable_file_specific_info()->set_content_mime_type( |
129 drive::util::kGoogleDocumentMimeType); | 133 drive::util::kGoogleDocumentMimeType); |
130 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->AddEntry(entry, &local_id)); | 134 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->AddEntry(entry, &local_id)); |
131 } | 135 } |
132 | 136 |
133 ResourceEntry GetFileEntry(const std::string& name, | 137 ResourceEntry GetFileEntry(const std::string& name, |
134 const std::string& resource_id, | 138 const std::string& resource_id, |
135 int64 last_accessed, | 139 int64_t last_accessed, |
136 const std::string& parent_local_id) { | 140 const std::string& parent_local_id) { |
137 ResourceEntry entry; | 141 ResourceEntry entry; |
138 entry.set_title(name); | 142 entry.set_title(name); |
139 entry.set_resource_id(resource_id); | 143 entry.set_resource_id(resource_id); |
140 entry.set_parent_local_id(parent_local_id); | 144 entry.set_parent_local_id(parent_local_id); |
141 entry.mutable_file_info()->set_last_accessed(last_accessed); | 145 entry.mutable_file_info()->set_last_accessed(last_accessed); |
142 return entry; | 146 return entry; |
143 } | 147 } |
144 | 148 |
145 ResourceEntry GetDirectoryEntry(const std::string& name, | 149 ResourceEntry GetDirectoryEntry(const std::string& name, |
146 const std::string& resource_id, | 150 const std::string& resource_id, |
147 int64 last_accessed, | 151 int64_t last_accessed, |
148 const std::string& parent_local_id) { | 152 const std::string& parent_local_id) { |
149 ResourceEntry entry; | 153 ResourceEntry entry; |
150 entry.set_title(name); | 154 entry.set_title(name); |
151 entry.set_resource_id(resource_id); | 155 entry.set_resource_id(resource_id); |
152 entry.set_parent_local_id(parent_local_id); | 156 entry.set_parent_local_id(parent_local_id); |
153 entry.mutable_file_info()->set_last_accessed(last_accessed); | 157 entry.mutable_file_info()->set_last_accessed(last_accessed); |
154 entry.mutable_file_info()->set_is_directory(true); | 158 entry.mutable_file_info()->set_is_directory(true); |
155 return entry; | 159 return entry; |
156 } | 160 } |
157 | 161 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 base::UTF8ToUTF16("ing,"))); | 596 base::UTF8ToUTF16("ing,"))); |
593 | 597 |
594 std::string highlighted_text; | 598 std::string highlighted_text; |
595 EXPECT_TRUE( | 599 EXPECT_TRUE( |
596 FindAndHighlight("good morning, hello", queries, &highlighted_text)); | 600 FindAndHighlight("good morning, hello", queries, &highlighted_text)); |
597 EXPECT_EQ("good <b>morning,</b> hello", highlighted_text); | 601 EXPECT_EQ("good <b>morning,</b> hello", highlighted_text); |
598 } | 602 } |
599 | 603 |
600 } // namespace internal | 604 } // namespace internal |
601 } // namespace drive | 605 } // namespace drive |
OLD | NEW |