Commit 25e45b6c authored by Meredith Lane's avatar Meredith Lane Committed by Commit Bot

Revert "Enable SafeBrowsingIsRealtimeReportingEnabledTest on Chrome OS."

This reverts commit 1a7be35f.

Reason for revert: Deterministically fails on linux-chromeos-chrome, starting: https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-chrome/1806

Original change's description:
> Enable SafeBrowsingIsRealtimeReportingEnabledTest on Chrome OS.
> 
> Previously no setup was done for Chrome OS and the tests assumed that
> RealtimeReporting is never enabled on Chrome OS.
> Now it covers the same scenarios as on other platforms, but requires
> some extensive setup.
> 
> In a follow-up CL I'll add Chrome OS specific tests for different
> scenarios, e.g.device/user managed/non-managed and etc.
> 
> Bug: 1012048
> Change-Id: I810ae8c541fa0040ff63a8d7377129246a5473c8
> Tests: Unit test updated.
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002514
> Reviewed-by: Daniel Rubery <drubery@chromium.org>
> Commit-Queue: Sergey Poromov <poromov@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#732562}

TBR=poromov@chromium.org,drubery@chromium.org

Change-Id: I569a1e59f1c823d49b0b2f3c465276215ad7c49b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1012048
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2006274Reviewed-by: default avatarMeredith Lane <meredithl@chromium.org>
Commit-Queue: Meredith Lane <meredithl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732639}
parent e7681c70
...@@ -28,17 +28,6 @@ ...@@ -28,17 +28,6 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user.h"
#endif
using ::testing::_; using ::testing::_;
using ::testing::Mock; using ::testing::Mock;
using ::testing::SaveArg; using ::testing::SaveArg;
...@@ -828,30 +817,12 @@ class SafeBrowsingIsRealtimeReportingEnabledTest ...@@ -828,30 +817,12 @@ class SafeBrowsingIsRealtimeReportingEnabledTest
TestingBrowserProcess::GetGlobal()->local_state()->SetBoolean( TestingBrowserProcess::GetGlobal()->local_state()->SetBoolean(
prefs::kUnsafeEventsReportingEnabled, is_policy_enabled_); prefs::kUnsafeEventsReportingEnabled, is_policy_enabled_);
#if defined(OS_CHROMEOS)
auto user_manager = std::make_unique<chromeos::FakeChromeUserManager>();
const AccountId account_id(
AccountId::FromUserEmail(profile_->GetProfileUserName()));
const user_manager::User* user = user_manager->AddUserWithAffiliation(
account_id, /*is_affiliated=*/true);
chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
profile_);
user_manager->UserLoggedIn(account_id, user->username_hash(),
/*browser_restart=*/false,
/*is_child=*/false);
scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>(
std::move(user_manager));
profile_->ScopedCrosSettingsTestHelper()
->InstallAttributes()
->SetCloudManaged("domain.com", "device_id");
profile_->GetProfilePolicyConnector()->OverrideIsManagedForTesting(
is_manageable_);
#endif
} }
bool should_init() { bool should_init() {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #if defined(OS_CHROMEOS)
return false;
#elif BUILDFLAG(GOOGLE_CHROME_BRANDING)
return is_feature_flag_enabled_; return is_feature_flag_enabled_;
#else #else
return is_feature_flag_enabled_ && is_manageable_; return is_feature_flag_enabled_ && is_manageable_;
...@@ -864,11 +835,6 @@ class SafeBrowsingIsRealtimeReportingEnabledTest ...@@ -864,11 +835,6 @@ class SafeBrowsingIsRealtimeReportingEnabledTest
const bool is_manageable_; const bool is_manageable_;
const bool is_policy_enabled_; const bool is_policy_enabled_;
const bool is_authorized_; const bool is_authorized_;
#if defined(OS_CHROMEOS)
private:
std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_;
#endif
}; };
TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest, TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest,
...@@ -887,7 +853,9 @@ TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest, CheckRealtimeReport) { ...@@ -887,7 +853,9 @@ TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest, CheckRealtimeReport) {
api::safe_browsing_private::OnPolicySpecifiedPasswordChanged::kEventName); api::safe_browsing_private::OnPolicySpecifiedPasswordChanged::kEventName);
event_router_->AddEventObserver(&event_observer); event_router_->AddEventObserver(&event_observer);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #if defined(OS_CHROMEOS)
bool should_report = false;
#elif BUILDFLAG(GOOGLE_CHROME_BRANDING)
bool should_report = bool should_report =
is_feature_flag_enabled_ && is_policy_enabled_ && is_authorized_; is_feature_flag_enabled_ && is_policy_enabled_ && is_authorized_;
#else #else
......
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