| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 public: | 89 public: |
| 90 void RunTest(const std::string& filename) | 90 void RunTest(const std::string& filename) |
| 91 { | 91 { |
| 92 std::string baseURL("http://www.example.com/"); | 92 std::string baseURL("http://www.example.com/"); |
| 93 std::string fileName(filename); | 93 std::string fileName(filename); |
| 94 bool executeScript = true; | 94 bool executeScript = true; |
| 95 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL
.c_str()), WebString::fromUTF8(fileName.c_str())); | 95 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL
.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 96 webViewHelper.initializeAndLoad(baseURL + fileName, executeScript); | 96 webViewHelper.initializeAndLoad(baseURL + fileName, executeScript); |
| 97 } | 97 } |
| 98 | 98 |
| 99 virtual void TearDown() OVERRIDE | 99 virtual void TearDown() override |
| 100 { | 100 { |
| 101 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 101 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 FrameTestHelpers::WebViewHelper webViewHelper; | 105 FrameTestHelpers::WebViewHelper webViewHelper; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 | 108 |
| 109 // This test tries to create a reference cycle between node and its listener. | 109 // This test tries to create a reference cycle between node and its listener. |
| 110 // See http://crbug/17400. | 110 // See http://crbug/17400. |
| 111 TEST_F(ListenerLeakTest, ReferenceCycle) | 111 TEST_F(ListenerLeakTest, ReferenceCycle) |
| 112 { | 112 { |
| 113 RunTest("listener/listener_leak1.html"); | 113 RunTest("listener/listener_leak1.html"); |
| 114 ASSERT_EQ(0, GetNumObjects("EventListenerLeakTestObject1")); | 114 ASSERT_EQ(0, GetNumObjects("EventListenerLeakTestObject1")); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // This test sets node onclick many times to expose a possible memory | 117 // This test sets node onclick many times to expose a possible memory |
| 118 // leak where all listeners get referenced by the node. | 118 // leak where all listeners get referenced by the node. |
| 119 TEST_F(ListenerLeakTest, HiddenReferences) | 119 TEST_F(ListenerLeakTest, HiddenReferences) |
| 120 { | 120 { |
| 121 RunTest("listener/listener_leak2.html"); | 121 RunTest("listener/listener_leak2.html"); |
| 122 ASSERT_EQ(1, GetNumObjects("EventListenerLeakTestObject2")); | 122 ASSERT_EQ(1, GetNumObjects("EventListenerLeakTestObject2")); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace | 125 } // namespace |
| OLD | NEW |