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/files/file_util.h" | 7 #include "base/files/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 22 matching lines...) Expand all Loading... |
33 std::string* highlighted_text) { | 33 std::string* highlighted_text) { |
34 base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents query( | 34 base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents query( |
35 base::UTF8ToUTF16(query_text)); | 35 base::UTF8ToUTF16(query_text)); |
36 return FindAndHighlight(text, &query, highlighted_text); | 36 return FindAndHighlight(text, &query, highlighted_text); |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 class SearchMetadataTest : public testing::Test { | 41 class SearchMetadataTest : public testing::Test { |
42 protected: | 42 protected: |
43 virtual void SetUp() OVERRIDE { | 43 virtual void SetUp() override { |
44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
45 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); | 45 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); |
46 | 46 |
47 metadata_storage_.reset(new ResourceMetadataStorage( | 47 metadata_storage_.reset(new ResourceMetadataStorage( |
48 temp_dir_.path(), base::MessageLoopProxy::current().get())); | 48 temp_dir_.path(), base::MessageLoopProxy::current().get())); |
49 ASSERT_TRUE(metadata_storage_->Initialize()); | 49 ASSERT_TRUE(metadata_storage_->Initialize()); |
50 | 50 |
51 cache_.reset(new FileCache(metadata_storage_.get(), | 51 cache_.reset(new FileCache(metadata_storage_.get(), |
52 temp_dir_.path(), | 52 temp_dir_.path(), |
53 base::MessageLoopProxy::current().get(), | 53 base::MessageLoopProxy::current().get(), |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 519 } |
520 | 520 |
521 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) { | 521 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) { |
522 std::string highlighted_text; | 522 std::string highlighted_text; |
523 EXPECT_TRUE(FindAndHighlightWrapper("a&b&c&d", "b&c", &highlighted_text)); | 523 EXPECT_TRUE(FindAndHighlightWrapper("a&b&c&d", "b&c", &highlighted_text)); |
524 EXPECT_EQ("a&<b>b&c</b>&d", highlighted_text); | 524 EXPECT_EQ("a&<b>b&c</b>&d", highlighted_text); |
525 } | 525 } |
526 | 526 |
527 } // namespace internal | 527 } // namespace internal |
528 } // namespace drive | 528 } // namespace drive |
OLD | NEW |