OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autocomplete/autocomplete.h" | 7 #include "chrome/browser/autocomplete/autocomplete.h" |
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 // Basic test is crashy on Mac | 23 // Basic test is crashy on Mac |
24 // http://crbug.com/49324 | 24 // http://crbug.com/49324 |
25 #if defined(OS_MAC) | 25 #if defined(OS_MAC) |
26 #define MAYBE_Basic DISABLED_Basic | 26 #define MAYBE_Basic DISABLED_Basic |
27 #else | 27 #else |
28 #define MAYBE_Basic Basic | 28 #define MAYBE_Basic Basic |
29 #endif | 29 #endif |
30 | 30 |
| 31 // Autocomplete test is flaky on ChromeOS. |
| 32 // http://crbug.com/52928 |
| 33 #if defined(OS_CHROMEOS) |
| 34 #define MAYBE_Autocomplete FLAKY_Autocomplete |
| 35 #else |
| 36 #define MAYBE_Autocomplete Autocomplete |
| 37 #endif |
| 38 |
| 39 |
31 namespace { | 40 namespace { |
32 | 41 |
33 std::wstring AutocompleteResultAsString(const AutocompleteResult& result) { | 42 std::wstring AutocompleteResultAsString(const AutocompleteResult& result) { |
34 std::wstring output(StringPrintf(L"{%d} ", result.size())); | 43 std::wstring output(StringPrintf(L"{%d} ", result.size())); |
35 for (size_t i = 0; i < result.size(); ++i) { | 44 for (size_t i = 0; i < result.size(); ++i) { |
36 AutocompleteMatch match = result.match_at(i); | 45 AutocompleteMatch match = result.match_at(i); |
37 std::wstring provider_name(ASCIIToWide(match.provider->name())); | 46 std::wstring provider_name(ASCIIToWide(match.provider->name())); |
38 output.append(StringPrintf(L"[\"%ls\" by \"%ls\"] ", | 47 output.append(StringPrintf(L"[\"%ls\" by \"%ls\"] ", |
39 match.contents.c_str(), | 48 match.contents.c_str(), |
40 provider_name.c_str())); | 49 provider_name.c_str())); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 103 |
95 location_bar->location_entry()->SetUserText(L"chrome"); | 104 location_bar->location_entry()->SetUserText(L"chrome"); |
96 location_bar->Revert(); | 105 location_bar->Revert(); |
97 | 106 |
98 EXPECT_EQ(std::wstring(), location_bar->GetInputString()); | 107 EXPECT_EQ(std::wstring(), location_bar->GetInputString()); |
99 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 108 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
100 location_bar->location_entry()->GetText()); | 109 location_bar->location_entry()->GetText()); |
101 EXPECT_FALSE(location_bar->location_entry()->IsSelectAll()); | 110 EXPECT_FALSE(location_bar->location_entry()->IsSelectAll()); |
102 } | 111 } |
103 | 112 |
104 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, Autocomplete) { | 113 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { |
105 // The results depend on the history backend being loaded. Make sure it is | 114 // The results depend on the history backend being loaded. Make sure it is |
106 // loaded so that the autocomplete results are consistent. | 115 // loaded so that the autocomplete results are consistent. |
107 WaitForHistoryBackendToLoad(); | 116 WaitForHistoryBackendToLoad(); |
108 | 117 |
109 LocationBar* location_bar = GetLocationBar(); | 118 LocationBar* location_bar = GetLocationBar(); |
110 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 119 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
111 | 120 |
112 { | 121 { |
113 autocomplete_controller->Start(L"chrome", std::wstring(), | 122 autocomplete_controller->Start(L"chrome", std::wstring(), |
114 true, false, true); | 123 true, false, true); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_EQ(browser(), browser_used); | 160 EXPECT_EQ(browser(), browser_used); |
152 ui_test_utils::WaitForNavigation( | 161 ui_test_utils::WaitForNavigation( |
153 &browser()->GetSelectedTabContents()->controller()); | 162 &browser()->GetSelectedTabContents()->controller()); |
154 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 163 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
155 location_bar->location_entry()->GetText()); | 164 location_bar->location_entry()->GetText()); |
156 browser()->CloseTab(); | 165 browser()->CloseTab(); |
157 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 166 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
158 location_bar->location_entry()->GetText()); | 167 location_bar->location_entry()->GetText()); |
159 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 168 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
160 } | 169 } |
OLD | NEW |