| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxView); | 98 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxView); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class TestingOmniboxEditController : public OmniboxEditController { | 101 class TestingOmniboxEditController : public OmniboxEditController { |
| 102 public: | 102 public: |
| 103 explicit TestingOmniboxEditController(ToolbarModel* toolbar_model) | 103 explicit TestingOmniboxEditController(ToolbarModel* toolbar_model) |
| 104 : OmniboxEditController(NULL), | 104 : OmniboxEditController(NULL), |
| 105 toolbar_model_(toolbar_model) { | 105 toolbar_model_(toolbar_model) { |
| 106 } | 106 } |
| 107 | 107 |
| 108 protected: |
| 108 // OmniboxEditController: | 109 // OmniboxEditController: |
| 109 virtual void Update(const content::WebContents* contents) OVERRIDE {} | 110 virtual void Update(const content::WebContents* contents) OVERRIDE {} |
| 110 virtual void OnChanged() OVERRIDE {} | 111 virtual void OnChanged() OVERRIDE {} |
| 111 virtual void OnSetFocus() OVERRIDE {} | 112 virtual void OnSetFocus() OVERRIDE {} |
| 113 virtual void ShowURL() OVERRIDE {} |
| 114 virtual void HideURL() OVERRIDE {} |
| 112 virtual InstantController* GetInstant() OVERRIDE { return NULL; } | 115 virtual InstantController* GetInstant() OVERRIDE { return NULL; } |
| 113 virtual WebContents* GetWebContents() OVERRIDE { return NULL; } | 116 virtual WebContents* GetWebContents() OVERRIDE { return NULL; } |
| 114 virtual ToolbarModel* GetToolbarModel() OVERRIDE { return toolbar_model_; } | 117 virtual ToolbarModel* GetToolbarModel() OVERRIDE { return toolbar_model_; } |
| 115 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE { | 118 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE { |
| 116 return toolbar_model_; | 119 return toolbar_model_; |
| 117 } | 120 } |
| 118 | 121 |
| 119 private: | 122 private: |
| 120 ToolbarModel* toolbar_model_; | 123 ToolbarModel* toolbar_model_; |
| 121 | 124 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 253 |
| 251 model.SetUserText(UTF8ToUTF16("he")); | 254 model.SetUserText(UTF8ToUTF16("he")); |
| 252 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); | 255 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); |
| 253 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 256 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 254 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); | 257 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); |
| 255 | 258 |
| 256 model.AcceptTemporaryTextAsUserText(); | 259 model.AcceptTemporaryTextAsUserText(); |
| 257 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 260 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 258 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 261 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 259 } | 262 } |
| OLD | NEW |