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

Side by Side Diff: chrome/browser/devtools/devtools_window.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 toolbox_web_contents_(nullptr), 709 toolbox_web_contents_(nullptr),
710 bindings_(bindings), 710 bindings_(bindings),
711 browser_(nullptr), 711 browser_(nullptr),
712 is_docked_(true), 712 is_docked_(true),
713 can_dock_(can_dock), 713 can_dock_(can_dock),
714 // This initialization allows external front-end to work without changes. 714 // This initialization allows external front-end to work without changes.
715 // We don't wait for docking call, but instead immediately show undocked. 715 // We don't wait for docking call, but instead immediately show undocked.
716 // Passing "dockSide=undocked" parameter ensures proper UI. 716 // Passing "dockSide=undocked" parameter ensures proper UI.
717 life_stage_(can_dock ? kNotLoaded : kIsDockedSet), 717 life_stage_(can_dock ? kNotLoaded : kIsDockedSet),
718 action_on_load_(DevToolsToggleAction::NoOp()), 718 action_on_load_(DevToolsToggleAction::NoOp()),
719 intercepted_page_beforeunload_(false) { 719 intercepted_page_beforeunload_(false),
720 ready_for_test_(false) {
720 // Set up delegate, so we get fully-functional window immediately. 721 // Set up delegate, so we get fully-functional window immediately.
721 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. 722 // It will not appear in UI though until |life_stage_ == kLoadCompleted|.
722 main_web_contents_->SetDelegate(this); 723 main_web_contents_->SetDelegate(this);
723 // Bindings take ownership over devtools as its delegate. 724 // Bindings take ownership over devtools as its delegate.
724 bindings_->SetDelegate(this); 725 bindings_->SetDelegate(this);
725 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a 726 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a
726 // ZoomController. 727 // ZoomController.
727 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_); 728 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_);
728 ui_zoom::ZoomController::FromWebContents(main_web_contents_) 729 ui_zoom::ZoomController::FromWebContents(main_web_contents_)
729 ->SetShowsNotificationBubble(false); 730 ->SetShowsNotificationBubble(false);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 if (life_stage_ != kLoadCompleted) { 1169 if (life_stage_ != kLoadCompleted) {
1169 // Load is completed when both kIsDockedSet and kOnLoadFired happened. 1170 // Load is completed when both kIsDockedSet and kOnLoadFired happened.
1170 // Here we set kOnLoadFired. 1171 // Here we set kOnLoadFired.
1171 life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired; 1172 life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired;
1172 } 1173 }
1173 if (life_stage_ == kLoadCompleted) 1174 if (life_stage_ == kLoadCompleted)
1174 LoadCompleted(); 1175 LoadCompleted();
1175 } 1176 }
1176 1177
1177 void DevToolsWindow::ReadyForTest() { 1178 void DevToolsWindow::ReadyForTest() {
1179 ready_for_test_ = true;
1178 if (!ready_for_test_callback_.is_null()) { 1180 if (!ready_for_test_callback_.is_null()) {
1179 ready_for_test_callback_.Run(); 1181 ready_for_test_callback_.Run();
1180 ready_for_test_callback_ = base::Closure(); 1182 ready_for_test_callback_ = base::Closure();
1181 } 1183 }
1182 } 1184 }
1183 1185
1184 void DevToolsWindow::CreateDevToolsBrowser() { 1186 void DevToolsWindow::CreateDevToolsBrowser() {
1185 PrefService* prefs = profile_->GetPrefs(); 1187 PrefService* prefs = profile_->GetPrefs();
1186 if (!prefs->GetDictionary(prefs::kAppWindowPlacement)->HasKey(kDevToolsApp)) { 1188 if (!prefs->GetDictionary(prefs::kAppWindowPlacement)->HasKey(kDevToolsApp)) {
1187 DictionaryPrefUpdate update(prefs, prefs::kAppWindowPlacement); 1189 DictionaryPrefUpdate update(prefs, prefs::kAppWindowPlacement);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { 1299 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) {
1298 // Only route reload via front-end if the agent is attached. 1300 // Only route reload via front-end if the agent is attached.
1299 WebContents* wc = GetInspectedWebContents(); 1301 WebContents* wc = GetInspectedWebContents();
1300 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1302 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1301 return false; 1303 return false;
1302 base::FundamentalValue ignore_cache_value(ignore_cache); 1304 base::FundamentalValue ignore_cache_value(ignore_cache);
1303 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1305 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1304 &ignore_cache_value, nullptr, nullptr); 1306 &ignore_cache_value, nullptr, nullptr);
1305 return true; 1307 return true;
1306 } 1308 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/devtools/devtools_window_testing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698