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

Side by Side Diff: chrome/browser/ui/webui/chrome_url_data_manager_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 "chrome/common/url_constants.h" 5 #include "chrome/common/url_constants.h"
6 #include "chrome/test/base/in_process_browser_test.h" 6 #include "chrome/test/base/in_process_browser_test.h"
7 #include "chrome/test/base/ui_test_utils.h" 7 #include "chrome/test/base/ui_test_utils.h"
8 #include "content/browser/tab_contents/navigation_details.h" 8 #include "content/browser/tab_contents/navigation_details.h"
9 #include "content/public/browser/notification_registrar.h" 9 #include "content/public/browser/notification_registrar.h"
10 #include "content/common/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
12 #include "content/public/browser/notification_types.h" 12 #include "content/public/browser/notification_types.h"
13 13
14 namespace { 14 namespace {
15 15
16 class NavigationNotificationObserver : public content::NotificationObserver { 16 class NavigationNotificationObserver : public content::NotificationObserver {
17 public: 17 public:
18 NavigationNotificationObserver() 18 NavigationNotificationObserver()
19 : got_navigation_(false), 19 : got_navigation_(false),
20 http_status_code_(0) { 20 http_status_code_(0) {
21 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 21 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
22 NotificationService::AllSources()); 22 content::NotificationService::AllSources());
23 } 23 }
24 24
25 virtual void Observe(int type, 25 virtual void Observe(int type,
26 const content::NotificationSource& source, 26 const content::NotificationSource& source,
27 const content::NotificationDetails& details) OVERRIDE { 27 const content::NotificationDetails& details) OVERRIDE {
28 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); 28 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
29 got_navigation_ = true; 29 got_navigation_ = true;
30 http_status_code_ = 30 http_status_code_ =
31 content::Details<content::LoadCommittedDetails>(details)-> 31 content::Details<content::LoadCommittedDetails>(details)->
32 http_status_code; 32 http_status_code;
(...skipping 15 matching lines...) Expand all
48 typedef InProcessBrowserTest ChromeURLDataManagerTest; 48 typedef InProcessBrowserTest ChromeURLDataManagerTest;
49 49
50 // Makes sure navigating to the new tab page results in a http status code 50 // Makes sure navigating to the new tab page results in a http status code
51 // of 200. 51 // of 200.
52 IN_PROC_BROWSER_TEST_F(ChromeURLDataManagerTest, 200) { 52 IN_PROC_BROWSER_TEST_F(ChromeURLDataManagerTest, 200) {
53 NavigationNotificationObserver observer; 53 NavigationNotificationObserver observer;
54 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 54 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
55 EXPECT_TRUE(observer.got_navigation()); 55 EXPECT_TRUE(observer.got_navigation());
56 EXPECT_EQ(200, observer.http_status_code()); 56 EXPECT_EQ(200, observer.http_status_code());
57 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698