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 8791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8802 class SwapMainFrameWhenTitleChangesWebFrameClient | 8802 class SwapMainFrameWhenTitleChangesWebFrameClient |
8803 : public FrameTestHelpers::TestWebFrameClient { | 8803 : public FrameTestHelpers::TestWebFrameClient { |
8804 public: | 8804 public: |
8805 SwapMainFrameWhenTitleChangesWebFrameClient() : remote_frame_(nullptr) {} | 8805 SwapMainFrameWhenTitleChangesWebFrameClient() : remote_frame_(nullptr) {} |
8806 | 8806 |
8807 ~SwapMainFrameWhenTitleChangesWebFrameClient() override { | 8807 ~SwapMainFrameWhenTitleChangesWebFrameClient() override { |
8808 if (remote_frame_) | 8808 if (remote_frame_) |
8809 remote_frame_->Close(); | 8809 remote_frame_->Close(); |
8810 } | 8810 } |
8811 | 8811 |
8812 void DidReceiveTitle(WebLocalFrame* frame, | 8812 void DidReceiveTitle(const WebString&, WebTextDirection) override { |
8813 const WebString&, | 8813 if (!Frame()->Parent()) { |
8814 WebTextDirection) override { | |
8815 if (!frame->Parent()) { | |
8816 remote_frame_ = | 8814 remote_frame_ = |
8817 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr); | 8815 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr); |
8818 frame->Swap(remote_frame_); | 8816 Frame()->Swap(remote_frame_); |
8819 } | 8817 } |
8820 } | 8818 } |
8821 | 8819 |
8822 private: | 8820 private: |
8823 WebRemoteFrame* remote_frame_; | 8821 WebRemoteFrame* remote_frame_; |
8824 }; | 8822 }; |
8825 | 8823 |
8826 } // anonymous namespace | 8824 } // anonymous namespace |
8827 | 8825 |
8828 TEST_F(WebFrameTest, SwapMainFrameWhileLoading) { | 8826 TEST_F(WebFrameTest, SwapMainFrameWhileLoading) { |
(...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11999 | 11997 |
12000 // Failing the original child frame navigation and trying to render fallback | 11998 // Failing the original child frame navigation and trying to render fallback |
12001 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 11999 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
12002 // caller won't attempt to replace the correctly empty frame with an error | 12000 // caller won't attempt to replace the correctly empty frame with an error |
12003 // page. | 12001 // page. |
12004 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12002 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
12005 child->MaybeRenderFallbackContent(WebURLError())); | 12003 child->MaybeRenderFallbackContent(WebURLError())); |
12006 } | 12004 } |
12007 | 12005 |
12008 } // namespace blink | 12006 } // namespace blink |
OLD | NEW |