Index: mojo/shell/public/cpp/application_test_base.h |
diff --git a/mojo/shell/public/cpp/application_test_base.h b/mojo/shell/public/cpp/application_test_base.h |
index 91160df0fbb65944aab5f29e12d62ebcbfa57ef2..958c7795f270d67a55bc46de935f24816f4fbde0 100644 |
--- a/mojo/shell/public/cpp/application_test_base.h |
+++ b/mojo/shell/public/cpp/application_test_base.h |
@@ -34,9 +34,9 @@ class TestHelper { |
~TestHelper(); |
Connector* connector() { return shell_connection_->connector(); } |
- std::string test_name() { return name_; } |
+ const std::string& test_name() { return name_; } |
+ const std::string& test_userid() { return userid_; } |
uint32_t test_instance_id() { return instance_id_; } |
- uint32_t test_userid() { return userid_; } |
private: |
// The application delegate used if GetShellClient is not overridden. |
@@ -46,8 +46,8 @@ class TestHelper { |
scoped_ptr<ShellConnection> shell_connection_; |
std::string name_; |
+ std::string userid_; |
uint32_t instance_id_; |
- uint32_t userid_; |
DISALLOW_COPY_AND_ASSIGN(TestHelper); |
}; |
@@ -62,17 +62,16 @@ class ApplicationTestBase : public testing::Test { |
Connector* connector() { |
return test_helper_ ? test_helper_->connector() : nullptr; |
} |
- std::string test_name() const { |
- return test_helper_ ? test_helper_->test_name() : std::string(); |
+ const std::string& test_name() const { |
+ return test_helper_ ? test_helper_->test_name() : empty_; |
+ } |
+ const std::string& test_userid() const { |
+ return test_helper_ ? test_helper_->test_userid() : inherit_user_id_; |
} |
uint32_t test_instance_id() const { |
return test_helper_ ? test_helper_->test_instance_id() : |
shell::mojom::Connector::kInvalidApplicationID; |
} |
- uint32_t test_userid() const { |
- return test_helper_ ? test_helper_->test_userid() : |
- shell::mojom::Connector::kUserInherit; |
- } |
// Get the ShellClient for the application to be tested. |
virtual ShellClient* GetShellClient(); |
@@ -88,6 +87,8 @@ class ApplicationTestBase : public testing::Test { |
private: |
scoped_ptr<TestHelper> test_helper_; |
+ std::string empty_; |
+ std::string inherit_user_id_ = shell::mojom::kInheritUserID; |
DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); |
}; |