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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/interstitial_page.h" | 46 #include "content/public/browser/interstitial_page.h" |
47 #include "content/public/browser/navigation_details.h" | 47 #include "content/public/browser/navigation_details.h" |
48 #include "content/public/browser/navigation_entry.h" | 48 #include "content/public/browser/navigation_entry.h" |
49 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
50 #include "content/public/browser/notification_types.h" | 50 #include "content/public/browser/notification_types.h" |
51 #include "content/public/browser/page_navigator.h" | 51 #include "content/public/browser/page_navigator.h" |
52 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
53 #include "content/public/browser/web_contents_delegate.h" | 53 #include "content/public/browser/web_contents_delegate.h" |
54 #include "content/public/common/content_switches.h" | 54 #include "content/public/common/content_switches.h" |
55 #include "content/public/common/page_transition_types.h" | |
56 #include "content/public/common/referrer.h" | 55 #include "content/public/common/referrer.h" |
57 #include "content/public/common/url_constants.h" | 56 #include "content/public/common/url_constants.h" |
58 #include "content/public/test/browser_test_utils.h" | 57 #include "content/public/test/browser_test_utils.h" |
59 #include "content/public/test/test_utils.h" | 58 #include "content/public/test/test_utils.h" |
60 #include "google_apis/gaia/google_service_auth_error.h" | 59 #include "google_apis/gaia/google_service_auth_error.h" |
61 #include "net/test/spawned_test_server/spawned_test_server.h" | 60 #include "net/test/spawned_test_server/spawned_test_server.h" |
62 #include "testing/gmock/include/gmock/gmock.h" | 61 #include "testing/gmock/include/gmock/gmock.h" |
63 #include "testing/gtest/include/gtest/gtest.h" | 62 #include "testing/gtest/include/gtest/gtest.h" |
64 #include "third_party/WebKit/public/web/WebInputEvent.h" | 63 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 64 #include "ui/base/page_transition_types.h" |
65 #include "ui/base/window_open_disposition.h" | 65 #include "ui/base/window_open_disposition.h" |
66 #include "url/gurl.h" | 66 #include "url/gurl.h" |
67 | 67 |
68 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
69 #include "base/win/windows_version.h" | 69 #include "base/win/windows_version.h" |
70 #elif defined(OS_MACOSX) | 70 #elif defined(OS_MACOSX) |
71 #include "base/mac/mac_util.h" | 71 #include "base/mac/mac_util.h" |
72 #include "base/mac/scoped_nsautorelease_pool.h" | 72 #include "base/mac/scoped_nsautorelease_pool.h" |
73 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 73 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
74 #endif | 74 #endif |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1193 |
1194 EXPECT_EQ(sign_in_contents->GetURL(), controller()->SignInUrl()); | 1194 EXPECT_EQ(sign_in_contents->GetURL(), controller()->SignInUrl()); |
1195 | 1195 |
1196 AccountChooserModel* account_chooser_model = | 1196 AccountChooserModel* account_chooser_model = |
1197 controller()->AccountChooserModelForTesting(); | 1197 controller()->AccountChooserModelForTesting(); |
1198 EXPECT_FALSE(account_chooser_model->WalletIsSelected()); | 1198 EXPECT_FALSE(account_chooser_model->WalletIsSelected()); |
1199 | 1199 |
1200 content::OpenURLParams params(wallet::GetSignInContinueUrl(), | 1200 content::OpenURLParams params(wallet::GetSignInContinueUrl(), |
1201 content::Referrer(), | 1201 content::Referrer(), |
1202 CURRENT_TAB, | 1202 CURRENT_TAB, |
1203 content::PAGE_TRANSITION_LINK, | 1203 ui::PAGE_TRANSITION_LINK, |
1204 true); | 1204 true); |
1205 | 1205 |
1206 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); | 1206 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); |
1207 | 1207 |
1208 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems(_, _)); | 1208 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems(_, _)); |
1209 continue_page_observer.Wait(); | 1209 continue_page_observer.Wait(); |
1210 content::RunAllPendingInMessageLoop(); | 1210 content::RunAllPendingInMessageLoop(); |
1211 | 1211 |
1212 EXPECT_FALSE(controller()->ShouldShowSignInWebView()); | 1212 EXPECT_FALSE(controller()->ShouldShowSignInWebView()); |
1213 | 1213 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 | 1270 |
1271 EXPECT_EQ(sign_in_contents->GetURL(), controller()->SignInUrl()); | 1271 EXPECT_EQ(sign_in_contents->GetURL(), controller()->SignInUrl()); |
1272 | 1272 |
1273 EXPECT_FALSE(account_chooser_model->WalletIsSelected()); | 1273 EXPECT_FALSE(account_chooser_model->WalletIsSelected()); |
1274 | 1274 |
1275 // User signs into new account, account 3. | 1275 // User signs into new account, account 3. |
1276 controller()->set_sign_in_user_index(3U); | 1276 controller()->set_sign_in_user_index(3U); |
1277 content::OpenURLParams params(wallet::GetSignInContinueUrl(), | 1277 content::OpenURLParams params(wallet::GetSignInContinueUrl(), |
1278 content::Referrer(), | 1278 content::Referrer(), |
1279 CURRENT_TAB, | 1279 CURRENT_TAB, |
1280 content::PAGE_TRANSITION_LINK, | 1280 ui::PAGE_TRANSITION_LINK, |
1281 true); | 1281 true); |
1282 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); | 1282 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); |
1283 | 1283 |
1284 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems(_, _)); | 1284 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems(_, _)); |
1285 continue_page_observer.Wait(); | 1285 continue_page_observer.Wait(); |
1286 content::RunAllPendingInMessageLoop(); | 1286 content::RunAllPendingInMessageLoop(); |
1287 | 1287 |
1288 EXPECT_FALSE(controller()->ShouldShowSignInWebView()); | 1288 EXPECT_FALSE(controller()->ShouldShowSignInWebView()); |
1289 EXPECT_EQ(3U, controller()->GetTestingWalletClient()->user_index()); | 1289 EXPECT_EQ(3U, controller()->GetTestingWalletClient()->user_index()); |
1290 | 1290 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 | 1414 |
1415 content::WebContents* sign_in_contents = | 1415 content::WebContents* sign_in_contents = |
1416 GetViewTester()->GetSignInWebContents(); | 1416 GetViewTester()->GetSignInWebContents(); |
1417 ASSERT_TRUE(sign_in_contents); | 1417 ASSERT_TRUE(sign_in_contents); |
1418 | 1418 |
1419 sign_in_page_observer.Wait(); | 1419 sign_in_page_observer.Wait(); |
1420 | 1420 |
1421 content::OpenURLParams params(GURL("http://google.com"), | 1421 content::OpenURLParams params(GURL("http://google.com"), |
1422 content::Referrer(), | 1422 content::Referrer(), |
1423 CURRENT_TAB, | 1423 CURRENT_TAB, |
1424 content::PAGE_TRANSITION_LINK, | 1424 ui::PAGE_TRANSITION_LINK, |
1425 true); | 1425 true); |
1426 params.user_gesture = true; | 1426 params.user_gesture = true; |
1427 | 1427 |
1428 int num_tabs = browser()->tab_strip_model()->count(); | 1428 int num_tabs = browser()->tab_strip_model()->count(); |
1429 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); | 1429 sign_in_contents->GetDelegate()->OpenURLFromTab(sign_in_contents, params); |
1430 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); | 1430 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); |
1431 } | 1431 } |
1432 | 1432 |
1433 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, RefreshOnManageTabClose) { | 1433 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, RefreshOnManageTabClose) { |
1434 ASSERT_TRUE(browser()->is_type_tabbed()); | 1434 ASSERT_TRUE(browser()->is_type_tabbed()); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 "<input autocomplete='transaction-currency' value='USD'>" | 1766 "<input autocomplete='transaction-currency' value='USD'>" |
1767 "<input autocomplete='cc-csc'>"); | 1767 "<input autocomplete='cc-csc'>"); |
1768 AutofillDialogControllerImpl* controller = SetUpHtmlAndInvoke(html); | 1768 AutofillDialogControllerImpl* controller = SetUpHtmlAndInvoke(html); |
1769 ASSERT_TRUE(controller); | 1769 ASSERT_TRUE(controller); |
1770 | 1770 |
1771 EXPECT_EQ(ASCIIToUTF16("24"), controller->transaction_amount_); | 1771 EXPECT_EQ(ASCIIToUTF16("24"), controller->transaction_amount_); |
1772 EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_); | 1772 EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_); |
1773 } | 1773 } |
1774 | 1774 |
1775 } // namespace autofill | 1775 } // namespace autofill |
OLD | NEW |