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

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 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 "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/prerender/prerender_manager.h" 13 #include "chrome/browser/prerender/prerender_manager.h"
14 #include "chrome/browser/prerender/prerender_manager_factory.h" 14 #include "chrome/browser/prerender/prerender_manager_factory.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_tabstrip.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
18 #include "chrome/browser/ui/webui/web_ui_browsertest.h" 19 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/ui_test_utils.h" 21 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_ui_message_handler.h" 24 #include "content/public/browser/web_ui_message_handler.h"
24 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
25 #include "net/base/address_list.h" 26 #include "net/base/address_list.h"
26 #include "net/base/host_cache.h" 27 #include "net/base/host_cache.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ui_test_utils::NavigateToURLWithDisposition( 239 ui_test_utils::NavigateToURLWithDisposition(
239 browser(), 240 browser(),
240 GURL(loader_url), 241 GURL(loader_url),
241 NEW_BACKGROUND_TAB, 242 NEW_BACKGROUND_TAB,
242 ui_test_utils::BROWSER_TEST_NONE); 243 ui_test_utils::BROWSER_TEST_NONE);
243 } 244 }
244 245
245 void NetInternalsTest::MessageHandler::NavigateToPrerender( 246 void NetInternalsTest::MessageHandler::NavigateToPrerender(
246 const ListValue* list_value) { 247 const ListValue* list_value) {
247 content::RenderViewHost* host = 248 content::RenderViewHost* host =
248 browser()->GetWebContentsAt(1)->GetRenderViewHost(); 249 chrome::GetWebContentsAt(browser(), 1)->GetRenderViewHost();
249 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()")); 250 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()"));
250 } 251 }
251 252
252 void NetInternalsTest::MessageHandler::CreateIncognitoBrowser( 253 void NetInternalsTest::MessageHandler::CreateIncognitoBrowser(
253 const ListValue* list_value) { 254 const ListValue* list_value) {
254 ASSERT_FALSE(incognito_browser_); 255 ASSERT_FALSE(incognito_browser_);
255 incognito_browser_ = net_internals_test_->CreateIncognitoBrowser(); 256 incognito_browser_ = net_internals_test_->CreateIncognitoBrowser();
256 257
257 // Tell the test harness that creation is complete. 258 // Tell the test harness that creation is complete.
258 StringValue command_value("onIncognitoBrowserCreatedForTest"); 259 StringValue command_value("onIncognitoBrowserCreatedForTest");
259 web_ui()->CallJavascriptFunction("g_browser.receive", command_value); 260 web_ui()->CallJavascriptFunction("g_browser.receive", command_value);
260 } 261 }
261 262
262 void NetInternalsTest::MessageHandler::CloseIncognitoBrowser( 263 void NetInternalsTest::MessageHandler::CloseIncognitoBrowser(
263 const ListValue* list_value) { 264 const ListValue* list_value) {
264 ASSERT_TRUE(incognito_browser_); 265 ASSERT_TRUE(incognito_browser_);
265 incognito_browser_->CloseAllTabs(); 266 chrome::CloseAllTabs(incognito_browser_);
266 // Closing all a Browser's tabs will ultimately result in its destruction, 267 // Closing all a Browser's tabs will ultimately result in its destruction,
267 // thought it may not have been destroyed yet. 268 // thought it may not have been destroyed yet.
268 incognito_browser_ = NULL; 269 incognito_browser_ = NULL;
269 } 270 }
270 271
271 void NetInternalsTest::MessageHandler::EnableHttpPipelining( 272 void NetInternalsTest::MessageHandler::EnableHttpPipelining(
272 const ListValue* list_value) { 273 const ListValue* list_value) {
273 bool enable; 274 bool enable;
274 ASSERT_TRUE(list_value->GetBoolean(0, &enable)); 275 ASSERT_TRUE(list_value->GetBoolean(0, &enable));
275 BrowserThread::PostTask( 276 BrowserThread::PostTask(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) { 318 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) {
318 WebUIBrowserTest::SetUpCommandLine(command_line); 319 WebUIBrowserTest::SetUpCommandLine(command_line);
319 // Needed to test the prerender view. 320 // Needed to test the prerender view.
320 command_line->AppendSwitchASCII(switches::kPrerenderMode, 321 command_line->AppendSwitchASCII(switches::kPrerenderMode,
321 switches::kPrerenderModeSwitchValueEnabled); 322 switches::kPrerenderModeSwitchValueEnabled);
322 } 323 }
323 324
324 void NetInternalsTest::SetUpOnMainThread() { 325 void NetInternalsTest::SetUpOnMainThread() {
325 // Increase the memory allowed in a prerendered page above normal settings, 326 // Increase the memory allowed in a prerendered page above normal settings,
326 // as debug builds use more memory and often go over the usual limit. 327 // as debug builds use more memory and often go over the usual limit.
327 Profile* profile = browser()->GetActiveTabContents()->profile(); 328 Profile* profile = browser()->profile();
328 prerender::PrerenderManager* prerender_manager = 329 prerender::PrerenderManager* prerender_manager =
329 prerender::PrerenderManagerFactory::GetForProfile(profile); 330 prerender::PrerenderManagerFactory::GetForProfile(profile);
330 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; 331 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024;
331 } 332 }
332 333
333 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { 334 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() {
334 return message_handler_.get(); 335 return message_handler_.get();
335 } 336 }
336 337
337 GURL NetInternalsTest::CreatePrerenderLoaderUrl( 338 GURL NetInternalsTest::CreatePrerenderLoaderUrl(
(...skipping 12 matching lines...) Expand all
350 GURL url_loader = test_server()->GetURL(replacement_path); 351 GURL url_loader = test_server()->GetURL(replacement_path);
351 return url_loader; 352 return url_loader;
352 } 353 }
353 354
354 bool NetInternalsTest::StartTestServer() { 355 bool NetInternalsTest::StartTestServer() {
355 if (test_server_started_) 356 if (test_server_started_)
356 return true; 357 return true;
357 test_server_started_ = test_server()->Start(); 358 test_server_started_ = test_server()->Start();
358 return test_server_started_; 359 return test_server_started_;
359 } 360 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui_browsertest.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698