Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp

Issue 14264012: Create errors (especially cancellation errors) internally to WebCore, rather (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include <wtf/text/WTFString.h> 47 #include <wtf/text/WTFString.h>
48 48
49 #include <gtest/gtest.h> 49 #include <gtest/gtest.h>
50 50
51 using namespace WebKit; 51 using namespace WebKit;
52 using WebKit::URLTestHelpers::toKURL; 52 using WebKit::URLTestHelpers::toKURL;
53 53
54 namespace { 54 namespace {
55 55
56 class TestWebFrameClient : public WebFrameClient { 56 class TestWebFrameClient : public WebFrameClient {
57 // Return a non-null cancellation error so the WebFrame loaders can shut dow n without asserting.
58 // Make 'reason' non-zero so WebURLError isn't considered null.
59 WebURLError cancelledError(WebFrame*, const WebURLRequest& request)
60 {
61 WebURLError error;
62 error.reason = 1;
63 error.unreachableURL = request.url();
64 return error;
65 }
66 }; 57 };
67 58
68 class AssociatedURLLoaderTest : public testing::Test, 59 class AssociatedURLLoaderTest : public testing::Test,
69 public WebURLLoaderClient { 60 public WebURLLoaderClient {
70 public: 61 public:
71 AssociatedURLLoaderTest() 62 AssociatedURLLoaderTest()
72 : m_willSendRequest(false) 63 : m_willSendRequest(false)
73 , m_didSendData(false) 64 , m_didSendData(false)
74 , m_didReceiveResponse(false) 65 , m_didReceiveResponse(false)
75 , m_didReceiveData(false) 66 , m_didReceiveData(false)
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 m_expectedLoader->loadAsynchronously(request, this); 603 m_expectedLoader->loadAsynchronously(request, this);
613 serveRequests(); 604 serveRequests();
614 EXPECT_TRUE(m_didReceiveResponse); 605 EXPECT_TRUE(m_didReceiveResponse);
615 EXPECT_TRUE(m_didReceiveData); 606 EXPECT_TRUE(m_didReceiveData);
616 EXPECT_TRUE(m_didFinishLoading); 607 EXPECT_TRUE(m_didFinishLoading);
617 608
618 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); 609 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
619 } 610 }
620 611
621 } 612 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698