1 // Copyright 2014-2016 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.
5 #include "utc_blink_ewk_base.h"
7 class utc_blink_ewk_view_suspend : public utc_blink_ewk_base
10 utc_blink_ewk_view_suspend()
11 : after_progress(false), result_url_set(EINA_FALSE) {}
13 void LoadProgress(Evas_Object* webview, double progress) override {
14 if (!after_progress) {
15 // Page started to load, after that we want to suspend it
16 after_progress = true;
17 EventLoopStop(utc_blink_ewk_base::Success);
21 bool TimeOut() override {
22 // If we reached timeout then load,finished (and load,error) was not called
23 // we expect that - this indicates that suspend did work
24 EventLoopStop(utc_blink_ewk_base::Success);
28 void LoadFinished(Evas_Object* webview) override {
29 // Load finished should never be called after suspend
30 EventLoopStop(utc_blink_ewk_base::Failure);
33 static void job_url_set(utc_blink_ewk_base* data) {
34 utc_blink_ewk_view_suspend* owner =
35 static_cast<utc_blink_ewk_view_suspend*>(data);
36 owner->result_url_set =
37 ewk_view_url_set(owner->GetEwkWebView(), "http://www.google.pl");
41 Eina_Bool result_url_set;
45 * @brief Positive test case of ewk_view_suspend()
47 TEST_F(utc_blink_ewk_view_suspend, POS_TEST)
49 SetTestJob(utc_blink_ewk_view_suspend::job_url_set);
51 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
52 if (main_result != utc_blink_ewk_base::Success)
55 ASSERT_EQ(EINA_TRUE, result_url_set);
57 ewk_view_suspend(GetEwkWebView());
59 main_result = EventLoopStart(5.0);
60 if (main_result != utc_blink_ewk_base::Success)
63 evas_object_show(GetEwkWebView());
64 evas_object_show(GetEwkWindow());
68 * @brief Negative test case of ewk_view_suspend()
70 TEST_F(utc_blink_ewk_view_suspend, NEG_TEST)
72 ewk_view_suspend(NULL);
73 evas_object_show(GetEwkWebView());
74 evas_object_show(GetEwkWindow());