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

Unified Diff: chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm

Issue 9581041: Make web intents picker work as constrained dialog instead of InfoBubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm
index 88a5b725c982fb939b13684de6f14abc701fc309..09f003845cc1955ae44f453f57fb243409bd3f32 100644
--- a/chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm
@@ -10,6 +10,9 @@
#import "chrome/browser/ui/cocoa/web_intent_bubble_controller.h"
#include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h"
#include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
+#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h"
+#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/test/test_browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace {
@@ -27,25 +30,25 @@ class MockIntentPickerDelegate : public WebIntentPickerDelegate {
} // namespace
-class WebIntentBubbleControllerTest : public CocoaTest {
+class WebIntentBubbleControllerTest : public TabContentsWrapperTestHarness {
public:
+ WebIntentBubbleControllerTest()
+ : ui_thread_(content::BrowserThread::UI, MessageLoopForUI::current()) {}
+
virtual ~WebIntentBubbleControllerTest() {
message_loop_.RunAllPending();
}
- virtual void TearDown() {
- // Do not animate out because that is hard to test around.
- if (window_)
- [window_ setDelayOnClose:NO];
+ virtual void TearDown() {
if (picker_.get()) {
EXPECT_CALL(delegate_, OnCancelled());
EXPECT_CALL(delegate_, OnClosing());
- [controller_ close];
+ [controller_ closeSheet];
// Closing |controller_| destroys |picker_|.
ignore_result(picker_.release());
}
- CocoaTest::TearDown();
+ TabContentsWrapperTestHarness::TearDown();
}
void CreatePicker() {
@@ -57,14 +60,13 @@ class WebIntentBubbleControllerTest : public CocoaTest {
}
void CreateBubble() {
- CreatePicker();
- NSPoint anchor=NSMakePoint(0, 0);
+ Browser* browser=(Browser*)0xdeadbeef;
Nico 2012/03/03 06:13:49 Huh? If the browser object isn't needed, maybe WIP
groby-ooo-7-16 2012/03/03 23:41:49 It's needed _only_ if you invoke inline dispositio
+ picker_.reset(new WebIntentPickerCocoa(browser, contents_wrapper(),
+ &delegate_, &model_));
Nico 2012/03/03 06:13:49 indent is off
groby-ooo-7-16 2012/03/03 23:41:49 Done.
controller_ =
- [[WebIntentBubbleController alloc] initWithPicker:picker_.get()
- parentWindow:test_window()
- anchoredAt:anchor];
- window_ = static_cast<InfoBubbleWindow*>([controller_ window]);
+ [[WebIntentBubbleController alloc] initWithPicker:picker_.get()];
+ window_ = [controller_ window];
[controller_ showWindow:nil];
}
@@ -98,8 +100,6 @@ class WebIntentBubbleControllerTest : public CocoaTest {
NSButton* button = [views objectAtIndex:2 + i];
CheckServiceButton(button, i);
}
-
- EXPECT_EQ([window_ delegate], controller_);
}
// Checks that a service button is hooked up correctly.
@@ -116,11 +116,11 @@ class WebIntentBubbleControllerTest : public CocoaTest {
EXPECT_TRUE([button stringValue]);
}
+ content::TestBrowserThread ui_thread_;
WebIntentBubbleController* controller_; // Weak, owns self.
- InfoBubbleWindow* window_; // Weak, owned by controller.
+ NSWindow* window_; // Weak, owned by controller.
scoped_ptr<WebIntentPickerCocoa> picker_;
MockIntentPickerDelegate delegate_;
- MessageLoopForUI message_loop_;
WebIntentPickerModel model_; // The model used by the picker
};

Powered by Google App Engine
This is Rietveld 408576698