| 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 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 11 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 11 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 13 #include "components/omnibox/autocomplete_input.h" |
| 13 #include "ui/gfx/font_list.h" | 14 #include "ui/gfx/font_list.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/text_elider.h" | 16 #include "ui/gfx/text_elider.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 class MockOmniboxPopupViewMac : public OmniboxPopupViewMac { | 20 class MockOmniboxPopupViewMac : public OmniboxPopupViewMac { |
| 20 public: | 21 public: |
| 21 MockOmniboxPopupViewMac(OmniboxView* omnibox_view, | 22 MockOmniboxPopupViewMac(OmniboxView* omnibox_view, |
| 22 OmniboxEditModel* edit_model, | 23 OmniboxEditModel* edit_model, |
| 23 NSTextField* field) | 24 NSTextField* field) |
| 24 : OmniboxPopupViewMac(omnibox_view, edit_model, field) { | 25 : OmniboxPopupViewMac(omnibox_view, edit_model, field) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 void SetResultCount(size_t count) { | 28 void SetResultCount(size_t count) { |
| 28 ACMatches matches; | 29 ACMatches matches; |
| 29 for (size_t i = 0; i < count; ++i) | 30 for (size_t i = 0; i < count; ++i) |
| 30 matches.push_back(AutocompleteMatch()); | 31 matches.push_back(AutocompleteMatch()); |
| 31 result_.Reset(); | 32 result_.Reset(); |
| 32 result_.AppendMatches(matches); | 33 result_.AppendMatches(AutocompleteInput(), matches); |
| 33 } | 34 } |
| 34 | 35 |
| 35 protected: | 36 protected: |
| 36 const AutocompleteResult& GetResult() const override { return result_; } | 37 const AutocompleteResult& GetResult() const override { return result_; } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 AutocompleteResult result_; | 40 AutocompleteResult result_; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 class OmniboxPopupViewMacTest : public CocoaProfileTest { | 43 class OmniboxPopupViewMacTest : public CocoaProfileTest { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 70 EXPECT_GT(popup_view.GetTargetBounds().height(), old_height); | 71 EXPECT_GT(popup_view.GetTargetBounds().height(), old_height); |
| 71 EXPECT_EQ(5, [popup_view.matrix() numberOfRows]); | 72 EXPECT_EQ(5, [popup_view.matrix() numberOfRows]); |
| 72 | 73 |
| 73 popup_view.SetResultCount(0); | 74 popup_view.SetResultCount(0); |
| 74 popup_view.UpdatePopupAppearance(); | 75 popup_view.UpdatePopupAppearance(); |
| 75 EXPECT_FALSE(popup_view.IsOpen()); | 76 EXPECT_FALSE(popup_view.IsOpen()); |
| 76 EXPECT_EQ(0, [popup_view.matrix() numberOfRows]); | 77 EXPECT_EQ(0, [popup_view.matrix() numberOfRows]); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace | 80 } // namespace |
| OLD | NEW |