Commit eacdde4e authored by Ben Reich's avatar Ben Reich Committed by Commit Bot

[filesapp] Move JavaScript scripts output to script subdirectory

Move the JavaScript script output from being saved in the
devtools_code_coverage directory instead moving into a subdirectory
called scripts. This avoids pollution of the devtools_code_coverage
directory as merged coverage files will be saved there.

R=noel@chromium.org

Bug: 1113941
Test: browser_tests --gtest_filter=*FilesApp* --devtools-code-coverage
Change-Id: I109846b21d2d31e9a677f68f360409e2ecb3897e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527903Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Ben Reich <benreich@chromium.org>
Auto-Submit: Ben Reich <benreich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825708}
parent e60ea37c
...@@ -219,7 +219,8 @@ void DevToolsListener::StoreScripts(content::DevToolsAgentHost* host, ...@@ -219,7 +219,8 @@ void DevToolsListener::StoreScripts(content::DevToolsAgentHost* host,
CHECK(script->SetString("text", text)); CHECK(script->SetString("text", text));
CHECK(script->SetString("url", url)); CHECK(script->SetString("url", url));
base::FilePath path = store.AppendASCII(hash.append(".js.json")); base::FilePath path =
store.AppendASCII("scripts").Append(hash.append(".js.json"));
CHECK(base::JSONWriter::Write(*script, &text)); CHECK(base::JSONWriter::Write(*script, &text));
if (!base::PathExists(path)) // script de-duplication if (!base::PathExists(path)) // script de-duplication
base::WriteFile(path, text.data(), text.size()); base::WriteFile(path, text.data(), text.size());
......
...@@ -80,6 +80,14 @@ class DevToolsListenerBrowserTest : public content::DevToolsAgentHostObserver, ...@@ -80,6 +80,14 @@ class DevToolsListenerBrowserTest : public content::DevToolsAgentHostObserver,
tmp_dir_.GetPath().AppendASCII("devtools_listener_browser_test"); tmp_dir_.GetPath().AppendASCII("devtools_listener_browser_test");
CHECK(base::CreateDirectory(coverage_store)); CHECK(base::CreateDirectory(coverage_store));
base::FilePath tests = coverage_store.AppendASCII("tests");
if (!base::PathExists(tests))
CHECK(base::CreateDirectory(tests));
base::FilePath scripts = coverage_store.AppendASCII("scripts");
if (!base::PathExists(scripts))
CHECK(base::CreateDirectory(scripts));
for (auto& agent : devtools_agent_) { for (auto& agent : devtools_agent_) {
auto* host = agent.first; auto* host = agent.first;
EXPECT_TRUE(agent.second->HasCoverage(host)); EXPECT_TRUE(agent.second->HasCoverage(host));
......
...@@ -1916,13 +1916,17 @@ void FileManagerBrowserTestBase::StartTest() { ...@@ -1916,13 +1916,17 @@ void FileManagerBrowserTestBase::StartTest() {
base::FilePath store; base::FilePath store;
CHECK(base::PathService::Get(base::DIR_EXE, &store)); CHECK(base::PathService::Get(base::DIR_EXE, &store));
store = store.AppendASCII("coverage").AppendASCII("devtools_code_coverage"); store = store.AppendASCII("devtools_code_coverage");
CHECK(base::CreateDirectory(store)); CHECK(base::CreateDirectory(store));
base::FilePath tests = store.AppendASCII("tests"); base::FilePath tests = store.AppendASCII("tests");
if (!base::PathExists(tests)) if (!base::PathExists(tests))
CHECK(base::CreateDirectory(tests)); CHECK(base::CreateDirectory(tests));
base::FilePath scripts = store.AppendASCII("scripts");
if (!base::PathExists(scripts))
CHECK(base::CreateDirectory(scripts));
for (auto& agent : devtools_agent_) { for (auto& agent : devtools_agent_) {
auto* host = agent.first; auto* host = agent.first;
if (agent.second->HasCoverage(host)) if (agent.second->HasCoverage(host))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment