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

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

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
16 #include "base/json/json_file_value_serializer.h" 16 #include "base/json/json_file_value_serializer.h"
17 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
18 #include "base/json/json_string_value_serializer.h" 18 #include "base/json/json_string_value_serializer.h"
19 #include "base/location.h" 19 #include "base/location.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/prefs/scoped_user_pref_update.h" 22 #include "base/prefs/scoped_user_pref_update.h"
23 #include "base/single_thread_task_runner.h" 23 #include "base/single_thread_task_runner.h"
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/pattern.h"
25 #include "base/strings/string16.h" 26 #include "base/strings/string16.h"
26 #include "base/strings/string_number_conversions.h" 27 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
28 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
29 #include "base/thread_task_runner_handle.h" 30 #include "base/thread_task_runner_handle.h"
30 #include "base/version.h" 31 #include "base/version.h"
31 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
32 #include "chrome/browser/chrome_notification_types.h" 33 #include "chrome/browser/chrome_notification_types.h"
33 #include "chrome/browser/extensions/app_sync_data.h" 34 #include "chrome/browser/extensions/app_sync_data.h"
34 #include "chrome/browser/extensions/blacklist.h" 35 #include "chrome/browser/extensions/blacklist.h"
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 base::FilePath pref_path = 1373 base::FilePath pref_path =
1373 source_install_dir.DirName().Append(chrome::kPreferencesFilename); 1374 source_install_dir.DirName().Append(chrome::kPreferencesFilename);
1374 1375
1375 InitializeInstalledExtensionService(pref_path, source_install_dir); 1376 InitializeInstalledExtensionService(pref_path, source_install_dir);
1376 1377
1377 service()->Init(); 1378 service()->Init();
1378 1379
1379 ASSERT_EQ(4u, GetErrors().size()); 1380 ASSERT_EQ(4u, GetErrors().size());
1380 ASSERT_EQ(0u, loaded_.size()); 1381 ASSERT_EQ(0u, loaded_.size());
1381 1382
1382 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[0]), 1383 EXPECT_TRUE(base::MatchPattern(base::UTF16ToUTF8(GetErrors()[0]),
1383 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + 1384 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " +
1384 extensions::manifest_errors::kManifestUnreadable)) << 1385 extensions::manifest_errors::kManifestUnreadable)) <<
1385 base::UTF16ToUTF8(GetErrors()[0]); 1386 base::UTF16ToUTF8(GetErrors()[0]);
1386 1387
1387 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[1]), 1388 EXPECT_TRUE(base::MatchPattern(base::UTF16ToUTF8(GetErrors()[1]),
1388 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + 1389 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " +
1389 extensions::manifest_errors::kManifestUnreadable)) << 1390 extensions::manifest_errors::kManifestUnreadable)) <<
1390 base::UTF16ToUTF8(GetErrors()[1]); 1391 base::UTF16ToUTF8(GetErrors()[1]);
1391 1392
1392 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[2]), 1393 EXPECT_TRUE(base::MatchPattern(base::UTF16ToUTF8(GetErrors()[2]),
1393 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + 1394 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " +
1394 extensions::manifest_errors::kMissingFile)) << 1395 extensions::manifest_errors::kMissingFile)) <<
1395 base::UTF16ToUTF8(GetErrors()[2]); 1396 base::UTF16ToUTF8(GetErrors()[2]);
1396 1397
1397 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[3]), 1398 EXPECT_TRUE(base::MatchPattern(base::UTF16ToUTF8(GetErrors()[3]),
1398 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + 1399 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " +
1399 extensions::manifest_errors::kManifestUnreadable)) << 1400 extensions::manifest_errors::kManifestUnreadable)) <<
1400 base::UTF16ToUTF8(GetErrors()[3]); 1401 base::UTF16ToUTF8(GetErrors()[3]);
1401 } 1402 }
1402 1403
1403 // Test various cases for delayed install because of missing imports. 1404 // Test various cases for delayed install because of missing imports.
1404 TEST_F(ExtensionServiceTest, PendingImports) { 1405 TEST_F(ExtensionServiceTest, PendingImports) {
1405 InitPluginService(); 1406 InitPluginService();
1406 1407
1407 base::FilePath source_install_dir = 1408 base::FilePath source_install_dir =
(...skipping 6694 matching lines...) Expand 10 before | Expand all | Expand 10 after
8102 8103
8103 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 8104 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
8104 content::Source<Profile>(profile()), 8105 content::Source<Profile>(profile()),
8105 content::NotificationService::NoDetails()); 8106 content::NotificationService::NoDetails());
8106 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 8107 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
8107 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 8108 EXPECT_EQ(0u, registry()->enabled_extensions().size());
8108 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 8109 EXPECT_EQ(0u, registry()->disabled_extensions().size());
8109 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 8110 EXPECT_EQ(0u, registry()->terminated_extensions().size());
8110 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 8111 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
8111 } 8112 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_test.cc ('k') | chrome/browser/plugins/plugin_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698