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

Side by Side Diff: ash/mus/app_launch_unittest.cc

Issue 2715533005: Make mus_demo_unittests work with multiple root windows (Closed)
Patch Set: Add a unit test for multiple windows. Created 3 years, 9 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
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 "ash/public/interfaces/constants.mojom.h" 5 #include "ash/public/interfaces/constants.mojom.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "mash/quick_launch/public/interfaces/constants.mojom.h" 9 #include "mash/quick_launch/public/interfaces/constants.mojom.h"
10 #include "services/service_manager/public/cpp/service_test.h" 10 #include "services/service_manager/public/cpp/service_test.h"
11 #include "services/ui/public/interfaces/constants.mojom.h" 11 #include "services/ui/public/interfaces/constants.mojom.h"
12 #include "services/ui/public/interfaces/window_server_test.mojom.h" 12 #include "services/ui/public/interfaces/window_server_test.mojom.h"
13 13
14 namespace ash { 14 namespace ash {
15 namespace mus { 15 namespace mus {
16 16
17 void RunCallback(bool* success, const base::Closure& callback, bool result) { 17 void RunCallback(uint64_t* root_window_count,
18 *success = result; 18 const base::Closure& callback,
19 uint64_t result) {
20 *root_window_count = result;
19 callback.Run(); 21 callback.Run();
20 } 22 }
21 23
22 class AppLaunchTest : public service_manager::test::ServiceTest { 24 class AppLaunchTest : public service_manager::test::ServiceTest {
23 public: 25 public:
24 AppLaunchTest() : ServiceTest("mash_unittests") {} 26 AppLaunchTest() : ServiceTest("mash_unittests") {}
25 ~AppLaunchTest() override {} 27 ~AppLaunchTest() override {}
26 28
27 private: 29 private:
28 void SetUp() override { 30 void SetUp() override {
29 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config"); 31 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-test-config");
30 ServiceTest::SetUp(); 32 ServiceTest::SetUp();
31 } 33 }
32 34
33 DISALLOW_COPY_AND_ASSIGN(AppLaunchTest); 35 DISALLOW_COPY_AND_ASSIGN(AppLaunchTest);
34 }; 36 };
35 37
36 TEST_F(AppLaunchTest, TestQuickLaunch) { 38 TEST_F(AppLaunchTest, TestQuickLaunch) {
37 connector()->Connect(mojom::kServiceName); 39 connector()->Connect(mojom::kServiceName);
38 connector()->Connect(mash::quick_launch::mojom::kServiceName); 40 connector()->Connect(mash::quick_launch::mojom::kServiceName);
39 41
40 ui::mojom::WindowServerTestPtr test_interface; 42 ui::mojom::WindowServerTestPtr test_interface;
41 connector()->BindInterface(ui::mojom::kServiceName, &test_interface); 43 connector()->BindInterface(ui::mojom::kServiceName, &test_interface);
42 44
43 base::RunLoop run_loop; 45 base::RunLoop run_loop;
44 bool success = false; 46 uint64_t root_window_count = 0;
45 test_interface->EnsureClientHasDrawnWindow( 47 test_interface->EnsureClientHasDrawnRootWindows(
46 mash::quick_launch::mojom::kServiceName, 48 mash::quick_launch::mojom::kServiceName,
47 base::Bind(&RunCallback, &success, run_loop.QuitClosure())); 49 base::Bind(&RunCallback, &root_window_count, run_loop.QuitClosure()));
48 run_loop.Run(); 50 run_loop.Run();
49 EXPECT_TRUE(success); 51 EXPECT_EQ(1u, root_window_count);
50 } 52 }
51 53
52 } // namespace mus 54 } // namespace mus
53 } // namespace ash 55 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | services/ui/demo/mus_demo_unittests.cc » ('j') | services/ui/ws/window_server_test_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698