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

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

Issue 2119683002: Move TestExtraData classes to anonymous namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
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 "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 namespace {
38
37 class TestExtraData : public WebURLResponse::ExtraData { 39 class TestExtraData : public WebURLResponse::ExtraData {
38 public: 40 public:
39 explicit TestExtraData(bool* alive) 41 explicit TestExtraData(bool* alive)
40 : m_alive(alive) 42 : m_alive(alive)
41 { 43 {
42 *alive = true; 44 *alive = true;
43 } 45 }
44 46
45 ~TestExtraData() override { *m_alive = false; } 47 ~TestExtraData() override { *m_alive = false; }
46 48
47 private: 49 private:
48 bool* m_alive; 50 bool* m_alive;
49 }; 51 };
50 52
53 } // anonymous namespace
54
51 TEST(WebURLResponseTest, ExtraData) 55 TEST(WebURLResponseTest, ExtraData)
52 { 56 {
53 bool alive = false; 57 bool alive = false;
54 { 58 {
55 WebURLResponse urlResponse; 59 WebURLResponse urlResponse;
56 TestExtraData* extraData = new TestExtraData(&alive); 60 TestExtraData* extraData = new TestExtraData(&alive);
57 EXPECT_TRUE(alive); 61 EXPECT_TRUE(alive);
58 62
59 urlResponse.initialize(); 63 urlResponse.initialize();
60 urlResponse.setExtraData(extraData); 64 urlResponse.setExtraData(extraData);
61 EXPECT_EQ(extraData, urlResponse.getExtraData()); 65 EXPECT_EQ(extraData, urlResponse.getExtraData());
62 { 66 {
63 WebURLResponse otherUrlResponse = urlResponse; 67 WebURLResponse otherUrlResponse = urlResponse;
64 EXPECT_TRUE(alive); 68 EXPECT_TRUE(alive);
65 EXPECT_EQ(extraData, otherUrlResponse.getExtraData()); 69 EXPECT_EQ(extraData, otherUrlResponse.getExtraData());
66 EXPECT_EQ(extraData, urlResponse.getExtraData()); 70 EXPECT_EQ(extraData, urlResponse.getExtraData());
67 } 71 }
68 EXPECT_TRUE(alive); 72 EXPECT_TRUE(alive);
69 EXPECT_EQ(extraData, urlResponse.getExtraData()); 73 EXPECT_EQ(extraData, urlResponse.getExtraData());
70 } 74 }
71 EXPECT_FALSE(alive); 75 EXPECT_FALSE(alive);
72 } 76 }
73 77
74 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698