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

Side by Side Diff: chromeos/network/managed_network_configuration_handler_unittest.cc

Issue 2352853002: Disallow redundant Bind calls. (Closed)
Patch Set: static_assert message tweak Created 4 years, 2 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <iostream> 5 #include <iostream>
6 #include <memory> 6 #include <memory>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 for (base::DictionaryValue::Iterator it(*entries); !it.IsAtEnd(); 131 for (base::DictionaryValue::Iterator it(*entries); !it.IsAtEnd();
132 it.Advance()) { 132 it.Advance()) {
133 entry_paths->AppendString(it.key()); 133 entry_paths->AppendString(it.key());
134 } 134 }
135 135
136 ASSERT_TRUE(base::ContainsKey(profile_to_user_, profile_path.value())); 136 ASSERT_TRUE(base::ContainsKey(profile_to_user_, profile_path.value()));
137 const std::string& userhash = profile_to_user_[profile_path.value()]; 137 const std::string& userhash = profile_to_user_[profile_path.value()];
138 result->SetStringWithoutPathExpansion(shill::kUserHashProperty, userhash); 138 result->SetStringWithoutPathExpansion(shill::kUserHashProperty, userhash);
139 139
140 base::ThreadTaskRunnerHandle::Get()->PostTask( 140 base::ThreadTaskRunnerHandle::Get()->PostTask(
141 FROM_HERE, base::Bind(base::Bind(&DereferenceAndCall, callback), 141 FROM_HERE, base::Bind(&DereferenceAndCall, callback,
142 base::Owned(result.release()))); 142 base::Owned(result.release())));
143 } 143 }
144 144
145 void GetEntry(const dbus::ObjectPath& profile_path, 145 void GetEntry(const dbus::ObjectPath& profile_path,
146 const std::string& entry_path, 146 const std::string& entry_path,
147 const DictionaryValueCallbackWithoutStatus& callback, 147 const DictionaryValueCallbackWithoutStatus& callback,
148 const ErrorCallback& error_callback) { 148 const ErrorCallback& error_callback) {
149 base::DictionaryValue* entries = NULL; 149 base::DictionaryValue* entries = NULL;
150 profile_entries_.GetDictionaryWithoutPathExpansion(profile_path.value(), 150 profile_entries_.GetDictionaryWithoutPathExpansion(profile_path.value(),
151 &entries); 151 &entries);
152 ASSERT_TRUE(entries); 152 ASSERT_TRUE(entries);
153 153
154 base::DictionaryValue* entry = NULL; 154 base::DictionaryValue* entry = NULL;
155 entries->GetDictionaryWithoutPathExpansion(entry_path, &entry); 155 entries->GetDictionaryWithoutPathExpansion(entry_path, &entry);
156 ASSERT_TRUE(entry); 156 ASSERT_TRUE(entry);
157 base::ThreadTaskRunnerHandle::Get()->PostTask( 157 base::ThreadTaskRunnerHandle::Get()->PostTask(
158 FROM_HERE, base::Bind(base::Bind(&DereferenceAndCall, callback), 158 FROM_HERE, base::Bind(&DereferenceAndCall, callback,
159 base::Owned(entry->DeepCopy()))); 159 base::Owned(entry->DeepCopy())));
160 } 160 }
161 161
162 protected: 162 protected:
163 base::DictionaryValue profile_entries_; 163 base::DictionaryValue profile_entries_;
164 std::map<std::string, std::string> profile_to_user_; 164 std::map<std::string, std::string> profile_to_user_;
165 }; 165 };
166 166
167 class ShillServiceTestClient { 167 class ShillServiceTestClient {
168 public: 168 public:
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 EXPECT_CALL(*mock_profile_client_, 978 EXPECT_CALL(*mock_profile_client_,
979 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); 979 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _));
980 980
981 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 981 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
982 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); 982 managed_network_configuration_handler_->RemoveObserver(&policy_observer_);
983 managed_network_configuration_handler_.reset(); 983 managed_network_configuration_handler_.reset();
984 base::RunLoop().RunUntilIdle(); 984 base::RunLoop().RunUntilIdle();
985 } 985 }
986 986
987 } // namespace chromeos 987 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/attestation/attestation_flow.cc ('k') | components/dom_distiller/webui/dom_distiller_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698