From: Junghoon Park Date: Tue, 14 Apr 2020 09:11:17 +0000 (+0900) Subject: Add factory methods to improve testability X-Git-Tag: submit/tizen/20200422.092744~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F230817%2F12;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git Add factory methods to improve testability -require : https://review.tizen.org/gerrit/#/c/platform/core/appfw/screen-connector/+/230830/ Change-Id: Ia0c3271cdc8bcf1792d57c6ead6dc3d6074c2fa5 Signed-off-by: Junghoon Park Signed-off-by: mk5004.lee Signed-off-by: Junghoon Park --- diff --git a/ambient-viewer/src/ambient-viewer.cc b/ambient-viewer/src/ambient-viewer.cc index 2b54362c..edb3f8f0 100644 --- a/ambient-viewer/src/ambient-viewer.cc +++ b/ambient-viewer/src/ambient-viewer.cc @@ -53,6 +53,19 @@ AmbientViewer::~AmbientViewer() { aul_app_com_leave(receive_signal_conn_); } +std::shared_ptr AmbientViewer::CreateWatchSurface(int rid, + std::string id, std::string appid, Evas_Object* viewer_win, + IAmbientViewer* listener, bool mock) { + return make_shared(rid, id, std::move(appid), + viewer_win, listener, mock); +} + +std::shared_ptr AmbientViewer::CreateTopAppSurface( + std::shared_ptr surface, + IAmbientViewer* listener, bool mock) { + return make_shared(std::move(surface), listener, mock); +} + string AmbientViewer::GetUUID(string rid) const { char uuid[37]; uuid_t u; @@ -75,7 +88,7 @@ void AmbientViewer::OnChangedSignal(keynode_t *node, void *user_data) { Bundle data(raw); string appid = data.GetString(NOTIFY_CHANGED_EVENT_APPID_KEY); string rid = data.GetString(NOTIFY_CHANGED_EVENT_RID_KEY); - viewer->watch_surface_ = make_shared( + viewer->watch_surface_ = viewer->CreateWatchSurface( stoi(rid), viewer->GetUUID(rid), appid, viewer->win_, viewer); viewer->OnReceived(EVENT_WATCH_CHANGED, appid, data); } catch (const std::exception& e) { @@ -85,7 +98,7 @@ void AmbientViewer::OnChangedSignal(keynode_t *node, void *user_data) { } void AmbientViewer::Monitor() { - top_app_surface_ = std::make_shared( + top_app_surface_ = CreateTopAppSurface( make_shared(win_, false), this); if (vconf_notify_key_changed( VCONFKEY_WATCH_CURRENT_WATCH_INFO, OnChangedSignal, this) != 0) { diff --git a/ambient-viewer/src/ambient-viewer.hh b/ambient-viewer/src/ambient-viewer.hh index 9713fa3e..bd643ea6 100644 --- a/ambient-viewer/src/ambient-viewer.hh +++ b/ambient-viewer/src/ambient-viewer.hh @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,14 @@ class EXPORT_API AmbientViewer : public IAmbientViewer { const ISurface& GetTopAppSurface() const; void BlockUpdate(bool enable); + protected: + virtual std::shared_ptr CreateWatchSurface(int rid, std::string id, + std::string appid, Evas_Object* viewer_win, IAmbientViewer* listener, + bool mock = false); + virtual std::shared_ptr CreateTopAppSurface( + std::shared_ptr surface, + IAmbientViewer* listener, bool mock = false); + private: std::string GetUUID(std::string rid) const; static void OnChangedSignal(keynode_t *node, void *user_data); diff --git a/ambient-viewer/src/top-app-surface.cc b/ambient-viewer/src/top-app-surface.cc index 8998372a..433166e1 100644 --- a/ambient-viewer/src/top-app-surface.cc +++ b/ambient-viewer/src/top-app-surface.cc @@ -28,9 +28,11 @@ namespace ambient_viewer { TopAppSurface::TopAppSurface( - std::shared_ptr surface, IAmbientViewer* listener) + std::shared_ptr surface, + IAmbientViewer* listener, bool mock) : screen_connector::RemoteSurfaceWatcher( - screen_connector::RemoteSurface::UI, surface, true), listener_(listener) { + screen_connector::RemoteSurface::UI, surface, true, mock), + listener_(listener) { } TopAppSurface::~TopAppSurface() = default; diff --git a/ambient-viewer/src/top-app-surface.hh b/ambient-viewer/src/top-app-surface.hh index 886497f0..8d65f797 100644 --- a/ambient-viewer/src/top-app-surface.hh +++ b/ambient-viewer/src/top-app-surface.hh @@ -39,10 +39,10 @@ class TopAppSurface : public screen_connector::RemoteSurfaceWatcher, void BlockUpdate(bool enable) override; TopAppSurface(std::shared_ptr surface, - IAmbientViewer* listener); + IAmbientViewer* listener, bool mock = false); virtual ~TopAppSurface(); - private: + protected: void OnWatcherAdded(const std::string& appId, const std::string& instId, const int pid) override; void OnWatcherChanged(const std::string& appId, const std::string& instId, diff --git a/ambient-viewer/src/watch-surface.cc b/ambient-viewer/src/watch-surface.cc index 019e39de..7de726f0 100644 --- a/ambient-viewer/src/watch-surface.cc +++ b/ambient-viewer/src/watch-surface.cc @@ -28,9 +28,9 @@ namespace ambient_viewer { WatchSurface::WatchSurface( int rid, std::string id, std::string appid, - Evas_Object* viewer_win, IAmbientViewer* listener) + Evas_Object* viewer_win, IAmbientViewer* listener, bool mock) : RemoteSurfaceEvas(rid, id, RemoteSurface::WATCH, - std::make_shared(viewer_win, false)), + std::make_shared(viewer_win, false), mock), appid_(appid), listener_(listener) { RemoteSurfaceEvas::SetAutoVisibility(false); LOGI("WatchSurface created (%s)", appid.c_str()); diff --git a/ambient-viewer/src/watch-surface.hh b/ambient-viewer/src/watch-surface.hh index 6da81553..29e25161 100644 --- a/ambient-viewer/src/watch-surface.hh +++ b/ambient-viewer/src/watch-surface.hh @@ -37,10 +37,10 @@ class WatchSurface : public screen_connector::RemoteSurfaceEvas, public ISurface float GetOpr() const override; void BlockUpdate(bool enable) override; WatchSurface(int rid, std::string id, std::string appid, - Evas_Object* viewer_win, IAmbientViewer* listener); + Evas_Object* viewer_win, IAmbientViewer* listener, bool mock = false); virtual ~WatchSurface(); - private: + protected: void OnEvasAdded(const std::string& appId, const std::string& instId, int pid, const screen_connector::EvasObject& image) override; void OnEvasRemoved(const std::string& appId, const std::string& instId, diff --git a/unittest/mock/aul_mock.h b/unittest/mock/aul_mock.h index 3ff7df82..0f5eaa6b 100644 --- a/unittest/mock/aul_mock.h +++ b/unittest/mock/aul_mock.h @@ -17,6 +17,7 @@ #ifndef MOCK_AUL_H_ #define MOCK_AUL_H_ +#include #include "mock.h" #ifdef __cplusplus @@ -26,6 +27,11 @@ extern "C" { DECLARE_FAKE_VALUE_FUNC(int, aul_app_get_appid_bypid, int, char *, int); DECLARE_FAKE_VALUE_FUNC_VARARG(int, aul_widget_write_log, const char *, const char *, ...); +DECLARE_FAKE_VALUE_FUNC(int, aul_app_com_create, const char *, + aul_app_com_permission_h, app_com_cb, void *, aul_app_com_connection_h *); +DECLARE_FAKE_VALUE_FUNC(int, aul_app_com_leave, aul_app_com_connection_h); +DECLARE_FAKE_VALUE_FUNC(int, aul_app_com_send, const char *, bundle *); + #ifdef __cplusplus } #endif diff --git a/unittest/mock/mock.cc b/unittest/mock/mock.cc index ee0b68a4..d8fad636 100644 --- a/unittest/mock/mock.cc +++ b/unittest/mock/mock.cc @@ -11,6 +11,7 @@ #include "aul_mock.h" #include "widget_service_mock.h" #include "screen_connector_mock.h" +#include "vconf_mock.h" DEFINE_FFF_GLOBALS; @@ -55,6 +56,10 @@ DEFINE_FAKE_VOID_FUNC(elm_object_signal_emit, Evas_Object *, const char *, /* aul */ DEFINE_FAKE_VALUE_FUNC(int, aul_app_get_appid_bypid, int, char *, int); DEFINE_FAKE_VALUE_FUNC_VARARG(int, aul_widget_write_log, const char *, const char *, ...); +DEFINE_FAKE_VALUE_FUNC(int, aul_app_com_create, const char *, + aul_app_com_permission_h, app_com_cb, void *, aul_app_com_connection_h *); +DEFINE_FAKE_VALUE_FUNC(int, aul_app_com_leave, aul_app_com_connection_h); +DEFINE_FAKE_VALUE_FUNC(int, aul_app_com_send, const char *, bundle *); /* widget_service */ DEFINE_FAKE_VALUE_FUNC(int, widget_service_get_widget_max_count, const char *); @@ -62,4 +67,11 @@ DEFINE_FAKE_VALUE_FUNC(int, widget_instance_create, const char *, char **); /* screen_connector */ DEFINE_FAKE_VALUE_FUNC(int, screen_connector_toolkit_evas_init, - Evas_Object *, screen_connector_screen_type_e); \ No newline at end of file + Evas_Object *, screen_connector_screen_type_e); + +/* vconf */ +DEFINE_FAKE_VALUE_FUNC(char *, vconf_get_str, const char *); +DEFINE_FAKE_VALUE_FUNC(int, vconf_notify_key_changed, const char *, + vconf_callback_fn, void *); +DEFINE_FAKE_VALUE_FUNC(int, vconf_ignore_key_changed, + const char *, vconf_callback_fn); diff --git a/unittest/mock/vconf_mock.h b/unittest/mock/vconf_mock.h new file mode 100644 index 00000000..5457653e --- /dev/null +++ b/unittest/mock/vconf_mock.h @@ -0,0 +1,37 @@ + +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MOCK_VCONF_H_ +#define MOCK_VCONF_H_ + +#include +#include "mock.h" + +#ifdef __cplusplus +extern "C" { +#endif + +DECLARE_FAKE_VALUE_FUNC(char *, vconf_get_str, const char *); +DECLARE_FAKE_VALUE_FUNC(int, vconf_notify_key_changed, const char *, + vconf_callback_fn, void *); +DECLARE_FAKE_VALUE_FUNC(int, vconf_ignore_key_changed, + const char *, vconf_callback_fn); + +#ifdef __cplusplus +} +#endif +#endif /* MOCK_VCONF_H_ */ diff --git a/unittest/src/test_ambient_viewer.cc b/unittest/src/test_ambient_viewer.cc index 1b47edce..f7afd005 100644 --- a/unittest/src/test_ambient_viewer.cc +++ b/unittest/src/test_ambient_viewer.cc @@ -19,22 +19,160 @@ #include #include -#include #include +#include + +#include "unittest/mock/vconf_mock.h" +#include "unittest/mock/aul_mock.h" +#include "ambient-viewer/include/ambient_viewer.h" +#include "ambient-viewer/include/ambient_viewer_common.h" + +#define NOTIFY_CHANGED_EVENT_APPID_KEY "__NOTIFY_CHANGED_EVENT_APPID_KEY__" +#define NOTIFY_CHANGED_EVENT_RID_KEY "__NOTIFY_CHANGED_EVENT_RID_KEY__" using namespace std; using namespace ambient_viewer; using namespace tizen_base; +static app_com_cb __app_com_callback; +static void* __app_com_user_data; + +static void __receive_fake_message() { + Bundle b; + b.Add("__APP_AMBIENT_EVENT__", "1"); + b.Add("__APP_AMBIENT_SENDER__", "test"); + __app_com_callback("", AUL_APP_COM_R_OK, b.GetHandle(), __app_com_user_data); +} + +static int __aul_app_com_create(const char *endpoint, + aul_app_com_permission_h permission, app_com_cb callback, void *user_data, + aul_app_com_connection_h *connection) { + __app_com_callback = callback; + __app_com_user_data = user_data; + return 0; +} + +static int __aul_app_com_leave(aul_app_com_connection_h connection) { + return 0; +} + +static int __aul_app_com_send(const char *endpoint, bundle *envelope) { + return 0; +} + +static char* __vconf_get_str(const char* key) { + if (!key) + return nullptr; + + if (strcmp(key, VCONFKEY_WATCH_CURRENT_WATCH_INFO) == 0) { + Bundle data; + data.Add(NOTIFY_CHANGED_EVENT_APPID_KEY, "TestAppId"); + data.Add(NOTIFY_CHANGED_EVENT_RID_KEY, "1"); + return strdup(reinterpret_cast(data.ToRaw().first.get())); + } + + return nullptr; +} + +static int __vconf_notify_key_changed(const char* key, vconf_callback_fn cb, + void* user_data) { + return 0; +} + +static int __vconf_ignore_key_changed(const char* key, vconf_callback_fn cb) { + return 0; +} + +class WatchSurfaceMock : public WatchSurface { + public: + WatchSurfaceMock(int rid, std::string id, + std::string appid, Evas_Object* viewer_win, IAmbientViewer* listener) + : WatchSurface(rid, id, std::move(appid), viewer_win, listener, true) {} + + void InvokeEvasAdded() { + screen_connector::EvasObject eo(nullptr, false); + OnEvasAdded("TestAppId", "TestInstId", 99, eo); + } + + void InvokeEvasRemoved() { + screen_connector::EvasObject eo(nullptr, false); + OnEvasRemoved("TestAppId", "TestInstId", 99, eo); + } + + void InvokeEvasChanged() { + screen_connector::EvasObject eo(nullptr, false); + OnEvasChanged("TestAppId", "TestInstId", 99, eo); + } +}; + +class TopAppSurfaceMock : public TopAppSurface { + public: + TopAppSurfaceMock(std::shared_ptr surface, + IAmbientViewer* listener) : TopAppSurface(surface, listener, true) {} + + void InvokeWatcherAdded() { + OnWatcherAdded("TestAppId", "TestInstId", 99); + } + + void InvokeWatcherChanged() { + screen_connector::EvasObject image(nullptr, false); + OnWatcherChanged("TestAppId", "TestInstId", 99, image); + } + + void InvokeWatcherRemoved() { + OnWatcherRemoved("TestAppId", "TestInstId", 99); + } + + void InvokeWatcherFocusChanged() { + OnWatcherFocusChanged("TestAppId", "TestInstId", 99); + } +}; + class AmbientViewerStub : public AmbientViewer { public: AmbientViewerStub(Evas_Object* win) : AmbientViewer(win) { } - void OnAdded(const ISurface& surface) override {} - void OnUpdated(const ISurface& surface) override {} - void OnRemoved(const ISurface& surface) override {} - void OnReceived(EventType ev, string sender, Bundle extra) override {} + void OnAdded(const ISurface& surface) override { + added_ = true; + } + void OnUpdated(const ISurface& surface) override { + updated_ = true; + } + void OnRemoved(const ISurface& surface) override { + removed_ = true; + } + void OnReceived(EventType ev, string sender, Bundle extra) override { + AmbientViewer::OnReceived(ev, sender, extra); + received_ = true; + } + + public: + bool added_ = false; + bool updated_ = false; + bool removed_ = false; + bool received_ = false; + + protected: + std::shared_ptr CreateWatchSurface(int rid, std::string id, + std::string appid, Evas_Object* viewer_win, IAmbientViewer* listener, + bool mock = false) override { + auto suf = AmbientViewer::CreateWatchSurface(rid, id, appid, + viewer_win, listener, true); + if (suf.get() == nullptr) + return nullptr; + return make_shared(rid, id, std::move(appid), + viewer_win, listener); + } + + std::shared_ptr CreateTopAppSurface( + std::shared_ptr surface, + IAmbientViewer* listener, bool mock = false) override { + auto suf = AmbientViewer::CreateTopAppSurface(surface, listener, true); + if (suf.get() == nullptr) + return nullptr; + return make_shared(surface, listener); + } }; class AmbientViewerTest : public ::testing::Test { @@ -42,12 +180,17 @@ class AmbientViewerTest : public ::testing::Test { AmbientViewerStub* stub; virtual void SetUp() { + vconf_get_str_fake.custom_fake = __vconf_get_str; + vconf_notify_key_changed_fake.custom_fake = __vconf_notify_key_changed; + vconf_ignore_key_changed_fake.custom_fake = __vconf_ignore_key_changed; + aul_app_com_create_fake.custom_fake = __aul_app_com_create; + aul_app_com_leave_fake.custom_fake = __aul_app_com_leave; + aul_app_com_send_fake.custom_fake = __aul_app_com_send; + Evas_Object* win = elm_win_add(NULL, "Widget Viewer", ELM_WIN_BASIC); stub = new AmbientViewerStub(win); - AmbientViewerTest::stub->Monitor(); } virtual void TearDown() { - AmbientViewerTest::stub->Unmonitor(); delete stub; } }; @@ -62,6 +205,222 @@ TEST_F(AmbientViewerTest, NotifyAmbientEvent) { AmbientViewer::DIRECTION_ALL, b), 0); } +TEST_F(AmbientViewerTest, NotifyAmbientEvent2) { + Bundle b; + EXPECT_EQ(AmbientViewerTest::stub->NotifyAmbientEvent(true, + AmbientViewer::DIRECTION_VIEWER_AND_WATCH, b), 0); +} + +TEST_F(AmbientViewerTest, NotifyAmbientEvent3) { + Bundle b; + EXPECT_EQ(AmbientViewerTest::stub->NotifyAmbientEvent(true, + AmbientViewer::DIRECTION_VIEWER_AND_TOP_APP, b), 0); +} + TEST_F(AmbientViewerTest, BlockUpdate) { AmbientViewerTest::stub->BlockUpdate(true); } + +TEST_F(AmbientViewerTest, MonitorUnmonitor) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + + EXPECT_NE(&ws, nullptr); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, WatchSurface_GetAppId) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + + EXPECT_EQ(ws.GetAppId(), "TestAppId"); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, WatchSurface_GetInstId) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + WatchSurfaceMock* mock = const_cast( + static_cast(&ws)); + mock->InvokeEvasAdded(); + + EXPECT_TRUE(stub->added_); + EXPECT_EQ(ws.GetInstId(), "TestInstId"); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, AmbientViewer_Events) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + WatchSurfaceMock* mock = const_cast( + static_cast(&ws)); + + mock->InvokeEvasAdded(); + EXPECT_TRUE(stub->added_); + mock->InvokeEvasChanged(); + EXPECT_TRUE(stub->updated_); + mock->InvokeEvasRemoved(); + EXPECT_TRUE(stub->removed_); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, WatchSurface_IsWatch) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + + EXPECT_TRUE(ws.IsWatch()); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, AmbientViewer_OnReceived) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + + EXPECT_TRUE(stub->received_); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, TopAppSurface_IsWatch) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetTopAppSurface(); + ASSERT_NE(&ws, nullptr); + + EXPECT_FALSE(ws.IsWatch()); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, TopAppSurface_GetAppId) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetTopAppSurface(); + ASSERT_NE(&ws, nullptr); + TopAppSurfaceMock* mock = const_cast( + static_cast(&ws)); + mock->InvokeWatcherAdded(); + + EXPECT_EQ(ws.GetAppId(), "TestAppId"); + + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, TopAppSurface_GetInstId) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetTopAppSurface(); + ASSERT_NE(&ws, nullptr); + TopAppSurfaceMock* mock = const_cast( + static_cast(&ws)); + mock->InvokeWatcherAdded(); + mock->InvokeWatcherChanged(); + mock->InvokeWatcherFocusChanged(); + + EXPECT_EQ(ws.GetInstId(), "TestInstId"); + + mock->InvokeWatcherRemoved(); + stub->Unmonitor(); +} + +TEST_F(AmbientViewerTest, AmbientViewer_OnReceived2) { + stub->Monitor(); + const auto& ws = AmbientViewerTest::stub->GetWatchSurface(); + ASSERT_NE(&ws, nullptr); + stub->received_ = false; + __receive_fake_message(); + + EXPECT_TRUE(stub->received_); + + stub->Unmonitor(); +} + +class AmbientViewerStubTest : public ::testing::Test { + public: + virtual void SetUp() {} + virtual void TearDown() {} +}; + +TEST_F(AmbientViewerStubTest, ambient_viewer_create) { + EXPECT_EQ(ambient_viewer_create(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_destroy) { + EXPECT_EQ(ambient_viewer_destroy(nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_notify_ambient_event) { + EXPECT_EQ(ambient_viewer_notify_ambient_event(nullptr, true, + AMBIENT_VIEWER_DIRECTION_ALL, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_block_update) { + EXPECT_EQ(ambient_viewer_block_update(nullptr, true), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_monitor) { + ambient_viewer_lifecycle_s lifecycle; + EXPECT_EQ(ambient_viewer_monitor(nullptr, lifecycle, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_unmonitor) { + EXPECT_EQ(ambient_viewer_unmonitor(nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_set_event_listener) { + EXPECT_EQ(ambient_viewer_set_event_listener(nullptr, nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_unset_event_listener) { + EXPECT_EQ(ambient_viewer_unset_event_listener(nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_get_watch_surface) { + EXPECT_EQ(ambient_viewer_get_watch_surface(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_get_top_app_surface) { + EXPECT_EQ(ambient_viewer_get_top_app_surface(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_surface_get_cur_image) { + EXPECT_EQ(ambient_viewer_surface_get_cur_image(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_surface_is_watch) { + EXPECT_EQ(ambient_viewer_surface_is_watch(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_surface_get_app_id) { + EXPECT_EQ(ambient_viewer_surface_get_app_id(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_surface_get_inst_id) { + EXPECT_EQ(ambient_viewer_surface_get_inst_id(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +} + +TEST_F(AmbientViewerStubTest, ambient_viewer_surface_get_opr) { + EXPECT_EQ(ambient_viewer_surface_get_opr(nullptr, nullptr), + AMBIENT_VIEWER_ERROR_INVALID_PARAMETER); +}