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

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

Issue 1819243002: [DevTools] Use InspectorFrontendHost.readyForTest for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ready-for-test
Patch Set: resource-tree-reload.html fix Created 4 years, 9 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
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | components/test_runner/web_test_delegate.h » ('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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // static 90 // static
91 void DevToolsWindowTesting::WindowClosed(DevToolsWindow* window) { 91 void DevToolsWindowTesting::WindowClosed(DevToolsWindow* window) {
92 DevToolsWindowTesting* testing = DevToolsWindowTesting::Find(window); 92 DevToolsWindowTesting* testing = DevToolsWindowTesting::Find(window);
93 if (testing) 93 if (testing)
94 delete testing; 94 delete testing;
95 } 95 }
96 96
97 // static 97 // static
98 void DevToolsWindowTesting::WaitForDevToolsWindowLoad(DevToolsWindow* window) { 98 void DevToolsWindowTesting::WaitForDevToolsWindowLoad(DevToolsWindow* window) {
99 scoped_refptr<content::MessageLoopRunner> runner = 99 if (!window->ready_for_test_) {
100 new content::MessageLoopRunner; 100 scoped_refptr<content::MessageLoopRunner> runner =
101 window->ready_for_test_callback_ = runner->QuitClosure(); 101 new content::MessageLoopRunner;
102 runner->Run(); 102 window->ready_for_test_callback_ = runner->QuitClosure();
103 runner->Run();
104 }
103 base::string16 harness = base::UTF8ToUTF16( 105 base::string16 harness = base::UTF8ToUTF16(
104 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript)); 106 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript));
105 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness); 107 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness);
106 } 108 }
107 109
108 // static 110 // static
109 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync( 111 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync(
110 content::WebContents* inspected_web_contents, 112 content::WebContents* inspected_web_contents,
111 bool is_docked) { 113 bool is_docked) {
112 std::string settings = is_docked ? 114 std::string settings = is_docked ?
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!devtools_windows_.size()) 200 if (!devtools_windows_.size())
199 return nullptr; 201 return nullptr;
200 return devtools_windows_[devtools_windows_.size() - 1]; 202 return devtools_windows_[devtools_windows_.size() - 1];
201 } 203 }
202 204
203 void DevToolsWindowCreationObserver::CloseAllSync() { 205 void DevToolsWindowCreationObserver::CloseAllSync() {
204 for (DevToolsWindow* window : devtools_windows_) 206 for (DevToolsWindow* window : devtools_windows_)
205 DevToolsWindowTesting::CloseDevToolsWindowSync(window); 207 DevToolsWindowTesting::CloseDevToolsWindowSync(window);
206 devtools_windows_.clear(); 208 devtools_windows_.clear();
207 } 209 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698