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/files/scoped_temp_dir.h" |
6 #include "base/message_loop.h" | 7 #include "base/message_loop.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" |
11 #include "chrome/browser/intents/web_intents_registry.h" | 11 #include "chrome/browser/intents/web_intents_registry.h" |
12 #include "chrome/browser/ui/intents/web_intents_model.h" | 12 #include "chrome/browser/ui/intents/web_intents_model.h" |
13 #include "chrome/browser/webdata/web_data_service.h" | 13 #include "chrome/browser/webdata/web_data_service.h" |
14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "ui/base/models/tree_node_model.h" | 16 #include "ui/base/models/tree_node_model.h" |
17 | 17 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 service.title = ASCIIToUTF16("Digg"); | 70 service.title = ASCIIToUTF16("Digg"); |
71 registry_.RegisterIntentService(service); | 71 registry_.RegisterIntentService(service); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 MessageLoopForUI message_loop_; | 75 MessageLoopForUI message_loop_; |
76 content::TestBrowserThread ui_thread_; | 76 content::TestBrowserThread ui_thread_; |
77 content::TestBrowserThread db_thread_; | 77 content::TestBrowserThread db_thread_; |
78 scoped_refptr<WebDataService> wds_; | 78 scoped_refptr<WebDataService> wds_; |
79 WebIntentsRegistry registry_; | 79 WebIntentsRegistry registry_; |
80 ScopedTempDir temp_dir_; | 80 base::ScopedTempDir temp_dir_; |
81 }; | 81 }; |
82 | 82 |
83 class WaitingWebIntentsObserver : public WebIntentsModel::Observer { | 83 class WaitingWebIntentsObserver : public WebIntentsModel::Observer { |
84 public: | 84 public: |
85 WaitingWebIntentsObserver() : event_(true, false), added_(0) {} | 85 WaitingWebIntentsObserver() : event_(true, false), added_(0) {} |
86 | 86 |
87 virtual void TreeModelBeginBatch(WebIntentsModel* model) {} | 87 virtual void TreeModelBeginBatch(WebIntentsModel* model) {} |
88 | 88 |
89 virtual void TreeModelEndBatch(WebIntentsModel* model) { | 89 virtual void TreeModelEndBatch(WebIntentsModel* model) { |
90 event_.Signal(); | 90 event_.Signal(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 WebIntentsTreeNode* node = intents_model.GetTreeNode("www.google.com"); | 207 WebIntentsTreeNode* node = intents_model.GetTreeNode("www.google.com"); |
208 ASSERT_EQ(2, node->child_count()); | 208 ASSERT_EQ(2, node->child_count()); |
209 node = node->GetChild(1); | 209 node = node->GetChild(1); |
210 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); | 210 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); |
211 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); | 211 ASSERT_EQ(WebIntentsTreeNode::TYPE_SERVICE, node->Type()); |
212 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node); | 212 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node); |
213 EXPECT_EQ(ASCIIToUTF16("XEDIT"), snode->Action()); | 213 EXPECT_EQ(ASCIIToUTF16("XEDIT"), snode->Action()); |
214 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/xedit"), snode->ServiceUrl()); | 214 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/xedit"), snode->ServiceUrl()); |
215 } | 215 } |
OLD | NEW |