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

Side by Side Diff: chrome/test/base/view_event_test_base.cc

Issue 14678004: cros: Enable new cras audio handler by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 "chrome/test/base/view_event_test_base.h" 5 #include "chrome/test/base/view_event_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 21 matching lines...) Expand all
32 #include "ui/aura/env.h" 32 #include "ui/aura/env.h"
33 #include "ui/aura/root_window.h" 33 #include "ui/aura/root_window.h"
34 #include "ui/aura/test/aura_test_helper.h" 34 #include "ui/aura/test/aura_test_helper.h"
35 #endif 35 #endif
36 36
37 #if defined(OS_WIN) 37 #if defined(OS_WIN)
38 #include "base/win/metro.h" 38 #include "base/win/metro.h"
39 #include "ui/base/ime/win/tsf_bridge.h" 39 #include "ui/base/ime/win/tsf_bridge.h"
40 #endif 40 #endif
41 41
42 #if defined(OS_CHROMEOS)
43 #include "chromeos/audio/cras_audio_handler.h"
44 #endif
45
42 namespace { 46 namespace {
43 47
44 // View subclass that allows you to specify the preferred size. 48 // View subclass that allows you to specify the preferred size.
45 class TestView : public views::View { 49 class TestView : public views::View {
46 public: 50 public:
47 TestView() {} 51 TestView() {}
48 52
49 void SetPreferredSize(const gfx::Size& size) { 53 void SetPreferredSize(const gfx::Size& size) {
50 preferred_size_ = size; 54 preferred_size_ = size;
51 PreferredSizeChanged(); 55 PreferredSizeChanged();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when 109 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
106 // interactive_ui_tests is brought up on that platform. 110 // interactive_ui_tests is brought up on that platform.
107 gfx::Screen::SetScreenInstance( 111 gfx::Screen::SetScreenInstance(
108 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); 112 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
109 #else 113 #else
110 #if defined(ENABLE_MESSAGE_CENTER) 114 #if defined(ENABLE_MESSAGE_CENTER)
111 // Ash Shell can't just live on its own without a browser process, we need to 115 // Ash Shell can't just live on its own without a browser process, we need to
112 // also create the message center. 116 // also create the message center.
113 message_center::MessageCenter::Initialize(); 117 message_center::MessageCenter::Initialize();
114 #endif 118 #endif
119 #if defined(OS_CHROMEOS)
120 chromeos::CrasAudioHandler::InitializeForTesting();
121 #endif
115 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); 122 ash::Shell::CreateInstance(new ash::test::TestShellDelegate());
116 context = ash::Shell::GetPrimaryRootWindow(); 123 context = ash::Shell::GetPrimaryRootWindow();
117 #endif 124 #endif
118 #elif defined(USE_AURA) 125 #elif defined(USE_AURA)
119 // Instead of using the ash shell, use an AuraTestHelper to create and manage 126 // Instead of using the ash shell, use an AuraTestHelper to create and manage
120 // the test screen. 127 // the test screen.
121 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 128 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
122 aura_test_helper_->SetUp(); 129 aura_test_helper_->SetUp();
123 context = aura_test_helper_->root_window(); 130 context = aura_test_helper_->root_window();
124 #endif 131 #endif
(...skipping 11 matching lines...) Expand all
136 #else 143 #else
137 window_->Close(); 144 window_->Close();
138 content::RunAllPendingInMessageLoop(); 145 content::RunAllPendingInMessageLoop();
139 #endif 146 #endif
140 window_ = NULL; 147 window_ = NULL;
141 } 148 }
142 #if defined(USE_ASH) 149 #if defined(USE_ASH)
143 #if defined(OS_WIN) 150 #if defined(OS_WIN)
144 #else 151 #else
145 ash::Shell::DeleteInstance(); 152 ash::Shell::DeleteInstance();
146 #if defined(ENABLE_MESSAGE_CENTER) 153 #if defined(ENABLE_MESSAGE_CENTER)
James Cook 2013/04/30 20:55:05 Don't you need to shutdown the CrasAudioHandler?
rkc 2013/04/30 23:04:57 Don't really need to, but should - otherwise ASAN
147 // Ash Shell can't just live on its own without a browser process, we need to 154 // Ash Shell can't just live on its own without a browser process, we need to
148 // also shut down the message center. 155 // also shut down the message center.
149 message_center::MessageCenter::Shutdown(); 156 message_center::MessageCenter::Shutdown();
150 #endif 157 #endif
151 aura::Env::DeleteInstance(); 158 aura::Env::DeleteInstance();
152 #endif 159 #endif
153 #elif defined(USE_AURA) 160 #elif defined(USE_AURA)
154 aura_test_helper_->TearDown(); 161 aura_test_helper_->TearDown();
155 #endif 162 #endif
156 ui::CompositorTestSupport::Terminate(); 163 ui::CompositorTestSupport::Terminate();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 dnd_thread_.reset(NULL); 226 dnd_thread_.reset(NULL);
220 } 227 }
221 228
222 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 229 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
223 StopBackgroundThread(); 230 StopBackgroundThread();
224 231
225 task.Run(); 232 task.Run();
226 if (HasFatalFailure()) 233 if (HasFatalFailure())
227 Done(); 234 Done();
228 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698