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/autocomplete/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/bookmark_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 17 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
18 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" | 18 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" |
19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
20 #include "components/bookmarks/core/browser/bookmark_match.h" | 20 #include "components/bookmarks/browser/bookmark_match.h" |
21 #include "components/bookmarks/core/browser/bookmark_model.h" | 21 #include "components/bookmarks/browser/bookmark_model.h" |
22 #include "components/bookmarks/core/test/test_bookmark_client.h" | 22 #include "components/bookmarks/test/test_bookmark_client.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 // The bookmark corpus against which we will simulate searches. | 25 // The bookmark corpus against which we will simulate searches. |
26 struct BookmarksTestInfo { | 26 struct BookmarksTestInfo { |
27 std::string title; | 27 std::string title; |
28 std::string url; | 28 std::string url; |
29 } bookmark_provider_test_data[] = { | 29 } bookmark_provider_test_data[] = { |
30 { "abc def", "http://www.catsanddogs.com/a" }, | 30 { "abc def", "http://www.catsanddogs.com/a" }, |
31 { "abcde", "http://www.catsanddogs.com/b" }, | 31 { "abcde", "http://www.catsanddogs.com/b" }, |
32 { "abcdef", "http://www.catsanddogs.com/c" }, | 32 { "abcdef", "http://www.catsanddogs.com/c" }, |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 ASSERT_EQ(2U, chunks.size()) << description; | 457 ASSERT_EQ(2U, chunks.size()) << description; |
458 size_t offset; | 458 size_t offset; |
459 EXPECT_TRUE(base::StringToSizeT(chunks[0], &offset)) << description; | 459 EXPECT_TRUE(base::StringToSizeT(chunks[0], &offset)) << description; |
460 EXPECT_EQ(offset, match.contents_class[i].offset) << description; | 460 EXPECT_EQ(offset, match.contents_class[i].offset) << description; |
461 int style; | 461 int style; |
462 EXPECT_TRUE(base::StringToInt(chunks[1], &style)) << description; | 462 EXPECT_TRUE(base::StringToInt(chunks[1], &style)) << description; |
463 EXPECT_EQ(style, match.contents_class[i].style) << description; | 463 EXPECT_EQ(style, match.contents_class[i].style) << description; |
464 } | 464 } |
465 } | 465 } |
466 } | 466 } |
OLD | NEW |