Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1786)

Unified Diff: mojo/public/cpp/application/application_test_base.h

Issue 744973002: Pass command line args to apptests (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase and address comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/application/application_test_base.h
diff --git a/mojo/public/cpp/application/application_test_base.h b/mojo/public/cpp/application/application_test_base.h
index 2f400a414ba27a128e69334182bb46d73198bc71..563a184ef1c046ed1415d27425fbe5a0989de0a0 100644
--- a/mojo/public/cpp/application/application_test_base.h
+++ b/mojo/public/cpp/application/application_test_base.h
@@ -21,10 +21,14 @@ namespace test {
ScopedMessagePipeHandle PassShellHandle();
void SetShellHandle(ScopedMessagePipeHandle handle);
+// Access the command line arguments passed to the application test.
+const Array<String>& Args();
+void InitializeArgs(int argc, std::vector<const char*> argv);
+
// A GTEST base class for application testing executed in mojo_shell.
class ApplicationTestBase : public testing::Test {
public:
- explicit ApplicationTestBase(Array<String> args);
+ ApplicationTestBase();
~ApplicationTestBase() override;
protected:
@@ -33,14 +37,15 @@ class ApplicationTestBase : public testing::Test {
// Get the ApplicationDelegate for the application to be tested.
virtual ApplicationDelegate* GetApplicationDelegate() = 0;
+ // A testing::Test::SetUp helper to override the application command
+ // line arguments.
+ void SetUpWithArgs(const Array<String>& args);
+
// testing::Test:
void SetUp() override;
void TearDown() override;
private:
- // The command line arguments supplied to each test application instance.
- Array<String> args_;
-
// The application implementation instance, reconstructed for each test.
ApplicationImpl* application_impl_;

Powered by Google App Engine
This is Rietveld 408576698