blob: 29c19ef7843d88eee5d5e60b87f987a7301d063b [file] [log] [blame]
Simon Queacc79382012-05-04 18:10:09 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef _CRASH_REPORTER_UDEV_COLLECTOR_H_
6#define _CRASH_REPORTER_UDEV_COLLECTOR_H_
7
8#include <string>
9
Simon Que9f90aca2013-02-19 17:19:52 -080010#include "base/file_path.h"
Simon Queacc79382012-05-04 18:10:09 -070011#include "crash-reporter/crash_collector.h"
12#include "gtest/gtest_prod.h" // for FRIEND_TEST
13
Simon Queacc79382012-05-04 18:10:09 -070014// Udev crash collector.
15class UdevCollector : public CrashCollector {
16 public:
17 UdevCollector();
18
19 virtual ~UdevCollector();
20
21 // The udev event string should be formatted as follows:
22 // "ACTION=[action]:KERNEL=[name]:SUBSYSTEM=[subsystem]"
23 // The values don't have to be in any particular order. One or more of them
24 // could be omitted, in which case it would be treated as a wildcard (*).
25 bool HandleCrash(const std::string &udev_event);
26
27 private:
28 friend class UdevCollectorTest;
29
30 // Mutator for unit testing.
31 void set_log_config_path(const std::string& path) {
Simon Que9f90aca2013-02-19 17:19:52 -080032 log_config_path_ = base::FilePath(path);
Simon Queacc79382012-05-04 18:10:09 -070033 }
34};
35
36#endif // _CRASH_REPORTER_UDEV_COLLECTOR_H_