OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dev_tools_controller.h" | 5 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
6 | 6 |
7 #include "chrome/browser/devtools/devtools_window.h" | 7 #include "chrome/browser/devtools/devtools_window.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #include "chrome/browser/ui/find_bar/find_bar.h" | 12 #include "chrome/browser/ui/find_bar/find_bar.h" |
13 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 13 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
18 | 18 |
19 class DevToolsControllerTest : public InProcessBrowserTest { | 19 class DevToolsControllerTest : public InProcessBrowserTest { |
20 public: | 20 public: |
21 DevToolsControllerTest() : InProcessBrowserTest() { | 21 DevToolsControllerTest() : InProcessBrowserTest() { |
22 } | 22 } |
23 | 23 |
24 virtual void SetUpOnMainThread() OVERRIDE { | 24 virtual void SetUpOnMainThread() OVERRIDE { |
25 DevToolsWindow::ToggleDevToolsWindow(browser(), | 25 DevToolsWindow* devtools = DevToolsWindow::ToggleDevToolsWindow( |
26 DevToolsToggleAction::Show()); | 26 browser(), DevToolsToggleAction::Show()); |
| 27 devtools->SetIsDockedAndShowImmediatelyForTest(true); |
27 } | 28 } |
28 | 29 |
29 private: | 30 private: |
30 DISALLOW_COPY_AND_ASSIGN(DevToolsControllerTest); | 31 DISALLOW_COPY_AND_ASSIGN(DevToolsControllerTest); |
31 }; | 32 }; |
32 | 33 |
33 // Verify that AllowOverlappingViews is set while the find bar is visible. | 34 // Verify that AllowOverlappingViews is set while the find bar is visible. |
34 IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOverlappingViews) { | 35 IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOverlappingViews) { |
35 content::WebContents* web_contents = | 36 content::WebContents* web_contents = |
36 browser()->tab_strip_model()->GetActiveWebContents(); | 37 browser()->tab_strip_model()->GetActiveWebContents(); |
37 DevToolsWindow* dev_tools = | 38 DevToolsWindow* dev_tools = |
38 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents); | 39 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents); |
39 content::WebContentsView* dev_tools_view = | 40 content::WebContentsView* dev_tools_view = |
40 dev_tools->web_contents()->GetView(); | 41 dev_tools->web_contents()->GetView(); |
41 | 42 |
42 // Without the find bar. | 43 // Without the find bar. |
43 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); | 44 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); |
44 | 45 |
45 // With the find bar. | 46 // With the find bar. |
46 browser()->GetFindBarController()->find_bar()->Show(false); | 47 browser()->GetFindBarController()->find_bar()->Show(false); |
47 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); | 48 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); |
48 | 49 |
49 // Without the find bar. | 50 // Without the find bar. |
50 browser()->GetFindBarController()->find_bar()->Hide(false); | 51 browser()->GetFindBarController()->find_bar()->Hide(false); |
51 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); | 52 EXPECT_TRUE(dev_tools_view->GetAllowOverlappingViews()); |
52 } | 53 } |
OLD | NEW |