| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/intents/web_intents_registry.h" | 10 #include "chrome/browser/intents/web_intents_registry.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 if (wds_.get()) | 33 if (wds_.get()) |
| 34 wds_->Shutdown(); | 34 wds_->Shutdown(); |
| 35 | 35 |
| 36 db_thread_.Stop(); | 36 db_thread_.Stop(); |
| 37 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 37 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); |
| 38 MessageLoop::current()->Run(); | 38 MessageLoop::current()->Run(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void LoadRegistry() { | 41 void LoadRegistry() { |
| 42 { | 42 { |
| 43 WebIntentData provider; | 43 WebIntentServiceData service; |
| 44 provider.service_url = GURL("http://www.google.com/share"); | 44 service.service_url = GURL("http://www.google.com/share"); |
| 45 provider.action = ASCIIToUTF16("SHARE"); | 45 service.action = ASCIIToUTF16("SHARE"); |
| 46 provider.type = ASCIIToUTF16("text/url"); | 46 service.type = ASCIIToUTF16("text/url"); |
| 47 provider.title = ASCIIToUTF16("Google"); | 47 service.title = ASCIIToUTF16("Google"); |
| 48 registry_.RegisterIntentProvider(provider); | 48 registry_.RegisterIntentProvider(service); |
| 49 } | 49 } |
| 50 { | 50 { |
| 51 WebIntentData provider; | 51 WebIntentServiceData service; |
| 52 provider.service_url = GURL("http://picasaweb.google.com/share"); | 52 service.service_url = GURL("http://picasaweb.google.com/share"); |
| 53 provider.action = ASCIIToUTF16("EDIT"); | 53 service.action = ASCIIToUTF16("EDIT"); |
| 54 provider.type = ASCIIToUTF16("image/*"); | 54 service.type = ASCIIToUTF16("image/*"); |
| 55 provider.title = ASCIIToUTF16("Picasa"); | 55 service.title = ASCIIToUTF16("Picasa"); |
| 56 registry_.RegisterIntentProvider(provider); | 56 registry_.RegisterIntentProvider(service); |
| 57 } | 57 } |
| 58 { | 58 { |
| 59 WebIntentData provider; | 59 WebIntentServiceData service; |
| 60 provider.service_url = GURL("http://www.digg.com/share"); | 60 service.service_url = GURL("http://www.digg.com/share"); |
| 61 provider.action = ASCIIToUTF16("SHARE"); | 61 service.action = ASCIIToUTF16("SHARE"); |
| 62 provider.type = ASCIIToUTF16("text/url"); | 62 service.type = ASCIIToUTF16("text/url"); |
| 63 provider.title = ASCIIToUTF16("Digg"); | 63 service.title = ASCIIToUTF16("Digg"); |
| 64 registry_.RegisterIntentProvider(provider); | 64 registry_.RegisterIntentProvider(service); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 MessageLoopForUI message_loop_; | 68 MessageLoopForUI message_loop_; |
| 69 BrowserThread ui_thread_; | 69 BrowserThread ui_thread_; |
| 70 BrowserThread db_thread_; | 70 BrowserThread db_thread_; |
| 71 scoped_refptr<WebDataService> wds_; | 71 scoped_refptr<WebDataService> wds_; |
| 72 WebIntentsRegistry registry_; | 72 WebIntentsRegistry registry_; |
| 73 ScopedTempDir temp_dir_; | 73 ScopedTempDir temp_dir_; |
| 74 }; | 74 }; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 EXPECT_EQ(static_cast<size_t>(1), snode->Types().GetSize()); | 175 EXPECT_EQ(static_cast<size_t>(1), snode->Types().GetSize()); |
| 176 string16 stype; | 176 string16 stype; |
| 177 ASSERT_TRUE(snode->Types().GetString(0, &stype)); | 177 ASSERT_TRUE(snode->Types().GetString(0, &stype)); |
| 178 EXPECT_EQ(ASCIIToUTF16("text/url"), stype); | 178 EXPECT_EQ(ASCIIToUTF16("text/url"), stype); |
| 179 | 179 |
| 180 node = intents_model.GetTreeNode("www.digg.com"); | 180 node = intents_model.GetTreeNode("www.digg.com"); |
| 181 ASSERT_NE(static_cast<WebIntentsTreeNode*>(NULL), node); | 181 ASSERT_NE(static_cast<WebIntentsTreeNode*>(NULL), node); |
| 182 EXPECT_EQ(WebIntentsTreeNode::TYPE_ORIGIN, node->Type()); | 182 EXPECT_EQ(WebIntentsTreeNode::TYPE_ORIGIN, node->Type()); |
| 183 EXPECT_EQ(ASCIIToUTF16("www.digg.com"), node->GetTitle()); | 183 EXPECT_EQ(ASCIIToUTF16("www.digg.com"), node->GetTitle()); |
| 184 } | 184 } |
| OLD | NEW |