| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 18 #include "chrome/browser/google/google_profile_helper.h" |
| 18 #include "chrome/browser/google/google_util.h" | 19 #include "chrome/browser/google/google_util.h" |
| 19 #include "chrome/browser/net/url_request_mock_util.h" | 20 #include "chrome/browser/net/url_request_mock_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_commands.h" | 23 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 protected: | 407 protected: |
| 407 virtual void SetUpOnMainThread() OVERRIDE { | 408 virtual void SetUpOnMainThread() OVERRIDE { |
| 408 link_doctor_handler_ = new LinkDoctorProtocolHandler(); | 409 link_doctor_handler_ = new LinkDoctorProtocolHandler(); |
| 409 scoped_ptr<URLRequestJobFactory::ProtocolHandler> owned_handler( | 410 scoped_ptr<URLRequestJobFactory::ProtocolHandler> owned_handler( |
| 410 link_doctor_handler_); | 411 link_doctor_handler_); |
| 411 // Ownership of the |protocol_handler_| is passed to an object the IO | 412 // Ownership of the |protocol_handler_| is passed to an object the IO |
| 412 // thread, but a pointer is kept in the test fixture. As soon as anything | 413 // thread, but a pointer is kept in the test fixture. As soon as anything |
| 413 // calls URLRequestFilter::ClearHandlers(), |protocol_handler_| can become | 414 // calls URLRequestFilter::ClearHandlers(), |protocol_handler_| can become |
| 414 // invalid. | 415 // invalid. |
| 415 BrowserThread::PostTask( | 416 BrowserThread::PostTask( |
| 416 BrowserThread::IO, FROM_HERE, | 417 BrowserThread::IO, |
| 417 base::Bind(&InstallMockProtocolHandlers, | 418 FROM_HERE, |
| 418 google_util::GetGoogleSearchURL(browser()->profile()), | 419 base::Bind( |
| 419 base::Passed(&owned_handler))); | 420 &InstallMockProtocolHandlers, |
| 421 google_profile_helper::GetGoogleSearchURL(browser()->profile()), |
| 422 base::Passed(&owned_handler))); |
| 420 } | 423 } |
| 421 | 424 |
| 422 // Returns a GURL that results in a DNS error. | 425 // Returns a GURL that results in a DNS error. |
| 423 GURL GetDnsErrorURL() const { | 426 GURL GetDnsErrorURL() const { |
| 424 return URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); | 427 return URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); |
| 425 } | 428 } |
| 426 | 429 |
| 427 private: | 430 private: |
| 428 // Navigates the browser the indicated direction in the history and waits for | 431 // Navigates the browser the indicated direction in the history and waits for |
| 429 // |num_navigations| to occur and the title to change to |expected_title|. | 432 // |num_navigations| to occur and the title to change to |expected_title|. |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 browser(), | 1105 browser(), |
| 1103 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, | 1106 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, |
| 1104 kHostname), | 1107 kHostname), |
| 1105 1); | 1108 1); |
| 1106 | 1109 |
| 1107 ToggleHelpBox(browser()); | 1110 ToggleHelpBox(browser()); |
| 1108 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); | 1111 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); |
| 1109 } | 1112 } |
| 1110 | 1113 |
| 1111 } // namespace | 1114 } // namespace |
| OLD | NEW |