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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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) 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "webkit/database/database_tracker.h" 88 #include "webkit/database/database_tracker.h"
89 #include "webkit/database/database_util.h" 89 #include "webkit/database/database_util.h"
90 #include "webkit/plugins/npapi/mock_plugin_list.h" 90 #include "webkit/plugins/npapi/mock_plugin_list.h"
91 #include "webkit/quota/quota_manager.h" 91 #include "webkit/quota/quota_manager.h"
92 92
93 using content::BrowserContext; 93 using content::BrowserContext;
94 using content::BrowserThread; 94 using content::BrowserThread;
95 using content::DOMStorageContext; 95 using content::DOMStorageContext;
96 using content::IndexedDBContext; 96 using content::IndexedDBContext;
97 using content::PluginService; 97 using content::PluginService;
98 using extensions::Extension;
98 99
99 namespace keys = extension_manifest_keys; 100 namespace keys = extension_manifest_keys;
100 101
101 namespace { 102 namespace {
102 103
103 // Extension ids used during testing. 104 // Extension ids used during testing.
104 const char* const all_zero = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 105 const char* const all_zero = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
105 const char* const zero_n_one = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; 106 const char* const zero_n_one = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab";
106 const char* const good0 = "behllobkkfkfnphdnhnkndlbkcpglgmj"; 107 const char* const good0 = "behllobkkfkfnphdnhnkndlbkcpglgmj";
107 const char* const good1 = "hpiknbiabeeppbpihjehijgoemciehgk"; 108 const char* const good1 = "hpiknbiabeeppbpihjehijgoemciehgk";
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 content::Details<const Extension>(details).ptr(); 517 content::Details<const Extension>(details).ptr();
517 loaded_.push_back(make_scoped_refptr(extension)); 518 loaded_.push_back(make_scoped_refptr(extension));
518 // The tests rely on the errors being in a certain order, which can vary 519 // The tests rely on the errors being in a certain order, which can vary
519 // depending on how filesystem iteration works. 520 // depending on how filesystem iteration works.
520 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); 521 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder());
521 break; 522 break;
522 } 523 }
523 524
524 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 525 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
525 const Extension* e = 526 const Extension* e =
526 content::Details<UnloadedExtensionInfo>(details)->extension; 527 content::Details<extensions::UnloadedExtensionInfo>(
528 details)->extension;
527 unloaded_id_ = e->id(); 529 unloaded_id_ = e->id();
528 ExtensionList::iterator i = 530 extensions::ExtensionList::iterator i =
529 std::find(loaded_.begin(), loaded_.end(), e); 531 std::find(loaded_.begin(), loaded_.end(), e);
530 // TODO(erikkay) fix so this can be an assert. Right now the tests 532 // TODO(erikkay) fix so this can be an assert. Right now the tests
531 // are manually calling clear() on loaded_, so this isn't doable. 533 // are manually calling clear() on loaded_, so this isn't doable.
532 if (i == loaded_.end()) 534 if (i == loaded_.end())
533 return; 535 return;
534 loaded_.erase(i); 536 loaded_.erase(i);
535 break; 537 break;
536 } 538 }
537 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 539 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
538 installed_ = content::Details<const Extension>(details).ptr(); 540 installed_ = content::Details<const Extension>(details).ptr();
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 939
938 ListValue* list_value = new ListValue(); 940 ListValue* list_value = new ListValue();
939 for (std::set<std::string>::const_iterator iter = value.begin(); 941 for (std::set<std::string>::const_iterator iter = value.begin();
940 iter != value.end(); ++iter) 942 iter != value.end(); ++iter)
941 list_value->Append(Value::CreateStringValue(*iter)); 943 list_value->Append(Value::CreateStringValue(*iter));
942 944
943 SetPref(extension_id, pref_path, list_value, msg); 945 SetPref(extension_id, pref_path, list_value, msg);
944 } 946 }
945 947
946 protected: 948 protected:
947 ExtensionList loaded_; 949 extensions::ExtensionList loaded_;
948 std::string unloaded_id_; 950 std::string unloaded_id_;
949 const Extension* installed_; 951 const Extension* installed_;
950 952
951 private: 953 private:
952 content::NotificationRegistrar registrar_; 954 content::NotificationRegistrar registrar_;
953 }; 955 };
954 956
955 // Receives notifications from a PackExtensionJob, indicating either that 957 // Receives notifications from a PackExtensionJob, indicating either that
956 // packing succeeded or that there was some error. 958 // packing succeeded or that there was some error.
957 class PackExtensionTestClient : public PackExtensionJob::Client { 959 class PackExtensionTestClient : public PackExtensionJob::Client {
(...skipping 4005 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", 4965 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0",
4964 data_dir_.AppendASCII("hosted_app.crx")); 4966 data_dir_.AppendASCII("hosted_app.crx"));
4965 4967
4966 service_->CheckForExternalUpdates(); 4968 service_->CheckForExternalUpdates();
4967 loop_.RunAllPending(); 4969 loop_.RunAllPending();
4968 4970
4969 ASSERT_TRUE(service_->PopulateExtensionGlobalError( 4971 ASSERT_TRUE(service_->PopulateExtensionGlobalError(
4970 extension_global_error.get())); 4972 extension_global_error.get()));
4971 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size()); 4973 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size());
4972 } 4974 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_sorting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698