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/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
11 #include "chrome/browser/api/infobars/infobar_service.h" | 11 #include "chrome/browser/api/infobars/infobar_service.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/ui/browser_tabstrip.h" | |
14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 17 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
19 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 18 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
20 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 19 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
21 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 20 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
22 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 21 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
23 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 22 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
24 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 23 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
25 #include "chrome/browser/ui/search/search.h" | 24 #include "chrome/browser/ui/search/search.h" |
26 #include "chrome/browser/ui/search/search_model.h" | 25 #include "chrome/browser/ui/search/search_model.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #import "testing/gtest_mac.h" | 29 #import "testing/gtest_mac.h" |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 33 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
34 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 34 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
35 enum { | 35 enum { |
36 NSWindowDocumentVersionsButton = 6, | 36 NSWindowDocumentVersionsButton = 6, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 browser()->search_model()->set_web_contents(web_contents_.get()); | 121 browser()->search_model()->set_web_contents(web_contents_.get()); |
122 chrome::search::Mode mode(chrome::search::Mode::MODE_NTP, | 122 chrome::search::Mode mode(chrome::search::Mode::MODE_NTP, |
123 chrome::search::Mode::ORIGIN_NTP); | 123 chrome::search::Mode::ORIGIN_NTP); |
124 browser()->search_model()->SetMode(mode); | 124 browser()->search_model()->SetMode(mode); |
125 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); | 125 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); |
126 EXPECT_FALSE([controller() isShowingInstantResults]); | 126 EXPECT_FALSE([controller() isShowingInstantResults]); |
127 } | 127 } |
128 | 128 |
129 void ShowInfoBar() { | 129 void ShowInfoBar() { |
130 content::WebContents* web_contents = | 130 content::WebContents* web_contents = |
131 chrome::GetActiveWebContents(browser()); | 131 browser()->tab_strip_model()->GetActiveWebContents(); |
132 InfoBarService* service = | 132 InfoBarService* service = |
133 InfoBarService::FromWebContents(web_contents); | 133 InfoBarService::FromWebContents(web_contents); |
134 info_bar_delegate_.reset(new DummyInfoBar(service)); | 134 info_bar_delegate_.reset(new DummyInfoBar(service)); |
135 [[controller() infoBarContainerController] | 135 [[controller() infoBarContainerController] |
136 addInfoBar:info_bar_delegate_->CreateInfoBar(service) | 136 addInfoBar:info_bar_delegate_->CreateInfoBar(service) |
137 animate:NO]; | 137 animate:NO]; |
138 } | 138 } |
139 | 139 |
140 NSView* GetViewWithID(ViewID view_id) const { | 140 NSView* GetViewWithID(ViewID view_id) const { |
141 switch (view_id) { | 141 switch (view_id) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 [preview previewOffset]); | 429 [preview previewOffset]); |
430 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 430 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + |
431 GetViewHeight(VIEW_ID_INFO_BAR), | 431 GetViewHeight(VIEW_ID_INFO_BAR), |
432 [preview activeContainerOffset]); | 432 [preview activeContainerOffset]); |
433 | 433 |
434 // Minus bookmark bar. | 434 // Minus bookmark bar. |
435 browser()->window()->ToggleBookmarkBar(); | 435 browser()->window()->ToggleBookmarkBar(); |
436 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview previewOffset]); | 436 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview previewOffset]); |
437 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); | 437 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); |
438 } | 438 } |
OLD | NEW |