Skip to content

Commit

Permalink
refactor: move code into feature directory
Browse files Browse the repository at this point in the history
To help manage the growing number of files under diagnostics
"backend" shifting files into feature specific directories.

- Move code for common code into into the "common" directory
- Move code for connectivity diagnostics feature into the "connectivity"
 directory
- Move code for input diagnostics feature into the "input" directory
- Move code for system diagnostics feature into the "system" directory

Bug: b:253021171
Test: ash_unittest,ash_webui_unittest, and browser_test --gtest_filter=*Diagnostics*
Change-Id: I1bc1b9a95eb2371ca6b78ecf233630bb6b170bef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4000649
Commit-Queue: Ashley Prasad <ashleydp@google.com>
Reviewed-by: Michael Checo <michaelcheco@google.com>
Cr-Commit-Position: refs/heads/main@{#1067549}
  • Loading branch information
Ashley Prasad authored and Chromium LUCI CQ committed Nov 4, 2022
1 parent ad25b30 commit f98409c
Show file tree
Hide file tree
Showing 44 changed files with 158 additions and 158 deletions.
82 changes: 41 additions & 41 deletions ash/webui/diagnostics_ui/backend/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //ash")

static_library("backend") {
sources = [
"cpu_usage_data.cc",
"cpu_usage_data.h",
"cros_healthd_helpers.cc",
"cros_healthd_helpers.h",
"common/histogram_util.cc",
"common/histogram_util.h",
"common/routine_properties.cc",
"common/routine_properties.h",
"connectivity/network_health_provider.cc",
"connectivity/network_health_provider.h",
"diagnostics_manager.cc",
"diagnostics_manager.h",
"event_watcher_factory.cc",
"event_watcher_factory.h",
"histogram_util.cc",
"histogram_util.h",
"input_data_event_watcher.cc",
"input_data_event_watcher.h",
"input_data_provider.cc",
"input_data_provider.h",
"input_data_provider_keyboard.cc",
"input_data_provider_keyboard.h",
"input_data_provider_touch.cc",
"input_data_provider_touch.h",
"input_device_information.cc",
"input_device_information.h",
"keyboard_input_data_event_watcher.cc",
"keyboard_input_data_event_watcher.h",
"network_health_provider.cc",
"network_health_provider.h",
"power_manager_client_conversions.cc",
"power_manager_client_conversions.h",
"routine_properties.cc",
"routine_properties.h",
"input/event_watcher_factory.cc",
"input/event_watcher_factory.h",
"input/input_data_event_watcher.cc",
"input/input_data_event_watcher.h",
"input/input_data_provider.cc",
"input/input_data_provider.h",
"input/input_data_provider_keyboard.cc",
"input/input_data_provider_keyboard.h",
"input/input_data_provider_touch.cc",
"input/input_data_provider_touch.h",
"input/input_device_information.cc",
"input/input_device_information.h",
"input/keyboard_input_data_event_watcher.cc",
"input/keyboard_input_data_event_watcher.h",
"session_log_async_helper.cc",
"session_log_async_helper.h",
"session_log_handler.cc",
"session_log_handler.h",
"system_data_provider.cc",
"system_data_provider.h",
"system_routine_controller.cc",
"system_routine_controller.h",
"system/cpu_usage_data.cc",
"system/cpu_usage_data.h",
"system/cros_healthd_helpers.cc",
"system/cros_healthd_helpers.h",
"system/power_manager_client_conversions.cc",
"system/power_manager_client_conversions.h",
"system/system_data_provider.cc",
"system/system_data_provider.h",
"system/system_routine_controller.cc",
"system/system_routine_controller.h",
]

deps = [
Expand Down Expand Up @@ -83,19 +83,19 @@ source_set("unit_tests") {
testonly = true

sources = [
"cpu_usage_data_unittest.cc",
"input_data_event_watcher_unittest.cc",
"input_data_provider_keyboard_unittest.cc",
"input_data_provider_touch_unittest.cc",
"input_data_provider_unittest.cc",
"keyboard_input_data_event_watcher_unittest.cc",
"network_health_provider_unittest.cc",
"power_manager_client_conversions_unittest.cc",
"routine_properties_unittest.cc",
"common/routine_properties_unittest.cc",
"connectivity/network_health_provider_unittest.cc",
"input/input_data_event_watcher_unittest.cc",
"input/input_data_provider_keyboard_unittest.cc",
"input/input_data_provider_touch_unittest.cc",
"input/input_data_provider_unittest.cc",
"input/keyboard_input_data_event_watcher_unittest.cc",
"session_log_async_helper_unittest.cc",
"session_log_handler_unittest.cc",
"system_data_provider_unittest.cc",
"system_routine_controller_unittest.cc",
"system/cpu_usage_data_unittest.cc",
"system/power_manager_client_conversions_unittest.cc",
"system/system_data_provider_unittest.cc",
"system/system_routine_controller_unittest.cc",
]

deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/histogram_util.h"
#include "ash/webui/diagnostics_ui/backend/common/histogram_util.h"

#include "ash/webui/diagnostics_ui/backend/routine_properties.h"
#include "ash/webui/diagnostics_ui/backend/common/routine_properties.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_HISTOGRAM_UTIL_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_HISTOGRAM_UTIL_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_HISTOGRAM_UTIL_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_HISTOGRAM_UTIL_H_

#include <stddef.h>
#include <cstdint>
Expand Down Expand Up @@ -59,4 +59,4 @@ void EmitCrosHealthdProbeError(const base::StringPiece source_type,
} // namespace diagnostics
} // namespace ash

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_HISTOGRAM_UTIL_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_HISTOGRAM_UTIL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/routine_properties.h"
#include "ash/webui/diagnostics_ui/backend/common/routine_properties.h"

namespace ash::diagnostics {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_ROUTINE_PROPERTIES_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_ROUTINE_PROPERTIES_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_ROUTINE_PROPERTIES_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_ROUTINE_PROPERTIES_H_

#include <stddef.h>
#include <cstdint>
Expand Down Expand Up @@ -41,4 +41,4 @@ const RoutineProperties& GetRoutineProperties(mojom::RoutineType routine_type);
} // namespace diagnostics
} // namespace ash

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_ROUTINE_PROPERTIES_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_COMMON_ROUTINE_PROPERTIES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/routine_properties.h"
#include "ash/webui/diagnostics_ui/backend/common/routine_properties.h"

#include "testing/gtest/include/gtest/gtest.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/network_health_provider.h"
#include "ash/webui/diagnostics_ui/backend/connectivity/network_health_provider.h"

#include <string>
#include <utility>

#include "ash/constants/ash_features.h"
#include "ash/system/diagnostics/networking_log.h"
#include "ash/webui/diagnostics_ui/backend/histogram_util.h"
#include "ash/webui/diagnostics_ui/backend/common/histogram_util.h"
#include "base/bind.h"
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_map.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_NETWORK_HEALTH_PROVIDER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_NETWORK_HEALTH_PROVIDER_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_CONNECTIVITY_NETWORK_HEALTH_PROVIDER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_CONNECTIVITY_NETWORK_HEALTH_PROVIDER_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -163,4 +163,4 @@ class NetworkHealthProvider
} // namespace diagnostics
} // namespace ash

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_NETWORK_HEALTH_PROVIDER_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_CONNECTIVITY_NETWORK_HEALTH_PROVIDER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/network_health_provider.h"
#include "ash/webui/diagnostics_ui/backend/connectivity/network_health_provider.h"

#include "ash/constants/ash_features.h"
#include "ash/system/diagnostics/networking_log.h"
#include "ash/webui/diagnostics_ui/backend/histogram_util.h"
#include "ash/webui/diagnostics_ui/backend/common/histogram_util.h"
#include "base/feature_list.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ptr_util.h"
Expand Down
8 changes: 4 additions & 4 deletions ash/webui/diagnostics_ui/backend/diagnostics_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include <ui/aura/window.h>
#include "ash/constants/ash_features.h"
#include "ash/system/diagnostics/diagnostics_log_controller.h"
#include "ash/webui/diagnostics_ui/backend/input_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/network_health_provider.h"
#include "ash/webui/diagnostics_ui/backend/connectivity/network_health_provider.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/session_log_handler.h"
#include "ash/webui/diagnostics_ui/backend/system_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/system_routine_controller.h"
#include "ash/webui/diagnostics_ui/backend/system/system_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/system/system_routine_controller.h"

namespace ash {
namespace diagnostics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/event_watcher_factory.h"
#include "ash/webui/diagnostics_ui/backend/input/event_watcher_factory.h"

#include <cstdint>
#include <memory>

#include "ash/webui/diagnostics_ui/backend/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/keyboard_input_data_event_watcher.h"
#include "base/memory/weak_ptr.h"

namespace ash::diagnostics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_EVENT_WATCHER_FACTORY_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_EVENT_WATCHER_FACTORY_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_EVENT_WATCHER_FACTORY_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_EVENT_WATCHER_FACTORY_H_

#include <linux/input.h>
#include <cstdint>
#include <memory>

#include "ash/webui/diagnostics_ui/backend/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/keyboard_input_data_event_watcher.h"
#include "base/memory/weak_ptr.h"

namespace ash::diagnostics {
Expand Down Expand Up @@ -54,4 +54,4 @@ class EventWatcherFactoryImpl : public EventWatcherFactory {

} // namespace ash::diagnostics

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_EVENT_WATCHER_FACTORY_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_EVENT_WATCHER_FACTORY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_event_watcher.h"

#include <errno.h>
#include <fcntl.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_EVENT_WATCHER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_EVENT_WATCHER_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_EVENT_WATCHER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_EVENT_WATCHER_H_

#include <linux/input.h>

Expand Down Expand Up @@ -60,4 +60,4 @@ class InputDataEventWatcher : public base::MessagePumpForUI::FdWatcher {

} // namespace ash::diagnostics

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_EVENT_WATCHER_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_EVENT_WATCHER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_event_watcher.h"

#include <fcntl.h>
#include <linux/input-event-codes.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/input_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider.h"

#include <fcntl.h>
#include <linux/input.h>
Expand All @@ -14,10 +14,10 @@
#include "ash/public/cpp/tablet_mode.h"
#include "ash/shell.h"
#include "ash/system/diagnostics/keyboard_input_log.h"
#include "ash/webui/diagnostics_ui/backend/event_watcher_factory.h"
#include "ash/webui/diagnostics_ui/backend/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input_device_information.h"
#include "ash/webui/diagnostics_ui/backend/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/event_watcher_factory.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/input_device_information.h"
#include "ash/webui/diagnostics_ui/backend/input/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/mojom/input_data_provider.mojom.h"
#include "ash/wm/window_util.h"
#include "base/logging.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_H_

#include "ash/accelerators/accelerator_controller_impl.h"
#include "ash/public/cpp/tablet_mode_observer.h"
#include "ash/webui/diagnostics_ui/backend/event_watcher_factory.h"
#include "ash/webui/diagnostics_ui/backend/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input_data_provider_keyboard.h"
#include "ash/webui/diagnostics_ui/backend/input_data_provider_touch.h"
#include "ash/webui/diagnostics_ui/backend/input_device_information.h"
#include "ash/webui/diagnostics_ui/backend/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/event_watcher_factory.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider_keyboard.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider_touch.h"
#include "ash/webui/diagnostics_ui/backend/input/input_device_information.h"
#include "ash/webui/diagnostics_ui/backend/input/keyboard_input_data_event_watcher.h"
#include "ash/webui/diagnostics_ui/mojom/input_data_provider.mojom.h"
#include "base/containers/flat_map.h"
#include "base/files/file_path.h"
Expand Down Expand Up @@ -201,4 +201,4 @@ class InputDataProvider : public mojom::InputDataProvider,

} // namespace ash::diagnostics

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/webui/diagnostics_ui/backend/input_data_provider_keyboard.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider_keyboard.h"

#include <fcntl.h>
#include <linux/input.h>
Expand All @@ -11,7 +11,7 @@
#include "ash/constants/ash_switches.h"
#include "ash/display/privacy_screen_controller.h"
#include "ash/shell.h"
#include "ash/webui/diagnostics_ui/backend/input_data_provider.h"
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/fixed_flat_map.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_KEYBOARD_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_KEYBOARD_H_
#ifndef ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_KEYBOARD_H_
#define ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_KEYBOARD_H_

#include <vector>

Expand Down Expand Up @@ -64,4 +64,4 @@ class InputDataProviderKeyboard {
} // namespace diagnostics
} // namespace ash

#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_DATA_PROVIDER_KEYBOARD_H_
#endif // ASH_WEBUI_DIAGNOSTICS_UI_BACKEND_INPUT_INPUT_DATA_PROVIDER_KEYBOARD_H_

0 comments on commit f98409c

Please sign in to comment.