2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <gmock/gmock.h>
18 #include <widget_app.hpp>
22 class WidgetApp : public tizen_appfw::WidgetAppBase {
24 class Instance : public InstanceBase {
26 class Factory : public InstanceBase::Factory {
28 std::unique_ptr<InstanceBase> Create(widget_context_h h) override {
29 return std::unique_ptr<InstanceBase>(new Instance(h));
33 Instance(widget_context_h h) : InstanceBase(h) {}
34 void OnCreate(const tizen_base::Bundle& content, int w, int h) override {}
35 void OnDestroy(DestroyType reason, tizen_base::Bundle* content) override {}
36 void OnPause() override {}
37 void OnResume() override {}
38 void OnResize(int w, int h) override {}
39 void OnUpdate(const tizen_base::Bundle& content, bool force) override {}
43 void OnCreate() override {}
44 void OnTerminate() override {}
49 TEST(WidgetAppCppTest, Run_InvalidParameter) {
51 std::unique_ptr<tizen_appfw::WidgetAppBase::InstanceBase::Factory> factory(
52 new WidgetApp::Instance::Factory());
54 int ret = app.Run(0, nullptr, std::move(factory));
55 EXPECT_EQ(ret, APP_ERROR_INVALID_PARAMETER);