| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "mojo/data_pipe_utils/data_pipe_utils.h" | 10 #include "mojo/data_pipe_utils/data_pipe_utils.h" |
| 11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
| 12 #include "mojo/public/cpp/application/application_test_base.h" | 12 #include "mojo/public/cpp/application/application_test_base.h" |
| 13 #include "mojo/public/cpp/application/connect.h" |
| 13 #include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h" | 14 #include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h" |
| 14 #include "third_party/zlib/google/zip.h" | 15 #include "third_party/zlib/google/zip.h" |
| 15 | 16 |
| 16 namespace asset_bundle { | 17 namespace asset_bundle { |
| 17 | 18 |
| 18 class AssetBundleAppTest : public mojo::test::ApplicationTestBase { | 19 class AssetBundleAppTest : public mojo::test::ApplicationTestBase { |
| 19 public: | 20 public: |
| 20 AssetBundleAppTest() {} | 21 AssetBundleAppTest() {} |
| 21 ~AssetBundleAppTest() override {} | 22 ~AssetBundleAppTest() override {} |
| 22 | 23 |
| 23 void SetUp() override { | 24 void SetUp() override { |
| 24 mojo::test::ApplicationTestBase::SetUp(); | 25 mojo::test::ApplicationTestBase::SetUp(); |
| 25 application_impl()->ConnectToServiceDeprecated("mojo:asset_bundle", | 26 mojo::ConnectToService(application_impl()->shell(), "mojo:asset_bundle", |
| 26 &asset_unpacker_); | 27 GetProxy(&asset_unpacker_)); |
| 27 } | 28 } |
| 28 | 29 |
| 29 protected: | 30 protected: |
| 30 mojo::asset_bundle::AssetUnpackerPtr asset_unpacker_; | 31 mojo::asset_bundle::AssetUnpackerPtr asset_unpacker_; |
| 31 | 32 |
| 32 DISALLOW_COPY_AND_ASSIGN(AssetBundleAppTest); | 33 DISALLOW_COPY_AND_ASSIGN(AssetBundleAppTest); |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 TEST_F(AssetBundleAppTest, CanGetText) { | 36 TEST_F(AssetBundleAppTest, CanGetText) { |
| 36 std::string foo_content = "Some plain data"; | 37 std::string foo_content = "Some plain data"; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 [&](mojo::ScopedDataPipeConsumerHandle asset_pipe) { | 88 [&](mojo::ScopedDataPipeConsumerHandle asset_pipe) { |
| 88 mojo::common::BlockingCopyToString(asset_pipe.Pass(), &outside_content); | 89 mojo::common::BlockingCopyToString(asset_pipe.Pass(), &outside_content); |
| 89 }); | 90 }); |
| 90 ASSERT_TRUE(asset_bundle.WaitForIncomingResponse()); | 91 ASSERT_TRUE(asset_bundle.WaitForIncomingResponse()); |
| 91 | 92 |
| 92 EXPECT_EQ("", outside_content) | 93 EXPECT_EQ("", outside_content) |
| 93 << "Traversing outside of bundle is treated as an empty data stream"; | 94 << "Traversing outside of bundle is treated as an empty data stream"; |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace asset_bundle | 97 } // namespace asset_bundle |
| OLD | NEW |