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

Side by Side Diff: ui/views/mus/views_mus_test_suite.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: rebase, fix linux 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 unified diff | Download patch
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/views_mus_test_suite.h" 5 #include "ui/views/mus/views_mus_test_suite.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/simple_thread.h" 13 #include "base/threading/simple_thread.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "components/mus/common/switches.h"
15 #include "services/shell/background/background_shell.h" 16 #include "services/shell/background/background_shell.h"
16 #include "services/shell/public/cpp/connector.h" 17 #include "services/shell/public/cpp/connector.h"
17 #include "services/shell/public/cpp/shell_client.h" 18 #include "services/shell/public/cpp/shell_client.h"
18 #include "services/shell/public/cpp/shell_connection.h" 19 #include "services/shell/public/cpp/shell_connection.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/views/mus/window_manager_connection.h" 21 #include "ui/views/mus/window_manager_connection.h"
21 #include "ui/views/test/platform_test_helper.h" 22 #include "ui/views/test/platform_test_helper.h"
22 #include "ui/views/views_delegate.h" 23 #include "ui/views/views_delegate.h"
23 24
24 namespace views { 25 namespace views {
25 namespace { 26 namespace {
26 27
28 void EnsureCommandLineSwitch(const std::string& name) {
29 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
30 if (!cmd_line->HasSwitch(name))
31 cmd_line->AppendSwitch(name);
32 }
33
27 class DefaultShellClient : public shell::ShellClient { 34 class DefaultShellClient : public shell::ShellClient {
28 public: 35 public:
29 DefaultShellClient() {} 36 DefaultShellClient() {}
30 ~DefaultShellClient() override {} 37 ~DefaultShellClient() override {}
31 38
32 private: 39 private:
33 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); 40 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient);
34 }; 41 };
35 42
36 class PlatformTestHelperMus : public PlatformTestHelper { 43 class PlatformTestHelperMus : public PlatformTestHelper {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 DISALLOW_COPY_AND_ASSIGN(ShellConnection); 130 DISALLOW_COPY_AND_ASSIGN(ShellConnection);
124 }; 131 };
125 132
126 ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv) 133 ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv)
127 : ViewsTestSuite(argc, argv) {} 134 : ViewsTestSuite(argc, argv) {}
128 135
129 ViewsMusTestSuite::~ViewsMusTestSuite() {} 136 ViewsMusTestSuite::~ViewsMusTestSuite() {}
130 137
131 void ViewsMusTestSuite::Initialize() { 138 void ViewsMusTestSuite::Initialize() {
132 PlatformTestHelper::SetIsMus(); 139 PlatformTestHelper::SetIsMus();
140 // Let other mojo apps know that we're running in tests. Do this with a
141 // command line flag to avoid making blocking calls to other processes for
142 // setup for tests (e.g. to unlock the screen in the window manager).
143 EnsureCommandLineSwitch(mus::switches::kUseTestConfig);
144
133 ViewsTestSuite::Initialize(); 145 ViewsTestSuite::Initialize();
134 shell_connections_.reset(new ShellConnection); 146 shell_connections_.reset(new ShellConnection);
135 } 147 }
136 148
137 void ViewsMusTestSuite::Shutdown() { 149 void ViewsMusTestSuite::Shutdown() {
138 shell_connections_.reset(); 150 shell_connections_.reset();
139 ViewsTestSuite::Shutdown(); 151 ViewsTestSuite::Shutdown();
140 } 152 }
141 153
142 } // namespace views 154 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698