OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 7 #include "chrome/browser/search_engines/template_url_service_factory.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
10 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class TestingOmniboxView : public OmniboxView { | 21 class TestingOmniboxView : public OmniboxView { |
22 public: | 22 public: |
23 explicit TestingOmniboxView(OmniboxEditController* controller) | 23 explicit TestingOmniboxView(OmniboxEditController* controller) |
24 : OmniboxView(NULL, controller, NULL) {} | 24 : OmniboxView(NULL, controller, NULL) {} |
25 | 25 |
26 // OmniboxView: | 26 // OmniboxView: |
27 void SaveStateToTab(WebContents* tab) override {} | 27 void SaveStateToTab(WebContents* tab) override {} |
28 void OnTabChanged(const WebContents* web_contents) override {} | 28 void OnTabChanged(const WebContents* web_contents) override {} |
29 void ResetTabState(WebContents* web_contents) override {} | 29 void ResetTabState(WebContents* web_contents) override {} |
30 void Update() override {} | 30 void Update() override {} |
31 void UpdatePlaceholderText() override {} | |
32 void OpenMatch(const AutocompleteMatch& match, | 31 void OpenMatch(const AutocompleteMatch& match, |
33 WindowOpenDisposition disposition, | 32 WindowOpenDisposition disposition, |
34 const GURL& alternate_nav_url, | 33 const GURL& alternate_nav_url, |
35 const base::string16& pasted_text, | 34 const base::string16& pasted_text, |
36 size_t selected_line) override {} | 35 size_t selected_line) override {} |
37 base::string16 GetText() const override { return text_; } | 36 base::string16 GetText() const override { return text_; } |
38 void SetUserText(const base::string16& text, | 37 void SetUserText(const base::string16& text, |
39 const base::string16& display_text, | 38 const base::string16& display_text, |
40 bool update_popup) override { | 39 bool update_popup) override { |
41 text_ = display_text; | 40 text_ = display_text; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 249 |
251 model.SetUserText(UTF8ToUTF16("he")); | 250 model.SetUserText(UTF8ToUTF16("he")); |
252 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); | 251 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); |
253 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 252 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
254 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); | 253 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); |
255 | 254 |
256 model.AcceptTemporaryTextAsUserText(); | 255 model.AcceptTemporaryTextAsUserText(); |
257 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 256 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
258 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 257 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
259 } | 258 } |
OLD | NEW |