| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/favicon/favicon_service.h" | 12 #include "chrome/browser/favicon/favicon_service.h" |
| 13 #include "chrome/browser/intents/web_intent_data.h" | 13 #include "chrome/browser/intents/web_intent_service_data.h" |
| 14 #include "chrome/browser/intents/web_intents_registry.h" | 14 #include "chrome/browser/intents/web_intents_registry.h" |
| 15 #include "chrome/browser/intents/web_intents_registry_factory.h" | 15 #include "chrome/browser/intents/web_intents_registry_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/intents/web_intent_picker.h" | 17 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 18 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 18 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 19 #include "chrome/browser/ui/intents/web_intent_picker_factory.h" | 19 #include "chrome/browser/ui/intents/web_intent_picker_factory.h" |
| 20 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
| 21 #include "chrome/browser/webdata/web_data_service.h" | 21 #include "chrome/browser/webdata/web_data_service.h" |
| 22 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 23 #include "content/browser/browser_thread.h" | 23 #include "content/browser/browser_thread.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 virtual void TearDown() { | 141 virtual void TearDown() { |
| 142 controller_.reset(); | 142 controller_.reset(); |
| 143 | 143 |
| 144 TabContentsWrapperTestHarness::TearDown(); | 144 TabContentsWrapperTestHarness::TearDown(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 protected: | 147 protected: |
| 148 void AddWebIntentService(const string16& action, | 148 void AddWebIntentService(const string16& action, |
| 149 const GURL& service_url) { | 149 const GURL& service_url) { |
| 150 WebIntentData web_intent_data; | 150 WebIntentServiceData web_intent_service_data; |
| 151 web_intent_data.action = action; | 151 web_intent_service_data.action = action; |
| 152 web_intent_data.type = kType; | 152 web_intent_service_data.type = kType; |
| 153 web_intent_data.service_url = service_url; | 153 web_intent_service_data.service_url = service_url; |
| 154 web_data_service_->AddWebIntent(web_intent_data); | 154 web_data_service_->AddWebIntent(web_intent_service_data); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void AddFaviconForURL(const GURL& url) { | 157 void AddFaviconForURL(const GURL& url) { |
| 158 std::vector<unsigned char> image_data; | 158 std::vector<unsigned char> image_data; |
| 159 FillBitmap(16, 16, &image_data); | 159 FillBitmap(16, 16, &image_data); |
| 160 | 160 |
| 161 favicon_service_->SetFavicon(url, | 161 favicon_service_->SetFavicon(url, |
| 162 MakeFaviconURL(url), | 162 MakeFaviconURL(url), |
| 163 image_data, | 163 image_data, |
| 164 history::FAVICON); | 164 history::FAVICON); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 .Times(0); | 265 .Times(0); |
| 266 EXPECT_CALL(*controller_, OnCancelled()) | 266 EXPECT_CALL(*controller_, OnCancelled()) |
| 267 .WillOnce(Invoke(controller_.get(), | 267 .WillOnce(Invoke(controller_.get(), |
| 268 &TestWebIntentPickerController::BaseOnCancelled)); | 268 &TestWebIntentPickerController::BaseOnCancelled)); |
| 269 EXPECT_CALL(*picker_factory_, ClosePicker(_)); | 269 EXPECT_CALL(*picker_factory_, ClosePicker(_)); |
| 270 | 270 |
| 271 controller_->ShowDialog(NULL, kAction1, kType); | 271 controller_->ShowDialog(NULL, kAction1, kType); |
| 272 WaitForDialogToShow(); | 272 WaitForDialogToShow(); |
| 273 delegate_->OnCancelled(); | 273 delegate_->OnCancelled(); |
| 274 } | 274 } |
| OLD | NEW |