summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 03:21:58 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 03:21:58 +0000
commitcc37a23a18d3cdaf1aa922708d1dbb9d02d1dfee (patch)
treecfc6e17e03be5994c0b401f759eafea97544e52e
parent53e630665ec6fb9a5fffd51d2d6ea433f1ccd9f4 (diff)
downloadchromium_src-cc37a23a18d3cdaf1aa922708d1dbb9d02d1dfee.zip
chromium_src-cc37a23a18d3cdaf1aa922708d1dbb9d02d1dfee.tar.gz
chromium_src-cc37a23a18d3cdaf1aa922708d1dbb9d02d1dfee.tar.bz2
Fix for tab key view loop issue with Autofill dialog.
As sub-views got added and removed from the Autofill dialog the window's key view loop was not getting updated correctly. This manifested where tab cycling between text fields would not see the new address or credit card. After adding or removing an item we now tell the dialog's window to recompute the key view loop. Also including small cleanup to unit tests. Using scoped_nsobject<> at John's request. Also spotted that the dialog title was not internationalized properly. That is the change to AutoFillDialog.xib. Specifically, changed the dialog window title to be "^IDS_AUTOFILL_DIALOG_TITLE". BUG=36567 TEST=unit_tests --gtest_filter=AutoFillDialogControllerTest.*:AutoFillAddressModelTest.*:AutoFillAddressViewControllerTest.*:AutoFillCreditCardModelTest.*:AutoFillCreditCardViewControllerTest.*:DisclosureViewControllerTest.*:SectionSeparatorViewTest.*:VerticalLayoutViewTest.* TEST=1. Launch Chrome on Mac, 2. Open Preferences dialog, 3. Navigate to Personal Stuff panel, 4. Click on "Setup Autofill..." button, 5. Click in an address label text field, 6. Hit the tab key. 7. Create a new address with the "Add an Address" button, 8. Click in new address label text field, 9. Hit the tab key. Expect: focus to change to the next text field. Review URL: http://codereview.chromium.org/657036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39853 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/nibs/AutoFillDialog.xib11
-rw-r--r--chrome/browser/autofill/autofill_address_model_mac_unittest.mm8
-rw-r--r--chrome/browser/autofill/autofill_address_view_controller_mac_unittest.mm8
-rw-r--r--chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm8
-rw-r--r--chrome/browser/autofill/autofill_credit_card_view_controller_mac_unittest.mm8
-rw-r--r--chrome/browser/autofill/autofill_dialog_controller_mac.mm12
-rw-r--r--chrome/browser/cocoa/disclosure_view_controller_unittest.mm9
-rw-r--r--chrome/browser/cocoa/section_separator_view_unittest.mm8
-rw-r--r--chrome/browser/cocoa/vertical_layout_view_unittest.mm8
9 files changed, 51 insertions, 29 deletions
diff --git a/chrome/app/nibs/AutoFillDialog.xib b/chrome/app/nibs/AutoFillDialog.xib
index 3c455e1..e4ab911 100644
--- a/chrome/app/nibs/AutoFillDialog.xib
+++ b/chrome/app/nibs/AutoFillDialog.xib
@@ -40,7 +40,7 @@
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{990, 893}, {570, 544}}</string>
<int key="NSWTFlags">538968064</int>
- <string key="NSWindowTitle">Autofill profiles</string>
+ <string key="NSWindowTitle">^IDS_AUTOFILL_DIALOG_TITLE</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{570, 1200}</string>
@@ -771,6 +771,7 @@
<string>cancel:</string>
<string>deleteAddress:</string>
<string>deleteCreditCard:</string>
+ <string>notifyAddressChange:</string>
<string>save:</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -781,6 +782,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -851,6 +853,13 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/themed_window.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">SectionSeparatorView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
diff --git a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm
index f9199e9..882d31e 100644
--- a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm
+++ b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#import "chrome/browser/autofill/autofill_address_model_mac.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
@@ -21,10 +22,9 @@ TEST_F(AutoFillAddressModelTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
AutoFillProfile profile(ASCIIToUTF16("Home"), 0);
- AutoFillAddressModel* model = [[AutoFillAddressModel alloc]
- initWithProfile:profile];
- [model release];
- ASSERT_TRUE(true);
+ scoped_nsobject<AutoFillAddressModel> model([[AutoFillAddressModel alloc]
+ initWithProfile:profile]);
+ EXPECT_TRUE(model.get());
}
}
diff --git a/chrome/browser/autofill/autofill_address_view_controller_mac_unittest.mm b/chrome/browser/autofill/autofill_address_view_controller_mac_unittest.mm
index 5d43c98..2206b40 100644
--- a/chrome/browser/autofill/autofill_address_view_controller_mac_unittest.mm
+++ b/chrome/browser/autofill/autofill_address_view_controller_mac_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#import "chrome/browser/autofill/autofill_address_view_controller_mac.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
@@ -21,13 +22,12 @@ TEST_F(AutoFillAddressViewControllerTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
AutoFillProfile profile(ASCIIToUTF16("Home"), 0);
- AutoFillAddressViewController* controller =
+ scoped_nsobject<AutoFillAddressViewController> controller(
[[AutoFillAddressViewController alloc]
initWithProfile:profile
disclosure:NSOffState
- controller:nil];
- [controller release];
- ASSERT_TRUE(true);
+ controller:nil]);
+ EXPECT_TRUE(controller.get());
}
}
diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm
index 05fb71b..18650573 100644
--- a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm
+++ b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#import "chrome/browser/autofill/autofill_credit_card_model_mac.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
@@ -21,10 +22,9 @@ TEST_F(AutoFillCreditCardModelTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
CreditCard credit_card(ASCIIToUTF16("myCC"), 0);
- AutoFillCreditCardModel* model = [[AutoFillCreditCardModel alloc]
- initWithCreditCard:credit_card];
- [model release];
- ASSERT_TRUE(true);
+ scoped_nsobject<AutoFillCreditCardModel> model(
+ [[AutoFillCreditCardModel alloc] initWithCreditCard:credit_card]);
+ EXPECT_TRUE(model.get());
}
}
diff --git a/chrome/browser/autofill/autofill_credit_card_view_controller_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_view_controller_mac_unittest.mm
index 79bd403..9caadae 100644
--- a/chrome/browser/autofill/autofill_credit_card_view_controller_mac_unittest.mm
+++ b/chrome/browser/autofill/autofill_credit_card_view_controller_mac_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#import "chrome/browser/autofill/autofill_credit_card_view_controller_mac.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
@@ -21,13 +22,12 @@ TEST_F(AutoFillCreditCardViewControllerTest, HelloWorld) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
CreditCard credit_card(ASCIIToUTF16("myCC"), 0);
- AutoFillCreditCardViewController* controller =
+ scoped_nsobject<AutoFillCreditCardViewController> controller(
[[AutoFillCreditCardViewController alloc]
initWithCreditCard:credit_card
disclosure:NSOffState
- controller:nil];
- [controller release];
- ASSERT_TRUE(true);
+ controller:nil]);
+ EXPECT_TRUE(controller.get());
}
}
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index 238e2bf..418f699 100644
--- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
@@ -116,6 +116,9 @@
[[addressViewController view] setFrameOrigin:NSMakePoint(0, 0)];
[self notifyAddressChange:self];
+
+ // Recalculate key view loop to account for change in view tree.
+ [[self window] recalculateKeyViewLoop];
}
// Adds new credit card to bottom of list. A new credit card controller is
@@ -146,6 +149,9 @@
[childView_ addSubview:[creditCardViewController view]
positioned:NSWindowBelow relativeTo:insertionPoint];
[[creditCardViewController view] setFrameOrigin:NSMakePoint(0, 0)];
+
+ // Recalculate key view loop to account for change in view tree.
+ [[self window] recalculateKeyViewLoop];
}
- (IBAction)deleteAddress:(id)sender {
@@ -161,6 +167,9 @@
[addressFormViewControllers_.get() removeObjectAtIndex:i];
[self notifyAddressChange:self];
+
+ // Recalculate key view loop to account for change in view tree.
+ [[self window] recalculateKeyViewLoop];
}
- (IBAction)deleteCreditCard:(id)sender {
@@ -174,6 +183,9 @@
// at this point.
[[sender view] removeFromSuperview];
[creditCardFormViewControllers_.get() removeObjectAtIndex:i];
+
+ // Recalculate key view loop to account for change in view tree.
+ [[self window] recalculateKeyViewLoop];
}
// Credit card controllers are dependent upon the address labels. So we notify
diff --git a/chrome/browser/cocoa/disclosure_view_controller_unittest.mm b/chrome/browser/cocoa/disclosure_view_controller_unittest.mm
index ca0d9ca..0f0e2aa 100644
--- a/chrome/browser/cocoa/disclosure_view_controller_unittest.mm
+++ b/chrome/browser/cocoa/disclosure_view_controller_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#import "chrome/browser/cocoa/disclosure_view_controller.h"
@@ -19,10 +20,10 @@ class DisclosureViewControllerTest : public CocoaTest {
TEST_F(DisclosureViewControllerTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
- DisclosureViewController* controller = [[DisclosureViewController alloc]
- initWithNibName:@"" bundle:nil disclosure:NSOnState];
- [controller release];
- ASSERT_TRUE(true);
+ scoped_nsobject<DisclosureViewController> controller(
+ [[DisclosureViewController alloc]
+ initWithNibName:@"" bundle:nil disclosure:NSOnState]);
+ EXPECT_TRUE(controller.get());
}
}
diff --git a/chrome/browser/cocoa/section_separator_view_unittest.mm b/chrome/browser/cocoa/section_separator_view_unittest.mm
index 95408a8..f51d660 100644
--- a/chrome/browser/cocoa/section_separator_view_unittest.mm
+++ b/chrome/browser/cocoa/section_separator_view_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#import "chrome/browser/cocoa/section_separator_view.h"
@@ -19,10 +20,9 @@ class SectionSeparatorViewTest : public CocoaTest {
TEST_F(SectionSeparatorViewTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
- SectionSeparatorView* view = [[SectionSeparatorView alloc]
- initWithFrame:NSMakeRect(0, 0, 10, 10)];
- [view release];
- ASSERT_TRUE(true);
+ scoped_nsobject<SectionSeparatorView> view([[SectionSeparatorView alloc]
+ initWithFrame:NSMakeRect(0, 0, 10, 10)]);
+ EXPECT_TRUE(view.get());
}
}
diff --git a/chrome/browser/cocoa/vertical_layout_view_unittest.mm b/chrome/browser/cocoa/vertical_layout_view_unittest.mm
index 04248f1..90730df 100644
--- a/chrome/browser/cocoa/vertical_layout_view_unittest.mm
+++ b/chrome/browser/cocoa/vertical_layout_view_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#import "chrome/browser/cocoa/vertical_layout_view.h"
@@ -19,10 +20,9 @@ class VerticalLayoutViewTest : public CocoaTest {
TEST_F(VerticalLayoutViewTest, Basic) {
// A basic test that creates a new instance and releases.
// Aids valgrind leak detection.
- VerticalLayoutView* view = [[VerticalLayoutView alloc]
- initWithFrame:NSMakeRect(0, 0, 10, 10)];
- [view release];
- ASSERT_TRUE(true);
+ scoped_nsobject<VerticalLayoutView> view([[VerticalLayoutView alloc]
+ initWithFrame:NSMakeRect(0, 0, 10, 10)]);
+ EXPECT_TRUE(view.get());
}
}