| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 namespace { | 69 namespace { |
| 70 constexpr char kTestResourceFilename[] = "white-1x1.png"; | 70 constexpr char kTestResourceFilename[] = "white-1x1.png"; |
| 71 constexpr char kTestResourceMimeType[] = "image/png"; | 71 constexpr char kTestResourceMimeType[] = "image/png"; |
| 72 constexpr int kTestResourceSize = 103; // size of web/tests/data/white-1x1.png | 72 constexpr int kTestResourceSize = 103; // size of web/tests/data/white-1x1.png |
| 73 } | 73 } |
| 74 | 74 |
| 75 class ResourceFetcherTest : public ::testing::Test { | 75 class ResourceFetcherTest : public ::testing::Test { |
| 76 public: | 76 public: |
| 77 ResourceFetcherTest() = default; | 77 ResourceFetcherTest() = default; |
| 78 ~ResourceFetcherTest() override = default; | 78 ~ResourceFetcherTest() override { memoryCache()->evictResources(); } |
| 79 | |
| 80 void TearDown() override { | |
| 81 m_platform->getURLLoaderMockFactory()->unregisterAllURLs(); | |
| 82 memoryCache()->evictResources(); | |
| 83 } | |
| 84 | 79 |
| 85 protected: | 80 protected: |
| 86 MockFetchContext* context() { return m_platform->context(); } | 81 MockFetchContext* context() { return m_platform->context(); } |
| 87 | 82 |
| 88 ScopedTestingPlatformSupport<FetchTestingPlatformSupport> m_platform; | 83 ScopedTestingPlatformSupport<FetchTestingPlatformSupport> m_platform; |
| 89 | 84 |
| 90 private: | 85 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(ResourceFetcherTest); | 86 DISALLOW_COPY_AND_ASSIGN(ResourceFetcherTest); |
| 92 }; | 87 }; |
| 93 | 88 |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 // Resource created by parser on the second fetcher | 648 // Resource created by parser on the second fetcher |
| 654 FetchRequest fetchRequest2 = FetchRequest(url, FetchInitiatorInfo()); | 649 FetchRequest fetchRequest2 = FetchRequest(url, FetchInitiatorInfo()); |
| 655 Resource* newResource2 = MockResource::fetch(fetchRequest2, fetcher2); | 650 Resource* newResource2 = MockResource::fetch(fetchRequest2, fetcher2); |
| 656 Persistent<MockResourceClient> client2 = new MockResourceClient(newResource2); | 651 Persistent<MockResourceClient> client2 = new MockResourceClient(newResource2); |
| 657 EXPECT_EQ(resource, newResource2); | 652 EXPECT_EQ(resource, newResource2); |
| 658 EXPECT_FALSE(fetcher2->isFetching()); | 653 EXPECT_FALSE(fetcher2->isFetching()); |
| 659 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); | 654 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); |
| 660 } | 655 } |
| 661 | 656 |
| 662 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |