Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: headless/lib/headless_devtools_client_browsertest.cc

Issue 1906503002: headless: Implement convenience overloads for DevTools commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/domain_h.template ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_devtools_client_browsertest.cc
diff --git a/headless/lib/headless_devtools_client_browsertest.cc b/headless/lib/headless_devtools_client_browsertest.cc
index 3651d78b178eab475b201f7c954b102a17457989..d67682a60f8dc117d152cc270ff89e60a629384b 100644
--- a/headless/lib/headless_devtools_client_browsertest.cc
+++ b/headless/lib/headless_devtools_client_browsertest.cc
@@ -82,15 +82,28 @@ class HeadlessDevToolsClientEvalTest : public HeadlessDevToolsClientTest {
std::unique_ptr<runtime::EvaluateParams> params =
runtime::EvaluateParams::Builder().SetExpression("1 + 2").Build();
devtools_client_->GetRuntime()->Evaluate(
- std::move(params), base::Bind(&HeadlessDevToolsClientEvalTest::OnResult,
- base::Unretained(this)));
+ std::move(params),
+ base::Bind(&HeadlessDevToolsClientEvalTest::OnFirstResult,
+ base::Unretained(this)));
+ // Test the convenience overload which only takes the required command
+ // parameters.
+ devtools_client_->GetRuntime()->Evaluate(
+ "24 * 7", base::Bind(&HeadlessDevToolsClientEvalTest::OnSecondResult,
+ base::Unretained(this)));
}
- void OnResult(std::unique_ptr<runtime::EvaluateResult> result) {
+ void OnFirstResult(std::unique_ptr<runtime::EvaluateResult> result) {
int value;
EXPECT_TRUE(result->GetResult()->HasValue());
EXPECT_TRUE(result->GetResult()->GetValue()->GetAsInteger(&value));
EXPECT_EQ(3, value);
+ }
+
+ void OnSecondResult(std::unique_ptr<runtime::EvaluateResult> result) {
+ int value;
+ EXPECT_TRUE(result->GetResult()->HasValue());
+ EXPECT_TRUE(result->GetResult()->GetValue()->GetAsInteger(&value));
+ EXPECT_EQ(168, value);
FinishAsynchronousTest();
}
};
« no previous file with comments | « headless/lib/browser/domain_h.template ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698