| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
| 10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
| (...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 | 1714 |
| 1715 // Manufacture a few autocomplete results and get them down to the page. | 1715 // Manufacture a few autocomplete results and get them down to the page. |
| 1716 std::vector<InstantAutocompleteResult> autocomplete_results; | 1716 std::vector<InstantAutocompleteResult> autocomplete_results; |
| 1717 for (int i = 0; i < 3; ++i) { | 1717 for (int i = 0; i < 3; ++i) { |
| 1718 std::string description(base::StringPrintf("Test Description %d", i)); | 1718 std::string description(base::StringPrintf("Test Description %d", i)); |
| 1719 std::string url(base::StringPrintf("http://www.testurl%d.com", i)); | 1719 std::string url(base::StringPrintf("http://www.testurl%d.com", i)); |
| 1720 | 1720 |
| 1721 InstantAutocompleteResult res; | 1721 InstantAutocompleteResult res; |
| 1722 res.provider = ASCIIToUTF16(AutocompleteProvider::TypeToString( | 1722 res.provider = ASCIIToUTF16(AutocompleteProvider::TypeToString( |
| 1723 AutocompleteProvider::TYPE_BUILTIN)); | 1723 AutocompleteProvider::TYPE_BUILTIN)); |
| 1724 res.type = ASCIIToUTF16(AutocompleteMatchType::ToString( | 1724 res.type = AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
| 1725 AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED)), | |
| 1726 res.description = ASCIIToUTF16(description); | 1725 res.description = ASCIIToUTF16(description); |
| 1727 res.destination_url = ASCIIToUTF16(url); | 1726 res.destination_url = ASCIIToUTF16(url); |
| 1728 res.transition = content::PAGE_TRANSITION_TYPED; | 1727 res.transition = content::PAGE_TRANSITION_TYPED; |
| 1729 res.relevance = 42 + i; | 1728 res.relevance = 42 + i; |
| 1730 | 1729 |
| 1731 autocomplete_results.push_back(res); | 1730 autocomplete_results.push_back(res); |
| 1732 } | 1731 } |
| 1733 instant()->overlay()->SendAutocompleteResults(autocomplete_results); | 1732 instant()->overlay()->SendAutocompleteResults(autocomplete_results); |
| 1734 | 1733 |
| 1735 // Apparently, one needs to access nativeSuggestions before | 1734 // Apparently, one needs to access nativeSuggestions before |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 | 2513 |
| 2515 // Test that if the LogDropdownShown() call records a histogram value. | 2514 // Test that if the LogDropdownShown() call records a histogram value. |
| 2516 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) { | 2515 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) { |
| 2517 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 2516 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 2518 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 2517 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 2519 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb"); | 2518 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb"); |
| 2520 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a")); | 2519 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a")); |
| 2521 EXPECT_EQ(histogramValue + 1, | 2520 EXPECT_EQ(histogramValue + 1, |
| 2522 GetHistogramCount("Instant.TimeToFirstShowFromWeb")); | 2521 GetHistogramCount("Instant.TimeToFirstShowFromWeb")); |
| 2523 } | 2522 } |
| OLD | NEW |