| 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/file_enumerator.h" |
| 6 #include "base/hash.h" | 7 #include "base/hash.h" |
| 7 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 ASSERT_TRUE(pdf_test_server()->Start()); | 306 ASSERT_TRUE(pdf_test_server()->Start()); |
| 306 | 307 |
| 307 NavigationController* controller = | 308 NavigationController* controller = |
| 308 &(browser()->tab_strip_model()->GetActiveWebContents()->GetController()); | 309 &(browser()->tab_strip_model()->GetActiveWebContents()->GetController()); |
| 309 content::NotificationRegistrar registrar; | 310 content::NotificationRegistrar registrar; |
| 310 registrar.Add(this, | 311 registrar.Add(this, |
| 311 content::NOTIFICATION_LOAD_STOP, | 312 content::NOTIFICATION_LOAD_STOP, |
| 312 content::Source<NavigationController>(controller)); | 313 content::Source<NavigationController>(controller)); |
| 313 std::string base_url = std::string("files/"); | 314 std::string base_url = std::string("files/"); |
| 314 | 315 |
| 315 file_util::FileEnumerator file_enumerator( | 316 base::FileEnumerator file_enumerator( |
| 316 ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), | 317 ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), |
| 317 false, | 318 false, |
| 318 file_util::FileEnumerator::FILES, | 319 base::FileEnumerator::FILES, |
| 319 FILE_PATH_LITERAL("*.pdf")); | 320 FILE_PATH_LITERAL("*.pdf")); |
| 320 for (base::FilePath file_path = file_enumerator.Next(); | 321 for (base::FilePath file_path = file_enumerator.Next(); |
| 321 !file_path.empty(); | 322 !file_path.empty(); |
| 322 file_path = file_enumerator.Next()) { | 323 file_path = file_enumerator.Next()) { |
| 323 std::string filename = file_path.BaseName().MaybeAsASCII(); | 324 std::string filename = file_path.BaseName().MaybeAsASCII(); |
| 324 ASSERT_FALSE(filename.empty()); | 325 ASSERT_FALSE(filename.empty()); |
| 325 | 326 |
| 326 #if defined(OS_POSIX) | 327 #if defined(OS_POSIX) |
| 327 if (filename == "sample.pdf") | 328 if (filename == "sample.pdf") |
| 328 continue; // Crashes on Mac and Linux. http://crbug.com/63549 | 329 continue; // Crashes on Mac and Linux. http://crbug.com/63549 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 browser()->tab_strip_model()->GetActiveWebContents(), | 410 browser()->tab_strip_model()->GetActiveWebContents(), |
| 410 "reloadPDF();")); | 411 "reloadPDF();")); |
| 411 observer.Wait(); | 412 observer.Wait(); |
| 412 | 413 |
| 413 ASSERT_EQ("success", | 414 ASSERT_EQ("success", |
| 414 browser()->tab_strip_model()->GetActiveWebContents()-> | 415 browser()->tab_strip_model()->GetActiveWebContents()-> |
| 415 GetURL().query()); | 416 GetURL().query()); |
| 416 } | 417 } |
| 417 | 418 |
| 418 } // namespace | 419 } // namespace |
| OLD | NEW |