OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
10 #include "content/test/test_browser_context.h" | 10 #include "content/test/test_browser_context.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Destroying the delegate while it is still the delegate | 59 // Destroying the delegate while it is still the delegate |
60 // for a WebContentsImpl should unregister it. | 60 // for a WebContentsImpl should unregister it. |
61 contents_b->SetDelegate(delegate.get()); | 61 contents_b->SetDelegate(delegate.get()); |
62 EXPECT_EQ(delegate.get(), contents_a->GetDelegate()); | 62 EXPECT_EQ(delegate.get(), contents_a->GetDelegate()); |
63 EXPECT_EQ(delegate.get(), contents_b->GetDelegate()); | 63 EXPECT_EQ(delegate.get(), contents_b->GetDelegate()); |
64 delegate.reset(NULL); | 64 delegate.reset(NULL); |
65 EXPECT_TRUE(contents_a->GetDelegate() == NULL); | 65 EXPECT_TRUE(contents_a->GetDelegate() == NULL); |
66 EXPECT_TRUE(contents_b->GetDelegate() == NULL); | 66 EXPECT_TRUE(contents_b->GetDelegate() == NULL); |
67 | 67 |
68 // Destroy the tab contents and run the message loop to prevent leaks. | 68 // Destroy the WebContentses and run the message loop to prevent leaks. |
69 contents_a.reset(NULL); | 69 contents_a.reset(NULL); |
70 contents_b.reset(NULL); | 70 contents_b.reset(NULL); |
71 loop.RunAllPending(); | 71 loop.RunAllPending(); |
72 } | 72 } |
73 | 73 |
74 } // namespace | 74 } // namespace |
OLD | NEW |