Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm

Issue 403833002: Revert of [DevTools] Move DevToolsWindow testing code to a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/devtools/devtools_window_testing.h"
9 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/cocoa/browser_window_controller.h" 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
13 #include "chrome/browser/ui/find_bar/find_bar.h" 12 #include "chrome/browser/ui/find_bar/find_bar.h"
14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 13 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
15 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
17 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
19 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
20 19
21 class DevToolsControllerTest : public InProcessBrowserTest { 20 class DevToolsControllerTest : public InProcessBrowserTest {
22 public: 21 public:
23 DevToolsControllerTest() : InProcessBrowserTest(), devtools_window_(NULL) {} 22 DevToolsControllerTest() : InProcessBrowserTest(), devtools_window_(NULL) {}
24 23
25 protected: 24 protected:
26 void OpenDevToolsWindow() { 25 void OpenDevToolsWindow() {
27 devtools_window_ = 26 devtools_window_ =
28 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); 27 DevToolsWindow::OpenDevToolsWindowForTest(browser(), true);
29 } 28 }
30 29
31 void CloseDevToolsWindow() { 30 void CloseDevToolsWindow() {
32 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window_); 31 content::WindowedNotificationObserver close_observer(
32 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
33 content::Source<content::WebContents>(
34 devtools_window_->web_contents_for_test()));
35 DevToolsWindow::ToggleDevToolsWindow(
36 browser(), DevToolsToggleAction::Toggle());
37 close_observer.Wait();
33 } 38 }
34 39
35 content::WebContents* web_contents() { 40 content::WebContents* web_contents() {
36 return browser()->tab_strip_model()->GetActiveWebContents(); 41 return browser()->tab_strip_model()->GetActiveWebContents();
37 } 42 }
38 43
39 content::WebContents* devtools_web_contents() { 44 content::WebContents* devtools_web_contents() {
40 return DevToolsWindow::GetInTabWebContents(web_contents(), NULL); 45 return DevToolsWindow::GetInTabWebContents(web_contents(), NULL);
41 } 46 }
42 47
(...skipping 23 matching lines...) Expand all
66 IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOtherViews) { 71 IN_PROC_BROWSER_TEST_F(DevToolsControllerTest, AllowOtherViews) {
67 EXPECT_FALSE(web_contents()->GetAllowOtherViews()); 72 EXPECT_FALSE(web_contents()->GetAllowOtherViews());
68 73
69 OpenDevToolsWindow(); 74 OpenDevToolsWindow();
70 EXPECT_TRUE(devtools_web_contents()->GetAllowOtherViews()); 75 EXPECT_TRUE(devtools_web_contents()->GetAllowOtherViews());
71 EXPECT_TRUE(web_contents()->GetAllowOtherViews()); 76 EXPECT_TRUE(web_contents()->GetAllowOtherViews());
72 77
73 CloseDevToolsWindow(); 78 CloseDevToolsWindow();
74 EXPECT_FALSE(web_contents()->GetAllowOtherViews()); 79 EXPECT_FALSE(web_contents()->GetAllowOtherViews());
75 } 80 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm ('k') | chrome/browser/ui/cocoa/view_id_util_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698