summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc30
-rw-r--r--chrome/browser/autocomplete/autocomplete.h6
-rw-r--r--chrome/test/automation/autocomplete_edit_proxy.h17
3 files changed, 37 insertions, 16 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 5e9b083..e2c89c1 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -53,6 +53,22 @@ AutocompleteInput::AutocompleteInput(const std::wstring& text,
text_.erase(0, 1);
}
+// static
+std::string AutocompleteInput::TypeToString(Type type) {
+ switch (type) {
+ case INVALID: return "invalid";
+ case UNKNOWN: return "unknown";
+ case REQUESTED_URL: return "requested-url";
+ case URL: return "url";
+ case QUERY: return "query";
+ case FORCED_QUERY: return "forced-query";
+
+ default:
+ NOTREACHED();
+ return std::string();
+ }
+}
+
//static
AutocompleteInput::Type AutocompleteInput::Parse(const std::wstring& text,
const std::wstring& desired_tld,
@@ -250,6 +266,20 @@ AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider,
}
// static
+std::string AutocompleteMatch::TypeToString(Type type) {
+ switch (type) {
+ case URL: return "url";
+ case KEYWORD: return "keyword";
+ case SEARCH: return "search";
+ case HISTORY_SEARCH: return "history";
+
+ default:
+ NOTREACHED();
+ return std::string();
+ }
+}
+
+// static
bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1,
const AutocompleteMatch& elem2) {
// For equal-relevance matches, we sort alphabetically, so that providers
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h
index ad4c138..1c94cf9 100644
--- a/chrome/browser/autocomplete/autocomplete.h
+++ b/chrome/browser/autocomplete/autocomplete.h
@@ -162,6 +162,9 @@ class AutocompleteInput {
bool prefer_keyword,
bool synchronous_only);
+ // Converts |type| to a string representation. Used in logging.
+ static std::string TypeToString(Type type);
+
// Parses |text| and returns the type of input this will be interpreted as.
// The components of the input are stored in the output parameter |parts|.
static Type Parse(const std::wstring& text,
@@ -301,6 +304,9 @@ struct AutocompleteMatch {
int relevance,
bool deletable);
+ // Converts |type| to a string representation. Used in logging.
+ static std::string TypeToString(Type type);
+
// Comparison function for determining when one match is better than another.
static bool MoreRelevant(const AutocompleteMatch& elem1,
const AutocompleteMatch& elem2);
diff --git a/chrome/test/automation/autocomplete_edit_proxy.h b/chrome/test/automation/autocomplete_edit_proxy.h
index 8b6d766..87c8803 100644
--- a/chrome/test/automation/autocomplete_edit_proxy.h
+++ b/chrome/test/automation/autocomplete_edit_proxy.h
@@ -30,23 +30,8 @@ struct AutocompleteMatchData {
contents(match.contents),
description(match.description),
is_history_what_you_typed_match(match.is_history_what_you_typed_match),
+ type(AutocompleteMatch::TypeToString(match.type)),
starred(match.starred) {
- switch (match.type) {
- case AutocompleteMatch::URL:
- type = "URL";
- break;
- case AutocompleteMatch::KEYWORD:
- type = "KEYWORD";
- break;
- case AutocompleteMatch::SEARCH:
- type = "SEARCH";
- break;
- case AutocompleteMatch::HISTORY_SEARCH:
- type = "HISTORY";
- break;
- default:
- NOTREACHED();
- }
}
std::string provider_name;