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 "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/autocomplete/autocomplete_match.h" | 12 #include "chrome/browser/autocomplete/autocomplete_match.h" |
13 #include "chrome/browser/autocomplete/autocomplete_result.h" | 13 #include "chrome/browser/autocomplete/autocomplete_result.h" |
14 #include "components/variations/entropy_provider.h" | 14 #include "components/variations/entropy_provider.h" |
15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
16 #include "ui/base/gtk/gtk_hig_constants.h" | 16 #include "ui/base/gtk/gtk_hig_constants.h" |
17 #include "ui/gfx/font.h" | 17 #include "ui/gfx/font.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const float kLargeWidth = 10000; | |
23 | |
24 const GdkColor kContentTextColor = GDK_COLOR_RGB(0x00, 0x00, 0x00); | 22 const GdkColor kContentTextColor = GDK_COLOR_RGB(0x00, 0x00, 0x00); |
25 const GdkColor kDimContentTextColor = GDK_COLOR_RGB(0x80, 0x80, 0x80); | 23 const GdkColor kDimContentTextColor = GDK_COLOR_RGB(0x80, 0x80, 0x80); |
26 const GdkColor kURLTextColor = GDK_COLOR_RGB(0x00, 0x88, 0x00); | 24 const GdkColor kURLTextColor = GDK_COLOR_RGB(0x00, 0x88, 0x00); |
27 | 25 |
28 class TestableOmniboxPopupViewGtk : public OmniboxPopupViewGtk { | 26 class TestableOmniboxPopupViewGtk : public OmniboxPopupViewGtk { |
29 public: | 27 public: |
30 TestableOmniboxPopupViewGtk() | 28 TestableOmniboxPopupViewGtk() |
31 : OmniboxPopupViewGtk(gfx::Font(), NULL, NULL, NULL), | 29 : OmniboxPopupViewGtk(gfx::Font(), NULL, NULL, NULL), |
32 show_called_(false), | 30 show_called_(false), |
33 hide_called_(false) { | 31 hide_called_(false) { |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 473 |
476 EXPECT_EQ(0U, view_->GetHiddenMatchCount()); | 474 EXPECT_EQ(0U, view_->GetHiddenMatchCount()); |
477 EXPECT_EQ(0U, view_->LineFromY(0)); | 475 EXPECT_EQ(0U, view_->LineFromY(0)); |
478 gfx::Rect rect = view_->GetRectForLine(1, 100); | 476 gfx::Rect rect = view_->GetRectForLine(1, 100); |
479 EXPECT_EQ(25, rect.y()); | 477 EXPECT_EQ(25, rect.y()); |
480 | 478 |
481 // The single match is visible so the popup should be open. | 479 // The single match is visible so the popup should be open. |
482 view_->UpdatePopupAppearance(); | 480 view_->UpdatePopupAppearance(); |
483 EXPECT_TRUE(view_->show_called_); | 481 EXPECT_TRUE(view_->show_called_); |
484 } | 482 } |
OLD | NEW |