| 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 6 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
| 7 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 7 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 TEST_F(WebIntentPickerModelTest, GetInstalledServiceWithURL) { | 127 TEST_F(WebIntentPickerModelTest, GetInstalledServiceWithURL) { |
| 128 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); | 128 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); |
| 129 | 129 |
| 130 model_.AddInstalledService(kTitle1, kUrl1, kWindowDisposition); | 130 model_.AddInstalledService(kTitle1, kUrl1, kWindowDisposition); |
| 131 model_.AddInstalledService(kTitle2, kUrl2, kWindowDisposition); | 131 model_.AddInstalledService(kTitle2, kUrl2, kWindowDisposition); |
| 132 | 132 |
| 133 EXPECT_EQ(kTitle2, model_.GetInstalledServiceWithURL(kUrl2)->title); | 133 EXPECT_EQ(kTitle2, model_.GetInstalledServiceWithURL(kUrl2)->title); |
| 134 EXPECT_EQ(NULL, model_.GetInstalledServiceWithURL(kUrl3)); | 134 EXPECT_EQ(NULL, model_.GetInstalledServiceWithURL(kUrl3)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 TEST_F(WebIntentPickerModelTest, UpdateFaviconAt) { | 137 TEST_F(WebIntentPickerModelTest, UpdateFaviconForServiceWithURL) { |
| 138 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); | 138 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); |
| 139 EXPECT_CALL(observer_, OnFaviconChanged(&model_, 1U)).Times(1); | 139 EXPECT_CALL(observer_, OnFaviconChanged(&model_, 1U)).Times(1); |
| 140 | 140 |
| 141 model_.AddInstalledService(kTitle1, kUrl1, kWindowDisposition); | 141 model_.AddInstalledService(kTitle1, kUrl1, kWindowDisposition); |
| 142 model_.AddInstalledService(kTitle2, kUrl2, kWindowDisposition); | 142 model_.AddInstalledService(kTitle2, kUrl2, kWindowDisposition); |
| 143 gfx::Image image(gfx::test::CreateImage()); | 143 gfx::Image image(gfx::test::CreateImage()); |
| 144 model_.UpdateFaviconAt(1U, image); | 144 model_.UpdateFaviconForServiceWithURL(kUrl2, image); |
| 145 | 145 |
| 146 EXPECT_FALSE(gfx::test::IsEqual( | 146 EXPECT_FALSE(gfx::test::IsEqual( |
| 147 image, model_.GetInstalledServiceAt(0).favicon)); | 147 image, model_.GetInstalledServiceAt(0).favicon)); |
| 148 EXPECT_TRUE(gfx::test::IsEqual( | 148 EXPECT_TRUE(gfx::test::IsEqual( |
| 149 image, model_.GetInstalledServiceAt(1).favicon)); | 149 image, model_.GetInstalledServiceAt(1).favicon)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TEST_F(WebIntentPickerModelTest, AddSuggestedExtensions) { | 152 TEST_F(WebIntentPickerModelTest, AddSuggestedExtensions) { |
| 153 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(1); | 153 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(1); |
| 154 | 154 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // Default status is that "waiting for suggestions". | 227 // Default status is that "waiting for suggestions". |
| 228 EXPECT_TRUE(model_.IsWaitingForSuggestions()); | 228 EXPECT_TRUE(model_.IsWaitingForSuggestions()); |
| 229 | 229 |
| 230 // "waiting" status can be toggled manually. | 230 // "waiting" status can be toggled manually. |
| 231 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); | 231 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); |
| 232 model_.SetWaitingForSuggestions(false); | 232 model_.SetWaitingForSuggestions(false); |
| 233 EXPECT_FALSE(model_.IsWaitingForSuggestions()); | 233 EXPECT_FALSE(model_.IsWaitingForSuggestions()); |
| 234 model_.SetWaitingForSuggestions(true); | 234 model_.SetWaitingForSuggestions(true); |
| 235 EXPECT_TRUE(model_.IsWaitingForSuggestions()); | 235 EXPECT_TRUE(model_.IsWaitingForSuggestions()); |
| 236 } | 236 } |
| OLD | NEW |