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

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

Issue 1982963002: Reland: mus: Add views_mus_interactive_ui_tests target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix size_t to int warning on Windows 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
« no previous file with comments | « ui/views/mus/views_mus_test_suite.h ('k') | ui/views/run_all_unittests.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/views_mus_test_suite.cc
diff --git a/ui/views/mus/run_all_unittests_mus.cc b/ui/views/mus/views_mus_test_suite.cc
similarity index 79%
copy from ui/views/mus/run_all_unittests_mus.cc
copy to ui/views/mus/views_mus_test_suite.cc
index 52bc71a5a836ef44e09acd25ee53ffb46adc5648..9d327311ce9b698e7a7eaa61b0fe1612b75254d9 100644
--- a/ui/views/mus/run_all_unittests_mus.cc
+++ b/ui/views/mus/views_mus_test_suite.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/views/run_all_unittests.h"
+#include "ui/views/mus/views_mus_test_suite.h"
#include <memory>
+#include "base/command_line.h"
+#include "base/files/file_path.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
@@ -22,8 +24,6 @@
namespace views {
namespace {
-const char kTestName[] = "exe:views_mus_unittests";
-
class DefaultShellClient : public shell::ShellClient {
public:
DefaultShellClient() {}
@@ -38,9 +38,6 @@ class PlatformTestHelperMus : public PlatformTestHelper {
PlatformTestHelperMus() {}
~PlatformTestHelperMus() override {}
- // PlatformTestHelper:
- bool IsMus() const override { return true; }
-
private:
DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus);
};
@@ -53,6 +50,8 @@ std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper(
return base::WrapUnique(new PlatformTestHelperMus);
}
+} // namespace
+
class ShellConnection {
public:
ShellConnection() : thread_("Persistent shell connections") {
@@ -89,7 +88,7 @@ class ShellConnection {
shell_client_.reset(new DefaultShellClient);
shell_connection_.reset(new shell::ShellConnection(
shell_client_.get(),
- background_shell_->CreateShellClientRequest(kTestName)));
+ background_shell_->CreateShellClientRequest(GetTestName())));
// ui/views/mus requires a WindowManager running, for now use the desktop
// one.
@@ -105,6 +104,15 @@ class ShellConnection {
wait->Signal();
}
+ // 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();
+ }
+
base::Thread thread_;
std::unique_ptr<shell::BackgroundShell> background_shell_;
std::unique_ptr<shell::ShellConnection> shell_connection_;
@@ -115,30 +123,20 @@ class ShellConnection {
DISALLOW_COPY_AND_ASSIGN(ShellConnection);
};
-class ViewMusTestSuite : public ViewTestSuite {
- public:
- ViewMusTestSuite(int argc, char** argv) : ViewTestSuite(argc, argv) {}
+ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv)
+ : ViewTestSuite(argc, argv) {}
- protected:
- void Initialize() override {
- ViewTestSuite::Initialize();
- shell_connections_.reset(new ShellConnection);
- }
+ViewsMusTestSuite::~ViewsMusTestSuite() {}
- void Shutdown() override {
- shell_connections_.reset();
- ViewTestSuite::Shutdown();
- }
-
- private:
- std::unique_ptr<ShellConnection> shell_connections_;
+void ViewsMusTestSuite::Initialize() {
+ PlatformTestHelper::SetIsMus();
+ ViewTestSuite::Initialize();
+ shell_connections_.reset(new ShellConnection);
+}
- DISALLOW_COPY_AND_ASSIGN(ViewMusTestSuite);
-};
+void ViewsMusTestSuite::Shutdown() {
+ shell_connections_.reset();
+ ViewTestSuite::Shutdown();
+}
-} // namespace
} // namespace views
-
-int MasterProcessMain(int argc, char** argv) {
- return views::ViewMusTestSuite(argc, argv).RunTests();
-}
« no previous file with comments | « ui/views/mus/views_mus_test_suite.h ('k') | ui/views/run_all_unittests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698