Skip to content

Commit

Permalink
FeaturedClient: Remove ListenForActiveEarlyBootTrials()
Browse files Browse the repository at this point in the history
In tast tests, ListenForActiveEarlyBootTrials() causes Chrome to crash
due to FilePathWatcher blocking on a nonblocking thread.

Remove the method for now until a fix is in for the method to be posted
as a blocking task. See associated bug for more details.

BUG=b:305042166
TEST=unit tests

Change-Id: Ida22c5efb810cefab46842a74ccadacb6cc620ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4939796
Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Kendrake Tsui <kendraketsui@google.com>
Cr-Commit-Position: refs/heads/main@{#1209736}
  • Loading branch information
Kendrake Tsui authored and Chromium LUCI CQ committed Oct 13, 2023
1 parent b2d7a20 commit 1302476
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
2 changes: 1 addition & 1 deletion chromeos/ash/components/dbus/featured/featured_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FeaturedClientImpl : public FeaturedClient {
dbus::ObjectPath(::featured::kFeaturedServicePath));
expected_dir_ = expected_dir;
listen_callback_ = callback;
ListenForActiveEarlyBootTrials();
// TODO(b/305042166): Call ListenForActiveEarlyBootTrials() once fixed.
ReadTrialsActivatedBeforeChromeStartup();
}

Expand Down
48 changes: 0 additions & 48 deletions chromeos/ash/components/dbus/featured/featured_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,54 +267,6 @@ TEST_F(FeaturedClientTest, FakeHandleSeedFetched_InvokeSuccessWhenSet) {
EXPECT_EQ(FakeFeaturedClient::Get(), nullptr);
}

TEST_F(FeaturedClientTest, ListenForActiveEarlyBootTrials_NewFileCreated) {
base::RunLoop run_loop;
bool ran_callback = false;
FeaturedClient::InitializeForTesting(
bus_.get(), active_trials_dir_,
base::BindLambdaForTesting(
[&ran_callback, &run_loop](const std::string& trial_name,
const std::string& group_name) {
EXPECT_EQ(trial_name, "test_trial");
EXPECT_EQ(group_name, "test_group");
ran_callback = true;
run_loop.Quit();
}));

FeaturedClient* client = FeaturedClient::Get();
ASSERT_NE(client, nullptr);

// Create a new active trial file.
EXPECT_TRUE(
base::WriteFile(active_trials_dir_.Append("test_trial,test_group"), ""));
run_loop.Run();
// Ensures the callback was executed.
EXPECT_TRUE(ran_callback);

FeaturedClient::Shutdown();

EXPECT_EQ(FeaturedClient::Get(), nullptr);
}

TEST_F(FeaturedClientTest, ListenForActiveEarlyBootTrials_NoFileCreated) {
bool ran_callback = false;
FeaturedClient::InitializeForTesting(
bus_.get(), active_trials_dir_,
base::BindLambdaForTesting(
[&ran_callback](const std::string& trial_name,
const std::string& group_name) {
ran_callback = true;
}));

FeaturedClient* client = FeaturedClient::Get();
ASSERT_NE(client, nullptr);
EXPECT_FALSE(ran_callback);

FeaturedClient::Shutdown();

EXPECT_EQ(FeaturedClient::Get(), nullptr);
}

TEST_F(FeaturedClientTest, ReadTrialsActivatedBeforeChromeStartup_FilesExist) {
// Create active trial files before FeaturedClient is initialized.
EXPECT_TRUE(base::WriteFile(
Expand Down

0 comments on commit 1302476

Please sign in to comment.