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

Side by Side Diff: chrome/browser/ui/ash/volume_controller_browsertest_chromeos.cc

Issue 14314002: Implement new audio handler which talks to the new audio dbus apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser_tests compiling issue. 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 "chrome/browser/ui/ash/volume_controller_chromeos.h" 5 #include "chrome/browser/ui/ash/volume_controller_chromeos.h"
6 6
7 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/chromeos/audio/audio_handler.h" 8 #include "chrome/browser/chromeos/audio/audio_handler.h"
8 #include "chrome/browser/chromeos/audio/audio_mixer.h" 9 #include "chrome/browser/chromeos/audio/audio_mixer.h"
9 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "chromeos/audio/audio_pref_handler.h"
11 #include "ui/base/accelerators/accelerator.h" 13 #include "ui/base/accelerators/accelerator.h"
12 14
13 namespace { 15 namespace {
14 16
15 // Default volume as a percentage in the range [0.0, 100.0]. 17 // Default volume as a percentage in the range [0.0, 100.0].
16 const double kDefaultVolumePercent = 75.0; 18 const double kDefaultVolumePercent = 75.0;
17 19
18 class MockAudioMixer : public chromeos::AudioMixer { 20 class MockAudioMixer : public chromeos::AudioMixer {
19 public: 21 public:
20 MockAudioMixer() 22 MockAudioMixer()
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 79
78 // This class has to be browsertest because AudioHandler uses prefs_service. 80 // This class has to be browsertest because AudioHandler uses prefs_service.
79 class VolumeControllerTest : public InProcessBrowserTest { 81 class VolumeControllerTest : public InProcessBrowserTest {
80 public: 82 public:
81 VolumeControllerTest() {} 83 VolumeControllerTest() {}
82 84
83 virtual void SetUpOnMainThread() OVERRIDE { 85 virtual void SetUpOnMainThread() OVERRIDE {
84 // First we should shutdown the default audio handler. 86 // First we should shutdown the default audio handler.
85 chromeos::AudioHandler::Shutdown(); 87 chromeos::AudioHandler::Shutdown();
86 audio_mixer_ = new MockAudioMixer; 88 audio_mixer_ = new MockAudioMixer;
87 chromeos::AudioHandler::InitializeForTesting(audio_mixer_); 89 chromeos::AudioHandler::InitializeForTesting(audio_mixer_,
90 chromeos::AudioPrefHandler::Create(g_browser_process->local_state()));
88 } 91 }
89 92
90 virtual void CleanUpOnMainThread() OVERRIDE { 93 virtual void CleanUpOnMainThread() OVERRIDE {
91 chromeos::AudioHandler::Shutdown(); 94 chromeos::AudioHandler::Shutdown();
92 audio_mixer_ = NULL; 95 audio_mixer_ = NULL;
93 } 96 }
94 97
95 protected: 98 protected:
96 void SetVolumePercent(double percent) { 99 void SetVolumePercent(double percent) {
97 volume_controller_.SetVolumePercent(percent); 100 volume_controller_.SetVolumePercent(percent);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 EXPECT_DOUBLE_EQ(0.0, audio_mixer()->GetVolumePercent()); 205 EXPECT_DOUBLE_EQ(0.0, audio_mixer()->GetVolumePercent());
203 206
204 // Thus, further VolumeUp doesn't recover the volume, it's just slightly 207 // Thus, further VolumeUp doesn't recover the volume, it's just slightly
205 // bigger than 0. 208 // bigger than 0.
206 VolumeUp(); 209 VolumeUp();
207 EXPECT_LT(0.0, audio_mixer()->GetVolumePercent()); 210 EXPECT_LT(0.0, audio_mixer()->GetVolumePercent());
208 EXPECT_GT(initial_volume, audio_mixer()->GetVolumePercent()); 211 EXPECT_GT(initial_volume, audio_mixer()->GetVolumePercent());
209 } 212 }
210 213
211 } // namespace 214 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698