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

Side by Side Diff: content/browser/tab_contents/navigation_controller_impl_unittest.cc

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/notification_types.h" 28 #include "content/public/browser/notification_types.h"
29 #include "content/public/browser/web_contents_delegate.h" 29 #include "content/public/browser/web_contents_delegate.h"
30 #include "content/test/test_browser_context.h" 30 #include "content/test/test_browser_context.h"
31 #include "content/test/test_notification_tracker.h" 31 #include "content/test/test_notification_tracker.h"
32 #include "net/base/net_util.h" 32 #include "net/base/net_util.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 #include "webkit/glue/webkit_glue.h" 34 #include "webkit/glue/webkit_glue.h"
35 35
36 using base::Time; 36 using base::Time;
37 using content::NavigationController;
37 using content::NavigationEntry; 38 using content::NavigationEntry;
38 using content::NavigationEntryImpl; 39 using content::NavigationEntryImpl;
39 using content::WebContents; 40 using content::WebContents;
40 41
41 // NavigationControllerTest ---------------------------------------------------- 42 // NavigationControllerTest ----------------------------------------------------
42 43
43 class NavigationControllerTest : public RenderViewHostTestHarness { 44 class NavigationControllerTest : public RenderViewHostTestHarness {
44 public: 45 public:
45 NavigationControllerTest() {} 46 NavigationControllerTest() {}
46 }; 47 };
47 48
48 void RegisterForAllNavNotifications(TestNotificationTracker* tracker, 49 void RegisterForAllNavNotifications(TestNotificationTracker* tracker,
49 NavigationControllerImpl* controller) { 50 NavigationControllerImpl* controller) {
50 tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_COMMITTED, 51 tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_COMMITTED,
51 content::Source<content::NavigationController>( 52 content::Source<NavigationController>(
52 controller)); 53 controller));
53 tracker->ListenFor(content::NOTIFICATION_NAV_LIST_PRUNED, 54 tracker->ListenFor(content::NOTIFICATION_NAV_LIST_PRUNED,
54 content::Source<content::NavigationController>( 55 content::Source<NavigationController>(
55 controller)); 56 controller));
56 tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_CHANGED, 57 tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_CHANGED,
57 content::Source<content::NavigationController>( 58 content::Source<NavigationController>(
58 controller)); 59 controller));
59 } 60 }
60 61
61 class TestWebContentsDelegate : public content::WebContentsDelegate { 62 class TestWebContentsDelegate : public content::WebContentsDelegate {
62 public: 63 public:
63 explicit TestWebContentsDelegate() : 64 explicit TestWebContentsDelegate() :
64 navigation_state_change_count_(0) {} 65 navigation_state_change_count_(0) {}
65 66
66 int navigation_state_change_count() { 67 int navigation_state_change_count() {
67 return navigation_state_change_count_; 68 return navigation_state_change_count_;
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 } 1390 }
1390 } 1391 }
1391 1392
1392 // NotificationObserver implementation used in verifying we've received the 1393 // NotificationObserver implementation used in verifying we've received the
1393 // content::NOTIFICATION_NAV_LIST_PRUNED method. 1394 // content::NOTIFICATION_NAV_LIST_PRUNED method.
1394 class PrunedListener : public content::NotificationObserver { 1395 class PrunedListener : public content::NotificationObserver {
1395 public: 1396 public:
1396 explicit PrunedListener(NavigationControllerImpl* controller) 1397 explicit PrunedListener(NavigationControllerImpl* controller)
1397 : notification_count_(0) { 1398 : notification_count_(0) {
1398 registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, 1399 registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED,
1399 content::Source<content::NavigationController>(controller)); 1400 content::Source<NavigationController>(controller));
1400 } 1401 }
1401 1402
1402 virtual void Observe(int type, 1403 virtual void Observe(int type,
1403 const content::NotificationSource& source, 1404 const content::NotificationSource& source,
1404 const content::NotificationDetails& details) { 1405 const content::NotificationDetails& details) {
1405 if (type == content::NOTIFICATION_NAV_LIST_PRUNED) { 1406 if (type == content::NOTIFICATION_NAV_LIST_PRUNED) {
1406 notification_count_++; 1407 notification_count_++;
1407 details_ = *(content::Details<content::PrunedDetails>(details).ptr()); 1408 details_ = *(content::Details<content::PrunedDetails>(details).ptr());
1408 } 1409 }
1409 } 1410 }
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 TabNavigation nav(0, url0, GURL(), string16(), 2419 TabNavigation nav(0, url0, GURL(), string16(),
2419 webkit_glue::CreateHistoryStateForURL(url0), 2420 webkit_glue::CreateHistoryStateForURL(url0),
2420 content::PAGE_TRANSITION_LINK); 2421 content::PAGE_TRANSITION_LINK);
2421 session_helper_.AssertNavigationEquals(nav, 2422 session_helper_.AssertNavigationEquals(nav,
2422 windows_[0]->tabs[0]->navigations[0]); 2423 windows_[0]->tabs[0]->navigations[0]);
2423 nav.set_url(url2); 2424 nav.set_url(url2);
2424 session_helper_.AssertNavigationEquals(nav, 2425 session_helper_.AssertNavigationEquals(nav,
2425 windows_[0]->tabs[0]->navigations[1]); 2426 windows_[0]->tabs[0]->navigations[1]);
2426 } 2427 }
2427 */ 2428 */
OLDNEW
« no previous file with comments | « content/browser/tab_contents/navigation_controller_impl.cc ('k') | content/browser/tab_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698