Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_browsertest.cc

Issue 9586012: Some fixes split off from https://chromiumcodereview.appspot.com/9570064/ to try and make the omnib… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 9 #include "chrome/browser/autocomplete/autocomplete.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/omnibox/location_bar.h" 21 #include "chrome/browser/ui/omnibox/location_bar.h"
22 #include "chrome/browser/ui/omnibox/omnibox_view.h" 22 #include "chrome/browser/ui/omnibox/omnibox_view.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
25 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
27 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/notification_types.h" 28 #include "content/public/browser/notification_types.h"
29 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
30 30
31 // Autocomplete test is flaky on ChromeOS.
32 // http://crbug.com/52928
33 #if defined(OS_CHROMEOS)
34 #define MAYBE_Autocomplete DISABLED_Autocomplete
35 #else
36 #define MAYBE_Autocomplete Autocomplete
37 #endif
38
39
40 namespace { 31 namespace {
41 32
42 string16 AutocompleteResultAsString(const AutocompleteResult& result) { 33 string16 AutocompleteResultAsString(const AutocompleteResult& result) {
43 std::string output(base::StringPrintf("{%" PRIuS "} ", result.size())); 34 std::string output(base::StringPrintf("{%" PRIuS "} ", result.size()));
44 for (size_t i = 0; i < result.size(); ++i) { 35 for (size_t i = 0; i < result.size(); ++i) {
45 AutocompleteMatch match = result.match_at(i); 36 AutocompleteMatch match = result.match_at(i);
46 std::string provider_name = match.provider->name(); 37 std::string provider_name = match.provider->name();
47 output.append(base::StringPrintf("[\"%s\" by \"%s\"] ", 38 output.append(base::StringPrintf("[\"%s\" by \"%s\"] ",
48 UTF16ToUTF8(match.contents).c_str(), 39 UTF16ToUTF8(match.contents).c_str(),
49 provider_name.c_str())); 40 provider_name.c_str()));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 87
97 location_bar->location_entry()->SetUserText(ASCIIToUTF16("chrome")); 88 location_bar->location_entry()->SetUserText(ASCIIToUTF16("chrome"));
98 location_bar->Revert(); 89 location_bar->Revert();
99 90
100 EXPECT_TRUE(location_bar->GetInputString().empty()); 91 EXPECT_TRUE(location_bar->GetInputString().empty());
101 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), 92 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL),
102 location_bar->location_entry()->GetText()); 93 location_bar->location_entry()->GetText());
103 EXPECT_FALSE(location_bar->location_entry()->IsSelectAll()); 94 EXPECT_FALSE(location_bar->location_entry()->IsSelectAll());
104 } 95 }
105 96
97 // Autocomplete test is flaky on ChromeOS.
98 // http://crbug.com/52928
99 #if defined(OS_CHROMEOS)
100 #define MAYBE_Autocomplete DISABLED_Autocomplete
101 #else
102 #define MAYBE_Autocomplete Autocomplete
103 #endif
104
106 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { 105 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) {
107 // The results depend on the history backend being loaded. Make sure it is 106 // The results depend on the history backend being loaded. Make sure it is
108 // loaded so that the autocomplete results are consistent. 107 // loaded so that the autocomplete results are consistent.
109 ui_test_utils::WaitForHistoryToLoad(browser()); 108 ui_test_utils::WaitForHistoryToLoad(browser());
110 109
111 LocationBar* location_bar = GetLocationBar(); 110 LocationBar* location_bar = GetLocationBar();
112 AutocompleteController* autocomplete_controller = GetAutocompleteController(); 111 AutocompleteController* autocomplete_controller = GetAutocompleteController();
113 112
114 { 113 {
115 autocomplete_controller->Start( 114 autocomplete_controller->Start(
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 EXPECT_TRUE(autocomplete_controller->done()); 304 EXPECT_TRUE(autocomplete_controller->done());
306 const AutocompleteResult& result = autocomplete_controller->result(); 305 const AutocompleteResult& result = autocomplete_controller->result();
307 // 'App test' is also a substring of extension 'Packaged App Test'. 306 // 'App test' is also a substring of extension 'Packaged App Test'.
308 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); 307 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result);
309 AutocompleteMatch match = result.match_at(0); 308 AutocompleteMatch match = result.match_at(0);
310 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); 309 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents);
311 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); 310 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type);
312 EXPECT_FALSE(match.deletable); 311 EXPECT_FALSE(match.deletable);
313 } 312 }
314 } 313 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/history_backend.cc » ('j') | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698