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

Side by Side Diff: chrome/browser/profiles/profile_downloader_unittest.cc

Issue 23095006: If user profile doesn't contain language setting, default to his Google account settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment on "list of preferred languages". Created 7 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/profiles/profile_downloader.h" 5 #include "chrome/browser/profiles/profile_downloader.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
(...skipping 18 matching lines...) Expand all
29 29
30 virtual ~ProfileDownloaderTest() { 30 virtual ~ProfileDownloaderTest() {
31 } 31 }
32 32
33 void VerifyWithNameAndURL(const std::string& name, 33 void VerifyWithNameAndURL(const std::string& name,
34 const std::string& url, 34 const std::string& url,
35 const std::string& expected_url, 35 const std::string& expected_url,
36 bool is_valid) { 36 bool is_valid) {
37 string16 parsed_name; 37 string16 parsed_name;
38 std::string parsed_url; 38 std::string parsed_url;
39 bool result = ProfileDownloader::GetProfileNameAndImageURL( 39 std::string parsed_locale;
sail 2013/09/09 22:02:17 could you add a test for this?
Alexander Alekseev 2013/09/11 18:53:02 Done.
40 GetJSonData(name, url), &parsed_name, &parsed_url, 32); 40 bool result = ProfileDownloader::ParseProfileJSON(
41 GetJSonData(name, url), &parsed_name, &parsed_url, 32, &parsed_locale);
41 EXPECT_EQ(is_valid, result); 42 EXPECT_EQ(is_valid, result);
42 std::string parsed_name_utf8 = UTF16ToUTF8(parsed_name); 43 std::string parsed_name_utf8 = UTF16ToUTF8(parsed_name);
43 EXPECT_EQ(name, parsed_name_utf8); 44 EXPECT_EQ(name, parsed_name_utf8);
44 EXPECT_EQ(expected_url, parsed_url); 45 EXPECT_EQ(expected_url, parsed_url);
45 } 46 }
46 }; 47 };
47 48
48 TEST_F(ProfileDownloaderTest, ParseData) { 49 TEST_F(ProfileDownloaderTest, ParseData) {
49 // URL without size specified. 50 // URL without size specified.
50 VerifyWithNameAndURL( 51 VerifyWithNameAndURL(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Not default G+ photo 94 // Not default G+ photo
94 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL( 95 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL(
95 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAAAA/G/photo.jpg")); 96 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAAAA/G/photo.jpg"));
96 // Not default with 6 components 97 // Not default with 6 components
97 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL( 98 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL(
98 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAACQ/Efg/photo.jpg")); 99 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAACQ/Efg/photo.jpg"));
99 // Not default with 7 components 100 // Not default with 7 components
100 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL( 101 EXPECT_FALSE(ProfileDownloader::IsDefaultProfileImageURL(
101 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s32-c/photo.jpg")); 102 "https://example.com/-4/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s32-c/photo.jpg"));
102 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698