| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 MOCK_METHOD3(dataSent, | 63 MOCK_METHOD3(dataSent, |
| 64 void(Resource*, unsigned long long, unsigned long long)); | 64 void(Resource*, unsigned long long, unsigned long long)); |
| 65 MOCK_METHOD3(responseReceivedInternal, | 65 MOCK_METHOD3(responseReceivedInternal, |
| 66 void(Resource*, | 66 void(Resource*, |
| 67 const ResourceResponse&, | 67 const ResourceResponse&, |
| 68 WebDataConsumerHandle*)); | 68 WebDataConsumerHandle*)); |
| 69 MOCK_METHOD3(setSerializedCachedMetadata, | 69 MOCK_METHOD3(setSerializedCachedMetadata, |
| 70 void(Resource*, const char*, size_t)); | 70 void(Resource*, const char*, size_t)); |
| 71 MOCK_METHOD3(dataReceived, void(Resource*, const char*, size_t)); | 71 MOCK_METHOD3(dataReceived, void(Resource*, const char*, size_t)); |
| 72 MOCK_METHOD3(redirectReceived, | 72 MOCK_METHOD3(redirectReceived, |
| 73 void(Resource*, ResourceRequest&, const ResourceResponse&)); | 73 bool(Resource*, |
| 74 const ResourceRequest&, |
| 75 const ResourceResponse&)); |
| 74 MOCK_METHOD0(redirectBlocked, void()); | 76 MOCK_METHOD0(redirectBlocked, void()); |
| 75 MOCK_METHOD2(dataDownloaded, void(Resource*, int)); | 77 MOCK_METHOD2(dataDownloaded, void(Resource*, int)); |
| 76 MOCK_METHOD2(didReceiveResourceTiming, | 78 MOCK_METHOD2(didReceiveResourceTiming, |
| 77 void(Resource*, const ResourceTimingInfo&)); | 79 void(Resource*, const ResourceTimingInfo&)); |
| 78 | 80 |
| 79 void responseReceived( | 81 void responseReceived( |
| 80 Resource* resource, | 82 Resource* resource, |
| 81 const ResourceResponse& response, | 83 const ResourceResponse& response, |
| 82 std::unique_ptr<WebDataConsumerHandle> handle) override { | 84 std::unique_ptr<WebDataConsumerHandle> handle) override { |
| 83 responseReceivedInternal(resource, response, handle.get()); | 85 responseReceivedInternal(resource, response, handle.get()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 112 ~DummyClient() override {} | 114 ~DummyClient() override {} |
| 113 | 115 |
| 114 // ResourceClient implementation. | 116 // ResourceClient implementation. |
| 115 void notifyFinished(Resource* resource) override { m_called = true; } | 117 void notifyFinished(Resource* resource) override { m_called = true; } |
| 116 String debugName() const override { return "DummyClient"; } | 118 String debugName() const override { return "DummyClient"; } |
| 117 | 119 |
| 118 void dataReceived(Resource*, const char* data, size_t length) override { | 120 void dataReceived(Resource*, const char* data, size_t length) override { |
| 119 m_data.append(data, length); | 121 m_data.append(data, length); |
| 120 } | 122 } |
| 121 | 123 |
| 122 void redirectReceived(Resource*, | 124 bool redirectReceived(Resource*, |
| 123 ResourceRequest&, | 125 const ResourceRequest&, |
| 124 const ResourceResponse&) override { | 126 const ResourceResponse&) override { |
| 125 ++m_numberOfRedirectsReceived; | 127 ++m_numberOfRedirectsReceived; |
| 128 return true; |
| 126 } | 129 } |
| 127 | 130 |
| 128 bool called() { return m_called; } | 131 bool called() { return m_called; } |
| 129 int numberOfRedirectsReceived() const { return m_numberOfRedirectsReceived; } | 132 int numberOfRedirectsReceived() const { return m_numberOfRedirectsReceived; } |
| 130 const Vector<char>& data() { return m_data; } | 133 const Vector<char>& data() { return m_data; } |
| 131 DEFINE_INLINE_TRACE() { RawResourceClient::trace(visitor); } | 134 DEFINE_INLINE_TRACE() { RawResourceClient::trace(visitor); } |
| 132 | 135 |
| 133 private: | 136 private: |
| 134 bool m_called; | 137 bool m_called; |
| 135 int m_numberOfRedirectsReceived; | 138 int m_numberOfRedirectsReceived; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 557 |
| 555 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader) { | 558 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader) { |
| 556 ResourceRequest request("data:text/html,"); | 559 ResourceRequest request("data:text/html,"); |
| 557 request.setHTTPHeaderField( | 560 request.setHTTPHeaderField( |
| 558 HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, "Foo"); | 561 HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, "Foo"); |
| 559 Resource* raw = RawResource::create(request, Resource::Raw); | 562 Resource* raw = RawResource::create(request, Resource::Raw); |
| 560 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,"))); | 563 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,"))); |
| 561 } | 564 } |
| 562 | 565 |
| 563 } // namespace blink | 566 } // namespace blink |
| OLD | NEW |