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

Unified Diff: content/shell/renderer/test_runner/test_interfaces.cc

Issue 1079843002: DevTools: allow storing devtools preferences on the browser side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/test_interfaces.cc
diff --git a/content/shell/renderer/test_runner/test_interfaces.cc b/content/shell/renderer/test_runner/test_interfaces.cc
index 6b88763ad931c258581e2bfcbab6950858896708..a70ff059fcb989c3ab2db4e477c2d4fa6ea31e91 100644
--- a/content/shell/renderer/test_runner/test_interfaces.cc
+++ b/content/shell/renderer/test_runner/test_interfaces.cc
@@ -7,6 +7,8 @@
#include <string>
#include "base/command_line.h"
+#include "base/json/json_writer.h"
+#include "base/json/string_escape.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "content/shell/common/shell_switches.h"
@@ -118,22 +120,12 @@ void TestInterfaces::ConfigureForTestWithURL(const blink::WebURL& test_url,
test_runner_->ClearDevToolsLocalStorage();
if (spec.find("/inspector/") != std::string::npos) {
// Subfolder name determines default panel to open.
- std::string settings = "";
std::string test_path = spec.substr(spec.find("/inspector/") + 11);
- size_t slash_index = test_path.find("/");
- std::string test_path_setting = base::StringPrintf(
- "\"testPath\":\"\\\"%s\\\"\"", spec.c_str());
-
- // TODO(pfeldman): remove once migrated to testPath.
- std::string last_active_panel;
- if (slash_index != std::string::npos) {
- last_active_panel = base::StringPrintf(
- ",\"lastActivePanel\":\"\\\"%s\\\"\"",
- test_path.substr(0, slash_index).c_str());
- }
-
- test_runner_->ShowDevTools(base::StringPrintf("{%s%s}",
- test_path_setting.c_str(), last_active_panel.c_str()), std::string());
+ base::DictionaryValue settings;
+ settings.SetString("testPath", base::GetQuotedJSONString(spec));
+ std::string settings_string;
+ base::JSONWriter::Write(&settings, &settings_string);
+ test_runner_->ShowDevTools(settings_string, std::string());
}
if (spec.find("/viewsource/") != std::string::npos) {
test_runner_->setShouldEnableViewSource(true);
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698