| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 7050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7061 // Manually reset to break WebViewHelper's dependency on the stack allocated | 7061 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 7062 // TestWebFrameClient. | 7062 // TestWebFrameClient. |
| 7063 reset(); | 7063 reset(); |
| 7064 remoteFrame->close(); | 7064 remoteFrame->close(); |
| 7065 } | 7065 } |
| 7066 | 7066 |
| 7067 namespace { | 7067 namespace { |
| 7068 | 7068 |
| 7069 class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::Tes
tWebFrameClient { | 7069 class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::Tes
tWebFrameClient { |
| 7070 public: | 7070 public: |
| 7071 SwapMainFrameWhenTitleChangesWebFrameClient() {} | 7071 SwapMainFrameWhenTitleChangesWebFrameClient() |
| 7072 ~SwapMainFrameWhenTitleChangesWebFrameClient() override {} | 7072 : m_remoteFrame(nullptr) |
| 7073 { |
| 7074 } |
| 7075 |
| 7076 ~SwapMainFrameWhenTitleChangesWebFrameClient() override |
| 7077 { |
| 7078 if (m_remoteFrame) |
| 7079 m_remoteFrame->close(); |
| 7080 } |
| 7073 | 7081 |
| 7074 void didReceiveTitle(WebLocalFrame* frame, const WebString&, WebTextDirectio
n) override | 7082 void didReceiveTitle(WebLocalFrame* frame, const WebString&, WebTextDirectio
n) override |
| 7075 { | 7083 { |
| 7076 if (!frame->parent()) | 7084 if (!frame->parent()) { |
| 7077 frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullp
tr)); | 7085 m_remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, n
ullptr); |
| 7086 frame->swap(m_remoteFrame); |
| 7087 } |
| 7078 } | 7088 } |
| 7089 private: |
| 7090 WebRemoteFrame* m_remoteFrame; |
| 7079 }; | 7091 }; |
| 7080 | 7092 |
| 7081 } // anonymous namespace | 7093 } // anonymous namespace |
| 7082 | 7094 |
| 7083 TEST_F(WebFrameTest, SwapMainFrameWhileLoading) | 7095 TEST_F(WebFrameTest, SwapMainFrameWhileLoading) |
| 7084 { | 7096 { |
| 7085 SwapMainFrameWhenTitleChangesWebFrameClient frameClient; | 7097 SwapMainFrameWhenTitleChangesWebFrameClient frameClient; |
| 7086 | 7098 |
| 7087 FrameTestHelpers::WebViewHelper webViewHelper; | 7099 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7088 registerMockedHttpURLLoad("frame-a-b-c.html"); | 7100 registerMockedHttpURLLoad("frame-a-b-c.html"); |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8285 EXPECT_TRUE(resource); | 8297 EXPECT_TRUE(resource); |
| 8286 EXPECT_NE(0, resource->loadFinishTime()); | 8298 EXPECT_NE(0, resource->loadFinishTime()); |
| 8287 | 8299 |
| 8288 DocumentLoader* loader = document->loader(); | 8300 DocumentLoader* loader = document->loader(); |
| 8289 | 8301 |
| 8290 EXPECT_TRUE(loader); | 8302 EXPECT_TRUE(loader); |
| 8291 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); | 8303 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); |
| 8292 } | 8304 } |
| 8293 | 8305 |
| 8294 } // namespace blink | 8306 } // namespace blink |
| OLD | NEW |