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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebURLResponseTest.cpp

Issue 2117313002: Remove WebURLResponse::initialize() [revised] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanups Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "public/platform/WebURLResponse.h" 31 #include "public/platform/WebURLResponse.h"
32 32
33 #include "platform/weborigin/KURL.h"
34 #include "public/platform/WebURL.h"
33 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
34 36
35 namespace blink { 37 namespace blink {
36 38
37 namespace { 39 namespace {
38 40
39 class TestExtraData : public WebURLResponse::ExtraData { 41 class TestExtraData : public WebURLResponse::ExtraData {
40 public: 42 public:
41 explicit TestExtraData(bool* alive) 43 explicit TestExtraData(bool* alive)
42 : m_alive(alive) 44 : m_alive(alive)
(...skipping 10 matching lines...) Expand all
53 } // anonymous namespace 55 } // anonymous namespace
54 56
55 TEST(WebURLResponseTest, ExtraData) 57 TEST(WebURLResponseTest, ExtraData)
56 { 58 {
57 bool alive = false; 59 bool alive = false;
58 { 60 {
59 WebURLResponse urlResponse; 61 WebURLResponse urlResponse;
60 TestExtraData* extraData = new TestExtraData(&alive); 62 TestExtraData* extraData = new TestExtraData(&alive);
61 EXPECT_TRUE(alive); 63 EXPECT_TRUE(alive);
62 64
63 urlResponse.initialize();
64 urlResponse.setExtraData(extraData); 65 urlResponse.setExtraData(extraData);
65 EXPECT_EQ(extraData, urlResponse.getExtraData()); 66 EXPECT_EQ(extraData, urlResponse.getExtraData());
66 { 67 {
67 WebURLResponse otherUrlResponse = urlResponse; 68 WebURLResponse otherUrlResponse = urlResponse;
68 EXPECT_TRUE(alive); 69 EXPECT_TRUE(alive);
69 EXPECT_EQ(extraData, otherUrlResponse.getExtraData()); 70 EXPECT_EQ(extraData, otherUrlResponse.getExtraData());
70 EXPECT_EQ(extraData, urlResponse.getExtraData()); 71 EXPECT_EQ(extraData, urlResponse.getExtraData());
71 } 72 }
72 EXPECT_TRUE(alive); 73 EXPECT_TRUE(alive);
73 EXPECT_EQ(extraData, urlResponse.getExtraData()); 74 EXPECT_EQ(extraData, urlResponse.getExtraData());
74 } 75 }
75 EXPECT_FALSE(alive); 76 EXPECT_FALSE(alive);
76 } 77 }
77 78
79 TEST(WebURLResponseTest, NewInstanceIsNull)
80 {
81 WebURLResponse instance;
82 EXPECT_TRUE(instance.isNull());
83 }
84
85 TEST(WebURLResponseTest, NotNullAfterSetURL)
86 {
87 WebURLResponse instance;
88 instance.setURL(KURL(ParsedURLString, "http://localhost/"));
89 EXPECT_FALSE(instance.isNull());
90 }
91
78 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/public/platform/WebURLResponse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698