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

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

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim. shill_stub_helper and move functions to clients. Created 6 years, 9 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 | Annotate | Revision Log
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 <sstream> 6 #include <sstream>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 26 matching lines...) Expand all
37 namespace chromeos { 37 namespace chromeos {
38 38
39 namespace { 39 namespace {
40 40
41 std::string ValueToString(const base::Value* value) { 41 std::string ValueToString(const base::Value* value) {
42 std::stringstream str; 42 std::stringstream str;
43 str << *value; 43 str << *value;
44 return str.str(); 44 return str.str();
45 } 45 }
46 46
47 const char kSharedProfilePath[] = "/profile/default";
48 const char kUser1[] = "user1"; 47 const char kUser1[] = "user1";
49 const char kUser1ProfilePath[] = "/profile/user1/shill"; 48 const char kUser1ProfilePath[] = "/profile/user1/shill";
50 49
51 // Matcher to match base::Value. 50 // Matcher to match base::Value.
52 MATCHER_P(IsEqualTo, 51 MATCHER_P(IsEqualTo,
53 value, 52 value,
54 std::string(negation ? "isn't" : "is") + " equal to " + 53 std::string(negation ? "isn't" : "is") + " equal to " +
55 ValueToString(value)) { 54 ValueToString(value)) {
56 return value->Equals(&arg); 55 return value->Equals(&arg);
57 } 56 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Mock::VerifyAndClearExpectations(mock_manager_client_); 200 Mock::VerifyAndClearExpectations(mock_manager_client_);
202 Mock::VerifyAndClearExpectations(mock_profile_client_); 201 Mock::VerifyAndClearExpectations(mock_profile_client_);
203 SetNetworkConfigurationHandlerExpectations(); 202 SetNetworkConfigurationHandlerExpectations();
204 } 203 }
205 204
206 void InitializeStandardProfiles() { 205 void InitializeStandardProfiles() {
207 profiles_stub_.AddProfile(kUser1ProfilePath, kUser1); 206 profiles_stub_.AddProfile(kUser1ProfilePath, kUser1);
208 network_profile_handler_-> 207 network_profile_handler_->
209 AddProfileForTest(NetworkProfile(kUser1ProfilePath, kUser1)); 208 AddProfileForTest(NetworkProfile(kUser1ProfilePath, kUser1));
210 network_profile_handler_-> 209 network_profile_handler_->
211 AddProfileForTest(NetworkProfile(kSharedProfilePath, std::string())); 210 AddProfileForTest(NetworkProfile(
211 NetworkProfileHandler::GetSharedProfilePath(), std::string()));
212 } 212 }
213 213
214 void SetUpEntry(const std::string& path_to_shill_json, 214 void SetUpEntry(const std::string& path_to_shill_json,
215 const std::string& profile_path, 215 const std::string& profile_path,
216 const std::string& entry_path) { 216 const std::string& entry_path) {
217 scoped_ptr<base::DictionaryValue> entry = 217 scoped_ptr<base::DictionaryValue> entry =
218 test_utils::ReadTestDictionary(path_to_shill_json); 218 test_utils::ReadTestDictionary(path_to_shill_json);
219 profiles_stub_.AddEntry(profile_path, entry_path, *entry); 219 profiles_stub_.AddEntry(profile_path, entry_path, *entry);
220 } 220 }
221 221
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ConfigureServiceForProfile( 639 ConfigureServiceForProfile(
640 dbus::ObjectPath(kUser1ProfilePath), 640 dbus::ObjectPath(kUser1ProfilePath),
641 IsEqualTo(expected_shill_properties.get()), 641 IsEqualTo(expected_shill_properties.get()),
642 _, _)); 642 _, _));
643 643
644 InitializeStandardProfiles(); 644 InitializeStandardProfiles();
645 message_loop_.RunUntilIdle(); 645 message_loop_.RunUntilIdle();
646 } 646 }
647 647
648 } // namespace chromeos 648 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698