| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "chrome/browser/automation/automation_tab_helper.h" | 8 #include "chrome/browser/automation/automation_tab_helper.h" |
| 9 #include "chrome/browser/automation/mock_tab_event_observer.h" | 9 #include "chrome/browser/automation/mock_tab_event_observer.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // |AutomationTabHelper| friend. | 32 // |AutomationTabHelper| friend. |
| 33 void StartLoading() { | 33 void StartLoading() { |
| 34 tab_helper()->DidStartLoading(NULL); | 34 tab_helper()->DidStartLoading(NULL); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void StopLoading() { | 37 void StopLoading() { |
| 38 tab_helper()->DidStopLoading(NULL); | 38 tab_helper()->DidStopLoading(NULL); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void TabContentsDestroyed() { | 41 void TabContentsDestroyed() { |
| 42 tab_helper()->WebContentsDestroyed(tab_contents()->web_contents()); | 42 tab_helper()->WebContentsDestroyed(web_contents()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void WillPerformClientRedirect(int64 frame_id) { | 45 void WillPerformClientRedirect(int64 frame_id) { |
| 46 tab_helper()->OnWillPerformClientRedirect(frame_id, 0); | 46 tab_helper()->OnWillPerformClientRedirect(frame_id, 0); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void CompleteOrCancelClientRedirect(int64 frame_id) { | 49 void CompleteOrCancelClientRedirect(int64 frame_id) { |
| 50 tab_helper()->OnDidCompleteOrCancelClientRedirect(frame_id); | 50 tab_helper()->OnDidCompleteOrCancelClientRedirect(frame_id); |
| 51 } | 51 } |
| 52 | 52 |
| 53 AutomationTabHelper* tab_helper() { | 53 AutomationTabHelper* tab_helper() { |
| 54 return tab_contents()->automation_tab_helper(); | 54 return AutomationTabHelper::FromWebContents(web_contents()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 content::TestBrowserThread browser_thread_; | 57 content::TestBrowserThread browser_thread_; |
| 58 | 58 |
| 59 MockTabEventObserver mock_observer_; | 59 MockTabEventObserver mock_observer_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 ACTION_P2(CheckHasPendingLoads, tab_helper, has_pending_loads) { | 62 ACTION_P2(CheckHasPendingLoads, tab_helper, has_pending_loads) { |
| 63 EXPECT_EQ(has_pending_loads, tab_helper->has_pending_loads()); | 63 EXPECT_EQ(has_pending_loads, tab_helper->has_pending_loads()); |
| 64 } | 64 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 testing::InSequence expect_in_sequence; | 205 testing::InSequence expect_in_sequence; |
| 206 EXPECT_CALL(mock_observer_, OnFirstPendingLoad(contents())); | 206 EXPECT_CALL(mock_observer_, OnFirstPendingLoad(contents())); |
| 207 EXPECT_CALL(mock_observer_, OnNoMorePendingLoads(contents())); | 207 EXPECT_CALL(mock_observer_, OnNoMorePendingLoads(contents())); |
| 208 | 208 |
| 209 StartLoading(); | 209 StartLoading(); |
| 210 WillPerformClientRedirect(1); | 210 WillPerformClientRedirect(1); |
| 211 TabContentsDestroyed(); | 211 TabContentsDestroyed(); |
| 212 EXPECT_FALSE(tab_helper()->has_pending_loads()); | 212 EXPECT_FALSE(tab_helper()->has_pending_loads()); |
| 213 } | 213 } |
| OLD | NEW |