OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "chrome/browser/automation/ui_controls.h" | 6 #include "chrome/browser/automation/ui_controls.h" |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #include "chrome/browser/page_navigator.h" | 8 #include "chrome/browser/page_navigator.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/browser/views/bookmark_bar_view.h" | 10 #include "chrome/browser/views/bookmark_bar_view.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // GetPreferredSize hard codes a width of 1. For that reason we add the | 90 // GetPreferredSize hard codes a width of 1. For that reason we add the |
91 // BookmarkBarView to a dumby view as the parent. | 91 // BookmarkBarView to a dumby view as the parent. |
92 // | 92 // |
93 // This code looks a bit hacky, but I've written it so that it shouldn't | 93 // This code looks a bit hacky, but I've written it so that it shouldn't |
94 // be dependant upon any of the layout code in BookmarkBarView. Instead | 94 // be dependant upon any of the layout code in BookmarkBarView. Instead |
95 // we brute force search for a size that triggers the overflow button. | 95 // we brute force search for a size that triggers the overflow button. |
96 ChromeViews::View tmp_parent; | 96 ChromeViews::View tmp_parent; |
97 | 97 |
98 tmp_parent.AddChildView(bb_view_); | 98 tmp_parent.AddChildView(bb_view_); |
99 | 99 |
100 CSize bb_view_pref; | 100 bb_view_pref_ = bb_view_->GetPreferredSize(); |
101 bb_view_->GetPreferredSize(&bb_view_pref); | |
102 bb_view_pref_.set_width(1000); | 101 bb_view_pref_.set_width(1000); |
103 bb_view_pref_.set_height(bb_view_pref.cy); | |
104 ChromeViews::TextButton* button = bb_view_->GetBookmarkButton(4); | 102 ChromeViews::TextButton* button = bb_view_->GetBookmarkButton(4); |
105 while (button->IsVisible()) { | 103 while (button->IsVisible()) { |
106 bb_view_pref_.set_width(bb_view_pref_.width() - 25); | 104 bb_view_pref_.set_width(bb_view_pref_.width() - 25); |
107 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height()); | 105 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height()); |
108 bb_view_->Layout(); | 106 bb_view_->Layout(); |
109 } | 107 } |
110 | 108 |
111 tmp_parent.RemoveChildView(bb_view_); | 109 tmp_parent.RemoveChildView(bb_view_); |
112 | 110 |
113 ViewEventTestBase::SetUp(); | 111 ViewEventTestBase::SetUp(); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 817 |
820 void Step8() { | 818 void Step8() { |
821 ASSERT_TRUE( | 819 ASSERT_TRUE( |
822 model_->GetBookmarkBarNode()->GetChild(0)->GetChild(0)->GetURL() == | 820 model_->GetBookmarkBarNode()->GetChild(0)->GetChild(0)->GetURL() == |
823 navigator_.url_); | 821 navigator_.url_); |
824 Done(); | 822 Done(); |
825 } | 823 } |
826 }; | 824 }; |
827 | 825 |
828 VIEW_TEST(BookmarkBarViewTest10, KeyEvents) | 826 VIEW_TEST(BookmarkBarViewTest10, KeyEvents) |
OLD | NEW |