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

Side by Side Diff: chrome/browser/ui/views/payments/payment_method_view_controller_browsertest.cc

Issue 2759253002: [Web Payments] Implement item selection in lists. (Closed)
Patch Set: Assert back navigation in browser tests. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" 6 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
8 #include "components/autofill/core/browser/autofill_test_utils.h" 8 #include "components/autofill/core/browser/autofill_test_utils.h"
9 #include "components/autofill/core/browser/personal_data_manager.h" 9 #include "components/autofill/core/browser/personal_data_manager.h"
10 #include "components/payments/content/payment_request.h" 10 #include "components/payments/content/payment_request.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_EQ(request->state()->available_instruments().front().get(), 84 EXPECT_EQ(request->state()->available_instruments().front().get(),
85 request->state()->selected_instrument()); 85 request->state()->selected_instrument());
86 views::View* checkmark_view = list_view->child_at(0)->GetViewByID( 86 views::View* checkmark_view = list_view->child_at(0)->GetViewByID(
87 static_cast<int>(DialogViewID::CHECKMARK_VIEW)); 87 static_cast<int>(DialogViewID::CHECKMARK_VIEW));
88 EXPECT_TRUE(checkmark_view->visible()); 88 EXPECT_TRUE(checkmark_view->visible());
89 89
90 views::View* checkmark_view2 = list_view->child_at(1)->GetViewByID( 90 views::View* checkmark_view2 = list_view->child_at(1)->GetViewByID(
91 static_cast<int>(DialogViewID::CHECKMARK_VIEW)); 91 static_cast<int>(DialogViewID::CHECKMARK_VIEW));
92 EXPECT_FALSE(checkmark_view2->visible()); 92 EXPECT_FALSE(checkmark_view2->visible());
93 93
94 ResetEventObserver(DialogEvent::BACK_NAVIGATION);
94 // Simulate selecting the second card. 95 // Simulate selecting the second card.
95 ClickOnDialogViewAndWait(list_view->child_at(1)); 96 ClickOnDialogViewAndWait(list_view->child_at(1));
96 97
97 EXPECT_EQ(request->state()->available_instruments().back().get(), 98 EXPECT_EQ(request->state()->available_instruments().back().get(),
98 request->state()->selected_instrument()); 99 request->state()->selected_instrument());
100
101 OpenPaymentMethodScreen();
102 list_view = dialog_view()->GetViewByID(
103 static_cast<int>(DialogViewID::PAYMENT_METHOD_SHEET_LIST_VIEW));
104 // Clicking on the second card again should not modify any state.
105 ClickOnDialogViewAndWait(list_view->child_at(1));
Mathieu 2017/03/21 19:27:36 Do we not expect it to go back to the payment meth
anthonyvd 2017/03/21 20:29:14 Good question, we can ask Bruno!
106
107 checkmark_view = list_view->child_at(0)->GetViewByID(
108 static_cast<int>(DialogViewID::CHECKMARK_VIEW));
109 checkmark_view2 = list_view->child_at(1)->GetViewByID(
110 static_cast<int>(DialogViewID::CHECKMARK_VIEW));
99 EXPECT_FALSE(checkmark_view->visible()); 111 EXPECT_FALSE(checkmark_view->visible());
100 EXPECT_TRUE(checkmark_view2->visible()); 112 EXPECT_TRUE(checkmark_view2->visible());
101 113
102 // Clicking on the second card again should not modify any state.
103 ClickOnDialogViewAndWait(list_view->child_at(1));
104
105 EXPECT_EQ(request->state()->available_instruments().back().get(), 114 EXPECT_EQ(request->state()->available_instruments().back().get(),
106 request->state()->selected_instrument()); 115 request->state()->selected_instrument());
107 EXPECT_FALSE(checkmark_view->visible());
108 EXPECT_TRUE(checkmark_view2->visible());
109 } 116 }
110 117
111 } // namespace payments 118 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698