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