Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm

Issue 11418043: Remove TabContents from OmniboxEditController and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration.h" 7 #import "chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration.h"
8 8
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" 9 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h"
11 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 10 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h"
13 #include "content/public/browser/site_instance.h" 11 #include "content/public/browser/site_instance.h"
14 #include "content/public/browser/web_intents_dispatcher.h" 12 #include "content/public/browser/web_intents_dispatcher.h"
15 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
16 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webkit/glue/web_intent_data.h" 15 #include "webkit/glue/web_intent_data.h"
18 #include "webkit/glue/web_intent_reply_data.h" 16 #include "webkit/glue/web_intent_reply_data.h"
19 17
20 class WebIntentsButtonDecorationTest : public CocoaProfileTest { 18 class WebIntentsButtonDecorationTest : public CocoaProfileTest {
21 public: 19 public:
22 WebIntentsButtonDecorationTest() 20 WebIntentsButtonDecorationTest()
23 : decoration_(NULL, [NSFont userFontOfSize:12]) { 21 : decoration_(NULL, [NSFont userFontOfSize:12]) {
24 } 22 }
25 23
26 void SetWindowDispositionSource( 24 void SetWindowDispositionSource(
27 WebIntentPickerController* controller, 25 WebIntentPickerController* controller,
28 content::WebContents* contents, 26 content::WebContents* contents,
29 content::WebIntentsDispatcher* dispatcher) { 27 content::WebIntentsDispatcher* dispatcher) {
30 controller->SetWindowDispositionSource(contents, dispatcher); 28 controller->SetWindowDispositionSource(contents, dispatcher);
31 } 29 }
32 30
33 WebIntentsButtonDecoration decoration_; 31 WebIntentsButtonDecoration decoration_;
34 }; 32 };
35 33
36 TEST_F(WebIntentsButtonDecorationTest, IdentifiesWebIntentService) { 34 TEST_F(WebIntentsButtonDecorationTest, IdentifiesWebIntentService) {
37 scoped_refptr<content::SiteInstance> instance = 35 scoped_refptr<content::SiteInstance> instance =
38 content::SiteInstance::Create(profile()); 36 content::SiteInstance::Create(profile());
39 scoped_ptr<TabContents> contents(chrome::TabContentsFactory( 37 scoped_ptr<content::WebContents> contents(content::WebContents::Create(
40 profile(), instance.get(), MSG_ROUTING_NONE, NULL)); 38 profile(), instance.get(), MSG_ROUTING_NONE, NULL));
39 WebIntentPickerController::CreateForWebContents(contents.get());
41 40
42 decoration_.Update(contents.get()); 41 decoration_.Update(contents.get());
43 EXPECT_FALSE(decoration_.IsVisible()); 42 EXPECT_FALSE(decoration_.IsVisible());
44 43
45 webkit_glue::WebIntentData data; 44 webkit_glue::WebIntentData data;
46 content::WebIntentsDispatcher* dispatcher = 45 content::WebIntentsDispatcher* dispatcher =
47 content::WebIntentsDispatcher::Create(data); 46 content::WebIntentsDispatcher::Create(data);
48 WebIntentPickerController* web_intent_picker_controller = 47 WebIntentPickerController* web_intent_picker_controller =
49 WebIntentPickerController::FromWebContents(contents->web_contents()); 48 WebIntentPickerController::FromWebContents(contents.get());
50 SetWindowDispositionSource(web_intent_picker_controller, 49 SetWindowDispositionSource(web_intent_picker_controller,
51 contents->web_contents(), dispatcher); 50 contents.get(), dispatcher);
52 web_intent_picker_controller->SetLocationBarPickerButtonIndicated(); 51 web_intent_picker_controller->SetLocationBarPickerButtonIndicated();
53 52
54 decoration_.Update(contents.get()); 53 decoration_.Update(contents.get());
55 EXPECT_TRUE(decoration_.IsVisible()); 54 EXPECT_TRUE(decoration_.IsVisible());
56 55
57 dispatcher->SendReplyMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS, 56 dispatcher->SendReplyMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS,
58 string16()); 57 string16());
59 } 58 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration.mm ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698