26dc4aedf00cbf19cf8ec0dabfd5d225d8b192e1
[platform/framework/web/crosswalk-tizen.git] /
1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UTC_BLINK_EWK_CONTEXT_FORM_AUTOFILL_PROFILE_UTILS_H
6 #define UTC_BLINK_EWK_CONTEXT_FORM_AUTOFILL_PROFILE_UTILS_H
7
8 #include "utc_blink_ewk_base.h"
9
10 const unsigned     TEST_AUTOFILL_PROFILE_ID                    =   12345;
11 const char* const  TEST_AUTOFILL_PROFILE_NAME                  =   "Mr. Smith";
12 const char* const  TEST_AUTOFILL_PROFILE_COMPANY               =   "Samsung";
13 const char* const  TEST_AUTOFILL_PROFILE_ADDRESS1              =   "Existing Street 15";
14 const char* const  TEST_AUTOFILL_PROFILE_ADDRESS2              =   "NonExisting Street -15";
15 const char* const  TEST_AUTOFILL_PROFILE_CITY_TOWN             =   "Capitol";
16 const char* const  TEST_AUTOFILL_PROFILE_STATE_PROVINCE_REGION =   "Beautiful Province";
17 const char* const  TEST_AUTOFILL_PROFILE_ZIPCODE               =   "12-345";
18 const char* const  TEST_AUTOFILL_PROFILE_COUNTRY               =   "Neverland";
19 const char* const  TEST_AUTOFILL_PROFILE_PHONE                 =   "123456789";
20 const char* const  TEST_AUTOFILL_PROFILE_EMAIL                 =   "someEmail@someServer.com";
21
22 Ewk_Autofill_Profile* getTestEwkAutofillProfile();
23
24 bool checkOne(Ewk_Autofill_Profile* profileToCheck, const char* reference,
25               Ewk_Autofill_Profile_Data_Type kind, const char* errMessage);
26 bool checkIfProfileContainsTestData(Ewk_Autofill_Profile* profileToCheck);
27
28 class utc_blink_ewk_context_form_autofill_profile_base
29     : public utc_blink_ewk_base {
30  protected:
31   void PostSetUp() override {
32     EventLoopWait(3.0);
33     RemoveTestProfile();
34   }
35
36   void PreTearDown() override {
37     RemoveTestProfile();
38   }
39
40  private:
41   void RemoveTestProfile() {
42     Ewk_Autofill_Profile* profile =
43         ewk_context_form_autofill_profile_get(ewk_context_default_get(),
44                                               TEST_AUTOFILL_PROFILE_ID);
45     if (profile) {
46       ewk_context_form_autofill_profile_remove(ewk_context_default_get(),
47                                                TEST_AUTOFILL_PROFILE_ID);
48       ewk_autofill_profile_delete(profile);
49       EventLoopWait(3.0);
50       profile =
51           ewk_context_form_autofill_profile_get(ewk_context_default_get(),
52                                                 TEST_AUTOFILL_PROFILE_ID);
53       ASSERT_TRUE(profile == nullptr);
54     }
55   }
56 };
57
58 #endif //UTC_BLINK_EWK_CONTEXT_FORM_AUTOFILL_PROFILE_UTILS_H