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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ASSERT_TRUE(pdf_test_server()->Start()); | 308 ASSERT_TRUE(pdf_test_server()->Start()); |
308 | 309 |
309 NavigationController* controller = | 310 NavigationController* controller = |
310 &(browser()->tab_strip_model()->GetActiveWebContents()->GetController()); | 311 &(browser()->tab_strip_model()->GetActiveWebContents()->GetController()); |
311 content::NotificationRegistrar registrar; | 312 content::NotificationRegistrar registrar; |
312 registrar.Add(this, | 313 registrar.Add(this, |
313 content::NOTIFICATION_LOAD_STOP, | 314 content::NOTIFICATION_LOAD_STOP, |
314 content::Source<NavigationController>(controller)); | 315 content::Source<NavigationController>(controller)); |
315 std::string base_url = std::string("files/"); | 316 std::string base_url = std::string("files/"); |
316 | 317 |
317 file_util::FileEnumerator file_enumerator( | 318 base::FileEnumerator file_enumerator( |
318 ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), | 319 ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), |
319 false, | 320 false, |
320 file_util::FileEnumerator::FILES, | 321 base::FileEnumerator::FILES, |
321 FILE_PATH_LITERAL("*.pdf")); | 322 FILE_PATH_LITERAL("*.pdf")); |
322 for (base::FilePath file_path = file_enumerator.Next(); | 323 for (base::FilePath file_path = file_enumerator.Next(); |
323 !file_path.empty(); | 324 !file_path.empty(); |
324 file_path = file_enumerator.Next()) { | 325 file_path = file_enumerator.Next()) { |
325 std::string filename = file_path.BaseName().MaybeAsASCII(); | 326 std::string filename = file_path.BaseName().MaybeAsASCII(); |
326 ASSERT_FALSE(filename.empty()); | 327 ASSERT_FALSE(filename.empty()); |
327 | 328 |
328 #if defined(OS_POSIX) | 329 #if defined(OS_POSIX) |
329 if (filename == "sample.pdf") | 330 if (filename == "sample.pdf") |
330 continue; // Crashes on Mac and Linux. http://crbug.com/63549 | 331 continue; // Crashes on Mac and Linux. http://crbug.com/63549 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 browser()->tab_strip_model()->GetActiveWebContents(), | 412 browser()->tab_strip_model()->GetActiveWebContents(), |
412 "reloadPDF();")); | 413 "reloadPDF();")); |
413 observer.Wait(); | 414 observer.Wait(); |
414 | 415 |
415 ASSERT_EQ("success", | 416 ASSERT_EQ("success", |
416 browser()->tab_strip_model()->GetActiveWebContents()-> | 417 browser()->tab_strip_model()->GetActiveWebContents()-> |
417 GetURL().query()); | 418 GetURL().query()); |
418 } | 419 } |
419 | 420 |
420 } // namespace | 421 } // namespace |
OLD | NEW |