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" |
11 #include "ui/gfx/image/image_unittest_util.h" | 11 #include "ui/gfx/image/image_unittest_util.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const string16 kTitle1(ASCIIToUTF16("Foo")); | 15 const string16 kTitle1(ASCIIToUTF16("Foo")); |
16 const string16 kTitle2(ASCIIToUTF16("Bar")); | 16 const string16 kTitle2(ASCIIToUTF16("Bar")); |
17 const string16 kTitle3(ASCIIToUTF16("Baz")); | 17 const string16 kTitle3(ASCIIToUTF16("Baz")); |
18 const string16 kTitle4(ASCIIToUTF16("Biff")); | 18 const string16 kTitle4(ASCIIToUTF16("Biff")); |
19 const string16 kTitle5(ASCIIToUTF16("Max")); | 19 const string16 kTitle5(ASCIIToUTF16("Max")); |
20 const string16 kTitle6(ASCIIToUTF16("Lulz")); | 20 const string16 kTitle6(ASCIIToUTF16("Lulz")); |
21 const GURL kUrl1("http://www.example.com/foo"); | 21 const GURL kUrl1("http://www.example.com/foo"); |
22 const GURL kUrl2("http://www.example.com/bar"); | 22 const GURL kUrl2("http://www.example.com/bar"); |
23 const GURL kUrl3("http://www.example.com/baz"); | 23 const GURL kUrl3("http://www.example.com/baz"); |
24 const string16 kId1(ASCIIToUTF16("nhkckhebbbncbkefhcpcgepcgfaclehe")); | 24 const string16 kId1(ASCIIToUTF16("nhkckhebbbncbkefhcpcgepcgfaclehe")); |
25 const string16 kId2(ASCIIToUTF16("hcpcgepcgfaclehenhkckhebbbncbkef")); | 25 const string16 kId2(ASCIIToUTF16("hcpcgepcgfaclehenhkckhebbbncbkef")); |
26 const string16 kId3(ASCIIToUTF16("aclehenhkckhebbbncbkefhcpcgepcgf")); | 26 const string16 kId3(ASCIIToUTF16("aclehenhkckhebbbncbkefhcpcgepcgf")); |
27 const string16 kId4(ASCIIToUTF16("bclehenhkckhebbbncbkefhcpcgepcgf")); | 27 const string16 kId4(ASCIIToUTF16("bclehenhkckhebbbncbkefhcpcgepcgf")); |
28 const string16 kId5(ASCIIToUTF16("cclehenhkckhebbbncbkefhcpcgepcgf")); | 28 const string16 kId5(ASCIIToUTF16("cclehenhkckhebbbncbkefhcpcgepcgf")); |
29 const string16 kId6(ASCIIToUTF16("dclehenhkckhebbbncbkefhcpcgepcgf")); | 29 const string16 kId6(ASCIIToUTF16("dclehenhkckhebbbncbkefhcpcgepcgf")); |
30 const WebIntentPickerModel::Disposition kWindowDisposition( | 30 const webkit_glue::WebIntentServiceData::Disposition kWindowDisposition( |
31 WebIntentPickerModel::DISPOSITION_WINDOW); | 31 webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW); |
32 const WebIntentPickerModel::Disposition kInlineDisposition( | 32 const webkit_glue::WebIntentServiceData::Disposition kInlineDisposition( |
33 WebIntentPickerModel::DISPOSITION_INLINE); | 33 webkit_glue::WebIntentServiceData::DISPOSITION_INLINE); |
34 | 34 |
35 } | 35 } |
36 | 36 |
37 class WebIntentPickerModelObserverMock : public WebIntentPickerModelObserver { | 37 class WebIntentPickerModelObserverMock : public WebIntentPickerModelObserver { |
38 public: | 38 public: |
39 MOCK_METHOD1(OnModelChanged, void(WebIntentPickerModel* model)); | 39 MOCK_METHOD1(OnModelChanged, void(WebIntentPickerModel* model)); |
40 MOCK_METHOD2(OnFaviconChanged, | 40 MOCK_METHOD2(OnFaviconChanged, |
41 void(WebIntentPickerModel* model, size_t index)); | 41 void(WebIntentPickerModel* model, size_t index)); |
42 MOCK_METHOD2(OnExtensionIconChanged, | 42 MOCK_METHOD2(OnExtensionIconChanged, |
43 void(WebIntentPickerModel* model, const string16& extension_id)); | 43 void(WebIntentPickerModel* model, const string16& extension_id)); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // Default status is that "waiting for suggestions". | 233 // Default status is that "waiting for suggestions". |
234 EXPECT_TRUE(model_.IsWaitingForSuggestions()); | 234 EXPECT_TRUE(model_.IsWaitingForSuggestions()); |
235 | 235 |
236 // "waiting" status can be toggled manually. | 236 // "waiting" status can be toggled manually. |
237 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); | 237 EXPECT_CALL(observer_, OnModelChanged(&model_)).Times(2); |
238 model_.SetWaitingForSuggestions(false); | 238 model_.SetWaitingForSuggestions(false); |
239 EXPECT_FALSE(model_.IsWaitingForSuggestions()); | 239 EXPECT_FALSE(model_.IsWaitingForSuggestions()); |
240 model_.SetWaitingForSuggestions(true); | 240 model_.SetWaitingForSuggestions(true); |
241 EXPECT_TRUE(model_.IsWaitingForSuggestions()); | 241 EXPECT_TRUE(model_.IsWaitingForSuggestions()); |
242 } | 242 } |
OLD | NEW |