OLD | NEW |
---|---|
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/macros.h" | |
7 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
8 #include "services/shell/public/cpp/service_test.h" | 9 #include "services/shell/public/cpp/service_test.h" |
9 #include "services/ui/public/interfaces/window_server_test.mojom.h" | 10 #include "services/ui/public/interfaces/window_server_test.mojom.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | |
10 | 12 |
11 namespace ash { | 13 namespace ui { |
12 namespace mus { | 14 namespace demo { |
15 | |
16 namespace { | |
17 | |
18 const char kTestAppName[] = "exe:mus_demo_unittests"; | |
13 | 19 |
14 void RunCallback(bool* success, const base::Closure& callback, bool result) { | 20 void RunCallback(bool* success, const base::Closure& callback, bool result) { |
15 *success = result; | 21 *success = result; |
16 callback.Run(); | 22 callback.Run(); |
17 } | 23 } |
18 | 24 |
19 class AppLaunchTest : public shell::test::ServiceTest { | 25 class MusDemoTest : public shell::test::ServiceTest { |
rjkroege
2016/07/08 21:38:32
Given that we renamed mus to services/ui -- maybe
kylechar
2016/07/13 13:55:32
I see the thread. Hmmm, UIServiceDemo doesn't have
| |
20 public: | 26 public: |
21 AppLaunchTest() : ServiceTest("exe:mash_unittests") {} | 27 MusDemoTest() : shell::test::ServiceTest(kTestAppName) {} |
22 ~AppLaunchTest() override {} | 28 ~MusDemoTest() override {} |
23 | 29 |
24 private: | |
25 void SetUp() override { | 30 void SetUp() override { |
26 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config"); | 31 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config"); |
27 ServiceTest::SetUp(); | 32 ServiceTest::SetUp(); |
28 } | 33 } |
29 | 34 |
30 DISALLOW_COPY_AND_ASSIGN(AppLaunchTest); | 35 private: |
36 DISALLOW_COPY_AND_ASSIGN(MusDemoTest); | |
31 }; | 37 }; |
32 | 38 |
33 TEST_F(AppLaunchTest, TestQuickLaunch) { | 39 } // namespace |
34 connector()->Connect("mojo:ash"); | 40 |
35 connector()->Connect("mojo:quick_launch"); | 41 TEST_F(MusDemoTest, CheckMusDemoDraws) { |
42 connector()->Connect("mojo:mus_demo"); | |
36 | 43 |
37 ::ui::mojom::WindowServerTestPtr test_interface; | 44 ::ui::mojom::WindowServerTestPtr test_interface; |
38 connector()->ConnectToInterface("mojo:ui", &test_interface); | 45 connector()->ConnectToInterface("mojo:ui", &test_interface); |
39 | 46 |
40 base::RunLoop run_loop; | 47 base::RunLoop run_loop; |
41 bool success = false; | 48 bool success = false; |
49 // TODO(kylechar): Fix WindowServer::CreateTreeForWindowManager so that the | |
50 // WindowTree has the correct name instead of an empty name. | |
42 test_interface->EnsureClientHasDrawnWindow( | 51 test_interface->EnsureClientHasDrawnWindow( |
43 "mojo:quick_launch", | 52 "", // WindowTree name is empty. |
44 base::Bind(&RunCallback, &success, run_loop.QuitClosure())); | 53 base::Bind(&RunCallback, &success, run_loop.QuitClosure())); |
45 run_loop.Run(); | 54 run_loop.Run(); |
46 EXPECT_TRUE(success); | 55 EXPECT_TRUE(success); |
47 } | 56 } |
48 | 57 |
49 } // namespace mus | 58 } // namespace demo |
50 } // namespace ash | 59 } // namespace ui |
OLD | NEW |