OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/test/test_browser_dialog.h" | |
11 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
12 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 11 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
14 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
15 #include "components/autofill/core/browser/autofill_test_utils.h" | 14 #include "components/autofill/core/browser/autofill_test_utils.h" |
16 #include "components/autofill/core/browser/credit_card.h" | 15 #include "components/autofill/core/browser/credit_card.h" |
17 #include "components/payments/content/payment_request.h" | 16 #include "components/payments/content/payment_request.h" |
18 #include "components/payments/content/payment_request_web_contents_manager.h" | 17 #include "components/payments/content/payment_request_web_contents_manager.h" |
19 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 18 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
20 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 GetPaymentRequests(GetActiveWebContents()); | 336 GetPaymentRequests(GetActiveWebContents()); |
338 EXPECT_EQ(1u, requests.size()); | 337 EXPECT_EQ(1u, requests.size()); |
339 std::vector<std::string> supported_card_networks = | 338 std::vector<std::string> supported_card_networks = |
340 requests[0]->spec()->supported_card_networks(); | 339 requests[0]->spec()->supported_card_networks(); |
341 EXPECT_EQ(3u, supported_card_networks.size()); | 340 EXPECT_EQ(3u, supported_card_networks.size()); |
342 EXPECT_EQ("mastercard", supported_card_networks[0]); | 341 EXPECT_EQ("mastercard", supported_card_networks[0]); |
343 EXPECT_EQ("visa", supported_card_networks[1]); | 342 EXPECT_EQ("visa", supported_card_networks[1]); |
344 EXPECT_EQ("jcb", supported_card_networks[2]); | 343 EXPECT_EQ("jcb", supported_card_networks[2]); |
345 } | 344 } |
346 | 345 |
347 // Test harness integrating with DialogBrowserTest to present the dialog in an | |
348 // interactive manner for visual testing. | |
349 class PaymentsRequestVisualTest | |
350 : public SupportsTestDialog<PaymentRequestNoShippingTest> { | |
351 protected: | |
352 PaymentsRequestVisualTest() {} | |
353 | |
354 // TestBrowserDialog: | |
355 void ShowDialog(const std::string& name) override { | |
356 InvokePaymentRequestUI(); | |
357 } | |
358 | |
359 bool AlwaysCloseAsynchronously() override { | |
360 // Bypassing Widget::CanClose() causes payments::JourneyLogger to see the | |
361 // show, but not the close, resulting in a DCHECK in its destructor. | |
362 return true; | |
363 } | |
364 | |
365 private: | |
366 DISALLOW_COPY_AND_ASSIGN(PaymentsRequestVisualTest); | |
367 }; | |
368 | |
369 IN_PROC_BROWSER_TEST_F(PaymentsRequestVisualTest, InvokeDialog_NoShipping) { | |
370 RunDialog(); | |
371 } | |
372 | |
373 } // namespace payments | 346 } // namespace payments |
OLD | NEW |