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

Side by Side Diff: media/midi/midi_manager_unittest.cc

Issue 1315793008: Web MIDI: introduce MidiManager::Shutdown to shutdown gracefully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make sure to run Finalize() Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "media/midi/midi_manager.h" 5 #include "media/midi/midi_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 bool wait_for_result_; 93 bool wait_for_result_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(FakeMidiManagerClient); 95 DISALLOW_COPY_AND_ASSIGN(FakeMidiManagerClient);
96 }; 96 };
97 97
98 class MidiManagerTest : public ::testing::Test { 98 class MidiManagerTest : public ::testing::Test {
99 public: 99 public:
100 MidiManagerTest() 100 MidiManagerTest()
101 : manager_(new FakeMidiManager), 101 : manager_(new FakeMidiManager),
102 message_loop_(new base::MessageLoop) {} 102 message_loop_(new base::MessageLoop) {}
103 ~MidiManagerTest() override {} 103 ~MidiManagerTest() override {
104 manager_->Shutdown();
105 base::RunLoop run_loop;
106 run_loop.RunUntilIdle();
107 }
104 108
105 protected: 109 protected:
106 void StartTheFirstSession(FakeMidiManagerClient* client) { 110 void StartTheFirstSession(FakeMidiManagerClient* client) {
107 EXPECT_FALSE(manager_->start_initialization_is_called_); 111 EXPECT_FALSE(manager_->start_initialization_is_called_);
108 EXPECT_EQ(0U, manager_->GetClientCount()); 112 EXPECT_EQ(0U, manager_->GetClientCount());
109 EXPECT_EQ(0U, manager_->GetPendingClientCount()); 113 EXPECT_EQ(0U, manager_->GetPendingClientCount());
110 manager_->StartSession(client); 114 manager_->StartSession(client);
111 EXPECT_EQ(0U, manager_->GetClientCount()); 115 EXPECT_EQ(0U, manager_->GetClientCount());
112 EXPECT_EQ(1U, manager_->GetPendingClientCount()); 116 EXPECT_EQ(1U, manager_->GetPendingClientCount());
113 EXPECT_TRUE(manager_->start_initialization_is_called_); 117 EXPECT_TRUE(manager_->start_initialization_is_called_);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Do not change the condition for disabling this test. 264 // Do not change the condition for disabling this test.
261 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \ 265 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \
262 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID) 266 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID)
263 EXPECT_EQ(Result::NOT_SUPPORTED, result); 267 EXPECT_EQ(Result::NOT_SUPPORTED, result);
264 #elif defined(USE_ALSA) 268 #elif defined(USE_ALSA)
265 // Temporary until http://crbug.com/371230 is resolved. 269 // Temporary until http://crbug.com/371230 is resolved.
266 EXPECT_TRUE(result == Result::OK || result == Result::INITIALIZATION_ERROR); 270 EXPECT_TRUE(result == Result::OK || result == Result::INITIALIZATION_ERROR);
267 #else 271 #else
268 EXPECT_EQ(Result::OK, result); 272 EXPECT_EQ(Result::OK, result);
269 #endif 273 #endif
274
275 manager->Shutdown();
276 base::RunLoop run_loop;
277 run_loop.RunUntilIdle();
270 } 278 }
271 279
272 } // namespace 280 } // namespace
273 281
274 } // namespace midi 282 } // namespace midi
275 } // namespace media 283 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698