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

Unified Diff: chrome/browser/profiles/profile_downloader_unittest.cc

Issue 257773002: Use new people.get api instead of oauth2/v1/userinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix user image manager tests Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_downloader.cc ('k') | chrome/browser/signin/account_reconcilor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_downloader_unittest.cc
diff --git a/chrome/browser/profiles/profile_downloader_unittest.cc b/chrome/browser/profiles/profile_downloader_unittest.cc
index 3761c77ef2a8cbf0057de3d9198cc4930f975c9a..c7c13121d69ce4a331d2d9c15ee1c6757935b9cb 100644
--- a/chrome/browser/profiles/profile_downloader_unittest.cc
+++ b/chrome/browser/profiles/profile_downloader_unittest.cc
@@ -4,38 +4,31 @@
#include "chrome/browser/profiles/profile_downloader.h"
+#include "base/json/json_reader.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_piece.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-std::string GetJSonData(const std::string& full_name,
- const std::string& given_name,
- const std::string& url,
- const std::string& locale) {
- std::stringstream stream;
- bool started = false;
-
- stream << "{ ";
- if (!full_name.empty()) {
- stream << "\"name\": \"" << full_name << "\"";
- started = true;
- }
- if (!given_name.empty()) {
- stream << (started ? ", " : "") << "\"given_name\": \"" << given_name
- << "\"";
- started = true;
- }
- if (!url.empty()) {
- stream << (started ? ", " : "") << "\"picture\": \"" << url << "\"";
- started = true;
- }
+void GetJSonData(const std::string& full_name,
+ const std::string& given_name,
+ const std::string& url,
+ const std::string& locale,
+ base::DictionaryValue* dict) {
+ if (!full_name.empty())
+ dict->SetString("displayName", full_name);
- if (!locale.empty())
- stream << (started ? ", " : "") << "\"locale\": \"" << locale << "\"";
+ if (!given_name.empty())
+ dict->SetString("name.givenName", given_name);
+
+ if (!url.empty())
+ dict->SetString("image.url", url);
- stream << " }";
- return stream.str();
+ if (!locale.empty())
+ dict->SetString("language", locale);
}
} // namespace
@@ -58,8 +51,10 @@ class ProfileDownloaderTest : public testing::Test {
base::string16 parsed_given_name;
std::string parsed_url;
std::string parsed_locale;
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ GetJSonData(full_name, given_name, url, locale, dict.get());
bool result = ProfileDownloader::ParseProfileJSON(
- GetJSonData(full_name, given_name, url, locale),
+ dict.get(),
&parsed_full_name,
&parsed_given_name,
&parsed_url,
« no previous file with comments | « chrome/browser/profiles/profile_downloader.cc ('k') | chrome/browser/signin/account_reconcilor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698