Commit be21fb04 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Enable primary_account_mutator_unittest.cc on ChromeOS

Bug: 987170
Change-Id: I9b4ecb4b55d312766b6a8c895026229a0e43caae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713634
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680412}
parent 28709494
...@@ -79,6 +79,7 @@ source_set("unit_tests") { ...@@ -79,6 +79,7 @@ source_set("unit_tests") {
"identity_test_environment_unittest.cc", "identity_test_environment_unittest.cc",
"identity_utils_unittest.cc", "identity_utils_unittest.cc",
"primary_account_access_token_fetcher_unittest.cc", "primary_account_access_token_fetcher_unittest.cc",
"primary_account_mutator_unittest.cc",
] ]
deps = [ deps = [
...@@ -100,10 +101,6 @@ source_set("unit_tests") { ...@@ -100,10 +101,6 @@ source_set("unit_tests") {
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
] ]
if (!is_chromeos) {
sources += [ "primary_account_mutator_unittest.cc" ]
}
} }
source_set("test_support") { source_set("test_support") {
......
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
namespace { namespace {
// Constants used by the different tests. // Constants used by the different tests.
const char kUnknownAccountId[] = "{unknown account id}";
const char kPrimaryAccountEmail[] = "primary.account@example.com"; const char kPrimaryAccountEmail[] = "primary.account@example.com";
#if !defined(OS_CHROMEOS)
const char kAnotherAccountEmail[] = "another.account@example.com"; const char kAnotherAccountEmail[] = "another.account@example.com";
const char kUnknownAccountId[] = "{unknown account id}";
// All account consistency methods that are tested by those unit tests when // All account consistency methods that are tested by those unit tests when
// testing ClearPrimaryAccount method. // testing ClearPrimaryAccount method.
...@@ -206,6 +207,7 @@ void RunClearPrimaryAccountTest( ...@@ -206,6 +207,7 @@ void RunClearPrimaryAccountTest(
break; break;
} }
} }
#endif // !defined(OS_CHROMEOS)
} // namespace } // namespace
...@@ -236,6 +238,12 @@ TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount) { ...@@ -236,6 +238,12 @@ TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount) {
EXPECT_EQ(identity_manager->GetPrimaryAccountId(), account_info.account_id); EXPECT_EQ(identity_manager->GetPrimaryAccountId(), account_info.account_id);
} }
// Tests that various preconditions of SetPrimaryAccount() not being satisfied
// should cause the setting of the primary account to fail. Not run on
// ChromeOS, where those preconditions do not exist.
// TODO(https://crbug.com/983124): Run these tests on ChromeOS if/once we
// enable those preconditions on that platform
#if !defined(OS_CHROMEOS)
// Checks that setting the primary account fails if the account is not known by // Checks that setting the primary account fails if the account is not known by
// the identity service. // the identity service.
TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) { TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) {
...@@ -337,7 +345,14 @@ TEST_F(PrimaryAccountMutatorTest, ...@@ -337,7 +345,14 @@ TEST_F(PrimaryAccountMutatorTest,
EXPECT_FALSE(primary_account_mutator->SetPrimaryAccount( EXPECT_FALSE(primary_account_mutator->SetPrimaryAccount(
primary_account_info.account_id)); primary_account_info.account_id));
} }
#endif // !defined(OS_CHROMEOS)
// End of tests of preconditions not being satisfied causing the setting of
// the primary account to fail.
// Tests of clearing the primary account. Not run on ChromeOS, which does not
// support clearing the primary account.
#if !defined(OS_CHROMEOS)
TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_NotSignedIn) { TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_NotSignedIn) {
base::test::ScopedTaskEnvironment task_environment; base::test::ScopedTaskEnvironment task_environment;
signin::IdentityTestEnvironment environment; signin::IdentityTestEnvironment environment;
...@@ -481,3 +496,4 @@ TEST_F(PrimaryAccountMutatorTest, ...@@ -481,3 +496,4 @@ TEST_F(PrimaryAccountMutatorTest,
signin::PrimaryAccountMutator::ClearAccountsAction::kDefault, signin::PrimaryAccountMutator::ClearAccountsAction::kDefault,
RemoveAccountExpectation::kRemovePrimary, AuthExpectation::kAuthError); RemoveAccountExpectation::kRemovePrimary, AuthExpectation::kAuthError);
} }
#endif // !defined(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