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 "mojo/shell/context.h" | 6 #include "mojo/shell/context.h" |
7 #include "mojo/shell/dynamic_application_loader.h" | 7 #include "mojo/shell/dynamic_application_loader.h" |
8 #include "mojo/shell/dynamic_service_runner.h" | 8 #include "mojo/shell/dynamic_service_runner.h" |
9 #include "mojo/shell/filename_util.h" | 9 #include "mojo/shell/filename_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 private: | 56 private: |
57 TestState* state_; | 57 TestState* state_; |
58 }; | 58 }; |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 class DynamicApplicationLoaderTest : public testing::Test { | 62 class DynamicApplicationLoaderTest : public testing::Test { |
63 public: | 63 public: |
64 DynamicApplicationLoaderTest() {} | 64 DynamicApplicationLoaderTest() {} |
65 virtual ~DynamicApplicationLoaderTest() {} | 65 ~DynamicApplicationLoaderTest() override {} |
66 virtual void SetUp() override { | 66 void SetUp() override { |
67 context_.Init(); | 67 context_.Init(); |
68 scoped_ptr<DynamicServiceRunnerFactory> factory( | 68 scoped_ptr<DynamicServiceRunnerFactory> factory( |
69 new TestDynamicServiceRunnerFactory(&state_)); | 69 new TestDynamicServiceRunnerFactory(&state_)); |
70 loader_.reset(new DynamicApplicationLoader(&context_, factory.Pass())); | 70 loader_.reset(new DynamicApplicationLoader(&context_, factory.Pass())); |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 Context context_; | 74 Context context_; |
75 base::MessageLoop loop_; | 75 base::MessageLoop loop_; |
76 scoped_ptr<DynamicApplicationLoader> loader_; | 76 scoped_ptr<DynamicApplicationLoader> loader_; |
77 TestState state_; | 77 TestState state_; |
78 }; | 78 }; |
79 | 79 |
80 TEST_F(DynamicApplicationLoaderTest, DoesNotExist) { | 80 TEST_F(DynamicApplicationLoaderTest, DoesNotExist) { |
81 base::ScopedTempDir temp_dir; | 81 base::ScopedTempDir temp_dir; |
82 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 82 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
83 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt")); | 83 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt")); |
84 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file))); | 84 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file))); |
85 MessagePipe pipe; | 85 MessagePipe pipe; |
86 scoped_refptr<ApplicationLoader::SimpleLoadCallbacks> callbacks( | 86 scoped_refptr<ApplicationLoader::SimpleLoadCallbacks> callbacks( |
87 new ApplicationLoader::SimpleLoadCallbacks(pipe.handle0.Pass())); | 87 new ApplicationLoader::SimpleLoadCallbacks(pipe.handle0.Pass())); |
88 loader_->Load(context_.application_manager(), url, callbacks); | 88 loader_->Load(context_.application_manager(), url, callbacks); |
89 EXPECT_FALSE(state_.runner_was_created); | 89 EXPECT_FALSE(state_.runner_was_created); |
90 EXPECT_FALSE(state_.runner_was_started); | 90 EXPECT_FALSE(state_.runner_was_started); |
91 EXPECT_FALSE(state_.runner_was_destroyed); | 91 EXPECT_FALSE(state_.runner_was_destroyed); |
92 } | 92 } |
93 | 93 |
94 } // namespace shell | 94 } // namespace shell |
95 } // namespace mojo | 95 } // namespace mojo |
OLD | NEW |