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

Side by Side Diff: chrome/browser/devtools/devtools_window_testing.cc

Issue 2522613003: DevTools: respect isUnderTest conditions in the browser tests. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/devtools/devtools_window_testing.h" 5 #include "chrome/browser/devtools/devtools_window_testing.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/devtools/devtools_window.h" 9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 base::string16 harness = base::UTF8ToUTF16( 105 base::string16 harness = base::UTF8ToUTF16(
106 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript)); 106 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript));
107 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness); 107 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness);
108 } 108 }
109 109
110 // static 110 // static
111 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync( 111 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync(
112 content::WebContents* inspected_web_contents, 112 content::WebContents* inspected_web_contents,
113 bool is_docked) { 113 bool is_docked) {
114 std::string settings = is_docked ? 114 std::string settings = is_docked ?
115 "{\"currentDockState\":\"\\\"bottom\\\"\"}" : 115 "{\"isUnderTest\": true, \"currentDockState\":\"\\\"bottom\\\"\"}" :
116 "{\"currentDockState\":\"\\\"undocked\\\"\"}"; 116 "{\"isUnderTest\": true, \"currentDockState\":\"\\\"undocked\\\"\"}";
117 scoped_refptr<content::DevToolsAgentHost> agent( 117 scoped_refptr<content::DevToolsAgentHost> agent(
118 content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents)); 118 content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents));
119 DevToolsWindow::ToggleDevToolsWindow( 119 DevToolsWindow::ToggleDevToolsWindow(
120 inspected_web_contents, true, DevToolsToggleAction::Show(), settings); 120 inspected_web_contents, true, DevToolsToggleAction::Show(), settings);
121 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get()); 121 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get());
122 WaitForDevToolsWindowLoad(window); 122 WaitForDevToolsWindowLoad(window);
123 return window; 123 return window;
124 } 124 }
125 125
126 // static 126 // static
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 DevToolsWindow* DevToolsWindowCreationObserver::devtools_window() { 199 DevToolsWindow* DevToolsWindowCreationObserver::devtools_window() {
200 return !devtools_windows_.empty() ? devtools_windows_.back() : nullptr; 200 return !devtools_windows_.empty() ? devtools_windows_.back() : nullptr;
201 } 201 }
202 202
203 void DevToolsWindowCreationObserver::CloseAllSync() { 203 void DevToolsWindowCreationObserver::CloseAllSync() {
204 for (DevToolsWindow* window : devtools_windows_) 204 for (DevToolsWindow* window : devtools_windows_)
205 DevToolsWindowTesting::CloseDevToolsWindowSync(window); 205 DevToolsWindowTesting::CloseDevToolsWindowSync(window);
206 devtools_windows_.clear(); 206 devtools_windows_.clear();
207 } 207 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698