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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
13 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
15 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 15 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #import "testing/gtest_mac.h" | 18 #import "testing/gtest_mac.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 // CallClose; bubble gets closed. | 246 // CallClose; bubble gets closed. |
247 // Also confirm pulse notifications get sent. | 247 // Also confirm pulse notifications get sent. |
248 TEST_F(BookmarkBubbleControllerTest, TestClose) { | 248 TEST_F(BookmarkBubbleControllerTest, TestClose) { |
249 BookmarkModel* model = GetBookmarkModel(); | 249 BookmarkModel* model = GetBookmarkModel(); |
250 const BookmarkNode* node = model->AddURL( | 250 const BookmarkNode* node = model->AddURL( |
251 model->bookmark_bar_node(), 0, ASCIIToUTF16("Bookie markie title"), | 251 model->bookmark_bar_node(), 0, ASCIIToUTF16("Bookie markie title"), |
252 GURL("http://www.google.com")); | 252 GURL("http://www.google.com")); |
253 EXPECT_EQ(edits_, 0); | 253 EXPECT_EQ(edits_, 0); |
254 | 254 |
255 scoped_nsobject<BookmarkPulseObserver> observer([[BookmarkPulseObserver alloc] | 255 base::scoped_nsobject<BookmarkPulseObserver> observer( |
256 init]); | 256 [[BookmarkPulseObserver alloc] init]); |
257 EXPECT_EQ([observer notifications], 0); | 257 EXPECT_EQ([observer notifications], 0); |
258 BookmarkBubbleController* controller = ControllerForNode(node); | 258 BookmarkBubbleController* controller = ControllerForNode(node); |
259 EXPECT_TRUE(controller); | 259 EXPECT_TRUE(controller); |
260 EXPECT_FALSE(IsWindowClosing()); | 260 EXPECT_FALSE(IsWindowClosing()); |
261 EXPECT_EQ([observer notifications], 1); | 261 EXPECT_EQ([observer notifications], 1); |
262 [controller ok:controller]; | 262 [controller ok:controller]; |
263 EXPECT_EQ(edits_, 0); | 263 EXPECT_EQ(edits_, 0); |
264 EXPECT_TRUE(IsWindowClosing()); | 264 EXPECT_TRUE(IsWindowClosing()); |
265 EXPECT_EQ([observer notifications], 2); | 265 EXPECT_EQ([observer notifications], 2); |
266 } | 266 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // Normally this would be sent up the responder tree correctly, but since | 465 // Normally this would be sent up the responder tree correctly, but since |
466 // tests run in the background, key window and main window are never set on | 466 // tests run in the background, key window and main window are never set on |
467 // NSApplication. Adding it to NSApplication directly removes the need for | 467 // NSApplication. Adding it to NSApplication directly removes the need for |
468 // worrying about what the current window with focus is. | 468 // worrying about what the current window with focus is. |
469 - (void)editBookmarkNode:(id)sender { | 469 - (void)editBookmarkNode:(id)sender { |
470 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); | 470 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); |
471 BookmarkBubbleControllerTest::edits_++; | 471 BookmarkBubbleControllerTest::edits_++; |
472 } | 472 } |
473 | 473 |
474 @end | 474 @end |
OLD | NEW |