summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
blob: 10b8a6b33b77b69bcaf4c4c919d249bb91a0dfd9 (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
// 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/tab_contents/test_tab_contents.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/test/testing_profile.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::SetUp() {
  contents_wrapper_.reset(new TabContentsWrapper(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();
}