| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram_samples.h" | 11 #include "base/metrics/histogram_samples.h" |
| 12 #include "base/metrics/statistics_recorder.h" | 12 #include "base/metrics/statistics_recorder.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/test/histogram_tester.h" | 18 #include "base/test/histogram_tester.h" |
| 19 #include "base/test/scoped_feature_list.h" | 19 #include "base/test/scoped_feature_list.h" |
| 20 #include "base/threading/thread_restrictions.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 23 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 23 #include "chrome/browser/password_manager/password_manager_test_base.h" | 24 #include "chrome/browser/password_manager/password_manager_test_base.h" |
| 24 #include "chrome/browser/password_manager/password_store_factory.h" | 25 #include "chrome/browser/password_manager/password_store_factory.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_navigator_params.h" | 28 #include "chrome/browser/ui/browser_navigator_params.h" |
| 28 #include "chrome/browser/ui/login/login_handler.h" | 29 #include "chrome/browser/ui/login/login_handler.h" |
| 29 #include "chrome/browser/ui/login/login_handler_test_utils.h" | 30 #include "chrome/browser/ui/login/login_handler_test_utils.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class MockLoginModelObserver : public password_manager::LoginModelObserver { | 89 class MockLoginModelObserver : public password_manager::LoginModelObserver { |
| 89 public: | 90 public: |
| 90 MOCK_METHOD2(OnAutofillDataAvailableInternal, | 91 MOCK_METHOD2(OnAutofillDataAvailableInternal, |
| 91 void(const base::string16&, const base::string16&)); | 92 void(const base::string16&, const base::string16&)); |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 void OnLoginModelDestroying() override {} | 95 void OnLoginModelDestroying() override {} |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 GURL GetFileURL(const char* filename) { | 98 GURL GetFileURL(const char* filename) { |
| 99 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 98 base::FilePath path; | 100 base::FilePath path; |
| 99 PathService::Get(chrome::DIR_TEST_DATA, &path); | 101 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 100 path = path.AppendASCII("password").AppendASCII(filename); | 102 path = path.AppendASCII("password").AppendASCII(filename); |
| 101 CHECK(base::PathExists(path)); | 103 CHECK(base::PathExists(path)); |
| 102 return net::FilePathToFileURL(path); | 104 return net::FilePathToFileURL(path); |
| 103 } | 105 } |
| 104 | 106 |
| 105 // Handles |request| to "/basic_auth". If "Authorization" header is present, | 107 // Handles |request| to "/basic_auth". If "Authorization" header is present, |
| 106 // responds with a non-empty HTTP 200 page (regardless of its value). Otherwise | 108 // responds with a non-empty HTTP 200 page (regardless of its value). Otherwise |
| 107 // serves a Basic Auth challenge. | 109 // serves a Basic Auth challenge. |
| (...skipping 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3332 // Force a round-trip. | 3334 // Force a round-trip. |
| 3333 ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), | 3335 ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), |
| 3334 "var noop = 'noop';")); | 3336 "var noop = 'noop';")); |
| 3335 // Ensure the warning was not triggered. | 3337 // Ensure the warning was not triggered. |
| 3336 ASSERT_FALSE(observing_autofill_client->DidPopupAppear()); | 3338 ASSERT_FALSE(observing_autofill_client->DidPopupAppear()); |
| 3337 // Ensure the histogram remains empty. | 3339 // Ensure the histogram remains empty. |
| 3338 histograms.ExpectTotalCount(kHistogram, 0); | 3340 histograms.ExpectTotalCount(kHistogram, 0); |
| 3339 } | 3341 } |
| 3340 | 3342 |
| 3341 } // namespace password_manager | 3343 } // namespace password_manager |
| OLD | NEW |