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

Unified Diff: headless/test/headless_browser_test.h

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 6 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/public/headless_web_contents.h ('k') | headless/test/headless_browser_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/test/headless_browser_test.h
diff --git a/headless/test/headless_browser_test.h b/headless/test/headless_browser_test.h
index 8694b38849a177411b32b0b45e8c300770efc60f..8189d50cf6286384d2e105386ce4b4a709de0e7e 100644
--- a/headless/test/headless_browser_test.h
+++ b/headless/test/headless_browser_test.h
@@ -9,6 +9,8 @@
#include <string>
#include "content/public/test/browser_test_base.h"
+#include "headless/public/domains/network.h"
+#include "headless/public/domains/page.h"
#include "headless/public/headless_browser.h"
#include "headless/public/headless_web_contents.h"
@@ -22,6 +24,30 @@ class EvaluateResult;
}
class HeadlessDevToolsClient;
+// A utility class for asynchronously observing load events.
+class LoadObserver : public page::Observer, public network::Observer {
+ public:
+ LoadObserver(HeadlessDevToolsClient* devtools_client, base::Closure callback);
+ ~LoadObserver() override;
+
+ // page::Observer implementation:
+ void OnLoadEventFired(const page::LoadEventFiredParams& params) override;
+
+ // network::Observer implementation:
+ void OnResponseReceived(
+ const network::ResponseReceivedParams& params) override;
+
+ bool navigation_succeeded() const { return navigation_succeeded_; }
+
+ private:
+ base::Closure callback_;
+ HeadlessDevToolsClient* devtools_client_; // Not owned.
+
+ bool navigation_succeeded_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadObserver);
+};
+
// Base class for tests which require a full instance of the headless browser.
class HeadlessBrowserTest : public content::BrowserTestBase {
public:
« no previous file with comments | « headless/public/headless_web_contents.h ('k') | headless/test/headless_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698