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

Side by Side Diff: chromecast/base/device_capabilities_impl_unittest.cc

Issue 1642143003: [Chromecast] Log sample rate changes and tweak audio logging output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: sample rate logging fix Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromecast/base/device_capabilities_impl.h" 5 #include "chromecast/base/device_capabilities_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 SetValidatedValue(key, std::move(init_value)); 49 SetValidatedValue(key, std::move(init_value));
50 } 50 }
51 51
52 // Unregisters itself as Validator. 52 // Unregisters itself as Validator.
53 ~FakeCapabilityManagerSimple() override { 53 ~FakeCapabilityManagerSimple() override {
54 capabilities()->Unregister(key_, this); 54 capabilities()->Unregister(key_, this);
55 } 55 }
56 56
57 void Validate(const std::string& path, 57 void Validate(const std::string& path,
58 scoped_ptr<base::Value> proposed_value) override { 58 scoped_ptr<base::Value> proposed_value) override {
59 ASSERT_TRUE(path.find(key_) == 0); 59 ASSERT_EQ(path.find(key_), 0ul);
60 if (accept_changes_) 60 if (accept_changes_)
61 SetValidatedValue(path, std::move(proposed_value)); 61 SetValidatedValue(path, std::move(proposed_value));
62 } 62 }
63 63
64 private: 64 private:
65 const std::string key_; 65 const std::string key_;
66 const bool accept_changes_; 66 const bool accept_changes_;
67 }; 67 };
68 68
69 // Used to test that capabilities/validator can be read and written in 69 // Used to test that capabilities/validator can be read and written in
(...skipping 18 matching lines...) Expand all
88 } 88 }
89 89
90 private: 90 private:
91 const std::string key_; 91 const std::string key_;
92 }; 92 };
93 93
94 // Used to test that capabilities/validators can be read and written in 94 // Used to test that capabilities/validators can be read and written in
95 // OnCapabilitiesChanged() without encountering deadlocks/unexpected behavior. 95 // OnCapabilitiesChanged() without encountering deadlocks/unexpected behavior.
96 class FakeCapabilitiesObserver : public DeviceCapabilities::Observer { 96 class FakeCapabilitiesObserver : public DeviceCapabilities::Observer {
97 public: 97 public:
98 FakeCapabilitiesObserver(DeviceCapabilities* capabilities) 98 explicit FakeCapabilitiesObserver(DeviceCapabilities* capabilities)
99 : capabilities_(capabilities), removed_as_observer(false) { 99 : capabilities_(capabilities), removed_as_observer(false) {
100 capabilities_->AddCapabilitiesObserver(this); 100 capabilities_->AddCapabilitiesObserver(this);
101 } 101 }
102 102
103 ~FakeCapabilitiesObserver() override { 103 ~FakeCapabilitiesObserver() override {
104 if (!removed_as_observer) 104 if (!removed_as_observer)
105 capabilities_->RemoveCapabilitiesObserver(this); 105 capabilities_->RemoveCapabilitiesObserver(this);
106 } 106 }
107 107
108 // Runs TestBasicOperations(). 108 // Runs TestBasicOperations().
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 capabilities()->SetCapability( 579 capabilities()->SetCapability(
580 "dummy_validate_key", make_scoped_ptr(new base::FundamentalValue(true))); 580 "dummy_validate_key", make_scoped_ptr(new base::FundamentalValue(true)));
581 base::RunLoop().RunUntilIdle(); 581 base::RunLoop().RunUntilIdle();
582 582
583 // Check that FakeCapabilityManagerComplex::Validate() ran and that behavior 583 // Check that FakeCapabilityManagerComplex::Validate() ran and that behavior
584 // was successful 584 // was successful
585 AssertBasicOperationsSuccessful(capabilities()); 585 AssertBasicOperationsSuccessful(capabilities());
586 } 586 }
587 587
588 } // namespace chromecast 588 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/base/device_capabilities_impl.h ('k') | chromecast/media/cma/backend/alsa/audio_decoder_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698