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

Unified Diff: headless/test/headless_browser_test.cc

Issue 2026253002: Revert of headless: Allow protocol handler customization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/test/headless_browser_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/test/headless_browser_test.cc
diff --git a/headless/test/headless_browser_test.cc b/headless/test/headless_browser_test.cc
index d308fbead5842407acbc9488a97a1262e48dcc4c..380ccd7a28642277040a118c05977807c05e4b58 100644
--- a/headless/test/headless_browser_test.cc
+++ b/headless/test/headless_browser_test.cc
@@ -15,7 +15,6 @@
#include "headless/lib/headless_content_main_delegate.h"
#include "headless/public/domains/network.h"
#include "headless/public/domains/page.h"
-#include "headless/public/domains/runtime.h"
#include "headless/public/headless_devtools_client.h"
#include "headless/public/headless_devtools_target.h"
#include "headless/public/headless_web_contents.h"
@@ -68,43 +67,6 @@
DISALLOW_COPY_AND_ASSIGN(WaitForLoadObserver);
};
-class EvaluateHelper {
- public:
- EvaluateHelper(HeadlessBrowserTest* browser_test,
- HeadlessWebContents* web_contents,
- const std::string& script_to_eval)
- : browser_test_(browser_test),
- web_contents_(web_contents),
- devtools_client_(HeadlessDevToolsClient::Create()) {
- web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get());
- devtools_client_->GetRuntime()->Evaluate(
- script_to_eval,
- base::Bind(&EvaluateHelper::OnEvaluateResult, base::Unretained(this)));
- }
-
- ~EvaluateHelper() {
- web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get());
- }
-
- void OnEvaluateResult(std::unique_ptr<runtime::EvaluateResult> result) {
- result_ = std::move(result);
- browser_test_->FinishAsynchronousTest();
- }
-
- std::unique_ptr<runtime::EvaluateResult> TakeResult() {
- return std::move(result_);
- }
-
- private:
- HeadlessBrowserTest* browser_test_; // Not owned.
- HeadlessWebContents* web_contents_; // Not owned.
- std::unique_ptr<HeadlessDevToolsClient> devtools_client_;
-
- std::unique_ptr<runtime::EvaluateResult> result_;
-
- DISALLOW_COPY_AND_ASSIGN(EvaluateHelper);
-};
-
} // namespace
HeadlessBrowserTest::HeadlessBrowserTest() {
@@ -152,14 +114,6 @@
return observer.navigation_succeeded();
}
-std::unique_ptr<runtime::EvaluateResult> HeadlessBrowserTest::EvaluateScript(
- HeadlessWebContents* web_contents,
- const std::string& script) {
- EvaluateHelper helper(this, web_contents, script);
- RunAsynchronousTest();
- return helper.TakeResult();
-}
-
void HeadlessBrowserTest::RunAsynchronousTest() {
base::MessageLoop::ScopedNestableTaskAllower nestable_allower(
base::MessageLoop::current());
« no previous file with comments | « headless/test/headless_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698