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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 6 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
7 #include "chrome/browser/ui/omnibox/omnibox_controller.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_controller.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 #include "components/omnibox/autocomplete_provider.h" | 9 #include "components/omnibox/autocomplete_provider.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 class OmniboxControllerTest : public testing::Test { | 13 class OmniboxControllerTest : public testing::Test { |
13 protected: | 14 protected: |
14 OmniboxControllerTest(); | 15 OmniboxControllerTest(); |
15 ~OmniboxControllerTest() override; | 16 ~OmniboxControllerTest() override; |
16 | 17 |
17 void CreateController(); | 18 void CreateController(); |
18 void AssertProviders(int expected_providers); | 19 void AssertProviders(int expected_providers); |
19 | 20 |
20 PrefService* GetPrefs() { return profile_.GetPrefs(); } | 21 PrefService* GetPrefs() { return profile_.GetPrefs(); } |
21 const AutocompleteController::Providers& GetAutocompleteProviders() const { | 22 const AutocompleteController::Providers& GetAutocompleteProviders() const { |
22 return omnibox_controller_->autocomplete_controller()->providers(); | 23 return omnibox_controller_->autocomplete_controller()->providers(); |
23 } | 24 } |
24 | 25 |
25 private: | 26 private: |
| 27 content::TestBrowserThreadBundle thread_bundle_; |
26 TestingProfile profile_; | 28 TestingProfile profile_; |
27 scoped_ptr<OmniboxController> omnibox_controller_; | 29 scoped_ptr<OmniboxController> omnibox_controller_; |
28 | 30 |
29 DISALLOW_COPY_AND_ASSIGN(OmniboxControllerTest); | 31 DISALLOW_COPY_AND_ASSIGN(OmniboxControllerTest); |
30 }; | 32 }; |
31 | 33 |
32 OmniboxControllerTest::OmniboxControllerTest() { | 34 OmniboxControllerTest::OmniboxControllerTest() { |
33 } | 35 } |
34 | 36 |
35 OmniboxControllerTest::~OmniboxControllerTest() { | 37 OmniboxControllerTest::~OmniboxControllerTest() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Ensure we have at least one provider. | 71 // Ensure we have at least one provider. |
70 ASSERT_NE(0, observed_providers); | 72 ASSERT_NE(0, observed_providers); |
71 | 73 |
72 // Ensure instant extended includes all the provides in classic Chrome. | 74 // Ensure instant extended includes all the provides in classic Chrome. |
73 int providers_with_instant_extended = observed_providers; | 75 int providers_with_instant_extended = observed_providers; |
74 // TODO(beaudoin): remove TYPE_SEARCH once it's no longer needed to pass | 76 // TODO(beaudoin): remove TYPE_SEARCH once it's no longer needed to pass |
75 // the Instant suggestion through via FinalizeInstantQuery. | 77 // the Instant suggestion through via FinalizeInstantQuery. |
76 CreateController(); | 78 CreateController(); |
77 AssertProviders(providers_with_instant_extended); | 79 AssertProviders(providers_with_instant_extended); |
78 } | 80 } |
OLD | NEW |