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

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

Issue 249030: Disable "OK" button in edit dialog of bookmark button when name is not valid... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/bookmark_editor_controller.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/bookmark_editor_controller.h" 8 #import "chrome/browser/cocoa/bookmark_editor_controller.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 EXPECT_EQ(child->GetTitle(), L"whamma jamma bamma"); 99 EXPECT_EQ(child->GetTitle(), L"whamma jamma bamma");
100 EXPECT_EQ(child->GetURL(), GURL("http://yellow-sneakers.com/")); 100 EXPECT_EQ(child->GetURL(), GURL("http://yellow-sneakers.com/"));
101 101
102 // Give it a URL which needs fixen up to be valid 102 // Give it a URL which needs fixen up to be valid
103 // (e.g. http:// prefix added) 103 // (e.g. http:// prefix added)
104 [controller setDisplayURL:@"x"]; 104 [controller setDisplayURL:@"x"];
105 [controller ok:nil]; 105 [controller ok:nil];
106 child = parent->GetChild(0); 106 child = parent->GetChild(0);
107 EXPECT_TRUE(child->GetURL().is_valid()); 107 EXPECT_TRUE(child->GetURL().is_valid());
108 108
109 // Confirm OK button enabled/disabled as appropriate. 109 // Confirm OK button enabled/disabled as appropriate:
110 // First test the URL.
110 EXPECT_TRUE([controller okButtonEnabled]); 111 EXPECT_TRUE([controller okButtonEnabled]);
111 [controller setDisplayURL:@""]; 112 [controller setDisplayURL:@""];
112 EXPECT_FALSE([controller okButtonEnabled]); 113 EXPECT_FALSE([controller okButtonEnabled]);
113 [controller setDisplayURL:@"http://www.cnn.com"]; 114 [controller setDisplayURL:@"http://www.cnn.com"];
114 EXPECT_TRUE([controller okButtonEnabled]); 115 EXPECT_TRUE([controller okButtonEnabled]);
116 // Then test the name.
117 [controller setDisplayName:@""];
118 EXPECT_FALSE([controller okButtonEnabled]);
119 [controller setDisplayName:@" "];
120 EXPECT_FALSE([controller okButtonEnabled]);
121 // Then little mix of both.
122 [controller setDisplayName:@"name"];
123 EXPECT_TRUE([controller okButtonEnabled]);
124 [controller setDisplayURL:@""];
125 EXPECT_FALSE([controller okButtonEnabled]);
115 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_editor_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698