[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_context_inspector_server_stop_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
7 class utc_blink_ewk_context_inspector_server_stop : public utc_blink_ewk_base
8 {
9 protected:
10  void LoadFinished(Evas_Object* webview) override { EventLoopStop(Success); }
11 };
12
13 /* @brief Try stop inspector with NULL as context */
14 TEST_F(utc_blink_ewk_context_inspector_server_stop, NullArg)
15 {
16   ASSERT_NE(EINA_TRUE, ewk_context_inspector_server_stop(NULL));
17 }
18
19 /* @brief Try stop inspector without start */
20 TEST_F(utc_blink_ewk_context_inspector_server_stop, WithOutStart)
21 {
22   ASSERT_NE(EINA_TRUE, ewk_context_inspector_server_stop(ewk_context_default_get()));
23 }
24
25 /* @brief Try start inspector after stop */
26 TEST_F(utc_blink_ewk_context_inspector_server_stop, StartStop)
27 {
28   ASSERT_EQ(11111, ewk_context_inspector_server_start(ewk_context_default_get(), 11111));
29   EventLoopWait(1);
30
31   ASSERT_EQ(EINA_TRUE, ewk_context_inspector_server_stop(ewk_context_default_get()));
32   EventLoopWait(1);
33
34   ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
35   EXPECT_NE(Success, EventLoopStart());
36
37   ASSERT_EQ(11111, ewk_context_inspector_server_start(ewk_context_default_get(), 11111));
38   EventLoopWait(1);
39
40   ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
41   EXPECT_EQ(Success, EventLoopStart());
42
43   // must stop inspector because default context will be shared between tests
44   ASSERT_EQ(EINA_TRUE, ewk_context_inspector_server_stop(ewk_context_default_get()));
45   EventLoopWait(1);
46 }