Skip to content

Commit

Permalink
Address Web Discovery feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
DJAndries committed Jan 9, 2025
1 parent 4465e37 commit 71dffba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
21 changes: 10 additions & 11 deletions components/web_discovery/browser/double_fetcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@ class WebDiscoveryDoubleFetcherTest : public testing::Test {
url_loader_factory_.AddResponse(kTestUrl, kTestResponseText, status);
}

base::test::TaskEnvironment task_environment_;
struct CompletedFetch {
GURL url;
base::Value associated_data;
std::optional<std::string> response_body;
};
std::unique_ptr<DoubleFetcher> double_fetcher_;
std::vector<CompletedFetch> completed_fetches_;
network::TestURLLoaderFactory url_loader_factory_;

private:
void HandleDoubleFetch(const GURL& url,
const base::Value& associated_data,
std::optional<std::string> response_body) {
Expand All @@ -76,8 +65,18 @@ class WebDiscoveryDoubleFetcherTest : public testing::Test {
.response_body = response_body});
}

base::test::TaskEnvironment task_environment_;
TestingPrefServiceSimple profile_prefs_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;

struct CompletedFetch {
GURL url;
base::Value associated_data;
std::optional<std::string> response_body;
};
std::unique_ptr<DoubleFetcher> double_fetcher_;
std::vector<CompletedFetch> completed_fetches_;
network::TestURLLoaderFactory url_loader_factory_;
};

TEST_F(WebDiscoveryDoubleFetcherTest, ScheduleAndFetch) {
Expand Down
15 changes: 7 additions & 8 deletions components/web_discovery/browser/reporter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ class WebDiscoveryReporterTest : public testing::Test {
return payload;
}

base::test::TaskEnvironment task_environment_;
std::unique_ptr<Reporter> reporter_;
TestCredentialSigner credential_signer_;
size_t report_requests_made_ = 0;
net::HttpStatusCode submit_status_code_ = net::HTTP_OK;

private:
void HandleRequest(const network::ResourceRequest& request) {
url_loader_factory_.ClearResponses();

Expand All @@ -145,10 +138,16 @@ class WebDiscoveryReporterTest : public testing::Test {
report_requests_made_++;
}

std::unique_ptr<ServerConfigLoader> server_config_loader_;
base::test::TaskEnvironment task_environment_;
TestingPrefServiceSimple profile_prefs_;
network::TestURLLoaderFactory url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
std::unique_ptr<ServerConfigLoader> server_config_loader_;

std::unique_ptr<Reporter> reporter_;
TestCredentialSigner credential_signer_;
size_t report_requests_made_ = 0;
net::HttpStatusCode submit_status_code_ = net::HTTP_OK;
};

TEST_F(WebDiscoveryReporterTest, BasicReport) {
Expand Down

0 comments on commit 71dffba

Please sign in to comment.