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

Unified Diff: chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h

Issue 2631133003: [Payments] Introduce basic interactive browsertests for Payment Request (Closed)
Patch Set: Initial Created 3 years, 11 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
Index: chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h
diff --git a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..f68f50ec5677f2252c63bd9da095fa7a2bd2469c
--- /dev/null
+++ b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE_H_
+
+#include <vector>
+
+#include "base/command_line.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+
+namespace content {
+class WebContents;
+} // namespace content
+
+namespace payments {
+
+class PaymentRequest;
+
+// Base class for any interactive PaymentRequest test that will need to open
+// the UI and interact with it.
+class PaymentRequestInteractiveTestBase : public InProcessBrowserTest {
+ protected:
+ // Test will open a browser window to |test_file_path| (relative to
+ // chrome/test/data/payments).
+ explicit PaymentRequestInteractiveTestBase(const std::string& test_file_path);
+ ~PaymentRequestInteractiveTestBase() override;
+
+ void SetUpCommandLine(base::CommandLine* command_line) override;
+ void SetUpOnMainThread() override;
+
+ // Will call JavaScript to invoke the PaymentRequest dialog and verify that
+ // it's open.
+ void InvokePaymentRequestUI();
+
+ // Convenience method to get a list of PaymentRequest associated with
+ // |web_contents|.
+ const std::vector<PaymentRequest*> GetPaymentRequests(
+ content::WebContents* web_contents);
+
+ content::WebContents* GetActiveWebContents();
+
+ net::EmbeddedTestServer* https_server() { return https_server_.get(); }
+
+ private:
+ const std::string test_file_path_;
+ std::unique_ptr<net::EmbeddedTestServer> https_server_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentRequestInteractiveTestBase);
+};
+
+} // namespace payments
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_INTERACTIVE_UITEST_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698