[modular][tests] Remove old intents test
This has been replaced with a TestHarness version of the test in
//src/modular//tests
MF-405 #comment Remove old test
Change-Id: Iad619bf1bd0e887c2701bbc5dbaf404a4b7e38fc
diff --git a/peridot/packages/tests/BUILD.gn b/peridot/packages/tests/BUILD.gn
index 91df2f0..22ab368 100644
--- a/peridot/packages/tests/BUILD.gn
+++ b/peridot/packages/tests/BUILD.gn
@@ -89,8 +89,6 @@
"//peridot/tests/embed_shell:embed_shell_test_parent_module",
"//peridot/tests/embed_shell:embed_shell_test_session_shell",
"//peridot/tests/embed_shell:embed_shell_test_story_shell",
- "//peridot/tests/intents:intent_test_child_module",
- "//peridot/tests/intents:intent_test_parent_module",
"//peridot/tests/modular_config:test_config",
"//peridot/tests/modular_login_tests:modular_login_tests",
"//peridot/tests/module_context:module_context_test_entity_module",
diff --git a/peridot/tests/BUILD.gn b/peridot/tests/BUILD.gn
index 9a67ac1..bb03093 100644
--- a/peridot/tests/BUILD.gn
+++ b/peridot/tests/BUILD.gn
@@ -59,7 +59,6 @@
"common",
"component_context",
"embed_shell",
- "intents",
"maxwell_integration",
"modular_config",
"modular_login_tests",
diff --git a/peridot/tests/intents/BUILD.gn b/peridot/tests/intents/BUILD.gn
deleted file mode 100644
index f09c85c..0000000
--- a/peridot/tests/intents/BUILD.gn
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2018 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.
-
-import("//peridot/build/executable_package.gni")
-
-group("intents") {
- testonly = true
- deps = [
- ":defs",
- ":intent_test_child_module",
- ":intent_test_parent_module",
- ]
-}
-
-source_set("defs") {
- testonly = true
-
- sources = [
- "defs.h",
- ]
-}
-
-executable_package("intent_test_parent_module") {
- testonly = true
-
- meta = [
- {
- path = "meta/intent_test_parent_module.cmx"
- dest = "intent_test_parent_module.cmx"
- },
- ]
-
- sources = [
- "intent_test_parent_module.cc",
- ]
-
- deps = [
- ":defs",
- "//peridot/public/lib/app_driver/cpp:module_driver",
- "//peridot/public/lib/integration_testing/cpp",
- "//peridot/tests/common:defs",
- "//sdk/fidl/fuchsia.modular",
- "//zircon/public/lib/async-loop-cpp",
- ]
-}
-
-executable_package("intent_test_child_module") {
- testonly = true
-
- meta = [
- {
- path = "meta/intent_test_child_module.cmx"
- dest = "intent_test_child_module.cmx"
- },
- ]
-
- sources = [
- "intent_test_child_module.cc",
- ]
-
- deps = [
- ":defs",
- "//garnet/public/lib/callback",
- "//peridot/public/lib/app_driver/cpp:module_driver",
- "//peridot/public/lib/integration_testing/cpp",
- "//peridot/tests/common:defs",
- "//sdk/fidl/fuchsia.modular",
- "//zircon/public/lib/async-loop-cpp",
- ]
-}
diff --git a/peridot/tests/intents/README.md b/peridot/tests/intents/README.md
deleted file mode 100644
index 14957a3..0000000
--- a/peridot/tests/intents/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Intents integration test
-
-This test exercises the IntentHandler API. It verifies that modules
-receive intents both when they are started as well as when they are
-running and new intents are received by the framework.
diff --git a/peridot/tests/intents/defs.h b/peridot/tests/intents/defs.h
deleted file mode 100644
index 97b9407..0000000
--- a/peridot/tests/intents/defs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2018 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.
-
-#ifndef PERIDOT_TESTS_INTENTS_DEFS_H_
-#define PERIDOT_TESTS_INTENTS_DEFS_H_
-
-namespace {
-
-constexpr char kChildModuleName[] = "child";
-
-// Package URLs of the test components used here.
-constexpr char kChildModuleUrl[] =
- "fuchsia-pkg://fuchsia.com/intent_test_child_module#meta/"
- "intent_test_child_module.cmx";
-
-// The action of the intent the parent module issues to the child module.
-constexpr char kChildModuleAction[] = "intent_test_child_module_action";
-
-// The signal which the child module sends when it has received an intent.
-constexpr char kChildModuleHandledIntent[] = "child_module_handled_intent";
-
-// The name of the intent parameter which contains a string which the child
-// module is to append to its signal.
-constexpr char kIntentParameterName[] = "intent_parameter";
-
-// The name of the intent parameter which contains a string which the child
-// module is to append to its signal.
-constexpr char kIntentParameterNameAlternate[] = "intent_parameter_alternate";
-
-constexpr int kTimeoutMilliseconds = 5000;
-
-} // namespace
-
-#endif // PERIDOT_TESTS_INTENTS_DEFS_H_
diff --git a/peridot/tests/intents/intent_test_child_module.cc b/peridot/tests/intents/intent_test_child_module.cc
deleted file mode 100644
index f3ced18..0000000
--- a/peridot/tests/intents/intent_test_child_module.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2018 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/cpp/fidl.h>
-#include <lib/app_driver/cpp/module_driver.h>
-#include <lib/async-loop/cpp/loop.h>
-#include <lib/fsl/vmo/strings.h>
-
-#include "peridot/public/lib/integration_testing/cpp/reporting.h"
-#include "peridot/public/lib/integration_testing/cpp/testing.h"
-#include "peridot/tests/common/defs.h"
-#include "peridot/tests/intents/defs.h"
-
-using modular::testing::Signal;
-using modular::testing::TestPoint;
-
-namespace {
-
-// Cf. README.md for what this test does and how.
-class TestModule : fuchsia::modular::IntentHandler {
- public:
- TestModule(modular::ModuleHost* module_host,
- fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider>
- view_provider_request)
- : app_view_provider_(std::move(view_provider_request)) {
- modular::testing::Init(module_host->startup_context(), __FILE__);
- module_host->startup_context()
- ->outgoing()
- .AddPublicService<fuchsia::modular::IntentHandler>(
- [this](fidl::InterfaceRequest<fuchsia::modular::IntentHandler>
- request) {
- bindings_.AddBinding(this, std::move(request));
- });
- }
-
- // Called from ModuleDriver.
- void Terminate(fit::function<void()> done) {
- modular::testing::Done(std::move(done));
- }
-
- private:
- // |IntentHandler|
- void HandleIntent(fuchsia::modular::Intent intent) override {
- for (const auto& parameter : *intent.parameters) {
- if (parameter.data.is_json()) {
- if (parameter.name == kIntentParameterName ||
- parameter.name == kIntentParameterNameAlternate) {
- std::string parameter_data;
- FXL_CHECK(fsl::StringFromVmo(parameter.data.json(), ¶meter_data));
- Signal(kChildModuleHandledIntent + parameter_data);
- }
- }
- }
- }
-
- fidl::BindingSet<fuchsia::modular::IntentHandler> bindings_;
- // We keep the view provider around so that story shell can hold a view for
- // us, but don't do anything with it.
- fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider> app_view_provider_;
-
- FXL_DISALLOW_COPY_AND_ASSIGN(TestModule);
-};
-
-} // namespace
-
-int main(int /*argc*/, const char** /*argv*/) {
- async::Loop loop(&kAsyncLoopConfigAttachToThread);
- auto context = component::StartupContext::CreateFromStartupInfo();
- modular::ModuleDriver<TestModule> driver(context.get(),
- [&loop] { loop.Quit(); });
- loop.Run();
- return 0;
-}
diff --git a/peridot/tests/intents/intent_test_parent_module.cc b/peridot/tests/intents/intent_test_parent_module.cc
deleted file mode 100644
index 8489562..0000000
--- a/peridot/tests/intents/intent_test_parent_module.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2018 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/cpp/fidl.h>
-#include <lib/app_driver/cpp/module_driver.h>
-#include <lib/async-loop/cpp/loop.h>
-#include <lib/fsl/vmo/strings.h>
-
-#include "peridot/public/lib/integration_testing/cpp/reporting.h"
-#include "peridot/public/lib/integration_testing/cpp/testing.h"
-#include "peridot/tests/common/defs.h"
-#include "peridot/tests/intents/defs.h"
-
-using modular::testing::Await;
-using modular::testing::Signal;
-using modular::testing::TestPoint;
-
-namespace {
-
-void StartModuleWithJsonParameter(
- fuchsia::modular::ModuleContext* const module_context,
- std::string module_name, std::string parameter_name,
- std::string parameter_content,
- fidl::InterfaceRequest<fuchsia::modular::ModuleController> request) {
- fuchsia::modular::Intent intent;
- intent.handler = kChildModuleUrl;
- intent.action = kChildModuleAction;
-
- {
- fuchsia::modular::IntentParameter intent_parameter;
- intent_parameter.name = parameter_name;
- intent_parameter.data = fuchsia::modular::IntentParameterData();
- fsl::SizedVmo vmo;
- FXL_CHECK(fsl::VmoFromString(parameter_content, &vmo));
- intent_parameter.data.set_json(std::move(vmo).ToTransport());
- intent.parameters.push_back(std::move(intent_parameter));
- }
-
- // This tests a null parameter name; it should be excluded from module
- // resolution altogether.
- {
- fuchsia::modular::IntentParameter intent_parameter;
- intent_parameter.name = nullptr;
- intent_parameter.data = fuchsia::modular::IntentParameterData();
- fsl::SizedVmo vmo;
- FXL_CHECK(fsl::VmoFromString(R"("")", &vmo));
- intent_parameter.data.set_json(std::move(vmo).ToTransport());
- intent.parameters.push_back(std::move(intent_parameter));
- }
-
- module_context->AddModuleToStory(
- module_name, std::move(intent), std::move(request), nullptr,
- [](const fuchsia::modular::StartModuleStatus) {});
-}
-
-// Cf. README.md for what this test does and how.
-class TestModule {
- public:
- TestPoint initialized_{"Parent module initialized"};
- TestModule(modular::ModuleHost* module_host,
- fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider>
- view_provider_request)
- : module_host_(module_host),
- app_view_provider_(std::move(view_provider_request)) {
- modular::testing::Init(module_host->startup_context(), __FILE__);
- initialized_.Pass();
- TestStartWithModuleControllerRequest();
- }
-
- // Tests that a module which is started with an intent and exposes an intent
- // handler gets notified of the intent by the framework.
- TestPoint intent_was_handled_{"First intent was handled"};
- void TestStartWithModuleControllerRequest() {
- std::string json = "\"first\"";
- StartModuleWithJsonParameter(module_host_->module_context(),
- kChildModuleName, kIntentParameterName, json,
- child_module_.NewRequest());
- Await(kChildModuleHandledIntent + json, [this] {
- intent_was_handled_.Pass();
- TestStartSecondIntentSameParameter();
- });
- }
-
- // Tests that a second intent sent to an already running module with the same
- // parameters but different data notifies the intent handler of the new
- // intent.
- TestPoint second_intent_was_handled_{"Second intent was handled"};
- void TestStartSecondIntentSameParameter() {
- std::string json = "\"second\"";
- StartModuleWithJsonParameter(module_host_->module_context(),
- kChildModuleName, kIntentParameterName, json,
- child_module_second_.NewRequest());
- Await(kChildModuleHandledIntent + json, [this] {
- second_intent_was_handled_.Pass();
- TestStartThirdIntentDifferentParameter();
- });
- }
-
- // Tests that a third intent with different parameters is delivered to the
- // already running intent handler.
- TestPoint third_intent_was_handled_{"Third intent was handled"};
- void TestStartThirdIntentDifferentParameter() {
- std::string json = "\"third\"";
- StartModuleWithJsonParameter(
- module_host_->module_context(), kChildModuleName,
- kIntentParameterNameAlternate, json, child_module_second_.NewRequest());
- Await(kChildModuleHandledIntent + json, [this] {
- third_intent_was_handled_.Pass();
- Signal(modular::testing::kTestShutdown);
- });
- }
-
- // Called by ModuleDriver.
- TestPoint stopped_{"Parent module stopped"};
- void Terminate(fit::function<void()> done) {
- stopped_.Pass();
- modular::testing::Done(std::move(done));
- }
-
- private:
- modular::ModuleHost* module_host_;
- fuchsia::modular::ModuleControllerPtr child_module_;
- fuchsia::modular::ModuleControllerPtr child_module_second_;
-
- // We keep the view provider around so that story shell can hold a view for
- // us, but don't do anything with it.
- fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider> app_view_provider_;
-
- FXL_DISALLOW_COPY_AND_ASSIGN(TestModule);
-};
-
-} // namespace
-
-int main(int /*argc*/, const char** /*argv*/) {
- async::Loop loop(&kAsyncLoopConfigAttachToThread);
- auto context = component::StartupContext::CreateFromStartupInfo();
- modular::ModuleDriver<TestModule> driver(context.get(),
- [&loop] { loop.Quit(); });
- loop.Run();
- return 0;
-}
diff --git a/peridot/tests/intents/meta/intent_test_child_module.cmx b/peridot/tests/intents/meta/intent_test_child_module.cmx
deleted file mode 100644
index 04308d6..0000000
--- a/peridot/tests/intents/meta/intent_test_child_module.cmx
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "program": {
- "binary": "bin/intent_test_child_module"
- },
- "sandbox": {
- "services": [
- "fuchsia.cobalt.LoggerFactory",
- "fuchsia.modular.BasemgrMonitor",
- "fuchsia.modular.ModuleContext",
- "fuchsia.modular.PuppetMaster",
- "fuchsia.modular.SessionShellContext",
- "fuchsia.sys.Environment",
- "fuchsia.sys.Launcher",
- "fuchsia.sys.Loader",
- "fuchsia.testing.runner.TestRunner",
- "fuchsia.testing.runner.TestRunnerStore",
- "fuchsia.tracelink.Registry",
- "fuchsia.ui.policy.Presenter",
- "fuchsia.ui.scenic.Scenic"
- ]
- }
-}
diff --git a/peridot/tests/intents/meta/intent_test_parent_module.cmx b/peridot/tests/intents/meta/intent_test_parent_module.cmx
deleted file mode 100644
index 172d8d3..0000000
--- a/peridot/tests/intents/meta/intent_test_parent_module.cmx
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "program": {
- "binary": "bin/intent_test_parent_module"
- },
- "sandbox": {
- "services": [
- "fuchsia.cobalt.LoggerFactory",
- "fuchsia.modular.BasemgrMonitor",
- "fuchsia.modular.ModuleContext",
- "fuchsia.modular.PuppetMaster",
- "fuchsia.modular.SessionShellContext",
- "fuchsia.sys.Environment",
- "fuchsia.sys.Launcher",
- "fuchsia.sys.Loader",
- "fuchsia.testing.runner.TestRunner",
- "fuchsia.testing.runner.TestRunnerStore",
- "fuchsia.tracelink.Registry",
- "fuchsia.ui.policy.Presenter",
- "fuchsia.ui.scenic.Scenic"
- ]
- }
-}
diff --git a/peridot/tests/modular_tests.json b/peridot/tests/modular_tests.json
index 55bb023..a64c348 100644
--- a/peridot/tests/modular_tests.json
+++ b/peridot/tests/modular_tests.json
@@ -125,18 +125,6 @@
"--story_shell=fuchsia-pkg://fuchsia.com/dev_story_shell#meta/dev_story_shell.cmx",
"--sessionmgr_args=--use_memfs_for_ledger,--no_cloud_provider_for_ledger"
]
- },
- {
- "name": "intents",
- "exec": [
- "fuchsia-pkg://fuchsia.com/basemgr#meta/basemgr.cmx",
- "--test",
- "--base_shell=fuchsia-pkg://fuchsia.com/dev_base_shell#meta/dev_base_shell.cmx",
- "--session_shell=fuchsia-pkg://fuchsia.com/dev_session_shell#meta/dev_session_shell.cmx",
- "--story_shell=fuchsia-pkg://fuchsia.com/dev_story_shell#meta/dev_story_shell.cmx",
- "--session_shell_args=--root_module=fuchsia-pkg://fuchsia.com/intent_test_parent_module#meta/intent_test_parent_module.cmx",
- "--sessionmgr_args=--use_memfs_for_ledger,--no_cloud_provider_for_ledger"
- ]
}
]
}
\ No newline at end of file