Skip to content

Commit

Permalink
[DevTools] Replaced deprecated base::Value DICT and LIST types.
Browse files Browse the repository at this point in the history
These types are deprecated for a long time. This CL replaces their
usage in the remaining DevTools tests.

Change-Id: If84661acb256f40951c2b2e57394c5a7882a6301
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811529
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032222}
  • Loading branch information
Peter Kvitek authored and Chromium LUCI CQ committed Aug 6, 2022
1 parent ba8ddfb commit e274cf8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
14 changes: 7 additions & 7 deletions content/browser/devtools/devtools_issue_storage_browsertest.cc
Expand Up @@ -76,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageBrowserTest,
// Report an empty SameSite cookie issue.
ReportDummyIssue(main_frame_host());
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");
// Verify we have received the SameSite issue.
WaitForDummyIssueNotification();
}
Expand All @@ -85,7 +85,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageBrowserTest,
DevToolsReceivesBrowserIssuesWhileAttached) {
EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank")));
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");
// Report an empty SameSite cookie issue.
ReportDummyIssue(main_frame_host());
// Verify we have received the SameSite issue.
Expand Down Expand Up @@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageBrowserTest,

// 4) Open DevTools and enable Audits domain.
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");

// 5) Verify we have received the SameSite issue on the main target.
WaitForDummyIssueNotification();
Expand All @@ -136,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageBrowserTest,

// 4) Open DevTools and enable Audits domain.
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");

// 5) Verify that we haven't received any notifications.
ASSERT_FALSE(HasExistingNotification());
Expand Down Expand Up @@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageWithBackForwardCacheBrowserTest,

// 5) Open DevTools and enable Audits domain.
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");

// 6) Verify we have received the SameSite issue on the main target.
WaitForDummyIssueNotification();
Expand Down Expand Up @@ -234,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageWithPrerenderBrowserTest,

// 5) Open DevTools and enable Audits domain.
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");

// 6) Verify we have received the SameSite issue on the main target.
WaitForDummyIssueNotification();
Expand Down Expand Up @@ -277,7 +277,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsIssueStorageFencedFrameTest,

// 5) Open DevTools and enable Audits domain.
Attach();
SendCommand("Audits.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Audits.enable");

// 6) Verify we have received the SameSite issue on the main target.
WaitForDummyIssueNotification();
Expand Down
18 changes: 9 additions & 9 deletions content/browser/devtools/devtools_trust_token_browsertest.cc
Expand Up @@ -33,7 +33,7 @@ class DevToolsTrustTokenBrowsertest : public DevToolsProtocolTest,

// The returned view is only valid until the next |SendCommand| call.
base::Value::ConstListView GetTrustTokensViaProtocol() {
SendCommand("Storage.getTrustTokens", nullptr);
SendCommandSync("Storage.getTrustTokens");
const base::Value* tokens = result()->Find("tokens");
CHECK(tokens);
return tokens->GetListDeprecated();
Expand Down Expand Up @@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsTrustTokenBrowsertest,

// 2) Open DevTools and enable Network domain.
Attach();
SendCommand("Network.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Network.enable");

// Make sure there are no existing DevTools events in the queue.
EXPECT_FALSE(HasExistingNotification());
Expand Down Expand Up @@ -142,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(

// Open DevTools and enable Network domain.
Attach();
SendCommand("Network.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Network.enable");

// Make sure there are no existing DevTools events in the queue.
EXPECT_FALSE(HasExistingNotification());
Expand Down Expand Up @@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsTrustTokenBrowsertest, FetchEndToEnd) {

// 2) Open DevTools and enable Network domain.
Attach();
SendCommand("Network.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Network.enable");

// 3) Request and redeem a token, then use the redeemed token in a Signing
// request.
Expand Down Expand Up @@ -238,7 +238,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsTrustTokenBrowsertest, IframeEndToEnd) {

// 2) Open DevTools and enable Network domain.
Attach();
SendCommand("Network.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Network.enable");

// 3) Request and redeem a token, then use the redeemed token in a Signing
// request.
Expand Down Expand Up @@ -288,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsTrustTokenBrowsertest,

// 2) Open DevTools and enable Network domain.
Attach();
SendCommand("Network.enable", std::make_unique<base::DictionaryValue>());
SendCommandSync("Network.enable");

// 3) Request some Trust Tokens.
EXPECT_EQ("OperationError", EvalJs(shell(), R"(fetch('/issue',
Expand Down Expand Up @@ -354,9 +354,9 @@ IN_PROC_BROWSER_TEST_F(DevToolsTrustTokenBrowsertest, ClearTrustTokens) {
AssertTrustTokensViaProtocol(IssuanceOriginFromHost("a.test"), 10);

// 5) Call Storage.clearTrustTokens
auto params = std::make_unique<base::DictionaryValue>();
params->SetStringPath("issuerOrigin", IssuanceOriginFromHost("a.test"));
auto* result = SendCommand("Storage.clearTrustTokens", std::move(params));
base::Value::Dict params;
params.Set("issuerOrigin", IssuanceOriginFromHost("a.test"));
auto* result = SendCommandSync("Storage.clearTrustTokens", std::move(params));

EXPECT_THAT(result->FindBool("didDeleteTokens"), ::testing::Optional(true));

Expand Down
Expand Up @@ -27,16 +27,15 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VisualDebuggerTest) {
GURL url = GURL("data:text/html,<body></body>");
NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1);
Attach();
SendCommand("VisualDebugger.startStream", nullptr);
SendCommandSync("VisualDebugger.startStream");
WaitForNotification("VisualDebugger.frameResponse", true);

std::unique_ptr<base::DictionaryValue> command_params =
std::make_unique<base::DictionaryValue>();
auto filter_param =
std::string(R"({"filters":[{"selector":{"anno":""},"active":true}]})");
command_params->SetString("json", filter_param);
SendCommand("VisualDebugger.filterStream", std::move(command_params));
SendCommand("VisualDebugger.stopStream", nullptr);
base::Value::Dict command_params;
command_params.Set("json", filter_param);
SendCommandSync("VisualDebugger.filterStream", std::move(command_params));
SendCommandSync("VisualDebugger.stopStream");
}

} // namespace content

0 comments on commit e274cf8

Please sign in to comment.