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

Side by Side Diff: services/shell/background/tests/background_shell_unittest.cc

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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 | « services/shell/background/tests/BUILD.gn ('k') | services/shell/background/tests/test.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "services/shell/background/background_shell.h"
6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h"
11 #include "services/shell/background/tests/test.mojom.h"
12 #include "services/shell/public/cpp/connector.h"
13 #include "services/shell/public/cpp/service.h"
14 #include "services/shell/public/cpp/service_context.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 namespace shell {
18 namespace {
19
20 const char kTestName[] = "service:background_shell_unittest";
21 const char kAppName[] = "service:background_shell_test_service";
22
23 class ServiceImpl : public Service {
24 public:
25 ServiceImpl() {}
26 ~ServiceImpl() override {}
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(ServiceImpl);
30 };
31
32 void SetFlagAndRunClosure(bool* flag, const base::Closure& closure) {
33 *flag = true;
34 closure.Run();
35 }
36
37 } // namespace
38
39 // Uses BackgroundShell to start the shell in the background and connects to
40 // background_shell_test_app, verifying we can send a message to the app.
41 #if defined(OS_ANDROID)
42 // TODO(crbug.com/589784): This test is disabled, as it fails
43 // on the Android GN bot.
44 #define MAYBE_Basic DISABLED_Basic
45 #else
46 #define MAYBE_Basic Basic
47 #endif
48 TEST(BackgroundShellTest, MAYBE_Basic) {
49 base::MessageLoop message_loop;
50 BackgroundShell background_shell;
51 background_shell.Init(nullptr);
52 ServiceImpl service;
53 ServiceContext service_context(
54 &service, background_shell.CreateServiceRequest(kTestName));
55 mojom::TestServicePtr test_service;
56 service_context.connector()->ConnectToInterface(kAppName, &test_service);
57 base::RunLoop run_loop;
58 bool got_result = false;
59 test_service->Test(base::Bind(&SetFlagAndRunClosure, &got_result,
60 run_loop.QuitClosure()));
61 run_loop.Run();
62 EXPECT_TRUE(got_result);
63 }
64
65 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/background/tests/BUILD.gn ('k') | services/shell/background/tests/test.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698