| 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 "chrome/browser/chromeos/drive/search_metadata.h" | 5 #include "chrome/browser/chromeos/drive/search_metadata.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/i18n/string_search.h" | 9 #include "base/i18n/string_search.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 resource_metadata_.reset( | 56 resource_metadata_.reset( |
| 57 new ResourceMetadata(metadata_storage_.get(), | 57 new ResourceMetadata(metadata_storage_.get(), |
| 58 base::MessageLoopProxy::current())); | 58 base::MessageLoopProxy::current())); |
| 59 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize()); | 59 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize()); |
| 60 | 60 |
| 61 AddEntriesToMetadata(); | 61 AddEntriesToMetadata(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void AddEntriesToMetadata() { | 64 void AddEntriesToMetadata() { |
| 65 base::FilePath temp_file; | 65 base::FilePath temp_file; |
| 66 EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), | 66 EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); |
| 67 &temp_file)); | |
| 68 const std::string temp_file_md5 = "md5"; | 67 const std::string temp_file_md5 = "md5"; |
| 69 | 68 |
| 70 ResourceEntry entry; | 69 ResourceEntry entry; |
| 71 std::string local_id; | 70 std::string local_id; |
| 72 | 71 |
| 73 // drive/root | 72 // drive/root |
| 74 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->AddEntry(GetDirectoryEntry( | 73 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->AddEntry(GetDirectoryEntry( |
| 75 util::kDriveMyDriveRootDirName, "root", 100, | 74 util::kDriveMyDriveRootDirName, "root", 100, |
| 76 util::kDriveGrandRootLocalId), &local_id)); | 75 util::kDriveGrandRootLocalId), &local_id)); |
| 77 const std::string root_local_id = local_id; | 76 const std::string root_local_id = local_id; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } | 519 } |
| 521 | 520 |
| 522 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) { | 521 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) { |
| 523 std::string highlighted_text; | 522 std::string highlighted_text; |
| 524 EXPECT_TRUE(FindAndHighlightWrapper("a&b&c&d", "b&c", &highlighted_text)); | 523 EXPECT_TRUE(FindAndHighlightWrapper("a&b&c&d", "b&c", &highlighted_text)); |
| 525 EXPECT_EQ("a&<b>b&c</b>&d", highlighted_text); | 524 EXPECT_EQ("a&<b>b&c</b>&d", highlighted_text); |
| 526 } | 525 } |
| 527 | 526 |
| 528 } // namespace internal | 527 } // namespace internal |
| 529 } // namespace drive | 528 } // namespace drive |
| OLD | NEW |