| 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 "shell/context.h" | 6 #include "shell/context.h" |
| 7 #include "shell/dynamic_service_runner.h" | 7 #include "shell/dynamic_service_runner.h" |
| 8 #include "shell/filename_util.h" | 8 #include "shell/filename_util.h" |
| 9 #include "shell/native_application_loader.h" | 9 #include "shell/native_application_loader.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 class NativeApplicationLoaderTest : public testing::Test { | 63 class NativeApplicationLoaderTest : public testing::Test { |
| 64 public: | 64 public: |
| 65 NativeApplicationLoaderTest() {} | 65 NativeApplicationLoaderTest() {} |
| 66 ~NativeApplicationLoaderTest() override {} | 66 ~NativeApplicationLoaderTest() override {} |
| 67 void SetUp() override { | 67 void SetUp() override { |
| 68 context_.Init(); | 68 context_.Init(); |
| 69 scoped_ptr<DynamicServiceRunnerFactory> factory( | 69 scoped_ptr<DynamicServiceRunnerFactory> factory( |
| 70 new TestDynamicServiceRunnerFactory(&state_)); | 70 new TestDynamicServiceRunnerFactory(&state_)); |
| 71 loader_.reset(new NativeApplicationLoader(&context_, factory.Pass())); | 71 loader_.reset(new NativeApplicationLoader(&context_, factory.Pass())); |
| 72 } | 72 } |
| 73 void TearDown() override { context_.Shutdown(); } |
| 73 | 74 |
| 74 protected: | 75 protected: |
| 75 Context context_; | 76 Context context_; |
| 76 base::MessageLoop loop_; | 77 base::MessageLoop loop_; |
| 77 scoped_ptr<NativeApplicationLoader> loader_; | 78 scoped_ptr<NativeApplicationLoader> loader_; |
| 78 TestState state_; | 79 TestState state_; |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 TEST_F(NativeApplicationLoaderTest, DoesNotExist) { | 82 TEST_F(NativeApplicationLoaderTest, DoesNotExist) { |
| 82 base::ScopedTempDir temp_dir; | 83 base::ScopedTempDir temp_dir; |
| 83 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 84 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 84 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt")); | 85 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt")); |
| 85 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file))); | 86 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file))); |
| 86 ApplicationPtr application; | 87 ApplicationPtr application; |
| 87 loader_->Load(url, GetProxy(&application), | 88 loader_->Load(url, GetProxy(&application), |
| 88 NativeApplicationLoader::SimpleLoadCallback()); | 89 NativeApplicationLoader::SimpleLoadCallback()); |
| 89 EXPECT_FALSE(state_.runner_was_created); | 90 EXPECT_FALSE(state_.runner_was_created); |
| 90 EXPECT_FALSE(state_.runner_was_started); | 91 EXPECT_FALSE(state_.runner_was_started); |
| 91 EXPECT_FALSE(state_.runner_was_destroyed); | 92 EXPECT_FALSE(state_.runner_was_destroyed); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace shell | 95 } // namespace shell |
| 95 } // namespace mojo | 96 } // namespace mojo |
| OLD | NEW |