blob: 9d3791a2fdf3d174518fc64c0bd8c47cad710f12 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <fuchsia/modular/testing/cpp/fidl.h>
#include "src/lib/fsl/vmo/strings.h"
#include "src/modular/lib/modular_test_harness/cpp/fake_module.h"
#include "src/modular/lib/modular_test_harness/cpp/test_harness_fixture.h"
namespace {
constexpr char kModuleName[] = "mod_name";
constexpr char kStoryName[] = "story";
constexpr char kIntentAction[] = "action";
class StoryModuleTest : public modular_testing::TestHarnessFixture {
public:
StoryModuleTest() {
test_module_ = std::make_unique<modular_testing::FakeModule>(
modular_testing::FakeComponent::Args{
.url = modular_testing::TestHarnessBuilder::GenerateFakeUrl(),
.sandbox_services = {"fuchsia.modular.ModuleContext"}});
builder_.InterceptComponent(test_module_->BuildInterceptOptions());
builder_.BuildAndRun(test_harness());
}
std::unique_ptr<modular_testing::FakeModule> test_module_;
modular_testing::TestHarnessBuilder builder_;
std::string test_entity_provider_agent_url_;
};
// TODO: maybe remove
TEST_F(StoryModuleTest, ModuleWritesToOutput) {
fuchsia::modular::Intent intent;
intent.handler = test_module_->url();
intent.action = kIntentAction;
modular_testing::AddModToStory(test_harness(), kStoryName, kModuleName, std::move(intent));
RunLoopUntil([&] { return test_module_->is_running(); });
}
} // namespace