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

Side by Side Diff: chrome/browser/tab_contents/web_contents_unittest.cc

Issue 345037: Fifth patch in getting rid of caching MessageLoop pointers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/message_box_flags.h" 5 #include "app/message_box_flags.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "chrome/browser/renderer_host/render_view_host.h" 7 #include "chrome/browser/renderer_host/render_view_host.h"
8 #include "chrome/browser/renderer_host/render_widget_host_view.h" 8 #include "chrome/browser/renderer_host/render_widget_host_view.h"
9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h"
10 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/tab_contents/interstitial_page.h" 11 #include "chrome/browser/tab_contents/interstitial_page.h"
11 #include "chrome/browser/tab_contents/navigation_controller.h" 12 #include "chrome/browser/tab_contents/navigation_controller.h"
12 #include "chrome/browser/tab_contents/navigation_entry.h" 13 #include "chrome/browser/tab_contents/navigation_entry.h"
13 #include "chrome/browser/tab_contents/test_tab_contents.h" 14 #include "chrome/browser/tab_contents/test_tab_contents.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/pref_service.h" 16 #include "chrome/common/pref_service.h"
16 #include "chrome/common/render_messages.h" 17 #include "chrome/common/render_messages.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "chrome/test/testing_profile.h" 19 #include "chrome/test/testing_profile.h"
19 #include "ipc/ipc_channel.h" 20 #include "ipc/ipc_channel.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 DCHECK(interstitial_page_ == interstitial); 185 DCHECK(interstitial_page_ == interstitial);
185 interstitial_page_ = NULL; 186 interstitial_page_ = NULL;
186 } 187 }
187 188
188 private: 189 private:
189 TestInterstitialPage* interstitial_page_; 190 TestInterstitialPage* interstitial_page_;
190 }; 191 };
191 192
192 class TabContentsTest : public RenderViewHostTestHarness { 193 class TabContentsTest : public RenderViewHostTestHarness {
193 public: 194 public:
194 TabContentsTest() : RenderViewHostTestHarness() { 195 TabContentsTest()
196 : RenderViewHostTestHarness(),
197 ui_thread_(ChromeThread::UI, &message_loop_) {
195 } 198 }
196 199
197 private: 200 private:
198 // Supply our own profile so we use the correct profile data. The test harness 201 // Supply our own profile so we use the correct profile data. The test harness
199 // is not supposed to overwrite a profile if it's already created. 202 // is not supposed to overwrite a profile if it's already created.
200 virtual void SetUp() { 203 virtual void SetUp() {
201 profile_.reset(new TabContentsTestingProfile()); 204 profile_.reset(new TabContentsTestingProfile());
202 RenderViewHostTestHarness::SetUp(); 205 RenderViewHostTestHarness::SetUp();
203 } 206 }
207
208 ChromeThread ui_thread_;
204 }; 209 };
205 210
206 // Test to make sure that title updates get stripped of whitespace. 211 // Test to make sure that title updates get stripped of whitespace.
207 TEST_F(TabContentsTest, UpdateTitle) { 212 TEST_F(TabContentsTest, UpdateTitle) {
208 ViewHostMsg_FrameNavigate_Params params; 213 ViewHostMsg_FrameNavigate_Params params;
209 InitNavigateParams(&params, 0, GURL(chrome::kAboutBlankURL)); 214 InitNavigateParams(&params, 0, GURL(chrome::kAboutBlankURL));
210 215
211 NavigationController::LoadCommittedDetails details; 216 NavigationController::LoadCommittedDetails details;
212 controller().RendererDidNavigate(params, 0, &details); 217 controller().RendererDidNavigate(params, 0, &details);
213 218
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 1297
1293 // While the interstitial is showing, let's simulate the hidden page 1298 // While the interstitial is showing, let's simulate the hidden page
1294 // attempting to show a JS message. 1299 // attempting to show a JS message.
1295 IPC::Message* dummy_message = new IPC::Message; 1300 IPC::Message* dummy_message = new IPC::Message;
1296 bool did_suppress_message = false; 1301 bool did_suppress_message = false;
1297 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", 1302 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK",
1298 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, 1303 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message,
1299 &did_suppress_message); 1304 &did_suppress_message);
1300 EXPECT_TRUE(did_suppress_message); 1305 EXPECT_TRUE(did_suppress_message);
1301 } 1306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698