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

Side by Side Diff: chrome/browser/cocoa/status_bubble_mac_unittest.mm

Issue 3437002: Make status bubble expand on Mac to fit URLs longer than the standard width.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/status_bubble_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <Cocoa/Cocoa.h> 5 #include <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #import "chrome/browser/cocoa/bubble_view.h" 10 #import "chrome/browser/cocoa/bubble_view.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 bubble_->Hide(); 475 bubble_->Hide();
476 NSRect frame = [window frame]; 476 NSRect frame = [window frame];
477 frame.origin.x += 50; 477 frame.origin.x += 50;
478 [window setFrame:frame display:YES]; 478 [window setFrame:frame display:YES];
479 bubble_->SetStatus(UTF8ToUTF16("Reshowing")); 479 bubble_->SetStatus(UTF8ToUTF16("Reshowing"));
480 480
481 // The bubble should reattach in the correct location. 481 // The bubble should reattach in the correct location.
482 child = GetWindow(); 482 child = GetWindow();
483 EXPECT_TRUE(NSEqualPoints([window frame].origin, [child frame].origin)); 483 EXPECT_TRUE(NSEqualPoints([window frame].origin, [child frame].origin));
484 } 484 }
485
486 TEST_F(StatusBubbleMacTest, ExpandBubble) {
487 NSWindow* window = test_window();
488 ASSERT_TRUE(window);
489 NSRect window_frame = [window frame];
490 window_frame.size.width = 600.0;
491 [window setFrame:window_frame display:YES];
492
493 // Check basic expansion
494 bubble_->SetStatus(UTF8ToUTF16("Showing"));
495 EXPECT_TRUE(IsVisible());
496 bubble_->SetURL(GURL("http://www.battersbox.com/peter_paul_and_mary.html"),
497 string16());
498 EXPECT_NSEQ(@"battersbox.com/peter_paul_and_\u2026", GetURLText());
499 bubble_->ExpandBubble();
500 EXPECT_TRUE(IsVisible());
501 EXPECT_NSEQ(@"www.battersbox.com/peter_paul_and_mary.html", GetURLText());
502 bubble_->Hide();
503
504 // Make sure bubble resets after hide.
505 bubble_->SetStatus(UTF8ToUTF16("Showing"));
506 bubble_->SetURL(GURL("http://www.snickersnee.com/pioneer_fishstix.html"),
507 string16());
508 EXPECT_NSEQ(@"snickersnee.com/pioneer_fishstix\u2026", GetURLText());
509 // ...and that it expands again properly.
510 bubble_->ExpandBubble();
511 EXPECT_NSEQ(@"www.snickersnee.com/pioneer_fishstix.html", GetURLText());
512 // ...again, again!
513 bubble_->SetURL(GURL("http://www.battersbox.com/peter_paul_and_mary.html"),
514 string16());
515 bubble_->ExpandBubble();
516 EXPECT_NSEQ(@"www.battersbox.com/peter_paul_and_mary.html", GetURLText());
517 bubble_->Hide();
518
519 window_frame = [window frame];
520 window_frame.size.width = 300.0;
521 [window setFrame:window_frame display:YES];
522
523 // Very long URL's will be cut off even in the expanded state.
524 bubble_->SetStatus(UTF8ToUTF16("Showing"));
525 bubble_->SetURL(GURL(
526 "http://www.diewahrscheinlichlaengstepralinederwelt.com/duuuuplo.html"),
527 string16());
528 EXPECT_NSEQ(@"diewahrscheinli\u2026", GetURLText());
529 bubble_->ExpandBubble();
530 EXPECT_NSEQ(@"diewahrscheinlichlaengstepralinederwelt.com/duu\u2026",
531 GetURLText());
532 }
533
534
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/status_bubble_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698