| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 AutocompleteMatch match(nullptr, 500, false, | 314 AutocompleteMatch match(nullptr, 500, false, |
| 315 AutocompleteMatchType::HISTORY_TITLE); | 315 AutocompleteMatchType::HISTORY_TITLE); |
| 316 match.contents = base::ASCIIToUTF16("http://autocomplete-result/"); | 316 match.contents = base::ASCIIToUTF16("http://autocomplete-result/"); |
| 317 match.contents_class.push_back( | 317 match.contents_class.push_back( |
| 318 ACMatchClassification(0, ACMatchClassification::URL)); | 318 ACMatchClassification(0, ACMatchClassification::URL)); |
| 319 match.destination_url = GURL("http://autocomplete-result/"); | 319 match.destination_url = GURL("http://autocomplete-result/"); |
| 320 match.allowed_to_be_default_match = true; | 320 match.allowed_to_be_default_match = true; |
| 321 matches.push_back(match); | 321 matches.push_back(match); |
| 322 const AutocompleteInput input( | 322 const AutocompleteInput input( |
| 323 base::ASCIIToUTF16("a"), base::string16::npos, std::string(), GURL(), | 323 base::ASCIIToUTF16("a"), base::string16::npos, std::string(), GURL(), |
| 324 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 324 base::string16(), metrics::OmniboxEventProto::INVALID_SPEC, false, false, |
| 325 TestSchemeClassifier()); | 325 true, true, false, TestSchemeClassifier()); |
| 326 results.AppendMatches(input, matches); | 326 results.AppendMatches(input, matches); |
| 327 results.SortAndCull( | 327 results.SortAndCull( |
| 328 input, TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 328 input, TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
| 329 | 329 |
| 330 // The omnibox popup should open with suggestions displayed. | 330 // The omnibox popup should open with suggestions displayed. |
| 331 omnibox_view->model()->popup_model()->OnResultChanged(); | 331 omnibox_view->model()->popup_model()->OnResultChanged(); |
| 332 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 332 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
| 333 | 333 |
| 334 // The omnibox text should be selected. | 334 // The omnibox text should be selected. |
| 335 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 335 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 362 AutocompleteMatch match(nullptr, 500, false, | 362 AutocompleteMatch match(nullptr, 500, false, |
| 363 AutocompleteMatchType::HISTORY_TITLE); | 363 AutocompleteMatchType::HISTORY_TITLE); |
| 364 match.contents = base::ASCIIToUTF16("http://autocomplete-result/"); | 364 match.contents = base::ASCIIToUTF16("http://autocomplete-result/"); |
| 365 match.contents_class.push_back( | 365 match.contents_class.push_back( |
| 366 ACMatchClassification(0, ACMatchClassification::URL)); | 366 ACMatchClassification(0, ACMatchClassification::URL)); |
| 367 match.destination_url = GURL("http://autocomplete-result/"); | 367 match.destination_url = GURL("http://autocomplete-result/"); |
| 368 match.allowed_to_be_default_match = true; | 368 match.allowed_to_be_default_match = true; |
| 369 matches.push_back(match); | 369 matches.push_back(match); |
| 370 const AutocompleteInput input( | 370 const AutocompleteInput input( |
| 371 base::ASCIIToUTF16("autocomplete-result"), 19, "autocomplete-result", | 371 base::ASCIIToUTF16("autocomplete-result"), 19, "autocomplete-result", |
| 372 GURL("http://autocomplete-result/"), | 372 GURL("http://autocomplete-result/"), base::string16(), |
| 373 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 373 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, |
| 374 TestSchemeClassifier()); | 374 TestSchemeClassifier()); |
| 375 results.AppendMatches(input, matches); | 375 results.AppendMatches(input, matches); |
| 376 results.SortAndCull( | 376 results.SortAndCull( |
| 377 input, TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 377 input, TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
| 378 | 378 |
| 379 // The omnibox popup should open with suggestions displayed. | 379 // The omnibox popup should open with suggestions displayed. |
| 380 omnibox_view->model()->popup_model()->OnResultChanged(); | 380 omnibox_view->model()->popup_model()->OnResultChanged(); |
| 381 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 381 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
| 382 | 382 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 453 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
| 454 | 454 |
| 455 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); | 455 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); |
| 456 EXPECT_EQ(omnibox_view_views->GetRenderText()->elide_behavior(), | 456 EXPECT_EQ(omnibox_view_views->GetRenderText()->elide_behavior(), |
| 457 gfx::ELIDE_TAIL); | 457 gfx::ELIDE_TAIL); |
| 458 | 458 |
| 459 chrome::FocusLocationBar(browser()); | 459 chrome::FocusLocationBar(browser()); |
| 460 EXPECT_EQ(omnibox_view_views->GetRenderText()->elide_behavior(), | 460 EXPECT_EQ(omnibox_view_views->GetRenderText()->elide_behavior(), |
| 461 gfx::NO_ELIDE); | 461 gfx::NO_ELIDE); |
| 462 } | 462 } |
| OLD | NEW |