| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/page_transition_types.h" | |
| 19 #include "content/public/test/browser_test_utils.h" | 18 #include "content/public/test/browser_test_utils.h" |
| 20 #include "net/test/embedded_test_server/embedded_test_server.h" | 19 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 21 #include "net/test/embedded_test_server/http_request.h" | 20 #include "net/test/embedded_test_server/http_request.h" |
| 22 #include "net/test/embedded_test_server/http_response.h" | 21 #include "net/test/embedded_test_server/http_response.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/base/page_transition_types.h" |
| 24 | 24 |
| 25 using content::OpenURLParams; | 25 using content::OpenURLParams; |
| 26 using content::Referrer; | 26 using content::Referrer; |
| 27 using content::WebContents; | 27 using content::WebContents; |
| 28 | 28 |
| 29 // TODO(jam): http://crbug.com/350550 | 29 // TODO(jam): http://crbug.com/350550 |
| 30 #if !(defined(OS_CHROMEOS) && defined(ADDRESS_SANITIZER)) | 30 #if !(defined(OS_CHROMEOS) && defined(ADDRESS_SANITIZER)) |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 void SimulateRendererCrash(Browser* browser) { | 34 void SimulateRendererCrash(Browser* browser) { |
| 35 content::WindowedNotificationObserver observer( | 35 content::WindowedNotificationObserver observer( |
| 36 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 36 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
| 37 content::NotificationService::AllSources()); | 37 content::NotificationService::AllSources()); |
| 38 browser->OpenURL(OpenURLParams( | 38 browser->OpenURL(OpenURLParams( |
| 39 GURL(content::kChromeUICrashURL), Referrer(), CURRENT_TAB, | 39 GURL(content::kChromeUICrashURL), Referrer(), CURRENT_TAB, |
| 40 content::PAGE_TRANSITION_TYPED, false)); | 40 ui::PAGE_TRANSITION_TYPED, false)); |
| 41 observer.Wait(); | 41 observer.Wait(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // A request handler which returns a different result each time but stays fresh | 44 // A request handler which returns a different result each time but stays fresh |
| 45 // into the far future. | 45 // into the far future. |
| 46 class CacheMaxAgeHandler { | 46 class CacheMaxAgeHandler { |
| 47 public: | 47 public: |
| 48 explicit CacheMaxAgeHandler(const std::string& path) | 48 explicit CacheMaxAgeHandler(const std::string& path) |
| 49 : path_(path), request_count_(0) { } | 49 : path_(path), request_count_(0) { } |
| 50 | 50 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ASSERT_EQ(url, GetActiveWebContents()->GetVisibleURL()); | 168 ASSERT_EQ(url, GetActiveWebContents()->GetVisibleURL()); |
| 169 | 169 |
| 170 chrome::Reload(browser(), CURRENT_TAB); | 170 chrome::Reload(browser(), CURRENT_TAB); |
| 171 content::WaitForLoadStop(GetActiveWebContents()); | 171 content::WaitForLoadStop(GetActiveWebContents()); |
| 172 ASSERT_EQ(url, GetActiveWebContents()->GetVisibleURL()); | 172 ASSERT_EQ(url, GetActiveWebContents()->GetVisibleURL()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace | 175 } // namespace |
| 176 | 176 |
| 177 #endif | 177 #endif |
| OLD | NEW |