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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" |
7 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/extensions/test_extension_service.h" | 13 #include "chrome/browser/extensions/test_extension_service.h" |
14 #include "chrome/browser/intents/default_web_intent_service.h" | 14 #include "chrome/browser/intents/default_web_intent_service.h" |
15 #include "chrome/browser/intents/web_intents_registry.h" | 15 #include "chrome/browser/intents/web_intents_registry.h" |
16 #include "chrome/browser/webdata/web_data_service.h" | 16 #include "chrome/browser/webdata/web_data_service.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/extensions/extension_set.h" | 18 #include "chrome/common/extensions/extension_set.h" |
19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return NULL; | 127 return NULL; |
128 } | 128 } |
129 | 129 |
130 MessageLoopForUI message_loop_; | 130 MessageLoopForUI message_loop_; |
131 content::TestBrowserThread ui_thread_; | 131 content::TestBrowserThread ui_thread_; |
132 content::TestBrowserThread db_thread_; | 132 content::TestBrowserThread db_thread_; |
133 scoped_refptr<WebDataService> wds_; | 133 scoped_refptr<WebDataService> wds_; |
134 MockExtensionService extension_service_; | 134 MockExtensionService extension_service_; |
135 ExtensionSet extensions_; | 135 ExtensionSet extensions_; |
136 WebIntentsRegistry registry_; | 136 WebIntentsRegistry registry_; |
137 ScopedTempDir temp_dir_; | 137 base::ScopedTempDir temp_dir_; |
138 }; | 138 }; |
139 | 139 |
140 // Base consumer for WebIntentsRegistry results. | 140 // Base consumer for WebIntentsRegistry results. |
141 class TestConsumer { | 141 class TestConsumer { |
142 public: | 142 public: |
143 // Wait for the UI message loop to terminate - happens when OnIntesQueryDone | 143 // Wait for the UI message loop to terminate - happens when OnIntesQueryDone |
144 // is invoked. | 144 // is invoked. |
145 void WaitForData() { | 145 void WaitForData() { |
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
147 MessageLoop::current()->Run(); | 147 MessageLoop::current()->Run(); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 789 |
790 registry_.GetAllDefaultIntentServices( | 790 registry_.GetAllDefaultIntentServices( |
791 base::Bind(&DefaultServiceListConsumer::Accept, | 791 base::Bind(&DefaultServiceListConsumer::Accept, |
792 base::Unretained(&consumer))); | 792 base::Unretained(&consumer))); |
793 | 793 |
794 consumer.WaitForData(); | 794 consumer.WaitForData(); |
795 | 795 |
796 ASSERT_EQ(1U, consumer.services_.size()); | 796 ASSERT_EQ(1U, consumer.services_.size()); |
797 EXPECT_EQ(service_url_1.spec(), consumer.services_[0].service_url); | 797 EXPECT_EQ(service_url_1.spec(), consumer.services_[0].service_url); |
798 } | 798 } |
OLD | NEW |