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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
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/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/common/extensions/url_pattern.h" 52 #include "chrome/common/extensions/url_pattern.h"
53 #include "chrome/common/pref_names.h" 53 #include "chrome/common/pref_names.h"
54 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
55 #include "chrome/test/base/testing_profile.h" 55 #include "chrome/test/base/testing_profile.h"
56 #include "content/browser/appcache/chrome_appcache_service.h" 56 #include "content/browser/appcache/chrome_appcache_service.h"
57 #include "content/browser/browser_thread.h" 57 #include "content/browser/browser_thread.h"
58 #include "content/browser/file_system/browser_file_system_helper.h" 58 #include "content/browser/file_system/browser_file_system_helper.h"
59 #include "content/browser/in_process_webkit/dom_storage_context.h" 59 #include "content/browser/in_process_webkit/dom_storage_context.h"
60 #include "content/browser/in_process_webkit/webkit_context.h" 60 #include "content/browser/in_process_webkit/webkit_context.h"
61 #include "content/public/browser/notification_registrar.h" 61 #include "content/public/browser/notification_registrar.h"
62 #include "content/common/notification_service.h" 62 #include "content/public/browser/notification_service.h"
63 #include "googleurl/src/gurl.h" 63 #include "googleurl/src/gurl.h"
64 #include "net/base/cookie_monster.h" 64 #include "net/base/cookie_monster.h"
65 #include "net/base/cookie_options.h" 65 #include "net/base/cookie_options.h"
66 #include "net/url_request/url_request_context.h" 66 #include "net/url_request/url_request_context.h"
67 #include "net/url_request/url_request_context_getter.h" 67 #include "net/url_request/url_request_context_getter.h"
68 #include "testing/gtest/include/gtest/gtest.h" 68 #include "testing/gtest/include/gtest/gtest.h"
69 #include "testing/platform_test.h" 69 #include "testing/platform_test.h"
70 #include "webkit/database/database_tracker.h" 70 #include "webkit/database/database_tracker.h"
71 #include "webkit/database/database_util.h" 71 #include "webkit/database/database_util.h"
72 #include "webkit/quota/quota_manager.h" 72 #include "webkit/quota/quota_manager.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 478
479 void ExtensionServiceTestBase::SetUp() { 479 void ExtensionServiceTestBase::SetUp() {
480 ExtensionErrorReporter::GetInstance()->ClearErrors(); 480 ExtensionErrorReporter::GetInstance()->ClearErrors();
481 } 481 }
482 482
483 class ExtensionServiceTest 483 class ExtensionServiceTest
484 : public ExtensionServiceTestBase, public content::NotificationObserver { 484 : public ExtensionServiceTestBase, public content::NotificationObserver {
485 public: 485 public:
486 ExtensionServiceTest() : installed_(NULL) { 486 ExtensionServiceTest() : installed_(NULL) {
487 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 487 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
488 NotificationService::AllSources()); 488 content::NotificationService::AllSources());
489 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 489 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
490 NotificationService::AllSources()); 490 content::NotificationService::AllSources());
491 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 491 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
492 NotificationService::AllSources()); 492 content::NotificationService::AllSources());
493 } 493 }
494 494
495 virtual void Observe(int type, 495 virtual void Observe(int type,
496 const content::NotificationSource& source, 496 const content::NotificationSource& source,
497 const content::NotificationDetails& details) { 497 const content::NotificationDetails& details) {
498 switch (type) { 498 switch (type) {
499 case chrome::NOTIFICATION_EXTENSION_LOADED: { 499 case chrome::NOTIFICATION_EXTENSION_LOADED: {
500 const Extension* extension = 500 const Extension* extension =
501 content::Details<const Extension>(details).ptr(); 501 content::Details<const Extension>(details).ptr();
502 loaded_.push_back(make_scoped_refptr(extension)); 502 loaded_.push_back(make_scoped_refptr(extension));
(...skipping 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 3460
3461 // These are untouched by re-localization. 3461 // These are untouched by re-localization.
3462 EXPECT_EQ("My name is simple.", loaded_[1]->name()); 3462 EXPECT_EQ("My name is simple.", loaded_[1]->name());
3463 EXPECT_EQ("no l10n", loaded_[2]->name()); 3463 EXPECT_EQ("no l10n", loaded_[2]->name());
3464 } 3464 }
3465 3465
3466 class ExtensionsReadyRecorder : public content::NotificationObserver { 3466 class ExtensionsReadyRecorder : public content::NotificationObserver {
3467 public: 3467 public:
3468 ExtensionsReadyRecorder() : ready_(false) { 3468 ExtensionsReadyRecorder() : ready_(false) {
3469 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 3469 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
3470 NotificationService::AllSources()); 3470 content::NotificationService::AllSources());
3471 } 3471 }
3472 3472
3473 void set_ready(bool value) { ready_ = value; } 3473 void set_ready(bool value) { ready_ = value; }
3474 bool ready() { return ready_; } 3474 bool ready() { return ready_; }
3475 3475
3476 private: 3476 private:
3477 virtual void Observe(int type, 3477 virtual void Observe(int type,
3478 const content::NotificationSource& source, 3478 const content::NotificationSource& source,
3479 const content::NotificationDetails& details) { 3479 const content::NotificationDetails& details) {
3480 switch (type) { 3480 switch (type) {
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 ASSERT_FALSE(AddPendingSyncInstall()); 4196 ASSERT_FALSE(AddPendingSyncInstall());
4197 4197
4198 // Wait for the external source to install. 4198 // Wait for the external source to install.
4199 WaitForCrxInstall(crx_path_, true); 4199 WaitForCrxInstall(crx_path_, true);
4200 ASSERT_TRUE(IsCrxInstalled()); 4200 ASSERT_TRUE(IsCrxInstalled());
4201 4201
4202 // Now that the extension is installed, sync request should fail 4202 // Now that the extension is installed, sync request should fail
4203 // because the extension is already installed. 4203 // because the extension is already installed.
4204 ASSERT_FALSE(AddPendingSyncInstall()); 4204 ASSERT_FALSE(AddPendingSyncInstall());
4205 } 4205 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_settings_frontend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698