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

Side by Side Diff: chrome/browser/extensions/extension_management_browsertest.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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "chrome/browser/extensions/autoupdate_interceptor.h" 7 #include "chrome/browser/extensions/autoupdate_interceptor.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_test_message_listener.h" 11 #include "chrome/browser/extensions/extension_test_message_listener.h"
12 #include "chrome/browser/extensions/extension_updater.h" 12 #include "chrome/browser/extensions/extension_updater.h"
13 #include "chrome/browser/infobars/infobar_tab_helper.h" 13 #include "chrome/browser/infobars/infobar_tab_helper.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" 15 #include "chrome/browser/prefs/scoped_user_pref_update.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/browser/renderer_host/render_view_host.h" 23 #include "content/browser/renderer_host/render_view_host.h"
24 #include "content/public/browser/notification_service.h"
24 25
25 class ExtensionManagementTest : public ExtensionBrowserTest { 26 class ExtensionManagementTest : public ExtensionBrowserTest {
26 protected: 27 protected:
27 // Helper method that returns whether the extension is at the given version. 28 // Helper method that returns whether the extension is at the given version.
28 // This calls version(), which must be defined in the extension's bg page, 29 // This calls version(), which must be defined in the extension's bg page,
29 // as well as asking the extension itself. 30 // as well as asking the extension itself.
30 // 31 //
31 // Note that 'version' here means something different than the version field 32 // Note that 'version' here means something different than the version field
32 // in the extension's manifest. We use the version as reported by the 33 // in the extension's manifest. We use the version as reported by the
33 // background page to test how overinstalling crx files with the same 34 // background page to test how overinstalling crx files with the same
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Used for testing notifications sent during extension updates. 230 // Used for testing notifications sent during extension updates.
230 class NotificationListener : public content::NotificationObserver { 231 class NotificationListener : public content::NotificationObserver {
231 public: 232 public:
232 NotificationListener() : started_(false), finished_(false) { 233 NotificationListener() : started_(false), finished_(false) {
233 int types[] = { 234 int types[] = {
234 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, 235 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED,
235 chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, 236 chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED,
236 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND 237 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND
237 }; 238 };
238 for (size_t i = 0; i < arraysize(types); i++) { 239 for (size_t i = 0; i < arraysize(types); i++) {
239 registrar_.Add(this, types[i], NotificationService::AllSources()); 240 registrar_.Add(
241 this, types[i], content::NotificationService::AllSources());
240 } 242 }
241 } 243 }
242 ~NotificationListener() {} 244 ~NotificationListener() {}
243 245
244 bool started() { return started_; } 246 bool started() { return started_; }
245 247
246 bool finished() { return finished_; } 248 bool finished() { return finished_; }
247 249
248 const std::set<std::string>& updates() { return updates_; } 250 const std::set<std::string>& updates() { return updates_; }
249 251
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 603 }
602 ASSERT_TRUE(WaitForExtensionInstall()); 604 ASSERT_TRUE(WaitForExtensionInstall());
603 extensions = service->extensions(); 605 extensions = service->extensions();
604 ASSERT_EQ(size_before + 1, extensions->size()); 606 ASSERT_EQ(size_before + 1, extensions->size());
605 extension = extensions->at(size_before); 607 extension = extensions->at(size_before);
606 ASSERT_EQ(kExtensionId, extension->id()); 608 ASSERT_EQ(kExtensionId, extension->id());
607 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 609 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location());
608 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 610 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
609 EXPECT_TRUE(service->disabled_extensions()->empty()); 611 EXPECT_TRUE(service->disabled_extensions()->empty());
610 } 612 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api.cc ('k') | chrome/browser/extensions/extension_menu_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698