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

Unified Diff: ui/views/mus/platform_test_helper_mus.cc

Issue 1972363002: mus: Add views_mus_interactive_ui_tests target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: similarity Created 4 years, 7 months 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: ui/views/mus/platform_test_helper_mus.cc
diff --git a/ui/views/mus/platform_test_helper_mus.cc b/ui/views/mus/platform_test_helper_mus.cc
index bffdbc6a6eff1b122d06b100f8102a6123e1ab92..df87e10ef87e61cee54912c423e6fe33905e064f 100644
--- a/ui/views/mus/platform_test_helper_mus.cc
+++ b/ui/views/mus/platform_test_helper_mus.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "services/shell/background/background_shell.h"
@@ -20,8 +21,6 @@ using shell::BackgroundShell;
namespace views {
namespace {
-const char kTestName[] = "exe:views_mus_unittests";
-
class DefaultShellClient : public shell::ShellClient {
public:
DefaultShellClient() {}
@@ -39,7 +38,7 @@ class PlatformTestHelperMus : public PlatformTestHelper {
shell_client_.reset(new DefaultShellClient);
shell_connection_.reset(new shell::ShellConnection(
shell_client_.get(),
- background_shell_->CreateShellClientRequest(kTestName)));
+ background_shell_->CreateShellClientRequest(GetTestName())));
// TODO(rockot): Remove this RunLoop. http://crbug.com/594852.
base::RunLoop wait_loop;
@@ -66,8 +65,6 @@ class PlatformTestHelperMus : public PlatformTestHelper {
shell_connection_.reset();
}
- bool IsMus() const override { return true; }
-
private:
NativeWidget* CreateNativeWidgetMus(
const std::map<std::string, std::vector<uint8_t>>& props,
@@ -82,6 +79,15 @@ class PlatformTestHelperMus : public PlatformTestHelper {
return result;
}
+ // Returns the name of the test executable, e.g. "exe:views_mus_unittests".
+ std::string GetTestName() {
+ base::FilePath executable = base::CommandLine::ForCurrentProcess()
+ ->GetProgram()
+ .BaseName()
+ .RemoveExtension();
+ return std::string("exe:") + executable.MaybeAsASCII();
+ }
+
std::unique_ptr<BackgroundShell> background_shell_;
std::unique_ptr<shell::ShellConnection> shell_connection_;
std::unique_ptr<DefaultShellClient> shell_client_;
@@ -96,4 +102,9 @@ std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() {
return base::WrapUnique(new PlatformTestHelperMus);
}
+// static
+bool PlatformTestHelper::IsMus() {
+ return true;
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698