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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/rand_util.h" | 6 #include "base/rand_util.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/application/application_test_base.h" | 10 #include "mojo/public/cpp/application/application_test_base.h" |
| 11 #include "mojo/public/cpp/application/connect.h" |
11 #include "mojo/public/cpp/system/data_pipe.h" | 12 #include "mojo/public/cpp/system/data_pipe.h" |
12 #include "mojo/services/network/interfaces/url_loader.mojom.h" | 13 #include "mojo/services/network/interfaces/url_loader.mojom.h" |
13 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac
he.mojom.h" | 14 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac
he.mojom.h" |
14 #include "services/url_response_disk_cache/kTestData.h" | 15 #include "services/url_response_disk_cache/kTestData.h" |
15 | 16 |
16 namespace mojo { | 17 namespace mojo { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 class URLResponseDiskCacheAppTest : public mojo::test::ApplicationTestBase { | 21 class URLResponseDiskCacheAppTest : public mojo::test::ApplicationTestBase { |
21 public: | 22 public: |
22 URLResponseDiskCacheAppTest() : ApplicationTestBase() {} | 23 URLResponseDiskCacheAppTest() : ApplicationTestBase() {} |
23 ~URLResponseDiskCacheAppTest() override {} | 24 ~URLResponseDiskCacheAppTest() override {} |
24 | 25 |
25 void SetUp() override { | 26 void SetUp() override { |
26 mojo::test::ApplicationTestBase::SetUp(); | 27 test::ApplicationTestBase::SetUp(); |
27 application_impl()->ConnectToServiceDeprecated( | 28 ConnectToService(application_impl()->shell(), |
28 "mojo:url_response_disk_cache", &url_response_disk_cache_); | 29 "mojo:url_response_disk_cache", |
| 30 GetProxy(&url_response_disk_cache_)); |
29 } | 31 } |
30 | 32 |
31 protected: | 33 protected: |
32 URLResponseDiskCachePtr url_response_disk_cache_; | 34 URLResponseDiskCachePtr url_response_disk_cache_; |
33 | 35 |
34 DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheAppTest); | 36 DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheAppTest); |
35 }; | 37 }; |
36 | 38 |
37 base::FilePath toPath(Array<uint8_t> path) { | 39 base::FilePath toPath(Array<uint8_t> path) { |
38 if (path.is_null()) { | 40 if (path.is_null()) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 }); | 323 }); |
322 url_response_disk_cache_.WaitForIncomingResponse(); | 324 url_response_disk_cache_.WaitForIncomingResponse(); |
323 ASSERT_FALSE(file.empty()); | 325 ASSERT_FALSE(file.empty()); |
324 ASSERT_TRUE(base::ReadFileToString(file, &received_content)); | 326 ASSERT_TRUE(base::ReadFileToString(file, &received_content)); |
325 EXPECT_EQ(new_content, received_content); | 327 EXPECT_EQ(new_content, received_content); |
326 saved_file = cache_dir.Append("file"); | 328 saved_file = cache_dir.Append("file"); |
327 EXPECT_FALSE(base::PathExists(saved_file)); | 329 EXPECT_FALSE(base::PathExists(saved_file)); |
328 } | 330 } |
329 | 331 |
330 } // namespace mojo | 332 } // namespace mojo |
OLD | NEW |