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