OLD | NEW |
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 Loading... |
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 } |
57 }; | 66 }; |
58 | 67 |
59 class AssociatedURLLoaderTest : public testing::Test, | 68 class AssociatedURLLoaderTest : public testing::Test, |
60 public WebURLLoaderClient { | 69 public WebURLLoaderClient { |
61 public: | 70 public: |
62 AssociatedURLLoaderTest() | 71 AssociatedURLLoaderTest() |
63 : m_willSendRequest(false) | 72 : m_willSendRequest(false) |
64 , m_didSendData(false) | 73 , m_didSendData(false) |
65 , m_didReceiveResponse(false) | 74 , m_didReceiveResponse(false) |
66 , m_didReceiveData(false) | 75 , m_didReceiveData(false) |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 m_expectedLoader->loadAsynchronously(request, this); | 612 m_expectedLoader->loadAsynchronously(request, this); |
604 serveRequests(); | 613 serveRequests(); |
605 EXPECT_TRUE(m_didReceiveResponse); | 614 EXPECT_TRUE(m_didReceiveResponse); |
606 EXPECT_TRUE(m_didReceiveData); | 615 EXPECT_TRUE(m_didReceiveData); |
607 EXPECT_TRUE(m_didFinishLoading); | 616 EXPECT_TRUE(m_didFinishLoading); |
608 | 617 |
609 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); | 618 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); |
610 } | 619 } |
611 | 620 |
612 } | 621 } |
OLD | NEW |