| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/omnibox/search_provider.h" | 5 #include "components/omnibox/search_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 class SuggestionDeletionHandler; | 69 class SuggestionDeletionHandler; |
| 70 class SearchProviderForTest : public SearchProvider { | 70 class SearchProviderForTest : public SearchProvider { |
| 71 public: | 71 public: |
| 72 SearchProviderForTest(AutocompleteProviderListener* listener, | 72 SearchProviderForTest(AutocompleteProviderListener* listener, |
| 73 TemplateURLService* template_url_service, | 73 TemplateURLService* template_url_service, |
| 74 Profile* profile); | 74 Profile* profile); |
| 75 bool is_success() { return is_success_; }; | 75 bool is_success() { return is_success_; }; |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 virtual ~SearchProviderForTest(); | 78 ~SearchProviderForTest() override; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 virtual void RecordDeletionResult(bool success) override; | 81 void RecordDeletionResult(bool success) override; |
| 82 bool is_success_; | 82 bool is_success_; |
| 83 DISALLOW_COPY_AND_ASSIGN(SearchProviderForTest); | 83 DISALLOW_COPY_AND_ASSIGN(SearchProviderForTest); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 SearchProviderForTest::SearchProviderForTest( | 86 SearchProviderForTest::SearchProviderForTest( |
| 87 AutocompleteProviderListener* listener, | 87 AutocompleteProviderListener* listener, |
| 88 TemplateURLService* template_url_service, | 88 TemplateURLService* template_url_service, |
| 89 Profile* profile) | 89 Profile* profile) |
| 90 : SearchProvider(listener, template_url_service, | 90 : SearchProvider(listener, template_url_service, |
| 91 scoped_ptr<AutocompleteProviderClient>( | 91 scoped_ptr<AutocompleteProviderClient>( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Sets |match| to it if found. Returns whether |match| was set. | 178 // Sets |match| to it if found. Returns whether |match| was set. |
| 179 bool FindMatchWithContents(const base::string16& contents, | 179 bool FindMatchWithContents(const base::string16& contents, |
| 180 AutocompleteMatch* match); | 180 AutocompleteMatch* match); |
| 181 | 181 |
| 182 // Looks for a match in |provider_| with destination |url|. Sets |match| to | 182 // Looks for a match in |provider_| with destination |url|. Sets |match| to |
| 183 // it if found. Returns whether |match| was set. | 183 // it if found. Returns whether |match| was set. |
| 184 bool FindMatchWithDestination(const GURL& url, AutocompleteMatch* match); | 184 bool FindMatchWithDestination(const GURL& url, AutocompleteMatch* match); |
| 185 | 185 |
| 186 // AutocompleteProviderListener: | 186 // AutocompleteProviderListener: |
| 187 // If we're waiting for the provider to finish, this exits the message loop. | 187 // If we're waiting for the provider to finish, this exits the message loop. |
| 188 virtual void OnProviderUpdate(bool updated_matches) override; | 188 void OnProviderUpdate(bool updated_matches) override; |
| 189 | 189 |
| 190 // Runs a nested message loop until provider_ is done. The message loop is | 190 // Runs a nested message loop until provider_ is done. The message loop is |
| 191 // exited by way of OnProviderUpdate. | 191 // exited by way of OnProviderUpdate. |
| 192 void RunTillProviderDone(); | 192 void RunTillProviderDone(); |
| 193 | 193 |
| 194 // Invokes Start on provider_, then runs all pending tasks. | 194 // Invokes Start on provider_, then runs all pending tasks. |
| 195 void QueryForInput(const base::string16& text, | 195 void QueryForInput(const base::string16& text, |
| 196 bool prevent_inline_autocomplete, | 196 bool prevent_inline_autocomplete, |
| 197 bool prefer_keyword); | 197 bool prefer_keyword); |
| 198 | 198 |
| (...skipping 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3448 EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type); | 3448 EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type); |
| 3449 EXPECT_TRUE(matches[1].answer_contents.empty()); | 3449 EXPECT_TRUE(matches[1].answer_contents.empty()); |
| 3450 EXPECT_TRUE(matches[1].answer_type.empty()); | 3450 EXPECT_TRUE(matches[1].answer_type.empty()); |
| 3451 EXPECT_TRUE(matches[2].answer_contents.empty()); | 3451 EXPECT_TRUE(matches[2].answer_contents.empty()); |
| 3452 EXPECT_TRUE(matches[2].answer_type.empty()); | 3452 EXPECT_TRUE(matches[2].answer_type.empty()); |
| 3453 EXPECT_TRUE(matches[3].answer_contents.empty()); | 3453 EXPECT_TRUE(matches[3].answer_contents.empty()); |
| 3454 EXPECT_TRUE(matches[3].answer_type.empty()); | 3454 EXPECT_TRUE(matches[3].answer_type.empty()); |
| 3455 EXPECT_TRUE(matches[4].answer_contents.empty()); | 3455 EXPECT_TRUE(matches[4].answer_contents.empty()); |
| 3456 EXPECT_TRUE(matches[4].answer_type.empty()); | 3456 EXPECT_TRUE(matches[4].answer_type.empty()); |
| 3457 } | 3457 } |
| OLD | NEW |