| 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 "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 #include "chrome/test/testing_profile.h" | 8 #include "chrome/test/testing_profile.h" |
| 9 #include "content/browser/tab_contents/test_tab_contents.h" | 9 #include "content/browser/tab_contents/test_tab_contents.h" |
| 10 | 10 |
| 11 TabContentsWrapperTestHarness::TabContentsWrapperTestHarness() | 11 TabContentsWrapperTestHarness::TabContentsWrapperTestHarness() |
| 12 : RenderViewHostTestHarness() { | 12 : RenderViewHostTestHarness() { |
| 13 } | 13 } |
| 14 | 14 |
| 15 TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { | 15 TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 TestTabContents* TabContentsWrapperTestHarness::contents() { | 18 TestTabContents* TabContentsWrapperTestHarness::contents() { |
| 19 return static_cast<TestTabContents*>(contents_wrapper_.get()->tab_contents()); | 19 return static_cast<TestTabContents*>(contents_wrapper_->tab_contents()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { | 22 TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { |
| 23 return contents_wrapper_.get(); | 23 return contents_wrapper_.get(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) { | 26 void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) { |
| 27 contents_wrapper_.reset(new TabContentsWrapper(contents)); | 27 contents_wrapper_.reset(new TabContentsWrapper(contents)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void TabContentsWrapperTestHarness::SetContentsWrapper( | |
| 31 TabContentsWrapper* contents) { | |
| 32 contents_wrapper_.reset(contents); | |
| 33 } | |
| 34 | |
| 35 void TabContentsWrapperTestHarness::SetUp() { | 30 void TabContentsWrapperTestHarness::SetUp() { |
| 36 SetContents(CreateTestTabContents()); | 31 SetContents(CreateTestTabContents()); |
| 37 } | 32 } |
| 38 | 33 |
| 39 void TabContentsWrapperTestHarness::TearDown() { | 34 void TabContentsWrapperTestHarness::TearDown() { |
| 40 contents_wrapper_.reset(); | 35 contents_wrapper_.reset(); |
| 41 | 36 |
| 42 // Make sure that we flush any messages related to TabContents destruction | 37 // Make sure that we flush any messages related to TabContents destruction |
| 43 // before we destroy the profile. | 38 // before we destroy the profile. |
| 44 MessageLoop::current()->RunAllPending(); | 39 MessageLoop::current()->RunAllPending(); |
| 45 | 40 |
| 46 // Release the profile on the UI thread. | 41 // Release the profile on the UI thread. |
| 47 message_loop_.DeleteSoon(FROM_HERE, profile_.release()); | 42 message_loop_.DeleteSoon(FROM_HERE, profile_.release()); |
| 48 message_loop_.RunAllPending(); | 43 message_loop_.RunAllPending(); |
| 49 } | 44 } |
| OLD | NEW |