summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm
blob: c850488c81c410513302d3c15f6e1de7f372f7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/ui/cocoa/dev_tools_controller.h"

#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/web_contents.h"

class DevToolsControllerTest : public InProcessBrowserTest {
 public:
  DevToolsControllerTest() : InProcessBrowserTest() {
  }

  virtual void SetUpOnMainThread() OVERRIDE {
    DevToolsWindow::OpenDevToolsWindowForTest(browser(), true);
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(DevToolsControllerTest);
};

// Verify that AllowOverlappingViews is set while the find bar is visible.
IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOverlappingViews) {
  content::WebContents* web_contents =
      browser()->tab_strip_model()->GetActiveWebContents();
  DevToolsWindow* dev_tools =
      DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents);

  // Without the find bar.
  EXPECT_TRUE(dev_tools->web_contents()->GetAllowOverlappingViews());

  // With the find bar.
  browser()->GetFindBarController()->find_bar()->Show(false);
  EXPECT_TRUE(dev_tools->web_contents()->GetAllowOverlappingViews());

  // Without the find bar.
  browser()->GetFindBarController()->find_bar()->Hide(false);
  EXPECT_TRUE(dev_tools->web_contents()->GetAllowOverlappingViews());
}