| 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/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 wds_->Init(temp_dir_.path()); | 94 wds_->Init(temp_dir_.path()); |
| 95 registry_.Initialize(wds_, &extension_service_); | 95 registry_.Initialize(wds_, &extension_service_); |
| 96 EXPECT_CALL(extension_service_, extensions()). | 96 EXPECT_CALL(extension_service_, extensions()). |
| 97 WillRepeatedly(testing::Return(&extensions_)); | 97 WillRepeatedly(testing::Return(&extensions_)); |
| 98 EXPECT_CALL(extension_service_, GetExtensionById(testing::_, testing::_)). | 98 EXPECT_CALL(extension_service_, GetExtensionById(testing::_, testing::_)). |
| 99 WillRepeatedly( | 99 WillRepeatedly( |
| 100 testing::Invoke(this, &WebIntentsRegistryTest::GetExtensionById)); | 100 testing::Invoke(this, &WebIntentsRegistryTest::GetExtensionById)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 virtual void TearDown() { | 103 virtual void TearDown() { |
| 104 if (wds_.get()) | 104 wds_ = NULL; |
| 105 wds_->Shutdown(); | |
| 106 | 105 |
| 107 db_thread_.Stop(); | 106 db_thread_.Stop(); |
| 108 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 107 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 109 MessageLoop::current()->Run(); | 108 MessageLoop::current()->Run(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 const Extension* GetExtensionById(const std::string& extension_id, | 111 const Extension* GetExtensionById(const std::string& extension_id, |
| 113 testing::Unused) { | 112 testing::Unused) { |
| 114 for (ExtensionSet::const_iterator iter = extensions_.begin(); | 113 for (ExtensionSet::const_iterator iter = extensions_.begin(); |
| 115 iter != extensions_.end(); ++iter) { | 114 iter != extensions_.end(); ++iter) { |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 registry_.RegisterIntentService(services[1]); | 506 registry_.RegisterIntentService(services[1]); |
| 508 | 507 |
| 509 TestConsumer consumer; | 508 TestConsumer consumer; |
| 510 consumer.expected_id_ = registry_.GetIntentServices( | 509 consumer.expected_id_ = registry_.GetIntentServices( |
| 511 ASCIIToUTF16("http://webintents.org/share"), | 510 ASCIIToUTF16("http://webintents.org/share"), |
| 512 ASCIIToUTF16("image/*"), &consumer); | 511 ASCIIToUTF16("image/*"), &consumer); |
| 513 consumer.WaitForData(); | 512 consumer.WaitForData(); |
| 514 ASSERT_EQ(1U, consumer.services_.size()); | 513 ASSERT_EQ(1U, consumer.services_.size()); |
| 515 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); | 514 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); |
| 516 } | 515 } |
| OLD | NEW |