| OLD | NEW |
| 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 "chrome/browser/copresence/chrome_whispernet_client.h" | 5 #include "chrome/browser/copresence/chrome_whispernet_client.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 protected: | 125 protected: |
| 126 void InitCallback(bool success) { | 126 void InitCallback(bool success) { |
| 127 EXPECT_TRUE(success); | 127 EXPECT_TRUE(success); |
| 128 initialized_ = true; | 128 initialized_ = true; |
| 129 ASSERT_TRUE(run_loop_); | 129 ASSERT_TRUE(run_loop_); |
| 130 run_loop_->Quit(); | 130 run_loop_->Quit(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void SamplesCallback( | 133 void SamplesCallback( |
| 134 copresence::AudioType type, |
| 134 const std::string& token, | 135 const std::string& token, |
| 135 copresence::AudioType type, | |
| 136 const scoped_refptr<media::AudioBusRefCounted>& samples) { | 136 const scoped_refptr<media::AudioBusRefCounted>& samples) { |
| 137 EXPECT_EQ(expected_token_, token); | 137 EXPECT_EQ(expected_token_, token); |
| 138 EXPECT_EQ(expected_audible_, type == copresence::AUDIBLE); | 138 EXPECT_EQ(expected_audible_, type == copresence::AUDIBLE); |
| 139 saved_samples_ = samples; | 139 saved_samples_ = samples; |
| 140 ASSERT_TRUE(run_loop_); | 140 ASSERT_TRUE(run_loop_); |
| 141 run_loop_->Quit(); | 141 run_loop_->Quit(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void TokensCallback(const std::vector<copresence::AudioToken>& tokens) { | 144 void TokensCallback(const std::vector<copresence::AudioToken>& tokens) { |
| 145 ASSERT_TRUE(run_loop_); | 145 ASSERT_TRUE(run_loop_); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 EncodeTokenAndSaveSamples(false); | 188 EncodeTokenAndSaveSamples(false); |
| 189 DecodeSamplesAndVerifyToken(false); | 189 DecodeSamplesAndVerifyToken(false); |
| 190 DetectBroadcast(); | 190 DetectBroadcast(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, Audible) { | 193 IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, Audible) { |
| 194 InitializeWhispernet(); | 194 InitializeWhispernet(); |
| 195 EncodeTokenAndSaveSamples(true); | 195 EncodeTokenAndSaveSamples(true); |
| 196 DecodeSamplesAndVerifyToken(true); | 196 DecodeSamplesAndVerifyToken(true); |
| 197 } | 197 } |
| OLD | NEW |