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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "mojo/fetcher/base_application_fetcher.h" | 7 #include "mojo/fetcher/base_application_fetcher.h" |
8 #include "mojo/runner/context.h" | 8 #include "mojo/runner/context.h" |
9 #include "mojo/shell/application_manager.h" | 9 #include "mojo/shell/application_manager.h" |
10 #include "mojo/util/filename_util.h" | 10 #include "mojo/util/filename_util.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 explicit TestNativeRunner(TestState* state) : state_(state) { | 30 explicit TestNativeRunner(TestState* state) : state_(state) { |
31 state_->runner_was_created = true; | 31 state_->runner_was_created = true; |
32 } | 32 } |
33 ~TestNativeRunner() override { | 33 ~TestNativeRunner() override { |
34 state_->runner_was_destroyed = true; | 34 state_->runner_was_destroyed = true; |
35 if (base::MessageLoop::current()->is_running()) | 35 if (base::MessageLoop::current()->is_running()) |
36 base::MessageLoop::current()->Quit(); | 36 base::MessageLoop::current()->Quit(); |
37 } | 37 } |
38 void Start(const base::FilePath& app_path, | 38 void Start(const base::FilePath& app_path, |
39 bool start_sandboxed, | 39 bool start_sandboxed, |
40 shell::NativeApplicationCleanup cleanup, | |
41 InterfaceRequest<Application> application_request, | 40 InterfaceRequest<Application> application_request, |
42 const base::Closure& app_completed_callback) override { | 41 const base::Closure& app_completed_callback) override { |
43 state_->runner_was_started = true; | 42 state_->runner_was_started = true; |
44 } | 43 } |
45 | 44 |
46 private: | 45 private: |
47 TestState* state_; | 46 TestState* state_; |
48 }; | 47 }; |
49 | 48 |
50 class TestNativeRunnerFactory : public shell::NativeRunnerFactory { | 49 class TestNativeRunnerFactory : public shell::NativeRunnerFactory { |
51 public: | 50 public: |
52 explicit TestNativeRunnerFactory(TestState* state) : state_(state) {} | 51 explicit TestNativeRunnerFactory(TestState* state) : state_(state) {} |
53 ~TestNativeRunnerFactory() override {} | 52 ~TestNativeRunnerFactory() override {} |
54 scoped_ptr<shell::NativeRunner> Create(const Options& options) override { | 53 scoped_ptr<shell::NativeRunner> Create() override { |
55 return scoped_ptr<shell::NativeRunner>(new TestNativeRunner(state_)); | 54 return scoped_ptr<shell::NativeRunner>(new TestNativeRunner(state_)); |
56 } | 55 } |
57 | 56 |
58 private: | 57 private: |
59 TestState* state_; | 58 TestState* state_; |
60 }; | 59 }; |
61 | 60 |
62 class NativeApplicationLoaderTest : public testing::Test { | 61 class NativeApplicationLoaderTest : public testing::Test { |
63 public: | 62 public: |
64 NativeApplicationLoaderTest() { | 63 NativeApplicationLoaderTest() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 service_provider.Pass(), shell::GetPermissiveCapabilityFilter(), | 100 service_provider.Pass(), shell::GetPermissiveCapabilityFilter(), |
102 base::Closure(), shell::EmptyConnectCallback()); | 101 base::Closure(), shell::EmptyConnectCallback()); |
103 EXPECT_FALSE(state_.runner_was_created); | 102 EXPECT_FALSE(state_.runner_was_created); |
104 EXPECT_FALSE(state_.runner_was_started); | 103 EXPECT_FALSE(state_.runner_was_started); |
105 EXPECT_FALSE(state_.runner_was_destroyed); | 104 EXPECT_FALSE(state_.runner_was_destroyed); |
106 } | 105 } |
107 | 106 |
108 } // namespace | 107 } // namespace |
109 } // namespace runner | 108 } // namespace runner |
110 } // namespace mojo | 109 } // namespace mojo |
OLD | NEW |