OLD | NEW |
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/test/test_tab_strip_model_observer.h" | 5 #include "chrome/test/test_tab_strip_model_observer.h" |
6 | 6 |
7 #include "chrome/browser/tabs/tab_strip_model.h" | 7 #include "chrome/browser/tabs/tab_strip_model.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
9 #include "chrome/test/ui_test_utils.h" | 9 #include "chrome/test/ui_test_utils.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (!done_) { | 36 if (!done_) { |
37 EXPECT_FALSE(running_); | 37 EXPECT_FALSE(running_); |
38 running_ = true; | 38 running_ = true; |
39 ui_test_utils::RunMessageLoop(); | 39 ui_test_utils::RunMessageLoop(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 void TestTabStripModelObserver::TabInsertedAt( | 43 void TestTabStripModelObserver::TabInsertedAt( |
44 TabContentsWrapper* contents, int index, bool foreground) { | 44 TabContentsWrapper* contents, int index, bool foreground) { |
45 NavigationController* controller = &contents->controller(); | 45 NavigationController* controller = &contents->controller(); |
46 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, | 46 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
47 Source<NavigationController>(controller)); | 47 Source<NavigationController>(controller)); |
48 registrar_.Add(this, NotificationType::LOAD_START, | 48 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
49 Source<NavigationController>(controller)); | 49 Source<NavigationController>(controller)); |
50 registrar_.Add(this, NotificationType::LOAD_STOP, | 50 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
51 Source<NavigationController>(controller)); | 51 Source<NavigationController>(controller)); |
52 } | 52 } |
53 | 53 |
54 void TestTabStripModelObserver::Observe( | 54 void TestTabStripModelObserver::Observe( |
55 NotificationType type, const NotificationSource& source, | 55 int type, const NotificationSource& source, |
56 const NotificationDetails& details) { | 56 const NotificationDetails& details) { |
57 if (type == NotificationType::NAV_ENTRY_COMMITTED || | 57 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || |
58 type == NotificationType::LOAD_START) { | 58 type == content::NOTIFICATION_LOAD_START) { |
59 if (!navigation_started_) { | 59 if (!navigation_started_) { |
60 load_start_observer_->OnLoadStart(); | 60 load_start_observer_->OnLoadStart(); |
61 navigation_started_ = true; | 61 navigation_started_ = true; |
62 } | 62 } |
63 } else if (type == NotificationType::LOAD_STOP) { | 63 } else if (type == content::NOTIFICATION_LOAD_STOP) { |
64 if (navigation_started_ && | 64 if (navigation_started_ && |
65 ++navigations_completed_ == number_of_navigations_) { | 65 ++navigations_completed_ == number_of_navigations_) { |
66 navigation_started_ = false; | 66 navigation_started_ = false; |
67 done_ = true; | 67 done_ = true; |
68 if (running_) | 68 if (running_) |
69 MessageLoopForUI::current()->Quit(); | 69 MessageLoopForUI::current()->Quit(); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
OLD | NEW |