| 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/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 virtual void SetUp() { | 27 virtual void SetUp() { |
| 28 db_thread_.Start(); | 28 db_thread_.Start(); |
| 29 wds_ = new WebDataService(); | 29 wds_ = new WebDataService(); |
| 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 31 wds_->Init(temp_dir_.path()); | 31 wds_->Init(temp_dir_.path()); |
| 32 | 32 |
| 33 registry_.Initialize(wds_, NULL); | 33 registry_.Initialize(wds_, NULL); |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual void TearDown() { | 36 virtual void TearDown() { |
| 37 if (wds_.get()) | 37 wds_->ShutdownOnUIThread(); |
| 38 wds_->Shutdown(); | 38 wds_ = NULL; |
| 39 | 39 base::WaitableEvent done(false, false); |
| 40 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 41 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 42 done.Wait(); |
| 40 db_thread_.Stop(); | 43 db_thread_.Stop(); |
| 41 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 44 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 42 MessageLoop::current()->Run(); | 45 MessageLoop::current()->Run(); |
| 43 } | 46 } |
| 44 | 47 |
| 45 void LoadRegistry() { | 48 void LoadRegistry() { |
| 46 { | 49 { |
| 47 webkit_glue::WebIntentServiceData service; | 50 webkit_glue::WebIntentServiceData service; |
| 48 service.service_url = GURL("http://www.google.com/share"); | 51 service.service_url = GURL("http://www.google.com/share"); |
| 49 service.action = ASCIIToUTF16("SHARE"); | 52 service.action = ASCIIToUTF16("SHARE"); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 206 |
| 204 WebIntentsTreeNode* node = intents_model.GetTreeNode("www.google.com"); | 207 WebIntentsTreeNode* node = intents_model.GetTreeNode("www.google.com"); |
| 205 ASSERT_EQ(2, node->child_count()); | 208 ASSERT_EQ(2, node->child_count()); |
| 206 node = node->GetChild(1); | 209 node = node->GetChild(1); |
| 207 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); | 210 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); |
| 208 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); | 211 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); |
| 209 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node); | 212 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node); |
| 210 EXPECT_EQ(ASCIIToUTF16("XEDIT"), snode->Action()); | 213 EXPECT_EQ(ASCIIToUTF16("XEDIT"), snode->Action()); |
| 211 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/xedit"), snode->ServiceUrl()); | 214 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/xedit"), snode->ServiceUrl()); |
| 212 } | 215 } |
| OLD | NEW |