From a46169b50939085c733d30580437ea5073476767 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 9 Aug 2002 23:29:24 +0000 Subject: [PATCH] Added methods that return the entry_ref to the application and the port of its app looper. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@674 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/app/common/AppRunner.cpp | 30 +++++++++++++++++++++++++ src/tests/kits/app/common/AppRunner.h | 4 ++++ 2 files changed, 34 insertions(+) diff --git a/src/tests/kits/app/common/AppRunner.cpp b/src/tests/kits/app/common/AppRunner.cpp index bb28f49bab..ffcf053a47 100644 --- a/src/tests/kits/app/common/AppRunner.cpp +++ b/src/tests/kits/app/common/AppRunner.cpp @@ -23,6 +23,7 @@ AppRunner::AppRunner(bool requestQuitOnDestruction) fOutput(), fReader(-1), fTeam(-1), + fRef(), fMessenger(), fRequestQuitOnDestruction(requestQuitOnDestruction) { @@ -50,6 +51,7 @@ AppRunner::Run(const char *command, const char *args, bool findCommand) find_test_app(command, &appPath); command = appPath.String(); } + get_ref_for_path(command, &fRef); // add args, i.e. compose the command line BString cmdLine(command); if (args) { @@ -128,6 +130,34 @@ AppRunner::Team() return fTeam; } +// AppLooperPort +port_id +AppRunner::AppLooperPort() +{ + struct messenger_hack { + port_id fPort; + int32 fHandlerToken; + team_id fTeam; + int32 extra0; + int32 extra1; + bool fPreferredTarget; + bool extra2; + bool extra3; + bool extra4; + }; + return ((messenger_hack*)&fMessenger)->fPort; +} + +// GetRef +status_t +AppRunner::GetRef(entry_ref *ref) +{ + status_t error = (ref ? B_OK : B_ERROR); + if (error == B_OK) + *ref = fRef; + return error; +} + // RequestQuit status_t AppRunner::RequestQuit() diff --git a/src/tests/kits/app/common/AppRunner.h b/src/tests/kits/app/common/AppRunner.h index fafc5a0982..43d8d1aa9b 100644 --- a/src/tests/kits/app/common/AppRunner.h +++ b/src/tests/kits/app/common/AppRunner.h @@ -6,6 +6,7 @@ #include #include +#include #include class AppRunner { @@ -18,6 +19,8 @@ public: bool HasQuitted(); void WaitFor(bool requestQuit = false); team_id Team(); + port_id AppLooperPort(); + status_t GetRef(entry_ref *ref); status_t RequestQuit(); status_t GetOutput(BString *buffer); @@ -38,6 +41,7 @@ private: BMallocIO fOutput; thread_id fReader; team_id fTeam; + entry_ref fRef; BMessenger fMessenger; bool fRequestQuitOnDestruction;