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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 10837130: Set locale for extension tests, keep it from affecting global state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/intents/cws_intents_registry_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "chrome/browser/plugin_prefs_factory.h" 52 #include "chrome/browser/plugin_prefs_factory.h"
53 #include "chrome/browser/prefs/browser_prefs.h" 53 #include "chrome/browser/prefs/browser_prefs.h"
54 #include "chrome/browser/prefs/pref_service_mock_builder.h" 54 #include "chrome/browser/prefs/pref_service_mock_builder.h"
55 #include "chrome/browser/prefs/scoped_user_pref_update.h" 55 #include "chrome/browser/prefs/scoped_user_pref_update.h"
56 #include "chrome/browser/themes/theme_service_factory.h" 56 #include "chrome/browser/themes/theme_service_factory.h"
57 #include "chrome/common/chrome_constants.h" 57 #include "chrome/common/chrome_constants.h"
58 #include "chrome/common/chrome_notification_types.h" 58 #include "chrome/common/chrome_notification_types.h"
59 #include "chrome/common/chrome_paths.h" 59 #include "chrome/common/chrome_paths.h"
60 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
61 #include "chrome/common/extensions/extension.h" 61 #include "chrome/common/extensions/extension.h"
62 #include "chrome/common/extensions/extension_l10n_util.h"
62 #include "chrome/common/extensions/extension_manifest_constants.h" 63 #include "chrome/common/extensions/extension_manifest_constants.h"
63 #include "chrome/common/extensions/extension_resource.h" 64 #include "chrome/common/extensions/extension_resource.h"
64 #include "chrome/common/extensions/permissions/permission_set.h" 65 #include "chrome/common/extensions/permissions/permission_set.h"
65 #include "chrome/common/extensions/url_pattern.h" 66 #include "chrome/common/extensions/url_pattern.h"
66 #include "chrome/common/pref_names.h" 67 #include "chrome/common/pref_names.h"
67 #include "chrome/common/string_ordinal.h" 68 #include "chrome/common/string_ordinal.h"
68 #include "chrome/common/url_constants.h" 69 #include "chrome/common/url_constants.h"
69 #include "chrome/test/base/testing_profile.h" 70 #include "chrome/test/base/testing_profile.h"
70 #include "content/public/browser/dom_storage_context.h" 71 #include "content/public/browser/dom_storage_context.h"
71 #include "content/public/browser/indexed_db_context.h" 72 #include "content/public/browser/indexed_db_context.h"
(...skipping 3930 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 " \"external_crx\": \"RandomExtension.crx\"," 4003 " \"external_crx\": \"RandomExtension.crx\","
4003 " \"external_version\": \"1.0\"," 4004 " \"external_version\": \"1.0\","
4004 " \"is_bookmark_app\": true" 4005 " \"is_bookmark_app\": true"
4005 " }" 4006 " }"
4006 "}"; 4007 "}";
4007 EXPECT_EQ(1, from_bookmark_visitor.Visit(json_data)); 4008 EXPECT_EQ(1, from_bookmark_visitor.Visit(json_data));
4008 } 4009 }
4009 4010
4010 // Test loading good extensions from the profile directory. 4011 // Test loading good extensions from the profile directory.
4011 TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) { 4012 TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) {
4013 // Ensure we're testing in "en" and leave global state untouched.
4014 extension_l10n_util::ScopedLocaleForTest testLocale("en");
4015
4012 // Initialize the test dir with a good Preferences/extensions. 4016 // Initialize the test dir with a good Preferences/extensions.
4013 FilePath source_install_dir = data_dir_ 4017 FilePath source_install_dir = data_dir_
4014 .AppendASCII("l10n"); 4018 .AppendASCII("l10n");
4015 FilePath pref_path = source_install_dir.AppendASCII("Preferences"); 4019 FilePath pref_path = source_install_dir.AppendASCII("Preferences");
4016 InitializeInstalledExtensionService(pref_path, source_install_dir); 4020 InitializeInstalledExtensionService(pref_path, source_install_dir);
4017 4021
4018 service_->Init(); 4022 service_->Init();
4019 4023
4020 ASSERT_EQ(3u, loaded_.size()); 4024 ASSERT_EQ(3u, loaded_.size());
4021 4025
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5242 // This should NOT trigger an alert. 5246 // This should NOT trigger an alert.
5243 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", 5247 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0",
5244 data_dir_.AppendASCII("hosted_app.crx")); 5248 data_dir_.AppendASCII("hosted_app.crx"));
5245 5249
5246 service_->CheckForExternalUpdates(); 5250 service_->CheckForExternalUpdates();
5247 loop_.RunAllPending(); 5251 loop_.RunAllPending();
5248 5252
5249 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get())); 5253 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get()));
5250 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size()); 5254 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size());
5251 } 5255 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/intents/cws_intents_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698