| Index: chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| index f485636874b4fbdcd6f508ee2f43c03579163498..4f6b173f64bf87c5ea0989371413fd36ea70eed2 100644
|
| --- a/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| +++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| @@ -27,6 +27,8 @@
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| +#include "content/public/browser/browser_context.h"
|
| +#include "content/public/browser/storage_partition.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "net/dns/mock_host_resolver.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| @@ -100,7 +102,8 @@ class HostZoomMapBrowserTest : public InProcessBrowserTest {
|
| }
|
|
|
| std::vector<std::string> GetHostsWithZoomLevelsFromPrefs() {
|
| - PrefService* prefs = browser()->profile()->GetPrefs();
|
| + PrefService* prefs = content::BrowserContext::GetDefaultStoragePartition(
|
| + browser()->profile())->GetZoomLevelPrefs();
|
| const base::DictionaryValue* values =
|
| prefs->GetDictionary(prefs::kPerHostZoomLevels);
|
| std::vector<std::string> results;
|
| @@ -146,21 +149,31 @@ class HostZoomMapSanitizationBrowserTest : public HostZoomMapBrowserTest {
|
| // caused by the bug. They incorrectly contain a per-host zoom level for the
|
| // empty host; and a value for 'host1' that only differs from the default by
|
| // epsilon. Neither should have been persisted.
|
| + const char kPrefs[] =
|
| + "{'profile': {"
|
| + " 'default_zoom_level': 1.2"
|
| + "}}";
|
| const char kBrokenPrefs[] =
|
| "{'profile': {"
|
| - " 'default_zoom_level': 1.2,"
|
| " 'per_host_zoom_levels': {'': 1.1, 'host1': 1.20001, 'host2': 1.3}"
|
| "}}";
|
| + std::string prefs(kPrefs);
|
| + std::replace(prefs.begin(), prefs.end(), '\'', '\"');
|
| std::string broken_prefs(kBrokenPrefs);
|
| std::replace(broken_prefs.begin(), broken_prefs.end(), '\'', '\"');
|
|
|
| - base::FilePath user_data_directory, path_to_prefs;
|
| + base::FilePath user_data_directory, path_to_prefs, path_to_broken_prefs;
|
| PathService::Get(chrome::DIR_USER_DATA, &user_data_directory);
|
| path_to_prefs = user_data_directory
|
| .AppendASCII(TestingProfile::kTestUserProfileDir)
|
| .Append(chrome::kPreferencesFilename);
|
| + path_to_broken_prefs = user_data_directory
|
| + .AppendASCII(TestingProfile::kTestUserProfileDir)
|
| + .Append(chrome::kZoomLevelPreferencesFilename);
|
| base::CreateDirectory(path_to_prefs.DirName());
|
| - base::WriteFile(path_to_prefs, broken_prefs.c_str(), broken_prefs.size());
|
| + base::WriteFile(path_to_prefs, prefs.c_str(), prefs.size());
|
| + base::WriteFile(
|
| + path_to_broken_prefs, broken_prefs.c_str(), broken_prefs.size());
|
| return true;
|
| }
|
|
|
|
|