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

Side by Side Diff: chrome/browser/tabs/tab_strip_model_unittest.cc

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 years, 3 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/extensions/extension_tab_helper.h" 18 #include "chrome/browser/extensions/extension_tab_helper.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/tabs/tab_strip_model.h" 20 #include "chrome/browser/tabs/tab_strip_model.h"
21 #include "chrome/browser/tabs/tab_strip_model_delegate.h" 21 #include "chrome/browser/tabs/tab_strip_model_delegate.h"
22 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" 22 #include "chrome/browser/tabs/tab_strip_model_order_controller.h"
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
26 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
28 #include "chrome/test/base/testing_profile.h" 29 #include "chrome/test/base/testing_profile.h"
29 #include "content/browser/browser_thread.h" 30 #include "content/browser/browser_thread.h"
30 #include "content/browser/renderer_host/test_render_view_host.h"
31 #include "content/browser/tab_contents/navigation_controller.h" 31 #include "content/browser/tab_contents/navigation_controller.h"
32 #include "content/browser/tab_contents/navigation_entry.h" 32 #include "content/browser/tab_contents/navigation_entry.h"
33 #include "content/browser/tab_contents/tab_contents.h" 33 #include "content/browser/tab_contents/tab_contents.h"
34 #include "content/common/notification_details.h" 34 #include "content/common/notification_details.h"
35 #include "content/common/notification_observer_mock.h" 35 #include "content/common/notification_observer_mock.h"
36 #include "content/common/notification_registrar.h" 36 #include "content/common/notification_registrar.h"
37 #include "content/common/notification_source.h" 37 #include "content/common/notification_source.h"
38 #include "content/common/property_bag.h" 38 #include "content/common/property_bag.h"
39 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
40 40
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // Whether tabs can be closed. 141 // Whether tabs can be closed.
142 bool can_close_; 142 bool can_close_;
143 143
144 // Whether to report that we need to run an unload listener before closing. 144 // Whether to report that we need to run an unload listener before closing.
145 bool run_unload_; 145 bool run_unload_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); 147 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate);
148 }; 148 };
149 149
150 class TabStripModelTest : public RenderViewHostTestHarness { 150 class TabStripModelTest : public ChromeRenderViewHostTestHarness {
151 public: 151 public:
152 TabStripModelTest() 152 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) {
153 : RenderViewHostTestHarness(),
154 browser_thread_(BrowserThread::UI, &message_loop_) {
155 } 153 }
156 154
157 TabContentsWrapper* CreateTabContents() { 155 TabContentsWrapper* CreateTabContents() {
158 return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL); 156 return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL);
159 } 157 }
160 158
161 TabContentsWrapper* CreateTabContentsWithSharedRPH( 159 TabContentsWrapper* CreateTabContentsWithSharedRPH(
162 TabContents* tab_contents) { 160 TabContents* tab_contents) {
163 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(), 161 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(),
164 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE, 162 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE,
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 ASSERT_EQ(1, observer.GetStateCount()); 2311 ASSERT_EQ(1, observer.GetStateCount());
2314 MockTabStripModelObserver::State s( 2312 MockTabStripModelObserver::State s(
2315 contents2, 1, MockTabStripModelObserver::SELECT); 2313 contents2, 1, MockTabStripModelObserver::SELECT);
2316 s.src_contents = contents2; 2314 s.src_contents = contents2;
2317 s.src_index = 1; 2315 s.src_index = 1;
2318 s.user_gesture = false; 2316 s.user_gesture = false;
2319 EXPECT_TRUE(observer.StateEquals(0, s)); 2317 EXPECT_TRUE(observer.StateEquals(0, s));
2320 strip.RemoveObserver(&observer); 2318 strip.RemoveObserver(&observer);
2321 strip.CloseAllTabs(); 2319 strip.CloseAllTabs();
2322 } 2320 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_contents_unittest.cc ('k') | chrome/browser/translate/translate_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698