Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: ui/views/test/views_test_base.cc

Issue 10911233: Now that unit_tests are clean, fix views_unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/test/views_test_base.h" 5 #include "ui/views/test/views_test_base.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "ui/base/clipboard/clipboard.h"
8 9
9 #if defined(USE_AURA) 10 #if defined(USE_AURA)
10 #include "ui/aura/env.h" 11 #include "ui/aura/env.h"
11 #include "ui/aura/test/aura_test_helper.h" 12 #include "ui/aura/test/aura_test_helper.h"
12 #endif 13 #endif
13 14
14 namespace views { 15 namespace views {
15 16
16 ViewsTestBase::ViewsTestBase() 17 ViewsTestBase::ViewsTestBase()
17 : setup_called_(false), 18 : setup_called_(false),
(...skipping 12 matching lines...) Expand all
30 setup_called_ = true; 31 setup_called_ = true;
31 if (!views_delegate_.get()) 32 if (!views_delegate_.get())
32 views_delegate_.reset(new TestViewsDelegate()); 33 views_delegate_.reset(new TestViewsDelegate());
33 #if defined(USE_AURA) 34 #if defined(USE_AURA)
34 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 35 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
35 aura_test_helper_->SetUp(); 36 aura_test_helper_->SetUp();
36 #endif // USE_AURA 37 #endif // USE_AURA
37 } 38 }
38 39
39 void ViewsTestBase::TearDown() { 40 void ViewsTestBase::TearDown() {
41 ui::Clipboard::DestroyClipboardForCurrentThread();
42
40 // Flush the message loop because we have pending release tasks 43 // Flush the message loop because we have pending release tasks
41 // and these tasks if un-executed would upset Valgrind. 44 // and these tasks if un-executed would upset Valgrind.
42 RunPendingMessages(); 45 RunPendingMessages();
43 teardown_called_ = true; 46 teardown_called_ = true;
44 views_delegate_.reset(); 47 views_delegate_.reset();
45 testing::Test::TearDown(); 48 testing::Test::TearDown();
46 #if defined(USE_AURA) 49 #if defined(USE_AURA)
47 aura_test_helper_->TearDown(); 50 aura_test_helper_->TearDown();
48 #endif 51 #endif
49 } 52 }
50 53
51 void ViewsTestBase::RunPendingMessages() { 54 void ViewsTestBase::RunPendingMessages() {
52 base::RunLoop run_loop; 55 base::RunLoop run_loop;
53 #if defined(USE_AURA) 56 #if defined(USE_AURA)
54 run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher()); 57 run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher());
55 #endif 58 #endif
56 run_loop.RunUntilIdle(); 59 run_loop.RunUntilIdle();
57 } 60 }
58 61
59 } // namespace views 62 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698