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

Side by Side Diff: components/copresence/handlers/audio/audio_directive_handler_unittest.cc

Issue 453203002: Fixing memory leak in TimedMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabling broken test Created 6 years, 4 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 "components/copresence/handlers/audio/audio_directive_handler.h" 5 #include "components/copresence/handlers/audio/audio_directive_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/copresence/test/audio_test_support.h" 9 #include "components/copresence/test/audio_test_support.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // This order is important. We want the message loop to get created before 69 // This order is important. We want the message loop to get created before
70 // our the audio directive handler since the directive list ctor (invoked 70 // our the audio directive handler since the directive list ctor (invoked
71 // from the directive handler ctor) will post tasks. 71 // from the directive handler ctor) will post tasks.
72 base::MessageLoop message_loop_; 72 base::MessageLoop message_loop_;
73 scoped_ptr<MockAudioDirectiveHandler> directive_handler_; 73 scoped_ptr<MockAudioDirectiveHandler> directive_handler_;
74 74
75 private: 75 private:
76 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveHandlerTest); 76 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveHandlerTest);
77 }; 77 };
78 78
79 // TODO(rkc): Find and fix the memory leak here. 79 // TODO(rkc): This test is broken, possibly due to the changes for audible.
80 #define MAYBE_Basic DISABLED_Basic 80 TEST_F(AudioDirectiveHandlerTest, DISABLED_Basic) {
81
82 TEST_F(AudioDirectiveHandlerTest, MAYBE_Basic) {
83 const base::TimeDelta kSmallTtl = base::TimeDelta::FromMilliseconds(0x1337); 81 const base::TimeDelta kSmallTtl = base::TimeDelta::FromMilliseconds(0x1337);
84 const base::TimeDelta kLargeTtl = base::TimeDelta::FromSeconds(0x7331); 82 const base::TimeDelta kLargeTtl = base::TimeDelta::FromSeconds(0x7331);
85 83
86 // Expect to play and record instructions for 'less' than the TTL specified, 84 // Expect to play and record instructions for 'less' than the TTL specified,
87 // since by the time that the token would have gotten encoded, we would 85 // since by the time that the token would have gotten encoded, we would
88 // have (TTL - time_to_encode) left to play on that instruction. 86 // have (TTL - time_to_encode) left to play on that instruction.
89 EXPECT_CALL(*directive_handler_, PlayAudio(_, testing::Le(kLargeTtl))) 87 EXPECT_CALL(*directive_handler_, PlayAudio(_, testing::Le(kLargeTtl)))
90 .Times(3); 88 .Times(3);
91 directive_handler_->AddInstruction(CreateTransmitInstruction("token1"), 89 directive_handler_->AddInstruction(CreateTransmitInstruction("token1"),
92 kLargeTtl); 90 kLargeTtl);
93 directive_handler_->AddInstruction(CreateTransmitInstruction("token2"), 91 directive_handler_->AddInstruction(CreateTransmitInstruction("token2"),
94 kLargeTtl); 92 kLargeTtl);
95 directive_handler_->AddInstruction(CreateTransmitInstruction("token3"), 93 directive_handler_->AddInstruction(CreateTransmitInstruction("token3"),
96 kSmallTtl); 94 kSmallTtl);
97 95
98 EXPECT_CALL(*directive_handler_, RecordAudio(Le(kLargeTtl))).Times(3); 96 EXPECT_CALL(*directive_handler_, RecordAudio(Le(kLargeTtl))).Times(3);
99 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); 97 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl);
100 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl); 98 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl);
101 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); 99 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl);
102 } 100 }
103 101
104 // TODO(rkc): When we are keeping track of which token we're currently playing, 102 // TODO(rkc): When we are keeping track of which token we're currently playing,
105 // add tests to make sure we don't replay if we get a token with a lower ttl 103 // add tests to make sure we don't replay if we get a token with a lower ttl
106 // than the current active. 104 // than the current active.
107 105
108 } // namespace copresence 106 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698