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

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: rebase 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 }
104 106
105 protected: 107 protected:
106 void StartTheFirstSession(FakeMidiManagerClient* client) { 108 void StartTheFirstSession(FakeMidiManagerClient* client) {
107 EXPECT_FALSE(manager_->start_initialization_is_called_); 109 EXPECT_FALSE(manager_->start_initialization_is_called_);
108 EXPECT_EQ(0U, manager_->GetClientCount()); 110 EXPECT_EQ(0U, manager_->GetClientCount());
109 EXPECT_EQ(0U, manager_->GetPendingClientCount()); 111 EXPECT_EQ(0U, manager_->GetPendingClientCount());
110 manager_->StartSession(client); 112 manager_->StartSession(client);
111 EXPECT_EQ(0U, manager_->GetClientCount()); 113 EXPECT_EQ(0U, manager_->GetClientCount());
112 EXPECT_EQ(1U, manager_->GetPendingClientCount()); 114 EXPECT_EQ(1U, manager_->GetPendingClientCount());
113 EXPECT_TRUE(manager_->start_initialization_is_called_); 115 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. 262 // Do not change the condition for disabling this test.
261 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \ 263 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \
262 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID) 264 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID)
263 EXPECT_EQ(Result::NOT_SUPPORTED, result); 265 EXPECT_EQ(Result::NOT_SUPPORTED, result);
264 #elif defined(USE_ALSA) 266 #elif defined(USE_ALSA)
265 // Temporary until http://crbug.com/371230 is resolved. 267 // Temporary until http://crbug.com/371230 is resolved.
266 EXPECT_TRUE(result == Result::OK || result == Result::INITIALIZATION_ERROR); 268 EXPECT_TRUE(result == Result::OK || result == Result::INITIALIZATION_ERROR);
267 #else 269 #else
268 EXPECT_EQ(Result::OK, result); 270 EXPECT_EQ(Result::OK, result);
269 #endif 271 #endif
272
273 manager->Shutdown();
270 } 274 }
271 275
272 } // namespace 276 } // namespace
273 277
274 } // namespace midi 278 } // namespace midi
275 } // namespace media 279 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698