[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_context_form_autofill_profile_get_all_func.cpp
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 #include "utc_blink_ewk_base.h"
6 #include "utc_blink_ewk_context_form_autofill_profile_utils.h"
7
8 #include <map>
9 #include <sstream>
10
11 class utc_blink_ewk_context_form_autofill_profile_get_all
12     : public utc_blink_ewk_context_form_autofill_profile_base {
13 };
14
15 TEST_F(utc_blink_ewk_context_form_autofill_profile_get_all, POS_TEST)
16 {
17   Ewk_Autofill_Profile* profile = getTestEwkAutofillProfile();
18   ASSERT_TRUE(NULL != profile);
19   Eina_Bool result = ewk_context_form_autofill_profile_add(
20       ewk_context_default_get(), profile);
21   ewk_autofill_profile_delete(profile);
22   EventLoopWait(3.0);
23   ASSERT_TRUE(EINA_FALSE != result);
24   Eina_List* profilesList = ewk_context_form_autofill_profile_get_all(
25       ewk_context_default_get());
26   ASSERT_TRUE (NULL != profilesList);
27   Eina_List* l;
28   void* data;
29   profile = NULL;
30   EINA_LIST_FOREACH(profilesList, l, data)
31   {
32     Ewk_Autofill_Profile* tmp_profile = static_cast<Ewk_Autofill_Profile*>(data);
33     if (NULL != tmp_profile) {
34       if (TEST_AUTOFILL_PROFILE_ID == ewk_autofill_profile_id_get(tmp_profile)) {
35         utc_message("found proper profile ID");
36         profile = tmp_profile;
37       } else {
38         ewk_autofill_profile_delete(tmp_profile);
39       }
40     }
41   }
42   ASSERT_TRUE(profile);
43   EXPECT_TRUE(checkIfProfileContainsTestData(profile));
44   ewk_autofill_profile_delete(profile);
45 }
46
47
48 TEST_F(utc_blink_ewk_context_form_autofill_profile_get_all, NEG_TEST)
49 {
50   ASSERT_EQ(NULL, ewk_context_form_autofill_profile_get_all(NULL));
51 }