From 642c15e020eef69301e29f2998f073d95650534d Mon Sep 17 00:00:00 2001 From: "amit@chromium.org" Date: Thu, 13 May 2010 20:56:12 +0000 Subject: Fix unit test breakage in last change. Instead of returning E_FAIL from IStream::Read when there is no valid cache to serve content from, confirm tp the IStream Read contract and return S_FALSE with 0 bytes. TBR=stoyan TEST=MonikerPatchTest.CacheStream Review URL: http://codereview.chromium.org/2114001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47189 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/test/urlmon_moniker_unittest.cc | 2 +- chrome_frame/urlmon_bind_status_callback.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'chrome_frame') diff --git a/chrome_frame/test/urlmon_moniker_unittest.cc b/chrome_frame/test/urlmon_moniker_unittest.cc index 5af4eb3..1d889bf 100644 --- a/chrome_frame/test/urlmon_moniker_unittest.cc +++ b/chrome_frame/test/urlmon_moniker_unittest.cc @@ -69,7 +69,7 @@ TEST_F(MonikerPatchTest, CacheStream) { // Test 1: empty stream reads nothing CComObjectStackEx cache_stream1; - EXPECT_EQ(E_PENDING, cache_stream1.Read(ret, sizeof(ret), &read)); + EXPECT_EQ(S_FALSE, cache_stream1.Read(ret, sizeof(ret), &read)); EXPECT_EQ(0, read); // Test 2: Read from initialized cache diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc index 1f39a08..5730870 100644 --- a/chrome_frame/urlmon_bind_status_callback.cc +++ b/chrome_frame/urlmon_bind_status_callback.cc @@ -75,8 +75,10 @@ STDMETHODIMP CacheStream::Read(void* pv, ULONG cb, ULONG* read) { if (!pv || !read) return E_INVALIDARG; - if (!cache_.get()) - return E_FAIL; + if (!cache_.get()) { + *read = 0; + return S_FALSE; + } // Default to E_PENDING to signal that this is a partial data. HRESULT hr = eof_ ? S_FALSE : E_PENDING; -- cgit v1.1