OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/service_manager/background_shell_service_loader.h" | 5 #include "mojo/service_manager/background_shell_service_loader.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Tests that the loader can load a service that is well behaved (quits | 45 // Tests that the loader can load a service that is well behaved (quits |
46 // itself). | 46 // itself). |
47 TEST(BackgroundShellServiceLoaderTest, Load) { | 47 TEST(BackgroundShellServiceLoaderTest, Load) { |
48 scoped_ptr<ServiceLoader> real_loader(new DummyLoader()); | 48 scoped_ptr<ServiceLoader> real_loader(new DummyLoader()); |
49 BackgroundShellServiceLoader loader(real_loader.Pass(), "test", | 49 BackgroundShellServiceLoader loader(real_loader.Pass(), "test", |
50 base::MessageLoop::TYPE_DEFAULT); | 50 base::MessageLoop::TYPE_DEFAULT); |
51 MessagePipe dummy; | 51 MessagePipe dummy; |
52 loader.LoadService(NULL, GURL(), dummy.handle0.Pass()); | 52 loader.LoadService(NULL, GURL(), dummy.handle0.Pass()); |
53 } | 53 } |
54 | 54 |
| 55 // Test that an app that doesn't quit itself can still be handled. |
| 56 // TODO(tim): Remove this. |
| 57 TEST(BackgroundShellServiceLoaderTest, LoadMisbehavedService) { |
| 58 scoped_ptr<DummyLoader> real_loader(new DummyLoader()); |
| 59 real_loader->DontSimulateAppQuit(); |
| 60 BackgroundShellServiceLoader loader( |
| 61 real_loader.PassAs<ServiceLoader>(), "test", |
| 62 base::MessageLoop::TYPE_DEFAULT); |
| 63 // Because this app is mis-behaved (doesn't quit itself), we need to |
| 64 // explicitly kill the thread. |
| 65 loader.set_quit_on_shutdown(); |
| 66 MessagePipe dummy; |
| 67 loader.LoadService(NULL, GURL(), dummy.handle0.Pass()); |
| 68 } |
| 69 |
55 } // namespace mojo | 70 } // namespace mojo |
OLD | NEW |