| 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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "content/public/test/browser_test_utils.h" | 66 #include "content/public/test/browser_test_utils.h" |
| 67 #include "content/public/test/download_test_observer.h" | 67 #include "content/public/test/download_test_observer.h" |
| 68 #include "content/public/test/test_navigation_observer.h" | 68 #include "content/public/test/test_navigation_observer.h" |
| 69 #include "content/public/test/test_utils.h" | 69 #include "content/public/test/test_utils.h" |
| 70 #include "net/base/net_util.h" | 70 #include "net/base/net_util.h" |
| 71 #include "net/test/python_utils.h" | 71 #include "net/test/python_utils.h" |
| 72 #include "third_party/skia/include/core/SkBitmap.h" | 72 #include "third_party/skia/include/core/SkBitmap.h" |
| 73 #include "third_party/skia/include/core/SkColor.h" | 73 #include "third_party/skia/include/core/SkColor.h" |
| 74 #include "ui/gfx/size.h" | 74 #include "ui/gfx/size.h" |
| 75 #include "ui/snapshot/snapshot.h" | 75 #include "ui/snapshot/snapshot.h" |
| 76 #include "ui/ui_controls/ui_controls.h" | |
| 77 | 76 |
| 78 #if defined(USE_AURA) | 77 #if defined(USE_AURA) |
| 79 #include "ash/shell.h" | 78 #include "ash/shell.h" |
| 80 #include "ui/aura/root_window.h" | 79 #include "ui/aura/root_window.h" |
| 81 #endif | 80 #endif |
| 82 | 81 |
| 83 using content::BrowserThread; | 82 using content::BrowserThread; |
| 84 using content::DomOperationNotificationDetails; | 83 using content::DomOperationNotificationDetails; |
| 85 using content::NativeWebKeyboardEvent; | 84 using content::NativeWebKeyboardEvent; |
| 86 using content::NavigationController; | 85 using content::NavigationController; |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 position.longitude = longitude; | 663 position.longitude = longitude; |
| 665 position.altitude = 0.; | 664 position.altitude = 0.; |
| 666 position.accuracy = 0.; | 665 position.accuracy = 0.; |
| 667 position.timestamp = base::Time::Now(); | 666 position.timestamp = base::Time::Now(); |
| 668 scoped_refptr<content::MessageLoopRunner> runner = | 667 scoped_refptr<content::MessageLoopRunner> runner = |
| 669 new content::MessageLoopRunner; | 668 new content::MessageLoopRunner; |
| 670 content::OverrideLocationForTesting(position, runner->QuitClosure()); | 669 content::OverrideLocationForTesting(position, runner->QuitClosure()); |
| 671 runner->Run(); | 670 runner->Run(); |
| 672 } | 671 } |
| 673 | 672 |
| 674 namespace internal { | |
| 675 | |
| 676 void ClickTask(ui_controls::MouseButton button, | |
| 677 int state, | |
| 678 const base::Closure& followup) { | |
| 679 if (!followup.is_null()) | |
| 680 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); | |
| 681 else | |
| 682 ui_controls::SendMouseEvents(button, state); | |
| 683 } | |
| 684 | |
| 685 } // namespace internal | |
| 686 | |
| 687 HistoryEnumerator::HistoryEnumerator(Profile* profile) { | 673 HistoryEnumerator::HistoryEnumerator(Profile* profile) { |
| 688 scoped_refptr<content::MessageLoopRunner> message_loop_runner = | 674 scoped_refptr<content::MessageLoopRunner> message_loop_runner = |
| 689 new content::MessageLoopRunner; | 675 new content::MessageLoopRunner; |
| 690 | 676 |
| 691 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 677 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 692 profile, Profile::EXPLICIT_ACCESS); | 678 profile, Profile::EXPLICIT_ACCESS); |
| 693 hs->QueryHistory( | 679 hs->QueryHistory( |
| 694 string16(), | 680 string16(), |
| 695 history::QueryOptions(), | 681 history::QueryOptions(), |
| 696 &consumer_, | 682 &consumer_, |
| 697 base::Bind(&HistoryEnumerator::HistoryQueryComplete, | 683 base::Bind(&HistoryEnumerator::HistoryQueryComplete, |
| 698 base::Unretained(this), message_loop_runner->QuitClosure())); | 684 base::Unretained(this), message_loop_runner->QuitClosure())); |
| 699 message_loop_runner->Run(); | 685 message_loop_runner->Run(); |
| 700 } | 686 } |
| 701 | 687 |
| 702 HistoryEnumerator::~HistoryEnumerator() {} | 688 HistoryEnumerator::~HistoryEnumerator() {} |
| 703 | 689 |
| 704 void HistoryEnumerator::HistoryQueryComplete( | 690 void HistoryEnumerator::HistoryQueryComplete( |
| 705 const base::Closure& quit_task, | 691 const base::Closure& quit_task, |
| 706 HistoryService::Handle request_handle, | 692 HistoryService::Handle request_handle, |
| 707 history::QueryResults* results) { | 693 history::QueryResults* results) { |
| 708 for (size_t i = 0; i < results->size(); ++i) | 694 for (size_t i = 0; i < results->size(); ++i) |
| 709 urls_.push_back((*results)[i].url()); | 695 urls_.push_back((*results)[i].url()); |
| 710 quit_task.Run(); | 696 quit_task.Run(); |
| 711 } | 697 } |
| 712 | 698 |
| 713 } // namespace ui_test_utils | 699 } // namespace ui_test_utils |
| OLD | NEW |