Commit 50f5085c authored by Owen Min's avatar Owen Min Committed by Chromium LUCI CQ

replace ifdef in chrome/browser/policy/messaging_layor

Using if defined instead of idef, and include build/build_config.h

References: 
https: //chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md#platform_specific-code
Change-Id: I1336313e002eeee85496d31089349826a60fc34a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2618398Reviewed-by: default avatarZach Trudo <zatrudo@google.com>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841587}
parent 711938b6
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
...@@ -66,7 +66,7 @@ namespace { ...@@ -66,7 +66,7 @@ namespace {
void GetCloudPolicyClient( void GetCloudPolicyClient(
base::OnceCallback<void(StatusOr<policy::CloudPolicyClient*>)> base::OnceCallback<void(StatusOr<policy::CloudPolicyClient*>)>
get_client_cb) { get_client_cb) {
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
policy::CloudPolicyManager* cloud_policy_manager = policy::CloudPolicyManager* cloud_policy_manager =
g_browser_process->platform_part() g_browser_process->platform_part()
->browser_policy_connector_chromeos() ->browser_policy_connector_chromeos()
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "build/build_config.h"
#include "chrome/browser/policy/messaging_layer/public/report_queue.h" #include "chrome/browser/policy/messaging_layer/public/report_queue.h"
#include "chrome/browser/policy/messaging_layer/public/report_queue_configuration.h" #include "chrome/browser/policy/messaging_layer/public/report_queue_configuration.h"
#include "chrome/browser/policy/messaging_layer/util/status.h" #include "chrome/browser/policy/messaging_layer/util/status.h"
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/user_manager/scoped_user_manager.h" #include "components/user_manager/scoped_user_manager.h"
...@@ -73,7 +74,7 @@ class TestEvent { ...@@ -73,7 +74,7 @@ class TestEvent {
class ReportClientTest : public testing::Test { class ReportClientTest : public testing::Test {
public: public:
void SetUp() override { void SetUp() override {
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
// Set up fake primary profile. // Set up fake primary profile.
auto mock_user_manager = auto mock_user_manager =
std::make_unique<testing::NiceMock<chromeos::FakeChromeUserManager>>(); std::make_unique<testing::NiceMock<chromeos::FakeChromeUserManager>>();
...@@ -101,7 +102,7 @@ class ReportClientTest : public testing::Test { ...@@ -101,7 +102,7 @@ class ReportClientTest : public testing::Test {
} }
void TearDown() override { void TearDown() override {
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
user_manager_.reset(); user_manager_.reset();
profile_.reset(); profile_.reset();
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
...@@ -110,7 +111,7 @@ class ReportClientTest : public testing::Test { ...@@ -110,7 +111,7 @@ class ReportClientTest : public testing::Test {
protected: protected:
content::BrowserTaskEnvironment task_envrionment_; content::BrowserTaskEnvironment task_envrionment_;
std::unique_ptr<ReportingClient::TestEnvironment> test_reporting_; std::unique_ptr<ReportingClient::TestEnvironment> test_reporting_;
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
std::unique_ptr<TestingProfile> profile_; std::unique_ptr<TestingProfile> profile_;
std::unique_ptr<user_manager::ScopedUserManager> user_manager_; std::unique_ptr<user_manager::ScopedUserManager> user_manager_;
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task_runner.h" #include "base/task_runner.h"
#include "build/build_config.h"
#include "chrome/browser/policy/messaging_layer/util/status.h" #include "chrome/browser/policy/messaging_layer/util/status.h"
#include "chrome/browser/policy/messaging_layer/util/status_macros.h" #include "chrome/browser/policy/messaging_layer/util/status_macros.h"
#include "chrome/browser/policy/messaging_layer/util/statusor.h" #include "chrome/browser/policy/messaging_layer/util/statusor.h"
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
#include "components/policy/proto/record_constants.pb.h" #include "components/policy/proto/record_constants.pb.h"
#include "net/base/backoff_entry.h" #include "net/base/backoff_entry.h"
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/test/test_mock_time_task_runner.h" #include "base/test/test_mock_time_task_runner.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/policy/messaging_layer/upload/record_handler_impl.h" #include "chrome/browser/policy/messaging_layer/upload/record_handler_impl.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/policy/core/common/cloud/dm_token.h" #include "components/policy/core/common/cloud/dm_token.h"
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "services/network/test/test_network_connection_tracker.h" #include "services/network/test/test_network_connection_tracker.h"
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/user_manager/scoped_user_manager.h" #include "components/user_manager/scoped_user_manager.h"
...@@ -174,7 +175,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> { ...@@ -174,7 +175,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> {
protected: protected:
void SetUp() override { void SetUp() override {
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
// Set up fake primary profile. // Set up fake primary profile.
auto mock_user_manager = auto mock_user_manager =
std::make_unique<testing::NiceMock<chromeos::FakeChromeUserManager>>(); std::make_unique<testing::NiceMock<chromeos::FakeChromeUserManager>>();
...@@ -193,7 +194,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> { ...@@ -193,7 +194,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> {
} }
void TearDown() override { void TearDown() override {
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
user_manager_.reset(); user_manager_.reset();
profile_.reset(); profile_.reset();
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
...@@ -202,7 +203,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> { ...@@ -202,7 +203,7 @@ class UploadClientTest : public ::testing::TestWithParam<bool> {
bool need_encryption_key() const { return GetParam(); } bool need_encryption_key() const { return GetParam(); }
content::BrowserTaskEnvironment task_envrionment_; content::BrowserTaskEnvironment task_envrionment_;
#ifdef OS_CHROMEOS #if defined(OS_CHROMEOS)
std::unique_ptr<TestingProfile> profile_; std::unique_ptr<TestingProfile> profile_;
std::unique_ptr<user_manager::ScopedUserManager> user_manager_; std::unique_ptr<user_manager::ScopedUserManager> user_manager_;
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
......
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