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

Side by Side Diff: mash/wm/app_launch_unittest.cc

Issue 1921113002: mash: Add a test for exe:chrome. Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
« mash/wm/BUILD.gn ('K') | « mash/wm/BUILD.gn ('k') | no next file » | 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "components/mus/public/interfaces/window_server_test.mojom.h" 8 #include "components/mus/public/interfaces/window_server_test.mojom.h"
9 #include "services/shell/public/cpp/shell_test.h" 9 #include "services/shell/public/cpp/shell_test.h"
10 10
11 namespace mash { 11 namespace mash {
12 namespace wm { 12 namespace wm {
13 13
14 void RunCallback(bool* success, const base::Closure& callback, bool result) { 14 void RunCallback(bool* success, const base::Closure& callback, bool result) {
15 *success = result; 15 *success = result;
16 callback.Run(); 16 callback.Run();
17 } 17 }
18 18
19 class AppLaunchTest : public shell::test::ShellTest { 19 class AppLaunchTest : public shell::test::ShellTest {
20 public: 20 public:
21 AppLaunchTest() : ShellTest("exe:mash_unittests") {} 21 AppLaunchTest() : ShellTest("exe:mash_unittests") {}
22 ~AppLaunchTest() override {} 22 ~AppLaunchTest() override {}
23 23
24 bool LaunchApp(const std::string& app) {
25 connector()->Connect("mojo:desktop_wm");
26 connector()->Connect(app);
27
28 mus::mojom::WindowServerTestPtr test_interface;
29 connector()->ConnectToInterface("mojo:mus", &test_interface);
30
31 base::RunLoop run_loop;
32 bool success = false;
33 test_interface->EnsureClientHasDrawnWindow(
34 app, base::Bind(&RunCallback, &success, run_loop.QuitClosure()));
35 run_loop.Run();
36 return success;
37 }
38
24 private: 39 private:
25 void SetUp() override { 40 void SetUp() override {
26 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config"); 41 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config");
27 ShellTest::SetUp(); 42 ShellTest::SetUp();
28 } 43 }
29 44
30 DISALLOW_COPY_AND_ASSIGN(AppLaunchTest); 45 DISALLOW_COPY_AND_ASSIGN(AppLaunchTest);
31 }; 46 };
32 47
33 TEST_F(AppLaunchTest, TestQuickLaunch) { 48 TEST_F(AppLaunchTest, TestQuickLaunch) {
34 connector()->Connect("mojo:desktop_wm"); 49 EXPECT_TRUE(LaunchApp("mojo:quick_launch"));
35 connector()->Connect("mojo:quick_launch"); 50 }
36 51
37 mus::mojom::WindowServerTestPtr test_interface; 52 TEST_F(AppLaunchTest, TestChrome) {
38 connector()->ConnectToInterface("mojo:mus", &test_interface); 53 EXPECT_TRUE(LaunchApp("exe:chrome"));
39
40 base::RunLoop run_loop;
41 bool success = false;
42 test_interface->EnsureClientHasDrawnWindow(
43 "mojo:quick_launch",
44 base::Bind(&RunCallback, &success, run_loop.QuitClosure()));
45 run_loop.Run();
46 EXPECT_TRUE(success);
47 } 54 }
48 55
49 } // namespace wm 56 } // namespace wm
50 } // namespace mash 57 } // namespace mash
OLDNEW
« mash/wm/BUILD.gn ('K') | « mash/wm/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698