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

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

Issue 13235003: Support the Text services framework based IME for Chrome AURA on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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
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 #include "ui/base/clipboard/clipboard.h"
9 9
10 #if defined(USE_AURA) 10 #if defined(USE_AURA)
11 #include "ui/aura/env.h" 11 #include "ui/aura/env.h"
12 #include "ui/aura/root_window.h" 12 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/aura_test_helper.h" 13 #include "ui/aura/test/aura_test_helper.h"
14 #endif 14 #endif
15 15
16 #if defined(OS_WIN)
17 #include "base/win/metro.h"
18 #include "ui/base/ime/win/tsf_bridge.h"
19 #endif
20
16 namespace views { 21 namespace views {
17 22
23 #if defined(OS_WIN)
24 bool ViewsTestBase::tsf_initialized_ = false;
25 #endif
26
18 ViewsTestBase::ViewsTestBase() 27 ViewsTestBase::ViewsTestBase()
19 : setup_called_(false), 28 : setup_called_(false),
20 teardown_called_(false) { 29 teardown_called_(false) {
21 } 30 }
22 31
23 ViewsTestBase::~ViewsTestBase() { 32 ViewsTestBase::~ViewsTestBase() {
24 CHECK(setup_called_) 33 CHECK(setup_called_)
25 << "You have overridden SetUp but never called super class's SetUp"; 34 << "You have overridden SetUp but never called super class's SetUp";
26 CHECK(teardown_called_) 35 CHECK(teardown_called_)
27 << "You have overrideen TearDown but never called super class's TearDown"; 36 << "You have overrideen TearDown but never called super class's TearDown";
28 } 37 }
29 38
30 void ViewsTestBase::SetUp() { 39 void ViewsTestBase::SetUp() {
31 testing::Test::SetUp(); 40 testing::Test::SetUp();
32 setup_called_ = true; 41 setup_called_ = true;
33 if (!views_delegate_.get()) 42 if (!views_delegate_.get())
34 views_delegate_.reset(new TestViewsDelegate()); 43 views_delegate_.reset(new TestViewsDelegate());
35 #if defined(USE_AURA) 44 #if defined(USE_AURA)
36 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 45 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
37 aura_test_helper_->SetUp(); 46 aura_test_helper_->SetUp();
38 #endif // USE_AURA 47 #endif // USE_AURA
48 #if defined(OS_WIN)
49 if (base::win::IsTSFAwareRequired() && !tsf_initialized_) {
50 tsf_initialized_ = true;
51 ui::TSFBridge::Initialize();
52 }
53 #endif
39 } 54 }
40 55
41 void ViewsTestBase::TearDown() { 56 void ViewsTestBase::TearDown() {
42 ui::Clipboard::DestroyClipboardForCurrentThread(); 57 ui::Clipboard::DestroyClipboardForCurrentThread();
43 58
44 // Flush the message loop because we have pending release tasks 59 // Flush the message loop because we have pending release tasks
45 // and these tasks if un-executed would upset Valgrind. 60 // and these tasks if un-executed would upset Valgrind.
46 RunPendingMessages(); 61 RunPendingMessages();
47 teardown_called_ = true; 62 teardown_called_ = true;
48 views_delegate_.reset(); 63 views_delegate_.reset();
(...skipping 22 matching lines...) Expand all
71 86
72 gfx::NativeView ViewsTestBase::GetContext() { 87 gfx::NativeView ViewsTestBase::GetContext() {
73 #if defined(USE_AURA) 88 #if defined(USE_AURA)
74 return aura_test_helper_->root_window(); 89 return aura_test_helper_->root_window();
75 #else 90 #else
76 return NULL; 91 return NULL;
77 #endif 92 #endif
78 } 93 }
79 94
80 } // namespace views 95 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698