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/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "services/js/test/js_application_test_base.h" | 6 #include "services/js/test/js_application_test_base.h" |
7 #include "services/js/test/network_test_service.mojom.h" | 7 #include "services/js/test/network_test_service.mojom.h" |
8 | 8 |
9 namespace js { | 9 namespace js { |
10 namespace { | 10 namespace { |
11 | 11 |
12 class JSNetworkTest : public test::JSApplicationTestBase { | 12 class JSNetworkTest : public test::JSApplicationTestBase { |
13 public: | 13 public: |
14 JSNetworkTest() : JSApplicationTestBase() {} | 14 JSNetworkTest() : JSApplicationTestBase() {} |
15 ~JSNetworkTest() override {} | 15 ~JSNetworkTest() override {} |
16 | 16 |
17 protected: | 17 protected: |
18 // ApplicationTestBase: | 18 // ApplicationTestBase: |
19 void SetUp() override { | 19 void SetUp() override { |
20 ApplicationTestBase::SetUp(); | 20 ApplicationTestBase::SetUp(); |
21 const std::string& url = JSAppURL("network_test.js"); | 21 const std::string& url = JSAppURL("network_test.js"); |
22 application_impl()->ConnectToService(url, &network_test_service_); | 22 application_impl()->ConnectToServiceDeprecated(url, &network_test_service_); |
23 } | 23 } |
24 | 24 |
25 NetworkTestServicePtr network_test_service_; | 25 NetworkTestServicePtr network_test_service_; |
26 | 26 |
27 private: | 27 private: |
28 MOJO_DISALLOW_COPY_AND_ASSIGN(JSNetworkTest); | 28 MOJO_DISALLOW_COPY_AND_ASSIGN(JSNetworkTest); |
29 }; | 29 }; |
30 | 30 |
31 struct GetFileSizeCallback { | 31 struct GetFileSizeCallback { |
32 GetFileSizeCallback(bool* b, uint64* s) : ok(b), size(s) {} | 32 GetFileSizeCallback(bool* b, uint64* s) : ok(b), size(s) {} |
(...skipping 20 matching lines...) Expand all Loading... |
53 network_test_service_->GetFileSize(JSAppURL(filename), callback); | 53 network_test_service_->GetFileSize(JSAppURL(filename), callback); |
54 EXPECT_TRUE(network_test_service_.WaitForIncomingResponse()); | 54 EXPECT_TRUE(network_test_service_.WaitForIncomingResponse()); |
55 EXPECT_TRUE(file_size_ok); | 55 EXPECT_TRUE(file_size_ok); |
56 EXPECT_EQ(file_size, static_cast<uint64>(expected_file_size)); | 56 EXPECT_EQ(file_size, static_cast<uint64>(expected_file_size)); |
57 network_test_service_->Quit(); | 57 network_test_service_->Quit(); |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 } // namespace js | 61 } // namespace js |
62 | 62 |
OLD | NEW |