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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; | 162 mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; |
163 instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); | 163 instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); |
164 | 164 |
165 registrar_.Add(this, | 165 registrar_.Add(this, |
166 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, | 166 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
167 content::Source<content::WebContents>(web_contents_.get())); | 167 content::Source<content::WebContents>(web_contents_.get())); |
168 EXPECT_EQ(0, visibility_changed_count_); | 168 EXPECT_EQ(0, visibility_changed_count_); |
169 instant_overlay_model_.SetOverlayState(mode, 11, INSTANT_SIZE_PERCENT); | 169 instant_overlay_model_.SetOverlayState(mode, 11, INSTANT_SIZE_PERCENT); |
170 EXPECT_EQ(1, visibility_changed_count_); | 170 EXPECT_EQ(1, visibility_changed_count_); |
171 } | 171 } |
| 172 |
| 173 IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, OverlayOffset) { |
| 174 chrome::search::Mode mode; |
| 175 mode.mode = chrome::search::Mode::MODE_NTP; |
| 176 CGFloat expected_height = 10; |
| 177 InstantSizeUnits units = INSTANT_SIZE_PIXELS; |
| 178 instant_overlay_model_.SetOverlayState(mode, expected_height, units); |
| 179 |
| 180 CGFloat separator_height = [OverlayTopSeparatorView preferredHeight]; |
| 181 NSView* overlay_view = web_contents_->GetView()->GetNativeView(); |
| 182 EXPECT_EQ(separator_height, |
| 183 NSMaxY([[overlay_view superview] frame]) - |
| 184 NSMaxY([overlay_view frame])); |
| 185 |
| 186 CGFloat offset = 30; |
| 187 [controller_ setOverlayContentsOffset:offset]; |
| 188 EXPECT_EQ(separator_height + offset, |
| 189 NSMaxY([[overlay_view superview] frame]) - |
| 190 NSMaxY([overlay_view frame])); |
| 191 } |
OLD | NEW |