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

Side by Side Diff: chrome/browser/automation/automation_tab_helper_unittest.cc

Issue 11191008: Remove TabContents from AutomationTabHelperTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/base/chrome_render_view_host_test_harness.h"
11 #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
12 #include "content/public/test/test_browser_thread.h" 11 #include "content/public/test/test_browser_thread.h"
13 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 using content::BrowserThread; 15 using content::BrowserThread;
17 using testing::_; 16 using testing::_;
18 17
19 class AutomationTabHelperTest : public TabContentsTestHarness { 18 class AutomationTabHelperTest : public ChromeRenderViewHostTestHarness {
20 public: 19 public:
21 AutomationTabHelperTest() 20 AutomationTabHelperTest()
22 : TabContentsTestHarness(), 21 : ChromeRenderViewHostTestHarness(),
23 browser_thread_(BrowserThread::UI, &message_loop_) {} 22 browser_thread_(BrowserThread::UI, &message_loop_) {}
24 23
25 virtual void SetUp() { 24 virtual void SetUp() {
26 TabContentsTestHarness::SetUp(); 25 ChromeRenderViewHostTestHarness::SetUp();
26 AutomationTabHelper::CreateForWebContents(web_contents());
27 mock_observer_.StartObserving(tab_helper()); 27 mock_observer_.StartObserving(tab_helper());
28 } 28 }
29 29
30 protected: 30 protected:
31 // These are here so that we don't have to add each test as a 31 // These are here so that we don't have to add each test as a
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 WebContentsDestroyed() {
42 tab_helper()->WebContentsDestroyed(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 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 TEST_F(AutomationTabHelperTest, DestroyedTabStopsLoading) { 202 TEST_F(AutomationTabHelperTest, DestroyedTabStopsLoading) {
203 testing::MockFunction<void()> check; 203 testing::MockFunction<void()> check;
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 WebContentsDestroyed();
212 EXPECT_FALSE(tab_helper()->has_pending_loads()); 212 EXPECT_FALSE(tab_helper()->has_pending_loads());
213 } 213 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698