| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual void Observe(int type, | 71 virtual void Observe(int type, |
| 72 const content::NotificationSource& source, | 72 const content::NotificationSource& source, |
| 73 const content::NotificationDetails& details) OVERRIDE { | 73 const content::NotificationDetails& details) OVERRIDE { |
| 74 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) | 74 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) |
| 75 ++visibility_changed_count_; | 75 ++visibility_changed_count_; |
| 76 } | 76 } |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 InstantOverlayModel instant_overlay_model_; | 79 InstantOverlayModel instant_overlay_model_; |
| 80 scoped_ptr<content::WebContents> web_contents_; | 80 scoped_ptr<content::WebContents> web_contents_; |
| 81 scoped_nsobject<OverlayableContentsController> controller_; | 81 base::scoped_nsobject<OverlayableContentsController> controller_; |
| 82 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
| 83 int visibility_changed_count_; | 83 int visibility_changed_count_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // Verify that the view is correctly laid out when size is specified in percent. | 86 // Verify that the view is correctly laid out when size is specified in percent. |
| 87 IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePerecent) { | 87 IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePerecent) { |
| 88 SearchMode mode; | 88 SearchMode mode; |
| 89 mode.mode = SearchMode::MODE_NTP; | 89 mode.mode = SearchMode::MODE_NTP; |
| 90 CGFloat expected_height = 30; | 90 CGFloat expected_height = 30; |
| 91 InstantSizeUnits units = INSTANT_SIZE_PERCENT; | 91 InstantSizeUnits units = INSTANT_SIZE_PERCENT; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 EXPECT_EQ(separator_height, | 185 EXPECT_EQ(separator_height, |
| 186 NSMaxY([[overlay_view superview] frame]) - | 186 NSMaxY([[overlay_view superview] frame]) - |
| 187 NSMaxY([overlay_view frame])); | 187 NSMaxY([overlay_view frame])); |
| 188 | 188 |
| 189 CGFloat offset = 30; | 189 CGFloat offset = 30; |
| 190 [controller_ setOverlayContentsOffset:offset]; | 190 [controller_ setOverlayContentsOffset:offset]; |
| 191 EXPECT_EQ(separator_height + offset, | 191 EXPECT_EQ(separator_height + offset, |
| 192 NSMaxY([[overlay_view superview] frame]) - | 192 NSMaxY([[overlay_view superview] frame]) - |
| 193 NSMaxY([overlay_view frame])); | 193 NSMaxY([overlay_view frame])); |
| 194 } | 194 } |
| OLD | NEW |