| 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 "base/format_macros.h" | 5 #include "base/format_macros.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_input.h" | 9 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/browser/notification_types.h" | 31 #include "content/public/browser/notification_types.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 string16 AutocompleteResultAsString(const AutocompleteResult& result) { | 36 string16 AutocompleteResultAsString(const AutocompleteResult& result) { |
| 37 std::string output(base::StringPrintf("{%" PRIuS "} ", result.size())); | 37 std::string output(base::StringPrintf("{%" PRIuS "} ", result.size())); |
| 38 for (size_t i = 0; i < result.size(); ++i) { | 38 for (size_t i = 0; i < result.size(); ++i) { |
| 39 AutocompleteMatch match = result.match_at(i); | 39 AutocompleteMatch match = result.match_at(i); |
| 40 std::string provider_name = match.provider->name(); | |
| 41 output.append(base::StringPrintf("[\"%s\" by \"%s\"] ", | 40 output.append(base::StringPrintf("[\"%s\" by \"%s\"] ", |
| 42 UTF16ToUTF8(match.contents).c_str(), | 41 UTF16ToUTF8(match.contents).c_str(), |
| 43 provider_name.c_str())); | 42 match.provider->GetName())); |
| 44 } | 43 } |
| 45 return UTF8ToUTF16(output); | 44 return UTF8ToUTF16(output); |
| 46 } | 45 } |
| 47 | 46 |
| 48 } // namespace | 47 } // namespace |
| 49 | 48 |
| 50 class AutocompleteBrowserTest : public ExtensionBrowserTest { | 49 class AutocompleteBrowserTest : public ExtensionBrowserTest { |
| 51 protected: | 50 protected: |
| 52 LocationBar* GetLocationBar() const { | 51 LocationBar* GetLocationBar() const { |
| 53 return browser()->window()->GetLocationBar(); | 52 return browser()->window()->GetLocationBar(); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 EXPECT_TRUE(autocomplete_controller->done()); | 300 EXPECT_TRUE(autocomplete_controller->done()); |
| 302 const AutocompleteResult& result = autocomplete_controller->result(); | 301 const AutocompleteResult& result = autocomplete_controller->result(); |
| 303 // 'App test' is also a substring of extension 'Packaged App Test'. | 302 // 'App test' is also a substring of extension 'Packaged App Test'. |
| 304 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); | 303 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); |
| 305 AutocompleteMatch match = result.match_at(0); | 304 AutocompleteMatch match = result.match_at(0); |
| 306 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); | 305 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); |
| 307 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); | 306 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); |
| 308 EXPECT_FALSE(match.deletable); | 307 EXPECT_FALSE(match.deletable); |
| 309 } | 308 } |
| 310 } | 309 } |
| OLD | NEW |