summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
blob: 8ae1173cd6a82e6447707cc303dbbd3643d588bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2011 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_wrapper.h"

#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/test/testing_profile.h"
#include "content/browser/tab_contents/test_tab_contents.h"

TabContentsWrapperTestHarness::TabContentsWrapperTestHarness()
    : RenderViewHostTestHarness() {
}

TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() {
}

TestTabContents* TabContentsWrapperTestHarness::contents() {
  return static_cast<TestTabContents*>(contents_wrapper_.get()->tab_contents());
}

TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() {
  return contents_wrapper_.get();
}

void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) {
  contents_wrapper_.reset(new TabContentsWrapper(contents));
}

void TabContentsWrapperTestHarness::SetUp() {
  SetContents(CreateTestTabContents());
}

void TabContentsWrapperTestHarness::TearDown() {
  contents_wrapper_.reset();

  // Make sure that we flush any messages related to TabContents destruction
  // before we destroy the profile.
  MessageLoop::current()->RunAllPending();

  // Release the profile on the UI thread.
  message_loop_.DeleteSoon(FROM_HERE, profile_.release());
  message_loop_.RunAllPending();
}