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

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

Issue 1979323002: mus: Show USER_PRIVATE window container during views tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@widgetinteractive
Patch Set: 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 df87e10ef87e61cee54912c423e6fe33905e064f..01ddeca45efaa844ccf3e5e1fc530f39092caa4e 100644
--- a/ui/views/mus/platform_test_helper_mus.cc
+++ b/ui/views/mus/platform_test_helper_mus.cc
@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
+#include "components/mus/common/switches.h"
#include "services/shell/background/background_shell.h"
#include "services/shell/background/tests/test_catalog_store.h"
#include "services/shell/public/cpp/connector.h"
@@ -21,6 +22,12 @@ using shell::BackgroundShell;
namespace views {
namespace {
+void EnsureCommandLineSwitch(const std::string& name) {
+ base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
+ if (!cmd_line->HasSwitch(name))
+ cmd_line->AppendSwitch(name);
+}
+
class DefaultShellClient : public shell::ShellClient {
public:
DefaultShellClient() {}
@@ -33,6 +40,11 @@ class DefaultShellClient : public shell::ShellClient {
class PlatformTestHelperMus : public PlatformTestHelper {
public:
PlatformTestHelperMus() {
+ // Let other mojo apps know that we're running in tests. Do this with a
+ // command line flag to avoid making blocking calls to other processes for
+ // setup for tests (e.g. to unlock the screen in the window manager).
+ EnsureCommandLineSwitch(mus::switches::kUseTestConfig);
+
background_shell_.reset(new BackgroundShell);
background_shell_->Init(nullptr);
shell_client_.reset(new DefaultShellClient);

Powered by Google App Engine
This is Rietveld 408576698