OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/tab_contents/overlayable_contents_controller.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; | 165 mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; |
166 instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); | 166 instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); |
167 | 167 |
168 registrar_.Add(this, | 168 registrar_.Add(this, |
169 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, | 169 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
170 content::Source<content::WebContents>(web_contents_.get())); | 170 content::Source<content::WebContents>(web_contents_.get())); |
171 EXPECT_EQ(0, visibility_changed_count_); | 171 EXPECT_EQ(0, visibility_changed_count_); |
172 instant_overlay_model_.SetOverlayState(mode, 11, INSTANT_SIZE_PERCENT); | 172 instant_overlay_model_.SetOverlayState(mode, 11, INSTANT_SIZE_PERCENT); |
173 EXPECT_EQ(1, visibility_changed_count_); | 173 EXPECT_EQ(1, visibility_changed_count_); |
174 } | 174 } |
| 175 |
| 176 IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, OverlayOffset) { |
| 177 SearchMode mode; |
| 178 mode.mode = SearchMode::MODE_NTP; |
| 179 CGFloat expected_height = 10; |
| 180 InstantSizeUnits units = INSTANT_SIZE_PIXELS; |
| 181 instant_overlay_model_.SetOverlayState(mode, expected_height, units); |
| 182 |
| 183 CGFloat separator_height = [OverlayTopSeparatorView preferredHeight]; |
| 184 NSView* overlay_view = web_contents_->GetView()->GetNativeView(); |
| 185 EXPECT_EQ(separator_height, |
| 186 NSMaxY([[overlay_view superview] frame]) - |
| 187 NSMaxY([overlay_view frame])); |
| 188 |
| 189 CGFloat offset = 30; |
| 190 [controller_ setOverlayContentsOffset:offset]; |
| 191 EXPECT_EQ(separator_height + offset, |
| 192 NSMaxY([[overlay_view superview] frame]) - |
| 193 NSMaxY([overlay_view frame])); |
| 194 } |
OLD | NEW |