summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc8
-rw-r--r--chrome/browser/autocomplete/autocomplete_unittest.cc16
-rw-r--r--chrome/browser/autocomplete/history_contents_provider_unittest.cc4
-rw-r--r--chrome/browser/autocomplete/history_url_provider_unittest.cc6
4 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index d9c3143..3013638 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/autocomplete/search_provider.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/dom_ui/history_ui.h"
+#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
#include "chrome/common/gfx/text_elider.h"
@@ -29,13 +30,6 @@
#include "net/base/registry_controlled_domain.h"
#include "net/url_request/url_request.h"
-// TODO(port): Port this file.
-#if defined(OS_WIN)
-#include "chrome/browser/external_protocol_handler.h"
-#else
-#include "chrome/common/temp_scaffolding_stubs.h"
-#endif
-
using base::TimeDelta;
// AutocompleteInput ----------------------------------------------------------
diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc
index 53605f7..e798adf 100644
--- a/chrome/browser/autocomplete/autocomplete_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_unittest.cc
@@ -16,7 +16,7 @@
namespace {
-const int num_results_per_provider = 3;
+const size_t num_results_per_provider = 3;
// Autocomplete provider that provides known results. Note that this is
// refcounted so that it can also be a task on the message loop.
@@ -74,9 +74,7 @@ void TestProvider::AddResults(int start_at, int num) {
AutocompleteMatch match(this, relevance_ - i, false,
AutocompleteMatch::URL_WHAT_YOU_TYPED);
- wchar_t str[16];
- swprintf_s(str, L"%d", i);
- match.fill_into_edit = prefix_ + str;
+ match.fill_into_edit = prefix_ + IntToWString(i);
match.destination_url = GURL(WideToUTF8(match.fill_into_edit));
match.contents = match.fill_into_edit;
@@ -170,8 +168,6 @@ void AutocompleteProviderTest::Observe(NotificationType type,
}
}
-} // namespace
-
std::ostream& operator<<(std::ostream& os,
const AutocompleteResult::const_iterator& iter) {
return os << static_cast<const AutocompleteMatch*>(&(*iter));
@@ -232,14 +228,16 @@ TEST(AutocompleteTest, InputType) {
// { L"mailto:abuse@foo.com", AutocompleteInput::URL },
{ L"view-source:http://www.foo.com/", AutocompleteInput::URL },
{ L"javascript:alert(\"Hey there!\");", AutocompleteInput::URL },
+#if defined(OS_WIN)
{ L"C:\\Program Files", AutocompleteInput::URL },
+#endif
{ L"\\\\Server\\Folder\\File", AutocompleteInput::URL },
{ L"http://foo.com/", AutocompleteInput::URL },
{ L"127.0.0.1", AutocompleteInput::URL },
{ L"browser.tabs.closeButtons", AutocompleteInput::UNKNOWN },
};
- for (int i = 0; i < arraysize(input_cases); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) {
AutocompleteInput input(input_cases[i].input, std::wstring(), true, false,
false);
EXPECT_EQ(input_cases[i].type, input.type()) << "Input: " <<
@@ -266,10 +264,12 @@ TEST(AutocompleteMatch, MoreRelevant) {
AutocompleteMatch m1(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
AutocompleteMatch m2(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
- for (int i = 0; i < arraysize(cases); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
m1.relevance = cases[i].r1;
m2.relevance = cases[i].r2;
EXPECT_EQ(cases[i].expected_result,
AutocompleteMatch::MoreRelevant(m1, m2));
}
}
+
+} // namespace
diff --git a/chrome/browser/autocomplete/history_contents_provider_unittest.cc b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
index 459230a..06270ec 100644
--- a/chrome/browser/autocomplete/history_contents_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
@@ -94,8 +94,6 @@ class HistoryContentsProviderTest : public testing::Test,
scoped_refptr<HistoryContentsProvider> provider_;
};
-} // namespace
-
TEST_F(HistoryContentsProviderTest, Body) {
AutocompleteInput input(L"FOO", std::wstring(), true, false, false);
RunQuery(input, false);
@@ -182,3 +180,5 @@ TEST_F(HistoryContentsProviderTest, Bookmarks) {
EXPECT_EQ("http://www.google.com/3", m3[0].destination_url.spec());
}
}
+
+} // namespace
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index 6f12cc9..a178ac5 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -325,6 +325,7 @@ TEST_F(HistoryURLProviderTest, Fixup) {
const std::string crash_1[] = {"http://%20/"};
RunTest(L"%20", std::wstring(), false, crash_1, arraysize(crash_1));
+#if defined(OS_WIN)
// Fixing up "file:" should result in an inline autocomplete offset of just
// after "file:", not just after "file://".
const std::wstring input_1(L"file:");
@@ -347,4 +348,9 @@ TEST_F(HistoryURLProviderTest, Fixup) {
// rather than "0.0.0.56.com".
std::string fixup_3[] = {"http://www.56.com/"};
RunTest(L"56", L"com", true, fixup_3, arraysize(fixup_3));
+#elif defined(OS_POSIX)
+ // TODO(port): Fix this up once the dependencies have their UI bits
+ // extracted away.
+ NOTIMPLEMENTED();
+#endif
}