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

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

Issue 1828983002: Revert of [DevTools] Use InspectorFrontendHost.readyForTest for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ready-for-test
Patch Set: 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 if (!window->ready_for_test_) { 99 scoped_refptr<content::MessageLoopRunner> runner =
100 scoped_refptr<content::MessageLoopRunner> runner = 100 new content::MessageLoopRunner;
101 new content::MessageLoopRunner; 101 window->ready_for_test_callback_ = runner->QuitClosure();
102 window->ready_for_test_callback_ = runner->QuitClosure(); 102 runner->Run();
103 runner->Run();
104 }
105 base::string16 harness = base::UTF8ToUTF16( 103 base::string16 harness = base::UTF8ToUTF16(
106 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript)); 104 content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript));
107 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness); 105 window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness);
108 } 106 }
109 107
110 // static 108 // static
111 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync( 109 DevToolsWindow* DevToolsWindowTesting::OpenDevToolsWindowSync(
112 content::WebContents* inspected_web_contents, 110 content::WebContents* inspected_web_contents,
113 bool is_docked) { 111 bool is_docked) {
114 std::string settings = is_docked ? 112 std::string settings = is_docked ?
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (!devtools_windows_.size()) 198 if (!devtools_windows_.size())
201 return nullptr; 199 return nullptr;
202 return devtools_windows_[devtools_windows_.size() - 1]; 200 return devtools_windows_[devtools_windows_.size() - 1];
203 } 201 }
204 202
205 void DevToolsWindowCreationObserver::CloseAllSync() { 203 void DevToolsWindowCreationObserver::CloseAllSync() {
206 for (DevToolsWindow* window : devtools_windows_) 204 for (DevToolsWindow* window : devtools_windows_)
207 DevToolsWindowTesting::CloseDevToolsWindowSync(window); 205 DevToolsWindowTesting::CloseDevToolsWindowSync(window);
208 devtools_windows_.clear(); 206 devtools_windows_.clear();
209 } 207 }
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