| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" |
| 6 |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/browser/web_contents.h" |
| 10 |
| 11 using content::WebContents; |
| 12 |
| 13 TabContentsTestHarness::TabContentsTestHarness() |
| 14 : ChromeRenderViewHostTestHarness() { |
| 15 } |
| 16 |
| 17 TabContentsTestHarness::~TabContentsTestHarness() { |
| 18 } |
| 19 |
| 20 WebContents* TabContentsTestHarness::web_contents() { |
| 21 return tab_contents_.get() ? tab_contents_->web_contents() : NULL; |
| 22 } |
| 23 |
| 24 TabContents* TabContentsTestHarness::tab_contents() { |
| 25 return tab_contents_.get(); |
| 26 } |
| 27 |
| 28 void TabContentsTestHarness::SetContents(WebContents* contents) { |
| 29 tab_contents_.reset(contents ? new TabContents(contents) : NULL); |
| 30 } |
| 31 |
| 32 void TabContentsTestHarness::SetUp() { |
| 33 ChromeRenderViewHostTestHarness::SetUp(); |
| 34 SetContents(CreateTestWebContents()); |
| 35 } |
| 36 |
| 37 void TabContentsTestHarness::TearDown() { |
| 38 tab_contents_.reset(); |
| 39 |
| 40 // Make sure that we flush any messages related to WebContents destruction |
| 41 // before we destroy the browser context. |
| 42 MessageLoop::current()->RunAllPending(); |
| 43 |
| 44 // Release the browser context on the UI thread. |
| 45 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 46 message_loop_.RunAllPending(); |
| 47 |
| 48 ChromeRenderViewHostTestHarness::TearDown(); |
| 49 } |
| OLD | NEW |