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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #import "base/mac/mac_util.h" | 7 #import "base/mac/mac_util.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
38 #include "chrome/test/base/in_process_browser_test.h" | 38 #include "chrome/test/base/in_process_browser_test.h" |
39 #include "chrome/test/base/testing_profile.h" | 39 #include "chrome/test/base/testing_profile.h" |
40 #include "components/infobars/core/simple_alert_infobar_delegate.h" | 40 #include "components/infobars/core/simple_alert_infobar_delegate.h" |
41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
42 #include "content/public/test/test_utils.h" | 42 #include "content/public/test/test_utils.h" |
43 #import "testing/gtest_mac.h" | 43 #import "testing/gtest_mac.h" |
44 #import "third_party/ocmock/OCMock/OCMock.h" | 44 #import "third_party/ocmock/OCMock/OCMock.h" |
45 #import "ui/base/cocoa/nsview_additions.h" | 45 #import "ui/base/cocoa/nsview_additions.h" |
46 #include "ui/gfx/animation/slide_animation.h" | 46 #include "ui/gfx/animation/slide_animation.h" |
| 47 #include "ui/gfx/vector_icons_public.h" |
47 | 48 |
48 namespace { | 49 namespace { |
49 | 50 |
50 // Creates a mock of an NSWindow that has the given |frame|. | 51 // Creates a mock of an NSWindow that has the given |frame|. |
51 id MockWindowWithFrame(NSRect frame) { | 52 id MockWindowWithFrame(NSRect frame) { |
52 id window = [OCMockObject mockForClass:[NSWindow class]]; | 53 id window = [OCMockObject mockForClass:[NSWindow class]]; |
53 NSValue* window_frame = | 54 NSValue* window_frame = |
54 [NSValue valueWithBytes:&frame objCType:@encode(NSRect)]; | 55 [NSValue valueWithBytes:&frame objCType:@encode(NSRect)]; |
55 [[[window stub] andReturnValue:window_frame] frame]; | 56 [[[window stub] andReturnValue:window_frame] frame]; |
56 return window; | 57 return window; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 201 |
201 BrowserWindowController* controller() const { | 202 BrowserWindowController* controller() const { |
202 return [BrowserWindowController browserWindowControllerForWindow: | 203 return [BrowserWindowController browserWindowControllerForWindow: |
203 browser()->window()->GetNativeWindow()]; | 204 browser()->window()->GetNativeWindow()]; |
204 } | 205 } |
205 | 206 |
206 static void ShowInfoBar(Browser* browser) { | 207 static void ShowInfoBar(Browser* browser) { |
207 SimpleAlertInfoBarDelegate::Create( | 208 SimpleAlertInfoBarDelegate::Create( |
208 InfoBarService::FromWebContents( | 209 InfoBarService::FromWebContents( |
209 browser->tab_strip_model()->GetActiveWebContents()), | 210 browser->tab_strip_model()->GetActiveWebContents()), |
210 0, base::string16(), false); | 211 0, gfx::VectorIconId::VECTOR_ICON_NONE, base::string16(), false); |
211 } | 212 } |
212 | 213 |
213 NSView* GetViewWithID(ViewID view_id) const { | 214 NSView* GetViewWithID(ViewID view_id) const { |
214 switch (view_id) { | 215 switch (view_id) { |
215 case VIEW_ID_FULLSCREEN_FLOATING_BAR: | 216 case VIEW_ID_FULLSCREEN_FLOATING_BAR: |
216 return [controller() floatingBarBackingView]; | 217 return [controller() floatingBarBackingView]; |
217 case VIEW_ID_TOOLBAR: | 218 case VIEW_ID_TOOLBAR: |
218 return [[controller() toolbarController] view]; | 219 return [[controller() toolbarController] view]; |
219 case VIEW_ID_BOOKMARK_BAR: | 220 case VIEW_ID_BOOKMARK_BAR: |
220 return [[controller() bookmarkBarController] view]; | 221 return [[controller() bookmarkBarController] view]; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 VerifyWindowControlsZOrder(); | 630 VerifyWindowControlsZOrder(); |
630 [controller() removeOverlay]; | 631 [controller() removeOverlay]; |
631 VerifyWindowControlsZOrder(); | 632 VerifyWindowControlsZOrder(); |
632 | 633 |
633 // Toggle immersive fullscreen, then verify z order. In immersive fullscreen, | 634 // Toggle immersive fullscreen, then verify z order. In immersive fullscreen, |
634 // there are no window controls. | 635 // there are no window controls. |
635 [controller() enterImmersiveFullscreen]; | 636 [controller() enterImmersiveFullscreen]; |
636 [controller() exitImmersiveFullscreen]; | 637 [controller() exitImmersiveFullscreen]; |
637 VerifyWindowControlsZOrder(); | 638 VerifyWindowControlsZOrder(); |
638 } | 639 } |
OLD | NEW |