Commit bb489a38 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[CBCM] Move ReportRequestQueueGenerator to components

Moves ReportRequestQueueGenerator from chrome/browser/enterprise to
components/enterprise so it can be reused in iOS code.

Note that the associated unit tests are harder to move because of their
extensive use of TestProfileManager, which is in chrome/browser. They
will be reworked and moved in a separate CL. crbug.com/1103732 has
been created to track that, with a TODO in the code.

Bug: 1091938
Change-Id: I24a2c2e258eb772e3910cdf99e8e1e7a83eb57a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2290250Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#788848}
parent e26e98b0
...@@ -3136,8 +3136,6 @@ static_library("browser") { ...@@ -3136,8 +3136,6 @@ static_library("browser") {
"enterprise/reporting/profile_report_generator_desktop.h", "enterprise/reporting/profile_report_generator_desktop.h",
"enterprise/reporting/report_generator.cc", "enterprise/reporting/report_generator.cc",
"enterprise/reporting/report_generator.h", "enterprise/reporting/report_generator.h",
"enterprise/reporting/report_request_queue_generator.cc",
"enterprise/reporting/report_request_queue_generator.h",
"enterprise/reporting/report_scheduler.cc", "enterprise/reporting/report_scheduler.cc",
"enterprise/reporting/report_scheduler.h", "enterprise/reporting/report_scheduler.h",
"enterprise/reporting/reporting_delegate_factory_desktop.cc", "enterprise/reporting/reporting_delegate_factory_desktop.cc",
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/enterprise/reporting/report_request_queue_generator.h"
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h" #include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h"
#include "components/enterprise/browser/reporting/browser_report_generator.h" #include "components/enterprise/browser/reporting/browser_report_generator.h"
#include "components/enterprise/browser/reporting/report_request_definition.h" #include "components/enterprise/browser/reporting/report_request_definition.h"
#include "components/enterprise/browser/reporting/report_request_queue_generator.h"
#include "components/policy/proto/device_management_backend.pb.h" #include "components/policy/proto/device_management_backend.pb.h"
namespace enterprise_reporting { namespace enterprise_reporting {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/enterprise/reporting/report_request_queue_generator.h" #include "components/enterprise/browser/reporting/report_request_queue_generator.h"
#include <vector> #include <vector>
...@@ -39,6 +39,8 @@ const char kActiveProfileName2[] = "active_profile2"; ...@@ -39,6 +39,8 @@ const char kActiveProfileName2[] = "active_profile2";
} // namespace } // namespace
// TODO(crbug.com/1103732): Get rid of chrome/browser dependencies and then
// move this file to components/enterprise/browser.
class ReportRequestQueueGeneratorTest : public ::testing::Test { class ReportRequestQueueGeneratorTest : public ::testing::Test {
public: public:
using ReportRequest = definition::ReportRequest; using ReportRequest = definition::ReportRequest;
......
...@@ -15,6 +15,8 @@ static_library("enterprise") { ...@@ -15,6 +15,8 @@ static_library("enterprise") {
"browser/reporting/profile_report_generator.cc", "browser/reporting/profile_report_generator.cc",
"browser/reporting/profile_report_generator.h", "browser/reporting/profile_report_generator.h",
"browser/reporting/report_request_definition.h", "browser/reporting/report_request_definition.h",
"browser/reporting/report_request_queue_generator.cc",
"browser/reporting/report_request_queue_generator.h",
"browser/reporting/report_uploader.cc", "browser/reporting/report_uploader.cc",
"browser/reporting/report_uploader.h", "browser/reporting/report_uploader.h",
"browser/reporting/reporting_delegate_factory.h", "browser/reporting/reporting_delegate_factory.h",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/enterprise/reporting/report_request_queue_generator.h" #include "components/enterprise/browser/reporting/report_request_queue_generator.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
namespace enterprise_reporting { namespace enterprise_reporting {
namespace { namespace {
const size_t kMaximumReportSize = const size_t kMaximumReportSize =
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_ #ifndef COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_
#define CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_ #define COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_
#include <memory> #include <memory>
#include <queue> #include <queue>
...@@ -21,6 +21,8 @@ class ReportingDelegateFactory; ...@@ -21,6 +21,8 @@ class ReportingDelegateFactory;
// Generate a report request queue that contains full profile information. The // Generate a report request queue that contains full profile information. The
// request number in the queue is decided by the maximum report size setting. // request number in the queue is decided by the maximum report size setting.
// TODO(crbug.com/1103732): Unit tests for this class are still in
// chrome/browser/enterprise/reporting.
class ReportRequestQueueGenerator { class ReportRequestQueueGenerator {
using ReportRequest = definition::ReportRequest; using ReportRequest = definition::ReportRequest;
using ReportRequests = std::queue<std::unique_ptr<ReportRequest>>; using ReportRequests = std::queue<std::unique_ptr<ReportRequest>>;
...@@ -58,4 +60,4 @@ class ReportRequestQueueGenerator { ...@@ -58,4 +60,4 @@ class ReportRequestQueueGenerator {
} // namespace enterprise_reporting } // namespace enterprise_reporting
#endif // CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_ #endif // COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_REQUEST_QUEUE_GENERATOR_H_
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