Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / dev_tools_controller_browsertest.mm
blobe6602e962428eafb98aed69d68c6adef4b33d1bd
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
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/dev_tools_controller.h"
7 #include "chrome/browser/devtools/devtools_window.h"
8 #include "chrome/browser/devtools/devtools_window_testing.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
13 #include "chrome/browser/ui/find_bar/find_bar.h"
14 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/web_contents.h"
19 #include "content/public/test/test_utils.h"
21 class DevToolsControllerTest : public InProcessBrowserTest {
22  public:
23   DevToolsControllerTest() : InProcessBrowserTest(), devtools_window_(NULL) {}
25  protected:
26   void OpenDevToolsWindow() {
27     devtools_window_ =
28         DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true);
29   }
31   void CloseDevToolsWindow() {
32     DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window_);
33   }
35   content::WebContents* web_contents() {
36     return browser()->tab_strip_model()->GetActiveWebContents();
37   }
39   content::WebContents* devtools_web_contents() {
40     return DevToolsWindow::GetInTabWebContents(web_contents(), NULL);
41   }
43   DevToolsWindow* devtools_window_;
45  private:
46   DISALLOW_COPY_AND_ASSIGN(DevToolsControllerTest);
49 // Verify that AllowOtherViews is set when and only when DevTools is visible.
50 IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOtherViews) {
51   EXPECT_FALSE(web_contents()->GetAllowOtherViews());
53   OpenDevToolsWindow();
54   EXPECT_TRUE(devtools_web_contents()->GetAllowOtherViews());
55   EXPECT_TRUE(web_contents()->GetAllowOtherViews());
57   CloseDevToolsWindow();
58   EXPECT_FALSE(web_contents()->GetAllowOtherViews());