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

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

Issue 4697005: Part 3 of reapplying r64637. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prune dead files from gyp Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "app/message_box_flags.h" 7 #include "app/message_box_flags.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 *success = false; 1347 *success = false;
1348 *security_style = SECURITY_STYLE_UNKNOWN; 1348 *security_style = SECURITY_STYLE_UNKNOWN;
1349 *ssl_cert_status = 0; 1349 *ssl_cert_status = 0;
1350 *insecure_content_status = 0; 1350 *insecure_content_status = 0;
1351 } 1351 }
1352 } 1352 }
1353 1353
1354 void TestingAutomationProvider::GetPageType( 1354 void TestingAutomationProvider::GetPageType(
1355 int handle, 1355 int handle,
1356 bool* success, 1356 bool* success,
1357 NavigationEntry::PageType* page_type) { 1357 PageType* page_type) {
1358 if (tab_tracker_->ContainsHandle(handle)) { 1358 if (tab_tracker_->ContainsHandle(handle)) {
1359 NavigationController* tab = tab_tracker_->GetResource(handle); 1359 NavigationController* tab = tab_tracker_->GetResource(handle);
1360 NavigationEntry* entry = tab->GetActiveEntry(); 1360 NavigationEntry* entry = tab->GetActiveEntry();
1361 *page_type = entry->page_type(); 1361 *page_type = entry->page_type();
1362 *success = true; 1362 *success = true;
1363 // In order to return the proper result when an interstitial is shown and 1363 // In order to return the proper result when an interstitial is shown and
1364 // no navigation entry were created for it we need to ask the TabContents. 1364 // no navigation entry were created for it we need to ask the TabContents.
1365 if (*page_type == NavigationEntry::NORMAL_PAGE && 1365 if (*page_type == NORMAL_PAGE &&
1366 tab->tab_contents()->showing_interstitial_page()) 1366 tab->tab_contents()->showing_interstitial_page())
1367 *page_type = NavigationEntry::INTERSTITIAL_PAGE; 1367 *page_type = INTERSTITIAL_PAGE;
1368 } else { 1368 } else {
1369 *success = false; 1369 *success = false;
1370 *page_type = NavigationEntry::NORMAL_PAGE; 1370 *page_type = NORMAL_PAGE;
1371 } 1371 }
1372 } 1372 }
1373 1373
1374 void TestingAutomationProvider::GetMetricEventDuration( 1374 void TestingAutomationProvider::GetMetricEventDuration(
1375 const std::string& event_name, 1375 const std::string& event_name,
1376 int* duration_ms) { 1376 int* duration_ms) {
1377 *duration_ms = metric_event_duration_observer_->GetEventDurationMs( 1377 *duration_ms = metric_event_duration_observer_->GetEventDurationMs(
1378 event_name); 1378 event_name);
1379 } 1379 }
1380 1380
1381 void TestingAutomationProvider::ActionOnSSLBlockingPage( 1381 void TestingAutomationProvider::ActionOnSSLBlockingPage(
1382 int handle, 1382 int handle,
1383 bool proceed, 1383 bool proceed,
1384 IPC::Message* reply_message) { 1384 IPC::Message* reply_message) {
1385 if (tab_tracker_->ContainsHandle(handle)) { 1385 if (tab_tracker_->ContainsHandle(handle)) {
1386 NavigationController* tab = tab_tracker_->GetResource(handle); 1386 NavigationController* tab = tab_tracker_->GetResource(handle);
1387 NavigationEntry* entry = tab->GetActiveEntry(); 1387 NavigationEntry* entry = tab->GetActiveEntry();
1388 if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) { 1388 if (entry->page_type() == INTERSTITIAL_PAGE) {
1389 TabContents* tab_contents = tab->tab_contents(); 1389 TabContents* tab_contents = tab->tab_contents();
1390 InterstitialPage* ssl_blocking_page = 1390 InterstitialPage* ssl_blocking_page =
1391 InterstitialPage::GetInterstitialPage(tab_contents); 1391 InterstitialPage::GetInterstitialPage(tab_contents);
1392 if (ssl_blocking_page) { 1392 if (ssl_blocking_page) {
1393 if (proceed) { 1393 if (proceed) {
1394 AddNavigationStatusListener(tab, reply_message, 1, false); 1394 AddNavigationStatusListener(tab, reply_message, 1, false);
1395 ssl_blocking_page->Proceed(); 1395 ssl_blocking_page->Proceed();
1396 return; 1396 return;
1397 } 1397 }
1398 ssl_blocking_page->DontProceed(); 1398 ssl_blocking_page->DontProceed();
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 2462
2463 NavigationEntry::SSLStatus ssl_status = nav_entry->ssl(); 2463 NavigationEntry::SSLStatus ssl_status = nav_entry->ssl();
2464 ssl->SetString("security_style", 2464 ssl->SetString("security_style",
2465 style_to_string[ssl_status.security_style()]); 2465 style_to_string[ssl_status.security_style()]);
2466 ssl->SetBoolean("ran_insecure_content", ssl_status.ran_insecure_content()); 2466 ssl->SetBoolean("ran_insecure_content", ssl_status.ran_insecure_content());
2467 ssl->SetBoolean("displayed_insecure_content", 2467 ssl->SetBoolean("displayed_insecure_content",
2468 ssl_status.displayed_insecure_content()); 2468 ssl_status.displayed_insecure_content());
2469 return_value->Set("ssl", ssl); 2469 return_value->Set("ssl", ssl);
2470 2470
2471 // Page type. 2471 // Page type.
2472 std::map<NavigationEntry::PageType, std::string> pagetype_to_string; 2472 std::map<PageType, std::string> pagetype_to_string;
2473 pagetype_to_string[NavigationEntry::NORMAL_PAGE] = "NORMAL_PAGE"; 2473 pagetype_to_string[NORMAL_PAGE] = "NORMAL_PAGE";
2474 pagetype_to_string[NavigationEntry::ERROR_PAGE] = "ERROR_PAGE"; 2474 pagetype_to_string[ERROR_PAGE] = "ERROR_PAGE";
2475 pagetype_to_string[NavigationEntry::INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE"; 2475 pagetype_to_string[INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE";
2476 return_value->SetString("page_type", 2476 return_value->SetString("page_type",
2477 pagetype_to_string[nav_entry->page_type()]); 2477 pagetype_to_string[nav_entry->page_type()]);
2478 2478
2479 return_value->SetString("favicon_url", nav_entry->favicon().url().spec()); 2479 return_value->SetString("favicon_url", nav_entry->favicon().url().spec());
2480 reply.SendSuccess(return_value.get()); 2480 reply.SendSuccess(return_value.get());
2481 } 2481 }
2482 2482
2483 // Sample json input: { "command": "GetHistoryInfo", 2483 // Sample json input: { "command": "GetHistoryInfo",
2484 // "search_text": "some text" } 2484 // "search_text": "some text" }
2485 // Refer chrome/test/pyautolib/history_info.py for sample json output. 2485 // Refer chrome/test/pyautolib/history_info.py for sample json output.
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
4435 DCHECK(type == NotificationType::SESSION_END); 4435 DCHECK(type == NotificationType::SESSION_END);
4436 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit 4436 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit
4437 // before the task runs resulting in this object not being deleted. This 4437 // before the task runs resulting in this object not being deleted. This
4438 // Release balance out the Release scheduled by OnBrowserRemoved. 4438 // Release balance out the Release scheduled by OnBrowserRemoved.
4439 Release(); 4439 Release();
4440 } 4440 }
4441 4441
4442 void TestingAutomationProvider::OnRemoveProvider() { 4442 void TestingAutomationProvider::OnRemoveProvider() {
4443 AutomationProviderList::GetInstance()->RemoveProvider(this); 4443 AutomationProviderList::GetInstance()->RemoveProvider(this);
4444 } 4444 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698