blob: bb3f2dabf1c03260dbb3b88842f8998ca59e30e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright (c) 2013 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.
#include "components/autofill/browser/autocheckout_page_meta_data.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
void SetPageDetails(autofill::AutocheckoutPageMetaData* meta_data,
int current_page,
int total) {
meta_data->current_page_number = current_page;
meta_data->total_pages = total;
}
} // namespace
namespace autofill {
TEST(AutocheckoutPageMetaDataTest, AutofillableFlow) {
AutocheckoutPageMetaData page_meta_data;
EXPECT_FALSE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsInAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsEndOfAutofillableFlow());
SetPageDetails(&page_meta_data, -1, 0);
EXPECT_FALSE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsInAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsEndOfAutofillableFlow());
SetPageDetails(&page_meta_data, 0, 0);
EXPECT_FALSE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsInAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsEndOfAutofillableFlow());
SetPageDetails(&page_meta_data, 0, 1);
EXPECT_TRUE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_TRUE(page_meta_data.IsInAutofillableFlow());
EXPECT_TRUE(page_meta_data.IsEndOfAutofillableFlow());
SetPageDetails(&page_meta_data, 1, 2);
EXPECT_FALSE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_TRUE(page_meta_data.IsInAutofillableFlow());
EXPECT_TRUE(page_meta_data.IsEndOfAutofillableFlow());
SetPageDetails(&page_meta_data, 2, 2);
EXPECT_FALSE(page_meta_data.IsStartOfAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsInAutofillableFlow());
EXPECT_FALSE(page_meta_data.IsEndOfAutofillableFlow());
}
} // namespace autofill
|