Commit 4734ecf2 authored by Ben Reich's avatar Ben Reich Committed by Commit Bot

[filesapp] Add missing includes and fail if host crashed

Adds #include's that were missing from the initial patch, and FAIL the
test if the DevToolsAgentHost attached to crashes during the test.

Fix HostString() helper to *actually* take an optional prefix: use C++
c++17 {} style initializer.

Test: browser_test --gtest_filter="*DevToolsListener*"
Bug: 1113941
Change-Id: I5901019add9fea92b6e3a8b5b881b8d3d197b6c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2465456
Commit-Queue: Ben Reich <benreich@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816070}
parent 989724c3
......@@ -72,7 +72,7 @@ void DevToolsListener::Detach(content::DevToolsAgentHost* host) {
}
std::string DevToolsListener::HostString(content::DevToolsAgentHost* host,
const std::string& prefix = "") {
const std::string& prefix) {
std::string result = base::StrCat(
{prefix, " ", host->GetType(), " title: ", host->GetTitle()});
std::string description = host->GetDescription();
......
......@@ -42,7 +42,7 @@ class DevToolsListener : public content::DevToolsAgentHostClient {
// Returns a string that uniquely identifies a host
// with an optional prefix.
static std::string HostString(content::DevToolsAgentHost* host,
const std::string& prefix);
const std::string& prefix = {});
private:
// Enable CDP on host.
......
......@@ -3,16 +3,20 @@
// found in the LICENSE file.
#include <map>
#include <memory>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/chromeos/file_manager/devtools_listener.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_agent_host_observer.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
......@@ -55,7 +59,7 @@ class DevToolsListenerBrowserTest : public content::DevToolsAgentHostObserver,
base::TerminationStatus status) override {
if (devtools_agent_.find(host) == devtools_agent_.end())
return;
NOTREACHED();
LOG(FATAL) << "Host crashed: " << DevToolsListener::HostString(host);
}
void CollectCodeCoverage() {
......
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