Home | History | Annotate | Download | only in shill

Lines Matching refs:Profile

17 #include "shill/profile.h"
53 Profile::Identifier id("rather", "irrelevant");
54 profile_ = new Profile(
58 // about the interaction between Profile and StoreInterface, we'll
70 bool ProfileInitStorage(const Profile::Identifier& id,
71 Profile::InitStorageOption storage_option,
77 ProfileRefPtr profile(
78 new Profile(control_interface(), mock_metrics_.get(), manager(), id,
80 bool ret = profile->InitStorage(storage_option, &error);
83 EXPECT_TRUE(profile->Save());
113 // If HandleProfileEntryDeletion() returns false, Profile should call
131 // If HandleProfileEntryDeletion() returns true, Profile should not call
149 EXPECT_FALSE(Profile::IsValidIdentifierToken(""));
150 EXPECT_FALSE(Profile::IsValidIdentifierToken(" "));
151 EXPECT_FALSE(Profile::IsValidIdentifierToken("-"));
152 EXPECT_FALSE(Profile::IsValidIdentifierToken("~"));
153 EXPECT_FALSE(Profile::IsValidIdentifierToken("_"));
154 EXPECT_TRUE(Profile::IsValidIdentifierToken("a"));
155 EXPECT_TRUE(Profile::IsValidIdentifierToken("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
156 EXPECT_TRUE(Profile::IsValidIdentifierToken("abcdefghijklmnopqrstuvwxyz"));
157 EXPECT_TRUE(Profile::IsValidIdentifierToken("0123456789"));
161 Profile::Identifier identifier;
162 EXPECT_FALSE(Profile::ParseIdentifier("", &identifier));
163 EXPECT_FALSE(Profile::ParseIdentifier("~", &identifier));
164 EXPECT_FALSE(Profile::ParseIdentifier("~foo", &identifier));
165 EXPECT_FALSE(Profile::ParseIdentifier("~/", &identifier));
166 EXPECT_FALSE(Profile::ParseIdentifier("~bar/", &identifier));
167 EXPECT_FALSE(Profile::ParseIdentifier("~/zoo", &identifier));
168 EXPECT_FALSE(Profile::ParseIdentifier("~./moo", &identifier));
169 EXPECT_FALSE(Profile::ParseIdentifier("~valid/?", &identifier));
170 EXPECT_FALSE(Profile::ParseIdentifier("~no//no", &identifier));
171 EXPECT_FALSE(Profile::ParseIdentifier("~no~no", &identifier));
175 EXPECT_TRUE(Profile::ParseIdentifier(
181 EXPECT_FALSE(Profile::ParseIdentifier("!", &identifier));
182 EXPECT_FALSE(Profile::ParseIdentifier("/nope", &identifier));
185 EXPECT_TRUE(Profile::ParseIdentifier(kIdentifier2, &identifier));
191 Profile::Identifier identifier;
197 Profile::IdentifierToString(identifier));
203 Profile::Identifier id(kIdentifier);
204 ProfileRefPtr profile(new Profile(
206 EXPECT_EQ(kIdentifier, profile->GetFriendlyName());
208 profile = new Profile(
210 EXPECT_EQ(string(kUser) + "/" + kIdentifier, profile->GetFriendlyName());
217 Profile::Identifier id(kIdentifier);
218 ProfileRefPtr profile(new Profile(
220 EXPECT_TRUE(profile->persistent_profile_path_.empty());
222 profile = new Profile(
226 EXPECT_EQ("/a/place/for/chronos/someprofile.profile.json",
227 profile->persistent_profile_path_.value());
229 EXPECT_EQ("/a/place/for/chronos/someprofile.profile",
230 profile->persistent_profile_path_.value());
246 // Ensure services are in the profile now.
276 // Create new service; ask Profile to merge it with a known, matching,
338 FilePath list_path(FilePath(storage_path()).Append("test.profile"));
339 vector<Profile::Identifier> identifiers =
340 Profile::LoadUserProfileList(list_path);
359 identifiers = Profile::LoadUserProfileList(list_path);
372 Profile::Identifier id0(kUser0, kIdentifier0);
376 profiles.push_back(new Profile(
381 Profile::Identifier id1(kUser1, kIdentifier1);
384 profiles.push_back(new Profile(
389 Profile::Identifier id2("", kIdentifier2);
392 profiles.push_back(new Profile(
395 FilePath list_path(FilePath(storage_path()).Append("test.profile"));
396 EXPECT_TRUE(Profile::SaveUserProfileList(list_path, profiles));
409 Profile::Identifier id(kUser, kIdentifier);
410 ProfileRefPtr profile(new Profile(
412 EXPECT_TRUE(profile->MatchesIdentifier(id));
413 EXPECT_FALSE(profile->MatchesIdentifier(Profile::Identifier(kUser, "")));
415 profile->MatchesIdentifier(Profile::Identifier("", kIdentifier)));
417 profile->MatchesIdentifier(Profile::Identifier(kIdentifier, kUser)));
421 Profile::Identifier id("theUser", "theIdentifier");
425 // Profile doesn't exist but we wanted it to.
426 EXPECT_FALSE(ProfileInitStorage(id, Profile::kOpenExisting, false,
429 // Success case, with a side effect of creating the profile.
430 EXPECT_TRUE(ProfileInitStorage(id, Profile
434 // the profile now exists. First, we now succeed if we require that
435 // the profile already exist...
436 EXPECT_TRUE(ProfileInitStorage(id, Profile::kOpenExisting, false,
440 EXPECT_FALSE(ProfileInitStorage(id, Profile::kCreateNew, false,
443 // As a sanity check, ensure "create or open" works for both profile-exists...
444 EXPECT_TRUE(ProfileInitStorage(id, Profile::kCreateOrOpenExisting, false,
447 // ...and for a new profile that doesn't exist.
448 Profile::Identifier id2("theUser", "theIdentifier2");
449 // Let's just make double-check that this profile really doesn't exist.
450 ASSERT_FALSE(ProfileInitStorage(id2, Profile::kOpenExisting, false,
454 EXPECT_TRUE(ProfileInitStorage(id2, Profile::kCreateOrOpenExisting, false,
457 // Corrupt the profile storage.
459 base::StringPrintf("%s/%s/%s.profile", storage_path().c_str(),
469 EXPECT_FALSE(ProfileInitStorage(id, Profile::kOpenExisting, false,
475 ASSERT_FALSE(ProfileInitStorage(id, Profile::kOpenExisting, false,