Move fake metric reporting classes to their own dir.
Trying to have better organization as number of files is increasing.
Bug: b:257068745
Change-Id: If82f5a650ead4158326bbf1ce2a101bef147c75f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4000302
Reviewed-by: Leonid Baraz <[email protected]>
Commit-Queue: Ahmed Nasr <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1066665}
diff --git a/components/reporting/metrics/BUILD.gn b/components/reporting/metrics/BUILD.gn
index 8ea9c07..617d1897 100644
--- a/components/reporting/metrics/BUILD.gn
+++ b/components/reporting/metrics/BUILD.gn
@@ -31,29 +31,6 @@
]
}
-static_library("test_support") {
- testonly = true
- sources = [
- "fake_event_driven_telemetry_sampler_pool.cc",
- "fake_event_driven_telemetry_sampler_pool.h",
- "fake_metric_report_queue.cc",
- "fake_metric_report_queue.h",
- "fake_reporting_settings.cc",
- "fake_reporting_settings.h",
- "fake_sampler.cc",
- "fake_sampler.h",
- ]
- deps = [
- ":metrics_data_collection",
- "//base",
- "//components/reporting/client:report_queue",
- "//components/reporting/proto:metric_data_proto",
- "//components/reporting/proto:record_constants",
- "//components/reporting/util:status",
- "//testing/gtest",
- ]
-}
-
source_set("unit_tests") {
testonly = true
sources = [
@@ -67,11 +44,11 @@
]
deps = [
":metrics_data_collection",
- ":test_support",
"//base",
"//base/test:test_support",
"//components/reporting/client:report_queue",
"//components/reporting/client:test_support",
+ "//components/reporting/metrics/fakes:test_support",
"//components/reporting/proto:metric_data_proto",
"//components/reporting/proto:record_constants",
"//components/reporting/util:status",
diff --git a/components/reporting/metrics/configured_sampler_unittest.cc b/components/reporting/metrics/configured_sampler_unittest.cc
index db786fc..cf916b3 100644
--- a/components/reporting/metrics/configured_sampler_unittest.cc
+++ b/components/reporting/metrics/configured_sampler_unittest.cc
@@ -10,8 +10,8 @@
#include "base/strings/string_piece.h"
#include "base/test/task_environment.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
-#include "components/reporting/metrics/fake_sampler.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_sampler.h"
#include "components/reporting/metrics/sampler.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/reporting/metrics/fakes/BUILD.gn b/components/reporting/metrics/fakes/BUILD.gn
new file mode 100644
index 0000000..474d722f
--- /dev/null
+++ b/components/reporting/metrics/fakes/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2021 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+static_library("test_support") {
+ testonly = true
+ sources = [
+ "fake_event_driven_telemetry_sampler_pool.cc",
+ "fake_event_driven_telemetry_sampler_pool.h",
+ "fake_metric_report_queue.cc",
+ "fake_metric_report_queue.h",
+ "fake_reporting_settings.cc",
+ "fake_reporting_settings.h",
+ "fake_sampler.cc",
+ "fake_sampler.h",
+ ]
+ deps = [
+ "//base",
+ "//components/reporting/metrics:metrics_data_collection",
+ "//components/reporting/client:report_queue",
+ "//components/reporting/proto:metric_data_proto",
+ "//components/reporting/proto:record_constants",
+ "//components/reporting/util:status",
+ "//testing/gtest",
+ ]
+}
diff --git a/components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.cc b/components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.cc
similarity index 91%
rename from components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.cc
rename to components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.cc
index da09b51..2263813 100644
--- a/components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.cc
+++ b/components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.cc
@@ -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 "components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h"
+#include "components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h"
#include <vector>
diff --git a/components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h b/components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h
similarity index 82%
rename from components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h
rename to components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h
index 0d2856d4..bf46837 100644
--- a/components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h
+++ b/components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h
@@ -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 COMPONENTS_REPORTING_METRICS_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
-#define COMPONENTS_REPORTING_METRICS_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
+#ifndef COMPONENTS_REPORTING_METRICS_FAKES_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
+#define COMPONENTS_REPORTING_METRICS_FAKES_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
#include <vector>
@@ -40,4 +40,4 @@
} // namespace reporting::test
-#endif // COMPONENTS_REPORTING_METRICS_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
+#endif // COMPONENTS_REPORTING_METRICS_FAKES_FAKE_EVENT_DRIVEN_TELEMETRY_SAMPLER_POOL_H_
diff --git a/components/reporting/metrics/fake_metric_report_queue.cc b/components/reporting/metrics/fakes/fake_metric_report_queue.cc
similarity index 96%
rename from components/reporting/metrics/fake_metric_report_queue.cc
rename to components/reporting/metrics/fakes/fake_metric_report_queue.cc
index ac4a78fe..d693bc5 100644
--- a/components/reporting/metrics/fake_metric_report_queue.cc
+++ b/components/reporting/metrics/fakes/fake_metric_report_queue.cc
@@ -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 "components/reporting/metrics/fake_metric_report_queue.h"
+#include "components/reporting/metrics/fakes/fake_metric_report_queue.h"
#include <memory>
#include <vector>
diff --git a/components/reporting/metrics/fake_metric_report_queue.h b/components/reporting/metrics/fakes/fake_metric_report_queue.h
similarity index 86%
rename from components/reporting/metrics/fake_metric_report_queue.h
rename to components/reporting/metrics/fakes/fake_metric_report_queue.h
index d8ecab3..ac38a769 100644
--- a/components/reporting/metrics/fake_metric_report_queue.h
+++ b/components/reporting/metrics/fakes/fake_metric_report_queue.h
@@ -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 COMPONENTS_REPORTING_METRICS_FAKE_METRIC_REPORT_QUEUE_H_
-#define COMPONENTS_REPORTING_METRICS_FAKE_METRIC_REPORT_QUEUE_H_
+#ifndef COMPONENTS_REPORTING_METRICS_FAKES_FAKE_METRIC_REPORT_QUEUE_H_
+#define COMPONENTS_REPORTING_METRICS_FAKES_FAKE_METRIC_REPORT_QUEUE_H_
#include <memory>
#include <vector>
@@ -48,4 +48,4 @@
} // namespace test
} // namespace reporting
-#endif // COMPONENTS_REPORTING_METRICS_FAKE_METRIC_REPORT_QUEUE_H_
+#endif // COMPONENTS_REPORTING_METRICS_FAKES_FAKE_METRIC_REPORT_QUEUE_H_
diff --git a/components/reporting/metrics/fake_reporting_settings.cc b/components/reporting/metrics/fakes/fake_reporting_settings.cc
similarity index 96%
rename from components/reporting/metrics/fake_reporting_settings.cc
rename to components/reporting/metrics/fakes/fake_reporting_settings.cc
index 6a166d9..e7d80ea7 100644
--- a/components/reporting/metrics/fake_reporting_settings.cc
+++ b/components/reporting/metrics/fakes/fake_reporting_settings.cc
@@ -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 "components/reporting/metrics/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
#include "base/containers/contains.h"
#include "base/run_loop.h"
diff --git a/components/reporting/metrics/fake_reporting_settings.h b/components/reporting/metrics/fakes/fake_reporting_settings.h
similarity index 88%
rename from components/reporting/metrics/fake_reporting_settings.h
rename to components/reporting/metrics/fakes/fake_reporting_settings.h
index 97a6bf3..5d5378b 100644
--- a/components/reporting/metrics/fake_reporting_settings.h
+++ b/components/reporting/metrics/fakes/fake_reporting_settings.h
@@ -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 COMPONENTS_REPORTING_METRICS_FAKE_REPORTING_SETTINGS_H_
-#define COMPONENTS_REPORTING_METRICS_FAKE_REPORTING_SETTINGS_H_
+#ifndef COMPONENTS_REPORTING_METRICS_FAKES_FAKE_REPORTING_SETTINGS_H_
+#define COMPONENTS_REPORTING_METRICS_FAKES_FAKE_REPORTING_SETTINGS_H_
#include <memory>
#include <string>
@@ -56,4 +56,4 @@
} // namespace test
} // namespace reporting
-#endif // COMPONENTS_REPORTING_METRICS_FAKE_REPORTING_SETTINGS_H_
+#endif // COMPONENTS_REPORTING_METRICS_FAKES_FAKE_REPORTING_SETTINGS_H_
diff --git a/components/reporting/metrics/fake_sampler.cc b/components/reporting/metrics/fakes/fake_sampler.cc
similarity index 96%
rename from components/reporting/metrics/fake_sampler.cc
rename to components/reporting/metrics/fakes/fake_sampler.cc
index 1fb3108..638337a7 100644
--- a/components/reporting/metrics/fake_sampler.cc
+++ b/components/reporting/metrics/fakes/fake_sampler.cc
@@ -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 "components/reporting/metrics/fake_sampler.h"
+#include "components/reporting/metrics/fakes/fake_sampler.h"
#include <utility>
diff --git a/components/reporting/metrics/fake_sampler.h b/components/reporting/metrics/fakes/fake_sampler.h
similarity index 90%
rename from components/reporting/metrics/fake_sampler.h
rename to components/reporting/metrics/fakes/fake_sampler.h
index 1dd0ac3..14114a9 100644
--- a/components/reporting/metrics/fake_sampler.h
+++ b/components/reporting/metrics/fakes/fake_sampler.h
@@ -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 COMPONENTS_REPORTING_METRICS_FAKE_SAMPLER_H_
-#define COMPONENTS_REPORTING_METRICS_FAKE_SAMPLER_H_
+#ifndef COMPONENTS_REPORTING_METRICS_FAKES_FAKE_SAMPLER_H_
+#define COMPONENTS_REPORTING_METRICS_FAKES_FAKE_SAMPLER_H_
#include "components/reporting/metrics/sampler.h"
#include "components/reporting/proto/synced/metric_data.pb.h"
@@ -77,4 +77,4 @@
} // namespace test
} // namespace reporting
-#endif // COMPONENTS_REPORTING_METRICS_FAKE_SAMPLER_H_
+#endif // COMPONENTS_REPORTING_METRICS_FAKES_FAKE_SAMPLER_H_
diff --git a/components/reporting/metrics/metric_data_collector_unittest.cc b/components/reporting/metrics/metric_data_collector_unittest.cc
index a3a0596..344af078b6f6 100644
--- a/components/reporting/metrics/metric_data_collector_unittest.cc
+++ b/components/reporting/metrics/metric_data_collector_unittest.cc
@@ -13,10 +13,10 @@
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
-#include "components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h"
-#include "components/reporting/metrics/fake_metric_report_queue.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
-#include "components/reporting/metrics/fake_sampler.h"
+#include "components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h"
+#include "components/reporting/metrics/fakes/fake_metric_report_queue.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_sampler.h"
#include "components/reporting/metrics/metric_report_queue.h"
#include "components/reporting/proto/synced/metric_data.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/components/reporting/metrics/metric_event_observer_manager_unittest.cc b/components/reporting/metrics/metric_event_observer_manager_unittest.cc
index bac09f1..005b5ad3 100644
--- a/components/reporting/metrics/metric_event_observer_manager_unittest.cc
+++ b/components/reporting/metrics/metric_event_observer_manager_unittest.cc
@@ -12,10 +12,10 @@
#include "base/test/task_environment.h"
#include "components/reporting/metrics/configured_sampler.h"
-#include "components/reporting/metrics/fake_event_driven_telemetry_sampler_pool.h"
-#include "components/reporting/metrics/fake_metric_report_queue.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
-#include "components/reporting/metrics/fake_sampler.h"
+#include "components/reporting/metrics/fakes/fake_event_driven_telemetry_sampler_pool.h"
+#include "components/reporting/metrics/fakes/fake_metric_report_queue.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_sampler.h"
#include "components/reporting/metrics/metric_report_queue.h"
#include "components/reporting/proto/synced/metric_data.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/components/reporting/metrics/metric_rate_controller_unittest.cc b/components/reporting/metrics/metric_rate_controller_unittest.cc
index 04f9acb..7d8f8ed 100644
--- a/components/reporting/metrics/metric_rate_controller_unittest.cc
+++ b/components/reporting/metrics/metric_rate_controller_unittest.cc
@@ -10,7 +10,7 @@
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace reporting {
diff --git a/components/reporting/metrics/metric_report_queue_unittest.cc b/components/reporting/metrics/metric_report_queue_unittest.cc
index 9ccb2f4f..8515e8b 100644
--- a/components/reporting/metrics/metric_report_queue_unittest.cc
+++ b/components/reporting/metrics/metric_report_queue_unittest.cc
@@ -14,7 +14,7 @@
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/reporting/client/mock_report_queue.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
#include "components/reporting/proto/synced/metric_data.pb.h"
#include "components/reporting/proto/synced/record_constants.pb.h"
#include "components/reporting/util/status.h"
diff --git a/components/reporting/metrics/metric_reporting_controller_unittest.cc b/components/reporting/metrics/metric_reporting_controller_unittest.cc
index b152d8e..c5545ea 100644
--- a/components/reporting/metrics/metric_reporting_controller_unittest.cc
+++ b/components/reporting/metrics/metric_reporting_controller_unittest.cc
@@ -10,7 +10,7 @@
#include "base/callback_forward.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
-#include "components/reporting/metrics/fake_reporting_settings.h"
+#include "components/reporting/metrics/fakes/fake_reporting_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace reporting {
diff --git a/components/reporting/metrics/multi_samplers_collector_unittest.cc b/components/reporting/metrics/multi_samplers_collector_unittest.cc
index 20b38cf..667e4dea 100644
--- a/components/reporting/metrics/multi_samplers_collector_unittest.cc
+++ b/components/reporting/metrics/multi_samplers_collector_unittest.cc
@@ -7,7 +7,7 @@
#include "base/memory/scoped_refptr.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
-#include "components/reporting/metrics/fake_sampler.h"
+#include "components/reporting/metrics/fakes/fake_sampler.h"
#include "components/reporting/metrics/multi_samplers_collector.h"
#include "components/reporting/proto/synced/metric_data.pb.h"
#include "testing/gtest/include/gtest/gtest.h"