| Index: chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm
|
| diff --git a/chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm b/chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm
|
| index 33c5b9c6502c77745d0bd9c8ea1effd0a2dca96a..e22f829e675b969709127b3a7162bf3a4da1c0d0 100644
|
| --- a/chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm
|
| +++ b/chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm
|
| @@ -13,36 +13,68 @@
|
| #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/notification_types.h"
|
| #include "content/public/browser/web_contents.h"
|
| +#include "content/public/test/test_utils.h"
|
|
|
| class DevToolsControllerTest : public InProcessBrowserTest {
|
| public:
|
| - DevToolsControllerTest() : InProcessBrowserTest() {
|
| + DevToolsControllerTest() : InProcessBrowserTest(), devtools_window_(NULL) {}
|
| +
|
| + protected:
|
| + void OpenDevToolsWindow() {
|
| + devtools_window_ =
|
| + DevToolsWindow::OpenDevToolsWindowForTest(browser(), true);
|
| + }
|
| +
|
| + void CloseDevToolsWindow() {
|
| + content::WindowedNotificationObserver close_observer(
|
| + content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| + content::Source<content::WebContents>(
|
| + devtools_window_->web_contents_for_test()));
|
| + DevToolsWindow::ToggleDevToolsWindow(
|
| + browser(), DevToolsToggleAction::Toggle());
|
| + close_observer.Wait();
|
| + }
|
| +
|
| + content::WebContents* web_contents() {
|
| + return browser()->tab_strip_model()->GetActiveWebContents();
|
| }
|
|
|
| - virtual void SetUpOnMainThread() OVERRIDE {
|
| - DevToolsWindow::OpenDevToolsWindowForTest(browser(), true);
|
| + content::WebContents* devtools_web_contents() {
|
| + return DevToolsWindow::GetInTabWebContents(web_contents(), NULL);
|
| }
|
|
|
| + DevToolsWindow* devtools_window_;
|
| +
|
| 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();
|
| - content::WebContents* dev_tools =
|
| - DevToolsWindow::GetInTabWebContents(web_contents, NULL);
|
| + OpenDevToolsWindow();
|
|
|
| // Without the find bar.
|
| - EXPECT_TRUE(dev_tools->GetAllowOverlappingViews());
|
| + EXPECT_TRUE(devtools_web_contents()->GetAllowOverlappingViews());
|
|
|
| // With the find bar.
|
| browser()->GetFindBarController()->find_bar()->Show(false);
|
| - EXPECT_TRUE(dev_tools->GetAllowOverlappingViews());
|
| + EXPECT_TRUE(devtools_web_contents()->GetAllowOverlappingViews());
|
|
|
| // Without the find bar.
|
| browser()->GetFindBarController()->find_bar()->Hide(false);
|
| - EXPECT_TRUE(dev_tools->GetAllowOverlappingViews());
|
| + EXPECT_TRUE(devtools_web_contents()->GetAllowOverlappingViews());
|
| +}
|
| +
|
| +// Verify that AllowOtherViews is set when and only when DevTools is visible.
|
| +IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOtherViews) {
|
| + EXPECT_FALSE(web_contents()->GetAllowOtherViews());
|
| +
|
| + OpenDevToolsWindow();
|
| + EXPECT_TRUE(devtools_web_contents()->GetAllowOtherViews());
|
| + EXPECT_TRUE(web_contents()->GetAllowOtherViews());
|
| +
|
| + CloseDevToolsWindow();
|
| + EXPECT_FALSE(web_contents()->GetAllowOtherViews());
|
| }
|
|
|