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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void WebstoreInstallerTest::RunTestAsync( | 132 void WebstoreInstallerTest::RunTestAsync( |
133 const std::string& test_function_name) { | 133 const std::string& test_function_name) { |
134 std::string script = base::StringPrintf( | 134 std::string script = base::StringPrintf( |
135 "%s('%s')", test_function_name.c_str(), test_gallery_url_.c_str()); | 135 "%s('%s')", test_function_name.c_str(), test_gallery_url_.c_str()); |
136 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> | 136 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> |
137 ExecuteJavaScriptWithUserGestureForTests(base::UTF8ToUTF16(script)); | 137 ExecuteJavaScriptWithUserGestureForTests(base::UTF8ToUTF16(script)); |
138 } | 138 } |
139 | 139 |
140 void WebstoreInstallerTest::AutoAcceptInstall() { | 140 void WebstoreInstallerTest::AutoAcceptInstall() { |
141 ExtensionInstallPrompt::g_auto_confirm_for_tests = | 141 install_auto_confirm_.reset(); // Destroy any old override first. |
142 ExtensionInstallPrompt::ACCEPT; | 142 install_auto_confirm_.reset(new extensions::ScopedExtensionDialogAutoConfirm( |
| 143 &extensions::g_auto_confirm_install_for_testing, |
| 144 extensions::AUTO_CONFIRM_ACCEPT)); |
143 } | 145 } |
144 | 146 |
145 void WebstoreInstallerTest::AutoCancelInstall() { | 147 void WebstoreInstallerTest::AutoCancelInstall() { |
146 ExtensionInstallPrompt::g_auto_confirm_for_tests = | 148 install_auto_confirm_.reset(); // Destroy any old override first. |
147 ExtensionInstallPrompt::CANCEL; | 149 install_auto_confirm_.reset(new extensions::ScopedExtensionDialogAutoConfirm( |
| 150 &extensions::g_auto_confirm_install_for_testing, |
| 151 extensions::AUTO_CONFIRM_CANCEL)); |
148 } | 152 } |
OLD | NEW |