| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
| 9 #include "content/browser/tab_contents/tab_contents_delegate.h" | 9 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 10 #include "content/test/test_browser_context.h" | 10 #include "content/test/test_browser_context.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 virtual void LoadingStateChanged(TabContents* source) OVERRIDE {} | 51 virtual void LoadingStateChanged(TabContents* source) OVERRIDE {} |
| 52 | 52 |
| 53 virtual void LoadProgressChanged(double progress) OVERRIDE {} | 53 virtual void LoadProgressChanged(double progress) OVERRIDE {} |
| 54 | 54 |
| 55 virtual void CloseContents(TabContents* source) OVERRIDE {} | 55 virtual void CloseContents(TabContents* source) OVERRIDE {} |
| 56 | 56 |
| 57 virtual void MoveContents(TabContents* source, | 57 virtual void MoveContents(TabContents* source, |
| 58 const gfx::Rect& pos) OVERRIDE { | 58 const gfx::Rect& pos) OVERRIDE { |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void UpdateTargetURL(TabContents* source, const GURL& url) OVERRIDE {} | 61 virtual void UpdateTargetURL(TabContents* source, int32 page_id, |
| 62 const GURL& url) {} |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 TEST(TabContentsDelegateTest, UnregisterInDestructor) { | 65 TEST(TabContentsDelegateTest, UnregisterInDestructor) { |
| 65 MessageLoop loop(MessageLoop::TYPE_UI); | 66 MessageLoop loop(MessageLoop::TYPE_UI); |
| 66 TestBrowserContext browser_context; | 67 TestBrowserContext browser_context; |
| 67 | 68 |
| 68 scoped_ptr<TabContents> contents_a( | 69 scoped_ptr<TabContents> contents_a( |
| 69 new TabContents(&browser_context, NULL, 0, NULL, NULL)); | 70 new TabContents(&browser_context, NULL, 0, NULL, NULL)); |
| 70 scoped_ptr<TabContents> contents_b( | 71 scoped_ptr<TabContents> contents_b( |
| 71 new TabContents(&browser_context, NULL, 0, NULL, NULL)); | 72 new TabContents(&browser_context, NULL, 0, NULL, NULL)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_TRUE(contents_a->delegate() == NULL); | 104 EXPECT_TRUE(contents_a->delegate() == NULL); |
| 104 EXPECT_TRUE(contents_b->delegate() == NULL); | 105 EXPECT_TRUE(contents_b->delegate() == NULL); |
| 105 | 106 |
| 106 // Destroy the tab contents and run the message loop to prevent leaks. | 107 // Destroy the tab contents and run the message loop to prevent leaks. |
| 107 contents_a.reset(NULL); | 108 contents_a.reset(NULL); |
| 108 contents_b.reset(NULL); | 109 contents_b.reset(NULL); |
| 109 loop.RunAllPending(); | 110 loop.RunAllPending(); |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace | 113 } // namespace |
| OLD | NEW |