| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 #endif // defined(OS_WIN) | 555 #endif // defined(OS_WIN) |
| 556 | 556 |
| 557 void OverrideGeolocation(double latitude, double longitude) { | 557 void OverrideGeolocation(double latitude, double longitude) { |
| 558 content::Geoposition position; | 558 content::Geoposition position; |
| 559 position.latitude = latitude; | 559 position.latitude = latitude; |
| 560 position.longitude = longitude; | 560 position.longitude = longitude; |
| 561 position.altitude = 0.; | 561 position.altitude = 0.; |
| 562 position.accuracy = 0.; | 562 position.accuracy = 0.; |
| 563 position.timestamp = base::Time::Now(); | 563 position.timestamp = base::Time::Now(); |
| 564 scoped_refptr<content::MessageLoopRunner> runner = | 564 content::GeolocationProvider::GetInstance()->OverrideLocationForTesting( |
| 565 new content::MessageLoopRunner; | 565 position); |
| 566 | |
| 567 content::GeolocationProvider::OverrideLocationForTesting( | |
| 568 position, runner->QuitClosure()); | |
| 569 | |
| 570 runner->Run(); | |
| 571 } | 566 } |
| 572 | 567 |
| 573 HistoryEnumerator::HistoryEnumerator(Profile* profile) { | 568 HistoryEnumerator::HistoryEnumerator(Profile* profile) { |
| 574 scoped_refptr<content::MessageLoopRunner> message_loop_runner = | 569 scoped_refptr<content::MessageLoopRunner> message_loop_runner = |
| 575 new content::MessageLoopRunner; | 570 new content::MessageLoopRunner; |
| 576 | 571 |
| 577 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 572 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 578 profile, Profile::EXPLICIT_ACCESS); | 573 profile, Profile::EXPLICIT_ACCESS); |
| 579 hs->QueryHistory( | 574 hs->QueryHistory( |
| 580 base::string16(), | 575 base::string16(), |
| 581 history::QueryOptions(), | 576 history::QueryOptions(), |
| 582 &consumer_, | 577 &consumer_, |
| 583 base::Bind(&HistoryEnumerator::HistoryQueryComplete, | 578 base::Bind(&HistoryEnumerator::HistoryQueryComplete, |
| 584 base::Unretained(this), message_loop_runner->QuitClosure())); | 579 base::Unretained(this), message_loop_runner->QuitClosure())); |
| 585 message_loop_runner->Run(); | 580 message_loop_runner->Run(); |
| 586 } | 581 } |
| 587 | 582 |
| 588 HistoryEnumerator::~HistoryEnumerator() {} | 583 HistoryEnumerator::~HistoryEnumerator() {} |
| 589 | 584 |
| 590 void HistoryEnumerator::HistoryQueryComplete( | 585 void HistoryEnumerator::HistoryQueryComplete( |
| 591 const base::Closure& quit_task, | 586 const base::Closure& quit_task, |
| 592 HistoryService::Handle request_handle, | 587 HistoryService::Handle request_handle, |
| 593 history::QueryResults* results) { | 588 history::QueryResults* results) { |
| 594 for (size_t i = 0; i < results->size(); ++i) | 589 for (size_t i = 0; i < results->size(); ++i) |
| 595 urls_.push_back((*results)[i].url()); | 590 urls_.push_back((*results)[i].url()); |
| 596 quit_task.Run(); | 591 quit_task.Run(); |
| 597 } | 592 } |
| 598 | 593 |
| 599 } // namespace ui_test_utils | 594 } // namespace ui_test_utils |
| OLD | NEW |