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