| Index: chrome/browser/ui/tab_contents/test_tab_contents.cc
|
| diff --git a/chrome/browser/ui/tab_contents/test_tab_contents.cc b/chrome/browser/ui/tab_contents/test_tab_contents.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a28e1176a7a1fe13c547a7e1c880d93c923e4df9
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/tab_contents/test_tab_contents.cc
|
| @@ -0,0 +1,49 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/tab_contents/test_tab_contents.h"
|
| +
|
| +#include "chrome/browser/ui/tab_contents/tab_contents.h"
|
| +#include "chrome/test/base/testing_profile.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +
|
| +using content::WebContents;
|
| +
|
| +TabContentsTestHarness::TabContentsTestHarness()
|
| + : ChromeRenderViewHostTestHarness() {
|
| +}
|
| +
|
| +TabContentsTestHarness::~TabContentsTestHarness() {
|
| +}
|
| +
|
| +WebContents* TabContentsTestHarness::web_contents() {
|
| + return tab_contents_.get() ? tab_contents_->web_contents() : NULL;
|
| +}
|
| +
|
| +TabContents* TabContentsTestHarness::tab_contents() {
|
| + return tab_contents_.get();
|
| +}
|
| +
|
| +void TabContentsTestHarness::SetContents(WebContents* contents) {
|
| + tab_contents_.reset(contents ? new TabContents(contents) : NULL);
|
| +}
|
| +
|
| +void TabContentsTestHarness::SetUp() {
|
| + ChromeRenderViewHostTestHarness::SetUp();
|
| + SetContents(CreateTestWebContents());
|
| +}
|
| +
|
| +void TabContentsTestHarness::TearDown() {
|
| + tab_contents_.reset();
|
| +
|
| + // Make sure that we flush any messages related to WebContents destruction
|
| + // before we destroy the browser context.
|
| + MessageLoop::current()->RunAllPending();
|
| +
|
| + // Release the browser context on the UI thread.
|
| + message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
|
| + message_loop_.RunAllPending();
|
| +
|
| + ChromeRenderViewHostTestHarness::TearDown();
|
| +}
|
|
|