OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/browser/frame_host/navigator_impl.h" | 9 #include "content/browser/frame_host/navigator_impl.h" |
10 #include "content/browser/frame_host/render_frame_host_factory.h" | 10 #include "content/browser/frame_host/render_frame_host_factory.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 // Gets and resets the log, which is a string of what happened. | 57 // Gets and resets the log, which is a string of what happened. |
58 std::string GetLog() { | 58 std::string GetLog() { |
59 std::string result = log_; | 59 std::string result = log_; |
60 log_.clear(); | 60 log_.clear(); |
61 return result; | 61 return result; |
62 } | 62 } |
63 | 63 |
64 // content::WebContentsObserver implementation. | 64 // content::WebContentsObserver implementation. |
65 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE { | 65 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) override { |
66 LogWhatHappened("RenderFrameCreated", render_frame_host); | 66 LogWhatHappened("RenderFrameCreated", render_frame_host); |
67 } | 67 } |
68 | 68 |
69 virtual void RenderFrameHostChanged(RenderFrameHost* old_host, | 69 virtual void RenderFrameHostChanged(RenderFrameHost* old_host, |
70 RenderFrameHost* new_host) OVERRIDE { | 70 RenderFrameHost* new_host) override { |
71 if (old_host) | 71 if (old_host) |
72 LogWhatHappened("RenderFrameChanged(old)", old_host); | 72 LogWhatHappened("RenderFrameChanged(old)", old_host); |
73 LogWhatHappened("RenderFrameChanged(new)", new_host); | 73 LogWhatHappened("RenderFrameChanged(new)", new_host); |
74 } | 74 } |
75 | 75 |
76 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE { | 76 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) override { |
77 LogWhatHappened("RenderFrameDeleted", render_frame_host); | 77 LogWhatHappened("RenderFrameDeleted", render_frame_host); |
78 } | 78 } |
79 | 79 |
80 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE { | 80 virtual void RenderProcessGone(base::TerminationStatus status) override { |
81 LogWhatHappened("RenderProcessGone"); | 81 LogWhatHappened("RenderProcessGone"); |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 void LogWhatHappened(const std::string& event_name) { | 85 void LogWhatHappened(const std::string& event_name) { |
86 if (!log_.empty()) { | 86 if (!log_.empty()) { |
87 log_.append("\n"); | 87 log_.append("\n"); |
88 } | 88 } |
89 log_.append(event_name + " -> "); | 89 log_.append(event_name + " -> "); |
90 AppendTreeNodeState( | 90 AppendTreeNodeState( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); | 222 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); |
223 EXPECT_EQ( | 223 EXPECT_EQ( |
224 "RenderFrameDeleted(22) -> 1: []\n" | 224 "RenderFrameDeleted(22) -> 1: []\n" |
225 "RenderFrameDeleted(23) -> 1: []\n" | 225 "RenderFrameDeleted(23) -> 1: []\n" |
226 "RenderProcessGone -> 1: []", | 226 "RenderProcessGone -> 1: []", |
227 activity.GetLog()); | 227 activity.GetLog()); |
228 } | 228 } |
229 | 229 |
230 } // namespace | 230 } // namespace |
231 } // namespace content | 231 } // namespace content |
OLD | NEW |