summaryrefslogtreecommitdiff
path: root/chrome/test
diff options
context:
space:
mode:
authorPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
committerPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
commit1320f92c476a1ad9d19dba2a48c72b75566198e9 (patch)
treeea7f149ccad687b22c18a72b729646568b2d54fb /chrome/test
parent39b78c562f50ad7d5551ee861121f899239525a2 (diff)
downloadchromium_org-1320f92c476a1ad9d19dba2a48c72b75566198e9.tar.gz
Merge from Chromium at DEPS revision 267aeeb8d85c
This commit was generated by merge_to_master.py. Change-Id: Id3aac9713b301fae64408cdaee0888724eeb7c0e
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/BUILD.gn187
-rw-r--r--chrome/test/DEPS1
-rw-r--r--chrome/test/android/javatests/src/org/chromium/chrome/test/util/TranslateUtil.java2
-rw-r--r--chrome/test/android/unit_tests_apk/src/org/chromium/chrome/unit_tests_apk/ChromeNativeTestApplication.java4
-rw-r--r--chrome/test/base/browser_with_test_window_test.cc6
-rw-r--r--chrome/test/base/browser_with_test_window_test.h2
-rw-r--r--chrome/test/base/chrome_render_view_test.cc31
-rw-r--r--chrome/test/base/chrome_render_view_test.h4
-rw-r--r--chrome/test/base/chrome_test_launcher.cc12
-rw-r--r--chrome/test/base/chrome_test_suite.cc5
-rw-r--r--chrome/test/base/extension_js_browser_test.cc6
-rw-r--r--chrome/test/base/extension_js_browser_test.h4
-rw-r--r--chrome/test/base/in_process_browser_test.cc8
-rw-r--r--chrome/test/base/in_process_browser_test.h6
-rw-r--r--chrome/test/base/interactive_test_utils.h3
-rw-r--r--chrome/test/base/interactive_test_utils_mac.mm8
-rw-r--r--chrome/test/base/interactive_test_utils_views.cc7
-rw-r--r--chrome/test/base/interactive_test_utils_win.cc26
-rw-r--r--chrome/test/base/test_browser_window.cc15
-rw-r--r--chrome/test/base/test_browser_window.h13
-rw-r--r--chrome/test/base/testing_browser_process.cc8
-rw-r--r--chrome/test/base/testing_browser_process.h7
-rw-r--r--chrome/test/base/testing_io_thread_state.cc2
-rw-r--r--chrome/test/base/testing_profile.cc158
-rw-r--r--chrome/test/base/testing_profile.h25
-rw-r--r--chrome/test/base/testing_profile_manager.cc26
-rw-r--r--chrome/test/base/tracing.cc69
-rw-r--r--chrome/test/base/tracing_browsertest.cc8
-rw-r--r--chrome/test/base/ui_test_utils.cc6
-rw-r--r--chrome/test/base/v8_unit_test.cc74
-rw-r--r--chrome/test/base/v8_unit_test.h24
-rw-r--r--chrome/test/base/view_event_test_platform_part_chromeos.cc2
-rw-r--r--chrome/test/base/web_ui_browser_test.cc2
-rw-r--r--chrome/test/chromedriver/archive.py2
-rw-r--r--chrome/test/chromedriver/capabilities.cc3
-rw-r--r--chrome/test/chromedriver/chrome/chrome_finder.cc2
-rw-r--r--chrome/test/chromedriver/chrome/device_metrics.cc2
-rw-r--r--chrome/test/chromedriver/chrome/version.cc2
-rw-r--r--chrome/test/chromedriver/chrome_launcher.cc2
-rw-r--r--chrome/test/chromedriver/chrome_launcher_unittest.cc2
-rw-r--r--chrome/test/chromedriver/js/get_element_region.js6
-rw-r--r--chrome/test/chromedriver/net/net_util_unittest.cc19
-rw-r--r--chrome/test/chromedriver/net/test_http_server.cc30
-rw-r--r--chrome/test/chromedriver/net/test_http_server.h3
-rwxr-xr-xchrome/test/chromedriver/run_buildbot_steps.py48
-rw-r--r--chrome/test/chromedriver/server/chromedriver_server.cc18
-rw-r--r--chrome/test/chromedriver/session_commands.cc2
-rw-r--r--chrome/test/chromedriver/session_commands_unittest.cc2
-rwxr-xr-xchrome/test/chromedriver/test/run_all_tests.py4
-rwxr-xr-xchrome/test/chromedriver/test/run_py_tests.py79
-rw-r--r--chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java4
-rw-r--r--chrome/test/chromedriver/util.cc2
-rw-r--r--chrome/test/chromedriver/util_unittest.cc2
-rw-r--r--chrome/test/ext_auto/auto_provider/manifest.json2
-rw-r--r--chrome/test/gpu/webgl_infobar_browsertest.cc8
-rw-r--r--chrome/test/logging/win/test_log_collector.cc2
-rw-r--r--chrome/test/mini_installer/chrome_helper.py20
-rw-r--r--chrome/test/mini_installer/config/chrome_system_installed.prop8
-rw-r--r--chrome/test/mini_installer/config/chrome_system_no_pv.prop10
-rw-r--r--chrome/test/mini_installer/config/chrome_system_not_installed.prop7
-rw-r--r--chrome/test/mini_installer/config/chrome_user_installed.prop8
-rw-r--r--chrome/test/mini_installer/config/chrome_user_no_pv.prop10
-rw-r--r--chrome/test/mini_installer/config/chrome_user_not_installed.prop6
-rw-r--r--chrome/test/mini_installer/config/config.config14
-rw-r--r--chrome/test/mini_installer/quit_chrome.py3
-rw-r--r--chrome/test/mini_installer/registry_verifier.py29
-rw-r--r--chrome/test/mini_installer/test_installer.py81
-rw-r--r--chrome/test/nacl/nacl_browsertest.cc93
-rw-r--r--chrome/test/nacl/pnacl_header_test.cc32
-rw-r--r--chrome/test/nacl/pnacl_header_test.h27
-rw-r--r--chrome/test/perf/mach_ports_performancetest.cc2
-rw-r--r--chrome/test/ppapi/ppapi_browsertest.cc19
-rw-r--r--chrome/test/ppapi/ppapi_test.cc2
-rw-r--r--chrome/test/remoting/fullscreen_browsertest.cc2
-rwxr-xr-xchrome/test/remoting/install_and_launch_app.py206
-rw-r--r--chrome/test/remoting/me2me_browsertest.cc2
-rw-r--r--chrome/test/remoting/pin_browsertest.cc2
-rw-r--r--chrome/test/remoting/qunit_browser_test_runner.cc2
-rw-r--r--chrome/test/remoting/remote_desktop_browsertest.cc34
-rw-r--r--chrome/test/remoting/remote_desktop_browsertest.h5
-rw-r--r--chrome/test/remoting/scrollbar_browsertest.cc26
81 files changed, 1173 insertions, 484 deletions
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
new file mode 100644
index 0000000000..14353e2090
--- /dev/null
+++ b/chrome/test/BUILD.gn
@@ -0,0 +1,187 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/features.gni")
+import("//build/config/ui.gni")
+
+# GYP version: chrome/chrome_tests_unit.gypi:test_support_common
+source_set("test_support") {
+ testonly = true
+
+ sources = [
+ "base/chrome_process_util.cc",
+ "base/chrome_process_util.h",
+ "base/chrome_process_util_mac.cc",
+ "base/chrome_render_view_host_test_harness.cc",
+ "base/chrome_render_view_host_test_harness.h",
+ "base/chrome_test_launcher.cc",
+ "base/chrome_test_launcher.h",
+ "base/chrome_test_suite.cc",
+ "base/chrome_test_suite.h",
+ "base/chrome_unit_test_suite.cc",
+ "base/chrome_unit_test_suite.h",
+ "base/find_in_page_observer.cc",
+ "base/find_in_page_observer.h",
+ "base/history_index_restore_observer.cc",
+ "base/history_index_restore_observer.h",
+ "base/in_process_browser_test.cc",
+ "base/in_process_browser_test.h",
+ "base/profile_mock.cc",
+ "base/profile_mock.h",
+ "base/scoped_browser_locale.cc",
+ "base/scoped_browser_locale.h",
+ "base/scoped_testing_local_state.cc",
+ "base/scoped_testing_local_state.h",
+ "base/test_browser_window.cc",
+ "base/test_browser_window.h",
+ "base/test_launcher_utils.cc",
+ "base/test_launcher_utils.h",
+ "base/test_switches.cc",
+ "base/test_switches.h",
+ "base/testing_browser_process.cc",
+ "base/testing_browser_process.h",
+ "base/testing_browser_process_platform_part.h",
+ "base/testing_browser_process_platform_part.cc",
+ "base/testing_io_thread_state.cc",
+ "base/testing_io_thread_state.h",
+ "base/testing_pref_service_syncable.cc",
+ "base/testing_pref_service_syncable.h",
+ "base/testing_profile.cc",
+ "base/testing_profile.h",
+ "base/testing_profile_manager.cc",
+ "base/testing_profile_manager.h",
+ "base/tracing.cc",
+ "base/tracing.h",
+ "base/ui_test_utils.cc",
+ "base/ui_test_utils.h",
+ "logging/win/file_logger.cc",
+ "logging/win/file_logger.h",
+ "logging/win/log_file_printer.cc",
+ "logging/win/log_file_printer.h",
+ "logging/win/log_file_reader.cc",
+ "logging/win/log_file_reader.h",
+ "logging/win/mof_data_parser.cc",
+ "logging/win/mof_data_parser.h",
+ "logging/win/test_log_collector.cc",
+ "logging/win/test_log_collector.h",
+ ]
+
+ # New deps should go in the non-iOS section below.
+ public_deps = [
+ "//content/test:test_support",
+ ]
+ deps = [
+ "//base:prefs_test_support",
+ "//base/test:test_support",
+ "//chrome:resources",
+ "//chrome:strings",
+ "//chrome/app:test_support",
+ #"//chrome/app/theme:theme_resources",
+ "//chrome/browser:test_support",
+ "//chrome/common:test_support",
+ "//chrome/renderer:test_support",
+ "//components/bookmarks/test",
+ "//components/component_updater:test_support",
+ "//components/gcm_driver:test_support",
+ "//components/history/core/test:test",
+ "//components/metrics:test_support",
+ "//components/omnibox:test_support",
+ "//components/ownership",
+ "//components/password_manager/core/browser:test_support",
+ "//components/pref_registry:test_support",
+ "//components/search_engines:test_support",
+ "//components/signin/core/browser:test_support",
+ "//components/sync_driver:test_support",
+ "//content/public/app:both",
+ "//ui/gfx:test_support",
+ "//net",
+ "//net:test_support",
+ "//skia",
+ "//sql",
+ "//sql:test_support",
+ "//sync",
+ "//testing/gmock",
+ "//testing/gtest",
+ "//third_party/zlib",
+ "//ui/message_center:test_support",
+ ]
+
+ if (!is_ios) {
+ deps += [
+ "//chrome/common/extensions/api",
+ "//chrome/plugin",
+ "//chrome/renderer",
+ "//chrome/utility",
+ "//content/public/child",
+ "//content/public/common",
+ "//content/public/plugin",
+ "//content/public/renderer",
+ "//content/public/utility",
+ "//components/autofill/core/browser:test_support",
+ "//components/captive_portal:test_support",
+ "//components/infobars/core",
+ "//components/sessions:test_support",
+ "//extensions:test_support",
+ "//google_apis:test_support",
+ "//ipc:test_support",
+ "//media:test_support",
+ "//ppapi:ppapi_shared",
+ "//sql:test_support",
+ "//third_party/leveldatabase",
+ "//ui/base",
+ "//ui/events:events_base",
+ "//ui/gl",
+ ]
+ }
+
+ if (is_linux) {
+ deps += [ "//crypto:platform" ]
+ }
+ if (is_win) {
+ deps += [
+ "//third_party/wtl",
+ "//ui/snapshot:test_support",
+ ]
+ if (use_aura) {
+ deps += [
+ #'../win8/win8.gyp:test_registrar_constants', TODO(GYP)
+ #'../win8/win8.gyp:test_support_win8', TODO(GYP)
+ ]
+ }
+ }
+
+ if (enable_plugins) {
+ sources += [
+ "ppapi/ppapi_test.cc",
+ "ppapi/ppapi_test.h",
+ ]
+ }
+
+ if (use_ash) {
+ deps += [ "//ash:test_support" ]
+ }
+ if (toolkit_views) {
+ deps += [ "//ui/views:test_support" ]
+ }
+}
+
+source_set("test_support_unit") {
+ testonly = true
+ sources = [
+ "../browser/sync/glue/session_sync_test_helper.cc",
+ "../browser/sync/glue/session_sync_test_helper.h",
+ "base/run_all_unittests.cc",
+ ]
+
+ deps = [
+ ":test_support",
+ "//base",
+ "//chrome:resources",
+ "//chrome:strings",
+ "//chrome/browser",
+ "//chrome/common",
+ "//mojo/environment:chromium",
+ "//mojo/system",
+ ]
+}
diff --git a/chrome/test/DEPS b/chrome/test/DEPS
index db5b57fe42..1c79004e13 100644
--- a/chrome/test/DEPS
+++ b/chrome/test/DEPS
@@ -20,6 +20,5 @@ include_rules = [
"+media/base",
"+mojo/embedder",
"+sandbox/win/tests",
- "+webkit/glue",
"+win8/test",
]
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TranslateUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TranslateUtil.java
index 1e4bcddcc5..b61e2a3c90 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TranslateUtil.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TranslateUtil.java
@@ -35,7 +35,7 @@ public class TranslateUtil {
SpannableString spannable = (SpannableString) text.getText();
ClickableSpan[] clickable =
- spannable.getSpans(0, spannable.length() -1, ClickableSpan.class);
+ spannable.getSpans(0, spannable.length() - 1, ClickableSpan.class);
if (clickable.length <= 0) {
return false;
}
diff --git a/chrome/test/android/unit_tests_apk/src/org/chromium/chrome/unit_tests_apk/ChromeNativeTestApplication.java b/chrome/test/android/unit_tests_apk/src/org/chromium/chrome/unit_tests_apk/ChromeNativeTestApplication.java
index cb6f3f1227..b2ca9769e8 100644
--- a/chrome/test/android/unit_tests_apk/src/org/chromium/chrome/unit_tests_apk/ChromeNativeTestApplication.java
+++ b/chrome/test/android/unit_tests_apk/src/org/chromium/chrome/unit_tests_apk/ChromeNativeTestApplication.java
@@ -22,6 +22,10 @@ public class ChromeNativeTestApplication extends ChromiumApplication {
}
@Override
+ protected void showAutofillSettings() {
+ }
+
+ @Override
protected void showTermsOfServiceDialog() {
}
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index 022ad4db96..040cb5e6e3 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -14,8 +14,8 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/page_transition_types.h"
#include "content/public/test/test_renderer_host.h"
+#include "ui/base/page_transition_types.h"
#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
@@ -121,7 +121,7 @@ void BrowserWithTestWindowTest::TearDown() {
}
void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
- chrome::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED);
+ chrome::NavigateParams params(browser, url, ui::PAGE_TRANSITION_TYPED);
params.tabstrip_index = 0;
params.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&params);
@@ -174,7 +174,7 @@ void BrowserWithTestWindowTest::NavigateAndCommit(
NavigationController* controller,
const GURL& url) {
controller->LoadURL(
- url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
+ url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
CommitPendingLoad(controller);
}
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h
index cb65ebcb4d..404e94a906 100644
--- a/chrome/test/base/browser_with_test_window_test.h
+++ b/chrome/test/base/browser_with_test_window_test.h
@@ -71,7 +71,7 @@ class WebContents;
// // This is equivalent to the above, and lets you test pending navigations.
// browser()->OpenURL(OpenURLParams(
// GURL("http://foo/2"), GURL(), CURRENT_TAB,
-// content::PAGE_TRANSITION_TYPED, false));
+// ui::PAGE_TRANSITION_TYPED, false));
// CommitPendingLoad(controller);
//
// Subclasses must invoke BrowserWithTestWindowTest::SetUp as it is responsible
diff --git a/chrome/test/base/chrome_render_view_test.cc b/chrome/test/base/chrome_render_view_test.cc
index 92425b1b66..da8e1458ff 100644
--- a/chrome/test/base/chrome_render_view_test.cc
+++ b/chrome/test/base/chrome_render_view_test.cc
@@ -9,7 +9,6 @@
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
-#include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
#include "chrome/renderer/spellchecker/spellcheck.h"
#include "chrome/test/base/chrome_unit_test_suite.h"
#include "components/autofill/content/renderer/autofill_agent.h"
@@ -19,10 +18,6 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/renderer_preferences.h"
#include "content/public/renderer/render_view.h"
-#include "extensions/browser/extension_function_dispatcher.h"
-#include "extensions/common/extension.h"
-#include "extensions/renderer/dispatcher.h"
-#include "extensions/renderer/event_bindings.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
@@ -31,6 +26,17 @@
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebView.h"
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
+#include "extensions/browser/extension_function_dispatcher.h"
+#include "extensions/common/extension.h"
+#include "extensions/renderer/dispatcher.h"
+#include "extensions/renderer/event_bindings.h"
+#endif
+
+using autofill::AutofillAgent;
+using autofill::PasswordAutofillAgent;
+using autofill::PasswordGenerationAgent;
using blink::WebFrame;
using blink::WebInputEvent;
using blink::WebMouseEvent;
@@ -38,12 +44,9 @@ using blink::WebScriptController;
using blink::WebScriptSource;
using blink::WebString;
using blink::WebURLRequest;
-using autofill::AutofillAgent;
-using autofill::PasswordAutofillAgent;
-using autofill::PasswordGenerationAgent;
ChromeRenderViewTest::ChromeRenderViewTest()
- : password_autofill_(NULL),
+ : password_autofill_agent_(NULL),
password_generation_(NULL),
autofill_agent_(NULL),
chrome_render_thread_(NULL) {
@@ -64,16 +67,18 @@ void ChromeRenderViewTest::SetUp() {
// RenderView doesn't expose its Agent objects, because it has no need to
// store them directly (they're stored as RenderViewObserver*). So just
// create another set.
- password_autofill_ = new autofill::TestPasswordAutofillAgent(view_);
+ password_autofill_agent_ = new autofill::TestPasswordAutofillAgent(view_);
password_generation_ = new autofill::TestPasswordGenerationAgent(view_);
autofill_agent_ =
- new AutofillAgent(view_, password_autofill_, password_generation_);
+ new AutofillAgent(view_, password_autofill_agent_, password_generation_);
}
void ChromeRenderViewTest::TearDown() {
+#if defined(ENABLE_EXTENSIONS)
ChromeContentRendererClient* client =
static_cast<ChromeContentRendererClient*>(content_renderer_client_.get());
client->GetExtensionDispatcherForTest()->OnRenderProcessShutdown();
+#endif
#if defined(LEAK_SANITIZER)
// Do this before shutting down V8 in RenderViewTest::TearDown().
@@ -94,11 +99,13 @@ content::ContentBrowserClient*
content::ContentRendererClient*
ChromeRenderViewTest::CreateContentRendererClient() {
+ ChromeContentRendererClient* client = new ChromeContentRendererClient();
+#if defined(ENABLE_EXTENSIONS)
extension_dispatcher_delegate_.reset(
new ChromeExtensionsDispatcherDelegate());
- ChromeContentRendererClient* client = new ChromeContentRendererClient();
client->SetExtensionDispatcherForTest(
new extensions::Dispatcher(extension_dispatcher_delegate_.get()));
+#endif
#if defined(ENABLE_SPELLCHECK)
client->SetSpellcheck(new SpellCheck());
#endif
diff --git a/chrome/test/base/chrome_render_view_test.h b/chrome/test/base/chrome_render_view_test.h
index 19ee8d2869..6ff32b6dfd 100644
--- a/chrome/test/base/chrome_render_view_test.h
+++ b/chrome/test/base/chrome_render_view_test.h
@@ -35,9 +35,11 @@ class ChromeRenderViewTest : public content::RenderViewTest {
virtual content::ContentRendererClient*
CreateContentRendererClient() OVERRIDE;
+#if defined(ENABLE_EXTENSIONS)
scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_;
+#endif
- autofill::TestPasswordAutofillAgent* password_autofill_;
+ autofill::TestPasswordAutofillAgent* password_autofill_agent_;
autofill::TestPasswordGenerationAgent* password_generation_;
autofill::AutofillAgent* autofill_agent_;
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc
index 37e11414f6..524be28555 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -6,8 +6,8 @@
#include "base/command_line.h"
#include "base/debug/leak_annotations.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
#include "base/process/process_metrics.h"
@@ -41,7 +41,7 @@
#endif
#if defined(OS_LINUX) || defined(OS_ANDROID)
-#include "chrome/app/chrome_breakpad_client.h"
+#include "chrome/app/chrome_crash_reporter_client.h"
#endif
namespace {
@@ -114,10 +114,10 @@ int LaunchChromeTests(int default_jobs,
#if defined(OS_LINUX) || defined(OS_ANDROID)
// We leak this pointer intentionally. The breakpad client needs to outlive
// all other code.
- chrome::ChromeBreakpadClient* breakpad_client =
- new chrome::ChromeBreakpadClient();
- ANNOTATE_LEAKING_OBJECT_PTR(breakpad_client);
- breakpad::SetBreakpadClient(breakpad_client);
+ chrome::ChromeCrashReporterClient* crash_client =
+ new chrome::ChromeCrashReporterClient();
+ ANNOTATE_LEAKING_OBJECT_PTR(crash_client);
+ crash_reporter::SetCrashReporterClient(crash_client);
#endif
ChromeTestLauncherDelegate launcher_delegate(runner);
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 6292b85d7a..53941dd5b7 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -17,7 +17,9 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
+#include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/test/test_launcher.h"
+#include "extensions/common/constants.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_ANDROID)
@@ -106,6 +108,9 @@ void ChromeTestSuite::Initialize() {
// values for DIR_EXE and DIR_MODULE.
content::ContentTestSuiteBase::Initialize();
+ ContentSettingsPattern::SetNonWildcardDomainNonPortScheme(
+ extensions::kExtensionScheme);
+
#if defined(OS_MACOSX) && !defined(OS_IOS)
// Look in the framework bundle for resources.
base::FilePath path;
diff --git a/chrome/test/base/extension_js_browser_test.cc b/chrome/test/base/extension_js_browser_test.cc
index 36e78c90dc..70ddca1184 100644
--- a/chrome/test/base/extension_js_browser_test.cc
+++ b/chrome/test/base/extension_js_browser_test.cc
@@ -14,6 +14,12 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
+ExtensionJSBrowserTest::ExtensionJSBrowserTest() : libs_loaded_(false) {
+}
+
+ExtensionJSBrowserTest::~ExtensionJSBrowserTest() {
+}
+
void ExtensionJSBrowserTest::WaitForExtension(const char* extension_id,
const base::Closure& load_cb) {
load_waiter_.reset(new ExtensionLoadWaiterOneShot());
diff --git a/chrome/test/base/extension_js_browser_test.h b/chrome/test/base/extension_js_browser_test.h
index c9e0118703..34cecdd1f2 100644
--- a/chrome/test/base/extension_js_browser_test.h
+++ b/chrome/test/base/extension_js_browser_test.h
@@ -15,9 +15,9 @@
//chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs
class ExtensionJSBrowserTest : public JavaScriptBrowserTest {
public:
- ExtensionJSBrowserTest() : libs_loaded_(false) {}
+ ExtensionJSBrowserTest();
- virtual ~ExtensionJSBrowserTest() {}
+ virtual ~ExtensionJSBrowserTest();
protected:
// Waits for an extension to load; returns immediately if already loaded.
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 220865d3bb..f78058cb1c 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -8,8 +8,8 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
@@ -288,7 +288,7 @@ void InProcessBrowserTest::AddTabAtIndexToBrowser(
Browser* browser,
int index,
const GURL& url,
- content::PageTransition transition) {
+ ui::PageTransition transition) {
chrome::NavigateParams params(browser, url, transition);
params.tabstrip_index = index;
params.disposition = NEW_FOREGROUND_TAB;
@@ -300,7 +300,7 @@ void InProcessBrowserTest::AddTabAtIndexToBrowser(
void InProcessBrowserTest::AddTabAtIndex(
int index,
const GURL& url,
- content::PageTransition transition) {
+ ui::PageTransition transition) {
AddTabAtIndexToBrowser(browser(), index, url, transition);
}
@@ -351,7 +351,7 @@ void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) {
content::NotificationService::AllSources());
chrome::AddSelectedTabWithURL(browser,
GURL(url::kAboutBlankURL),
- content::PAGE_TRANSITION_AUTO_TOPLEVEL);
+ ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
observer.Wait();
browser->window()->Show();
diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h
index b0217d90cd..34a1e5115e 100644
--- a/chrome/test/base/in_process_browser_test.h
+++ b/chrome/test/base/in_process_browser_test.h
@@ -9,10 +9,10 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "content/public/common/page_transition_types.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/page_transition_types.h"
namespace base {
@@ -111,9 +111,9 @@ class InProcessBrowserTest : public content::BrowserTestBase {
void AddTabAtIndexToBrowser(Browser* browser,
int index,
const GURL& url,
- content::PageTransition transition);
+ ui::PageTransition transition);
void AddTabAtIndex(int index, const GURL& url,
- content::PageTransition transition);
+ ui::PageTransition transition);
// Initializes the contents of the user data directory. Called by SetUp()
// after creating the user data directory, but before any browser is launched.
diff --git a/chrome/test/base/interactive_test_utils.h b/chrome/test/base/interactive_test_utils.h
index 0779a4f862..e8c7a224b1 100644
--- a/chrome/test/base/interactive_test_utils.h
+++ b/chrome/test/base/interactive_test_utils.h
@@ -31,6 +31,9 @@ bool IsViewFocused(const Browser* browser, ViewID vid);
// Simulates a mouse click on a View in the browser.
void ClickOnView(const Browser* browser, ViewID vid);
+// Makes focus shift to the given View without clicking it.
+void FocusView(const Browser* browser, ViewID vid);
+
// A collection of utilities that are used from interactive_ui_tests. These are
// separated from ui_test_utils.h to ensure that browser_tests don't use them,
// since they depend on focus which isn't possible for sharded test.
diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm
index e2d5cdb5fa..fcf5f124f1 100644
--- a/chrome/test/base/interactive_test_utils_mac.mm
+++ b/chrome/test/base/interactive_test_utils_mac.mm
@@ -78,6 +78,14 @@ void ClickOnView(const Browser* browser, ViewID vid) {
content::RunMessageLoop();
}
+void FocusView(const Browser* browser, ViewID vid) {
+ NSWindow* window = browser->window()->GetNativeWindow();
+ DCHECK(window);
+ NSView* view = view_id_util::GetView(window, vid);
+ DCHECK(view);
+ [window makeFirstResponder:view];
+ }
+
void HideNativeWindow(gfx::NativeWindow window) {
[window orderOut:nil];
}
diff --git a/chrome/test/base/interactive_test_utils_views.cc b/chrome/test/base/interactive_test_utils_views.cc
index 67bcf63360..ac5047fa6f 100644
--- a/chrome/test/base/interactive_test_utils_views.cc
+++ b/chrome/test/base/interactive_test_utils_views.cc
@@ -43,6 +43,13 @@ void ClickOnView(const Browser* browser, ViewID vid) {
content::RunMessageLoop();
}
+void FocusView(const Browser* browser, ViewID vid) {
+ views::View* view =
+ BrowserView::GetBrowserViewForBrowser(browser)->GetViewByID(vid);
+ DCHECK(view);
+ view->RequestFocus();
+}
+
#endif // defined(OS_MACOSX)
void MoveMouseToCenterAndPress(views::View* view,
diff --git a/chrome/test/base/interactive_test_utils_win.cc b/chrome/test/base/interactive_test_utils_win.cc
index 4858cf69c0..fd3ec7b22d 100644
--- a/chrome/test/base/interactive_test_utils_win.cc
+++ b/chrome/test/base/interactive_test_utils_win.cc
@@ -4,6 +4,8 @@
#include "chrome/test/base/interactive_test_utils.h"
+#include <Psapi.h>
+
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -46,7 +48,29 @@ bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
// ShowWindow does not necessarily activate the window. In particular if a
// window from another app is the foreground window then the request to
// activate the window fails. See SetForegroundWindow for details.
- return GetForegroundWindow() == hwnd;
+ HWND foreground_window = GetForegroundWindow();
+ if (foreground_window == hwnd)
+ return true;
+
+ wchar_t window_title[256];
+ std::wstring path_str;
+ if (foreground_window) {
+ DWORD process_id = 0;
+ GetWindowThreadProcessId(foreground_window, &process_id);
+ HANDLE process_handle = OpenProcess(
+ PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, process_id);
+ if (process_handle) {
+ wchar_t path[MAX_PATH];
+ if (GetModuleFileNameEx(process_handle, NULL, path, MAX_PATH))
+ path_str = path;
+ CloseHandle(process_handle);
+ }
+ }
+ GetWindowText(foreground_window, window_title, arraysize(window_title));
+ LOG(ERROR) << "ShowAndFocusNativeWindow failed. foreground window: "
+ << foreground_window << ", title: " << window_title << ", path: "
+ << path_str;
+ return false;
}
} // namespace ui_test_utils
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc
index 9c64e5b751..0a159b17be 100644
--- a/chrome/test/base/test_browser_window.cc
+++ b/chrome/test/base/test_browser_window.cc
@@ -61,9 +61,14 @@ WindowOpenDisposition
return CURRENT_TAB;
}
-content::PageTransition
+ui::PageTransition
TestBrowserWindow::TestLocationBar::GetPageTransition() const {
- return content::PAGE_TRANSITION_LINK;
+ return ui::PAGE_TRANSITION_LINK;
+}
+
+bool TestBrowserWindow::TestLocationBar::ShowPageActionPopup(
+ const extensions::Extension* extension, bool grant_active_tab) {
+ return false;
}
const OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() const {
@@ -218,9 +223,3 @@ TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
void TestBrowserWindow::ExecuteExtensionCommand(
const extensions::Extension* extension,
const extensions::Command& command) {}
-
-void TestBrowserWindow::ShowPageActionPopup(
- const extensions::Extension* extension) {}
-
-void TestBrowserWindow::ShowBrowserActionPopup(
- const extensions::Extension* extension) {}
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index b1d9fd5b71..b9c746a265 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -149,18 +149,10 @@ class TestBrowserWindow : public BrowserWindow {
const gfx::Rect& rect) OVERRIDE {}
virtual void ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode,
const signin::ManageAccountsParams& manage_accounts_params) OVERRIDE {}
- virtual void ShowPasswordGenerationBubble(
- const gfx::Rect& rect,
- const autofill::PasswordForm& form,
- autofill::PasswordGenerator* generator) OVERRIDE {}
virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() OVERRIDE;
virtual void ExecuteExtensionCommand(
const extensions::Extension* extension,
const extensions::Command& command) OVERRIDE;
- virtual void ShowPageActionPopup(
- const extensions::Extension* extension) OVERRIDE;
- virtual void ShowBrowserActionPopup(
- const extensions::Extension* extension) OVERRIDE;
protected:
virtual void DestroyBrowser() OVERRIDE {}
@@ -175,7 +167,7 @@ class TestBrowserWindow : public BrowserWindow {
virtual void ShowFirstRunBubble() OVERRIDE {}
virtual GURL GetDestinationURL() const OVERRIDE;
virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE;
- virtual content::PageTransition GetPageTransition() const OVERRIDE;
+ virtual ui::PageTransition GetPageTransition() const OVERRIDE;
virtual void AcceptInput() OVERRIDE {}
virtual void FocusLocation(bool select_all) OVERRIDE {}
virtual void FocusSearch() OVERRIDE {}
@@ -183,6 +175,9 @@ class TestBrowserWindow : public BrowserWindow {
virtual void UpdateManagePasswordsIconAndBubble() OVERRIDE {}
virtual void UpdatePageActions() OVERRIDE {}
virtual void InvalidatePageActions() OVERRIDE {}
+ virtual void UpdateBookmarkStarVisibility() OVERRIDE {}
+ virtual bool ShowPageActionPopup(const extensions::Extension* extension,
+ bool grant_active_tab) OVERRIDE;
virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE {}
virtual void UpdateGeneratedCreditCardView() OVERRIDE {}
virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE {}
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index f704280101..4734ac5ba1 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/apps/chrome_apps_client.h"
+#include "chrome/browser/ui/apps/chrome_app_window_client.h"
#include "chrome/test/base/testing_browser_process_platform_part.h"
#include "components/network_time/network_time_tracker.h"
#include "content/public/browser/notification_service.h"
@@ -75,7 +75,7 @@ TestingBrowserProcess::TestingBrowserProcess()
#if defined(ENABLE_EXTENSIONS)
extensions_browser_client_.reset(
new extensions::ChromeExtensionsBrowserClient);
- apps::AppsClient::Set(ChromeAppsClient::GetInstance());
+ extensions::AppWindowClient::Set(ChromeAppWindowClient::GetInstance());
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
#endif
}
@@ -104,7 +104,7 @@ MetricsServicesManager* TestingBrowserProcess::GetMetricsServicesManager() {
return NULL;
}
-MetricsService* TestingBrowserProcess::metrics_service() {
+metrics::MetricsService* TestingBrowserProcess::metrics_service() {
return NULL;
}
@@ -266,7 +266,7 @@ bool TestingBrowserProcess::IsShuttingDown() {
}
printing::PrintJobManager* TestingBrowserProcess::print_job_manager() {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINTING)
if (!print_job_manager_.get())
print_job_manager_.reset(new printing::PrintJobManager());
return print_job_manager_.get();
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h
index b12410a2cf..bf39038d7d 100644
--- a/chrome/test/base/testing_browser_process.h
+++ b/chrome/test/base/testing_browser_process.h
@@ -61,7 +61,7 @@ class TestingBrowserProcess : public BrowserProcess {
virtual void ResourceDispatcherHostCreated() OVERRIDE;
virtual void EndSession() OVERRIDE;
virtual MetricsServicesManager* GetMetricsServicesManager() OVERRIDE;
- virtual MetricsService* metrics_service() OVERRIDE;
+ virtual metrics::MetricsService* metrics_service() OVERRIDE;
virtual rappor::RapporService* rappor_service() OVERRIDE;
virtual IOThread* io_thread() OVERRIDE;
virtual WatchDogThread* watchdog_thread() OVERRIDE;
@@ -155,8 +155,11 @@ class TestingBrowserProcess : public BrowserProcess {
scoped_ptr<ProfileManager> profile_manager_;
scoped_ptr<NotificationUIManager> notification_ui_manager_;
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINTING)
scoped_ptr<printing::PrintJobManager> print_job_manager_;
+#endif
+
+#if defined(ENABLE_FULL_PRINTING)
scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_;
scoped_refptr<printing::PrintPreviewDialogController>
print_preview_dialog_controller_;
diff --git a/chrome/test/base/testing_io_thread_state.cc b/chrome/test/base/testing_io_thread_state.cc
index 759d463c52..e79423fb67 100644
--- a/chrome/test/base/testing_io_thread_state.cc
+++ b/chrome/test/base/testing_io_thread_state.cc
@@ -40,7 +40,7 @@ namespace chrome {
TestingIOThreadState::TestingIOThreadState() {
#if defined(OS_CHROMEOS)
// Needed by IOThread constructor.
- chromeos::DBusThreadManager::InitializeWithStub();
+ chromeos::DBusThreadManager::Initialize();
chromeos::NetworkHandler::Initialize();
#endif
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 711a640b9e..ca36aceef0 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -6,7 +6,7 @@
#include "base/base_paths.h"
#include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/path_service.h"
#include "base/prefs/testing_pref_store.h"
@@ -19,6 +19,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/favicon/chrome_favicon_client_factory.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
@@ -53,6 +54,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/common/bookmark_constants.h"
+#include "components/history/core/browser/top_sites_observer.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/policy/core/common/policy_service.h"
#include "components/user_prefs/user_prefs.h"
@@ -105,6 +107,21 @@ using testing::Return;
namespace {
+// Used to make sure TopSites has finished loading
+class WaitTopSitesLoadedObserver : public history::TopSitesObserver {
+ public:
+ explicit WaitTopSitesLoadedObserver(content::MessageLoopRunner* runner)
+ : runner_(runner) {}
+ virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE {
+ runner_->Quit();
+ }
+ virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE {}
+
+ private:
+ // weak
+ content::MessageLoopRunner* runner_;
+};
+
// Task used to make sure history has finished processing a request. Intended
// for use with BlockUntilHistoryProcessesPendingRequests.
@@ -166,7 +183,7 @@ class TestExtensionURLRequestContextGetter
#if defined(ENABLE_NOTIFICATIONS)
KeyedService* CreateTestDesktopNotificationService(
content::BrowserContext* profile) {
- return new DesktopNotificationService(static_cast<Profile*>(profile), NULL);
+ return new DesktopNotificationService(static_cast<Profile*>(profile));
}
#endif
@@ -184,7 +201,6 @@ const char TestingProfile::kTestUserProfileDir[] = "Default";
TestingProfile::TestingProfile()
: start_time_(Time::Now()),
testing_prefs_(NULL),
- incognito_(false),
force_incognito_(false),
original_profile_(NULL),
guest_session_(false),
@@ -203,7 +219,6 @@ TestingProfile::TestingProfile()
TestingProfile::TestingProfile(const base::FilePath& path)
: start_time_(Time::Now()),
testing_prefs_(NULL),
- incognito_(false),
force_incognito_(false),
original_profile_(NULL),
guest_session_(false),
@@ -221,7 +236,6 @@ TestingProfile::TestingProfile(const base::FilePath& path,
Delegate* delegate)
: start_time_(Time::Now()),
testing_prefs_(NULL),
- incognito_(false),
force_incognito_(false),
original_profile_(NULL),
guest_session_(false),
@@ -248,7 +262,7 @@ TestingProfile::TestingProfile(
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
#endif
scoped_ptr<PrefServiceSyncable> prefs,
- bool incognito,
+ TestingProfile* parent,
bool guest_session,
const std::string& supervised_user_id,
scoped_ptr<policy::PolicyService> policy_service,
@@ -256,9 +270,8 @@ TestingProfile::TestingProfile(
: start_time_(Time::Now()),
prefs_(prefs.release()),
testing_prefs_(NULL),
- incognito_(incognito),
force_incognito_(false),
- original_profile_(NULL),
+ original_profile_(parent),
guest_session_(guest_session),
supervised_user_id_(supervised_user_id),
last_session_exited_cleanly_(true),
@@ -271,6 +284,9 @@ TestingProfile::TestingProfile(
resource_context_(NULL),
delegate_(delegate),
policy_service_(policy_service.release()) {
+ if (parent)
+ parent->SetOffTheRecordProfile(scoped_ptr<Profile>(this));
+
// If no profile path was supplied, create one.
if (profile_path_.empty()) {
CreateTempProfileDir();
@@ -342,6 +358,8 @@ void TestingProfile::Init() {
if (prefs_.get())
user_prefs::UserPrefs::Set(this, prefs_.get());
+ else if (IsOffTheRecord())
+ CreateIncognitoPrefService();
else
CreateTestingPrefService();
@@ -359,10 +377,10 @@ void TestingProfile::Init() {
this, extensions::TestExtensionSystem::Build);
#endif
- // If no original profile was specified for this profile: register preferences
- // even if this is an incognito profile - this allows tests to create a
- // standalone incognito profile while still having prefs registered.
- if (!IsOffTheRecord() || !original_profile_) {
+ // Prefs for incognito profiles are set in CreateIncognitoPrefService() by
+ // simulating ProfileImpl::GetOffTheRecordPrefs().
+ if (!IsOffTheRecord()) {
+ DCHECK(!original_profile_);
user_prefs::PrefRegistrySyncable* pref_registry =
static_cast<user_prefs::PrefRegistrySyncable*>(
prefs_->DeprecatedGetPrefRegistry());
@@ -380,11 +398,13 @@ void TestingProfile::Init() {
#endif
#if defined(ENABLE_MANAGED_USERS)
- SupervisedUserSettingsService* settings_service =
- SupervisedUserSettingsServiceFactory::GetForProfile(this);
- TestingPrefStore* store = new TestingPrefStore();
- settings_service->Init(store);
- store->SetInitializationCompleted();
+ if (!IsOffTheRecord()) {
+ SupervisedUserSettingsService* settings_service =
+ SupervisedUserSettingsServiceFactory::GetForProfile(this);
+ TestingPrefStore* store = new TestingPrefStore();
+ settings_service->Init(store);
+ store->SetInitializationCompleted();
+ }
#endif
profile_name_ = "testing_profile";
@@ -409,6 +429,9 @@ TestingProfile::~TestingProfile() {
// Revert to non-incognito mode before shutdown.
force_incognito_ = false;
+ // If this profile owns an incognito profile, tear it down first.
+ incognito_profile_.reset();
+
// Any objects holding live URLFetchers should be deleted before teardown.
TemplateURLFetcherFactory::ShutdownForProfile(this);
@@ -517,7 +540,7 @@ static KeyedService* BuildBookmarkModel(content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
ChromeBookmarkClient* bookmark_client =
ChromeBookmarkClientFactory::GetForProfile(profile);
- BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client, false);
+ BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client);
bookmark_client->Init(bookmark_model);
bookmark_model->Load(profile->GetPrefs(),
profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
@@ -536,7 +559,9 @@ static KeyedService* BuildChromeBookmarkClient(
static KeyedService* BuildChromeHistoryClient(
content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
- return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile));
+ return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile),
+ profile,
+ profile->GetTopSites());
}
void TestingProfile::CreateBookmarkModel(bool delete_file) {
@@ -582,10 +607,12 @@ void TestingProfile::BlockUntilHistoryIndexIsRefreshed() {
// TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
void TestingProfile::BlockUntilTopSitesLoaded() {
- content::WindowedNotificationObserver top_sites_loaded_observer(
- chrome::NOTIFICATION_TOP_SITES_LOADED,
- content::NotificationService::AllSources());
- top_sites_loaded_observer.Wait();
+ scoped_refptr<content::MessageLoopRunner> runner =
+ new content::MessageLoopRunner;
+ WaitTopSitesLoadedObserver observer(runner.get());
+ top_sites_->AddObserver(&observer);
+ runner->Run();
+ top_sites_->RemoveObserver(&observer);
}
void TestingProfile::SetGuestSession(bool guest) {
@@ -601,8 +628,7 @@ scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() {
}
TestingPrefServiceSyncable* TestingProfile::GetTestingPrefService() {
- if (!prefs_.get())
- CreateTestingPrefService();
+ DCHECK(prefs_);
DCHECK(testing_prefs_);
return testing_prefs_;
}
@@ -618,35 +644,26 @@ std::string TestingProfile::GetProfileName() {
Profile::ProfileType TestingProfile::GetProfileType() const {
if (guest_session_)
return GUEST_PROFILE;
- if (force_incognito_ || incognito_)
+ if (force_incognito_ || original_profile_)
return INCOGNITO_PROFILE;
return REGULAR_PROFILE;
}
bool TestingProfile::IsOffTheRecord() const {
- return force_incognito_ || incognito_;
+ return force_incognito_ || original_profile_;
}
void TestingProfile::SetOffTheRecordProfile(scoped_ptr<Profile> profile) {
DCHECK(!IsOffTheRecord());
+ DCHECK_EQ(this, profile->GetOriginalProfile());
incognito_profile_ = profile.Pass();
}
-void TestingProfile::SetOriginalProfile(Profile* profile) {
- DCHECK(IsOffTheRecord());
- original_profile_ = profile;
-}
-
Profile* TestingProfile::GetOffTheRecordProfile() {
if (IsOffTheRecord())
return this;
- if (!incognito_profile_) {
- TestingProfile::Builder builder;
- builder.SetIncognito();
- scoped_ptr<TestingProfile> incognito_test_profile(builder.Build());
- incognito_test_profile->SetOriginalProfile(this);
- SetOffTheRecordProfile(incognito_test_profile.PassAs<Profile>());
- }
+ if (!incognito_profile_)
+ TestingProfile::Builder().BuildIncognito(this);
return incognito_profile_.get();
}
@@ -697,6 +714,15 @@ void TestingProfile::CreateTestingPrefService() {
chrome::RegisterUserProfilePrefs(testing_prefs_->registry());
}
+void TestingProfile::CreateIncognitoPrefService() {
+ DCHECK(original_profile_);
+ DCHECK(!testing_prefs_);
+ // Simplified version of ProfileImpl::GetOffTheRecordPrefs(). Note this
+ // leaves testing_prefs_ unset.
+ prefs_.reset(original_profile_->prefs_->CreateIncognitoPrefService(NULL));
+ user_prefs::UserPrefs::Set(this, prefs_.get());
+}
+
void TestingProfile::CreateProfilePolicyConnector() {
#if defined(ENABLE_CONFIGURATION_POLICY)
schema_registry_service_ =
@@ -723,9 +749,7 @@ if (!policy_service_) {
}
PrefService* TestingProfile::GetPrefs() {
- if (!prefs_.get()) {
- CreateTestingPrefService();
- }
+ DCHECK(prefs_);
return prefs_.get();
}
@@ -811,8 +835,10 @@ HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() {
#if defined(ENABLE_EXTENSIONS)
ExtensionService* extension_service =
extensions::ExtensionSystem::Get(this)->extension_service();
- if (extension_service)
- host_content_settings_map_->RegisterExtensionService(extension_service);
+ if (extension_service) {
+ extension_service->RegisterContentSettings(
+ host_content_settings_map_.get());
+ }
#endif
}
return host_content_settings_map_.get();
@@ -921,7 +947,6 @@ Profile::ExitType TestingProfile::GetLastSessionExitType() {
TestingProfile::Builder::Builder()
: build_called_(false),
delegate_(NULL),
- incognito_(false),
guest_session_(false) {
}
@@ -948,10 +973,6 @@ void TestingProfile::Builder::SetPrefService(
pref_service_ = prefs.Pass();
}
-void TestingProfile::Builder::SetIncognito() {
- incognito_ = true;
-}
-
void TestingProfile::Builder::SetGuestSession() {
guest_session_ = true;
}
@@ -976,16 +997,35 @@ scoped_ptr<TestingProfile> TestingProfile::Builder::Build() {
DCHECK(!build_called_);
build_called_ = true;
- return scoped_ptr<TestingProfile>(new TestingProfile(
- path_,
- delegate_,
+ return scoped_ptr<TestingProfile>(new TestingProfile(path_,
+ delegate_,
+#if defined(ENABLE_EXTENSIONS)
+ extension_policy_,
+#endif
+ pref_service_.Pass(),
+ NULL,
+ guest_session_,
+ supervised_user_id_,
+ policy_service_.Pass(),
+ testing_factories_));
+}
+
+TestingProfile* TestingProfile::Builder::BuildIncognito(
+ TestingProfile* original_profile) {
+ DCHECK(!build_called_);
+ DCHECK(original_profile);
+ build_called_ = true;
+
+ // Note: Owned by |original_profile|.
+ return new TestingProfile(path_,
+ delegate_,
#if defined(ENABLE_EXTENSIONS)
- extension_policy_,
+ extension_policy_,
#endif
- pref_service_.Pass(),
- incognito_,
- guest_session_,
- supervised_user_id_,
- policy_service_.Pass(),
- testing_factories_));
+ pref_service_.Pass(),
+ original_profile,
+ guest_session_,
+ supervised_user_id_,
+ policy_service_.Pass(),
+ testing_factories_);
}
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index bf55546ce9..6c60f0660d 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -97,9 +97,6 @@ class TestingProfile : public Profile {
// Sets the PrefService to be used by this profile.
void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs);
- // Makes the Profile being built an incognito profile.
- void SetIncognito();
-
// Makes the Profile being built a guest profile.
void SetGuestSession();
@@ -113,6 +110,11 @@ class TestingProfile : public Profile {
// Creates the TestingProfile using previously-set settings.
scoped_ptr<TestingProfile> Build();
+ // Build an incognito profile, owned by |original_profile|. Note: unless you
+ // need to customize the Builder, or access TestingProfile member functions,
+ // you can use original_profile->GetOffTheRecordProfile().
+ TestingProfile* BuildIncognito(TestingProfile* original_profile);
+
private:
// If true, Build() has already been called.
bool build_called_;
@@ -124,7 +126,6 @@ class TestingProfile : public Profile {
#endif
base::FilePath path_;
Delegate* delegate_;
- bool incognito_;
bool guest_session_;
std::string supervised_user_id_;
scoped_ptr<policy::PolicyService> policy_service_;
@@ -154,7 +155,7 @@ class TestingProfile : public Profile {
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
#endif
scoped_ptr<PrefServiceSyncable> prefs,
- bool incognito,
+ TestingProfile* parent,
bool guest_session,
const std::string& supervised_user_id,
scoped_ptr<policy::PolicyService> policy_service,
@@ -209,6 +210,11 @@ class TestingProfile : public Profile {
TestingPrefServiceSyncable* GetTestingPrefService();
+ // Called on the parent of an incognito |profile|. Usually called from the
+ // constructor of an incognito TestingProfile, but can also be used by tests
+ // to provide an OffTheRecordProfileImpl instance.
+ void SetOffTheRecordProfile(scoped_ptr<Profile> profile);
+
// content::BrowserContext
virtual base::FilePath GetPath() const OVERRIDE;
virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE;
@@ -250,8 +256,6 @@ class TestingProfile : public Profile {
force_incognito_ = force_incognito;
}
- virtual void SetOffTheRecordProfile(scoped_ptr<Profile> profile);
- virtual void SetOriginalProfile(Profile* profile);
virtual Profile* GetOffTheRecordProfile() OVERRIDE;
virtual void DestroyOffTheRecordProfile() OVERRIDE {}
virtual bool HasOffTheRecordProfile() OVERRIDE;
@@ -349,6 +353,10 @@ class TestingProfile : public Profile {
// Creates a TestingPrefService and associates it with the TestingProfile.
void CreateTestingPrefService();
+ // Initializes |prefs_| for an incognito profile, derived from
+ // |original_profile_|.
+ void CreateIncognitoPrefService();
+
// Creates a ProfilePolicyConnector that the ProfilePolicyConnectorFactory
// maps to this profile.
void CreateProfilePolicyConnector();
@@ -357,10 +365,9 @@ class TestingProfile : public Profile {
// request context. Currently, only the CookieMonster is hooked up.
scoped_refptr<net::URLRequestContextGetter> extensions_request_context_;
- bool incognito_;
bool force_incognito_;
scoped_ptr<Profile> incognito_profile_;
- Profile* original_profile_;
+ TestingProfile* original_profile_;
bool guest_session_;
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc
index dd41700b32..2d49f6db36 100644
--- a/chrome/test/base/testing_profile_manager.cc
+++ b/chrome/test/base/testing_profile_manager.cc
@@ -10,9 +10,14 @@
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/test/base/testing_browser_process.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#endif
+
const std::string kGuestProfileName = "Guest";
namespace testing {
@@ -60,7 +65,18 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
// Create a path for the profile based on the name.
base::FilePath profile_path(profiles_dir_.path());
+#if defined(OS_CHROMEOS)
+ if (profile_name != chrome::kInitialProfile) {
+ profile_path =
+ profile_path.Append(chromeos::ProfileHelper::Get()->GetUserProfileDir(
+ chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting(
+ profile_name)));
+ } else {
+ profile_path = profile_path.AppendASCII(profile_name);
+ }
+#else
profile_path = profile_path.AppendASCII(profile_name);
+#endif
// Create the profile and register it.
TestingProfile::Builder builder;
@@ -102,11 +118,6 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
TestingProfile* TestingProfileManager::CreateGuestProfile() {
DCHECK(called_set_up_);
- // Set up a profile with an off the record profile.
- TestingProfile::Builder otr_builder;
- otr_builder.SetIncognito();
- scoped_ptr<TestingProfile> otr_profile(otr_builder.Build());
-
// Create the profile and register it.
TestingProfile::Builder builder;
builder.SetGuestSession();
@@ -116,8 +127,9 @@ TestingProfile* TestingProfileManager::CreateGuestProfile() {
TestingProfile* profile = builder.Build().release();
profile->set_profile_name(kGuestProfileName);
- otr_profile->SetOriginalProfile(profile);
- profile->SetOffTheRecordProfile(otr_profile.PassAs<Profile>());
+ // Set up a profile with an off the record profile.
+ TestingProfile::Builder().BuildIncognito(profile);
+
profile_manager_->AddProfile(profile); // Takes ownership.
profile_manager_->SetGuestProfilePrefs(profile);
diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc
index 03a53f1e1d..53af5af9eb 100644
--- a/chrome/test/base/tracing.cc
+++ b/chrome/test/base/tracing.cc
@@ -5,8 +5,8 @@
#include "chrome/test/base/tracing.h"
#include "base/debug/trace_event.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/memory/singleton.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
@@ -19,6 +19,30 @@ namespace {
using content::BrowserThread;
+class StringTraceSink : public content::TracingController::TraceDataSink {
+ public:
+ StringTraceSink(std::string* result, const base::Closure& callback)
+ : result_(result), completion_callback_(callback) {}
+
+ virtual void AddTraceChunk(const std::string& chunk) OVERRIDE {
+ *result_ += result_->empty() ? "[" : ",";
+ *result_ += chunk;
+ }
+ virtual void Close() OVERRIDE {
+ if (!result_->empty())
+ *result_ += "]";
+ completion_callback_.Run();
+ }
+
+ private:
+ virtual ~StringTraceSink() {}
+
+ std::string* result_;
+ base::Closure completion_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(StringTraceSink);
+};
+
class InProcessTraceController {
public:
static InProcessTraceController* GetInstance() {
@@ -87,12 +111,12 @@ class InProcessTraceController {
using namespace base::debug;
if (!content::TracingController::GetInstance()->DisableRecording(
- base::FilePath(),
- base::Bind(&InProcessTraceController::OnTraceDataCollected,
- base::Unretained(this),
- base::Unretained(json_trace_output))))
+ new StringTraceSink(
+ json_trace_output,
+ base::Bind(&InProcessTraceController::OnTracingComplete,
+ base::Unretained(this))))) {
return false;
-
+ }
// Wait for OnEndTracingComplete() to quit the message loop.
message_loop_runner_ = new content::MessageLoopRunner;
message_loop_runner_->Run();
@@ -110,38 +134,7 @@ class InProcessTraceController {
message_loop_runner_->Quit();
}
- void OnEndTracingComplete() {
- message_loop_runner_->Quit();
- }
-
- void OnTraceDataCollected(std::string* json_trace_output,
- const base::FilePath& path) {
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- base::Bind(&InProcessTraceController::ReadTraceData,
- base::Unretained(this),
- base::Unretained(json_trace_output),
- path));
- }
-
- void ReadTraceData(std::string* json_trace_output,
- const base::FilePath& path) {
- json_trace_output->clear();
- bool ok = base::ReadFileToString(path, json_trace_output);
- DCHECK(ok);
- base::DeleteFile(path, false);
-
- // The callers expect an array of trace events.
- const char* preamble = "{\"traceEvents\": ";
- const char* trailout = "}";
- DCHECK(StartsWithASCII(*json_trace_output, preamble, true));
- DCHECK(EndsWith(*json_trace_output, trailout, true));
- json_trace_output->erase(0, strlen(preamble));
- json_trace_output->erase(json_trace_output->end() - 1);
-
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&InProcessTraceController::OnEndTracingComplete,
- base::Unretained(this)));
- }
+ void OnTracingComplete() { message_loop_runner_->Quit(); }
void OnWatchEventMatched() {
if (watch_notification_count_ == 0)
diff --git a/chrome/test/base/tracing_browsertest.cc b/chrome/test/base/tracing_browsertest.cc
index 5a6b6f4152..b0b7c10be8 100644
--- a/chrome/test/base/tracing_browsertest.cc
+++ b/chrome/test/base/tracing_browsertest.cc
@@ -28,8 +28,8 @@ const char* g_event = "TheEvent";
class TracingBrowserTest : public InProcessBrowserTest {
protected:
// Execute some no-op javascript on the current tab - this triggers a trace
- // event in RenderFrameImpl::OnJavaScriptExecuteRequest (from the renderer
- // process).
+ // event in RenderFrameImpl::OnJavaScriptExecuteRequestForTests (from the
+ // renderer process).
void ExecuteJavascriptOnCurrentTab() {
content::RenderViewHost* rvh = browser()->tab_strip_model()->
GetActiveWebContents()->GetRenderViewHost();
@@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) {
// Child process events from same process.
ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category,
- "OnJavaScriptExecuteRequest", 2));
+ "OnJavaScriptExecuteRequestForTests", 2));
ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
EXPECT_TRUE(WaitForWatchEvent(no_timeout));
@@ -90,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) {
GURL url1("chrome://tracing/");
GURL url2("chrome://credits/");
ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category,
- "OnJavaScriptExecuteRequest", 2));
+ "OnJavaScriptExecuteRequestForTests", 2));
// Open two tabs to different URLs to encourage two separate renderer
// processes. Each will fire an event that will be counted towards the total.
ui_test_utils::NavigateToURLWithDisposition(browser(), url1,
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 978835bd99..b295a00e5a 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -12,8 +12,8 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -169,7 +169,7 @@ void NavigateToURL(chrome::NavigateParams* params) {
void NavigateToURLWithPost(Browser* browser, const GURL& url) {
chrome::NavigateParams params(browser, url,
- content::PAGE_TRANSITION_FORM_SUBMIT);
+ ui::PAGE_TRANSITION_FORM_SUBMIT);
params.uses_post = true;
NavigateToURL(&params);
}
@@ -205,7 +205,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
content::NotificationService::AllSources());
browser->OpenURL(OpenURLParams(
- url, Referrer(), disposition, content::PAGE_TRANSITION_TYPED, false));
+ url, Referrer(), disposition, ui::PAGE_TRANSITION_TYPED, false));
if (browser_test_flags & BROWSER_TEST_WAIT_FOR_BROWSER)
browser = WaitForBrowserNotInSet(initial_browsers);
if (browser_test_flags & BROWSER_TEST_WAIT_FOR_TAB)
diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc
index 6cad93dae8..3793c562b9 100644
--- a/chrome/test/base/v8_unit_test.cc
+++ b/chrome/test/base/v8_unit_test.cc
@@ -4,12 +4,13 @@
#include "chrome/test/base/v8_unit_test.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/chrome_paths.h"
+#include "third_party/WebKit/public/web/WebKit.h"
namespace {
@@ -45,7 +46,7 @@ base::FilePath gen_test_data_directory;
} // namespace
-V8UnitTest::V8UnitTest() : handle_scope_(isolate_scope_.isolate()) {
+V8UnitTest::V8UnitTest() : handle_scope_(blink::mainThreadIsolate()) {
InitPathsAndLibraries();
}
@@ -90,13 +91,14 @@ bool V8UnitTest::RunJavascriptTestF(const std::string& testFixture,
if (!ExecuteJavascriptLibraries())
return false;
- v8::HandleScope handle_scope(isolate());
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate(), context_);
+ v8::Local<v8::Context>::New(isolate, context_);
v8::Context::Scope context_scope(context);
v8::Handle<v8::Value> functionProperty =
- context->Global()->Get(v8::String::NewFromUtf8(isolate(), "runTest"));
+ context->Global()->Get(v8::String::NewFromUtf8(isolate, "runTest"));
EXPECT_FALSE(functionProperty.IsEmpty());
if (::testing::Test::HasNonfatalFailure())
return false;
@@ -106,20 +108,20 @@ bool V8UnitTest::RunJavascriptTestF(const std::string& testFixture,
v8::Handle<v8::Function> function =
v8::Handle<v8::Function>::Cast(functionProperty);
- v8::Local<v8::Array> params = v8::Array::New(isolate());
+ v8::Local<v8::Array> params = v8::Array::New(isolate);
params->Set(0,
- v8::String::NewFromUtf8(isolate(),
+ v8::String::NewFromUtf8(isolate,
testFixture.data(),
v8::String::kNormalString,
testFixture.size()));
params->Set(1,
- v8::String::NewFromUtf8(isolate(),
+ v8::String::NewFromUtf8(isolate,
testName.data(),
v8::String::kNormalString,
testName.size()));
v8::Handle<v8::Value> args[] = {
- v8::Boolean::New(isolate(), false),
- v8::String::NewFromUtf8(isolate(), "RUN_TEST_F"), params};
+ v8::Boolean::New(isolate, false),
+ v8::String::NewFromUtf8(isolate, "RUN_TEST_F"), params};
v8::TryCatch try_catch;
v8::Handle<v8::Value> result = function->Call(context->Global(), 3, args);
@@ -162,57 +164,60 @@ void V8UnitTest::InitPathsAndLibraries() {
}
void V8UnitTest::SetUp() {
- v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate());
- v8::Handle<v8::String> logString = v8::String::NewFromUtf8(isolate(), "log");
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
+ v8::Handle<v8::String> logString = v8::String::NewFromUtf8(isolate, "log");
v8::Handle<v8::FunctionTemplate> logFunction =
- v8::FunctionTemplate::New(isolate(), &V8UnitTest::Log);
+ v8::FunctionTemplate::New(isolate, &V8UnitTest::Log);
global->Set(logString, logFunction);
// Set up chrome object for chrome.send().
- v8::Handle<v8::ObjectTemplate> chrome = v8::ObjectTemplate::New(isolate());
- global->Set(v8::String::NewFromUtf8(isolate(), "chrome"), chrome);
- chrome->Set(v8::String::NewFromUtf8(isolate(), "send"),
- v8::FunctionTemplate::New(isolate(), &V8UnitTest::ChromeSend));
+ v8::Handle<v8::ObjectTemplate> chrome = v8::ObjectTemplate::New(isolate);
+ global->Set(v8::String::NewFromUtf8(isolate, "chrome"), chrome);
+ chrome->Set(v8::String::NewFromUtf8(isolate, "send"),
+ v8::FunctionTemplate::New(isolate, &V8UnitTest::ChromeSend));
// Set up console object for console.log(), etc.
- v8::Handle<v8::ObjectTemplate> console = v8::ObjectTemplate::New(isolate());
- global->Set(v8::String::NewFromUtf8(isolate(), "console"), console);
+ v8::Handle<v8::ObjectTemplate> console = v8::ObjectTemplate::New(isolate);
+ global->Set(v8::String::NewFromUtf8(isolate, "console"), console);
console->Set(logString, logFunction);
- console->Set(v8::String::NewFromUtf8(isolate(), "info"), logFunction);
- console->Set(v8::String::NewFromUtf8(isolate(), "warn"), logFunction);
- console->Set(v8::String::NewFromUtf8(isolate(), "error"),
- v8::FunctionTemplate::New(isolate(), &V8UnitTest::Error));
+ console->Set(v8::String::NewFromUtf8(isolate, "info"), logFunction);
+ console->Set(v8::String::NewFromUtf8(isolate, "warn"), logFunction);
+ console->Set(v8::String::NewFromUtf8(isolate, "error"),
+ v8::FunctionTemplate::New(isolate, &V8UnitTest::Error));
- context_.Reset(isolate(), v8::Context::New(isolate(), NULL, global));
+ context_.Reset(isolate, v8::Context::New(isolate, NULL, global));
}
void V8UnitTest::SetGlobalStringVar(const std::string& var_name,
const std::string& value) {
+ v8::Isolate* isolate = blink::mainThreadIsolate();
v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate(), context_);
+ v8::Local<v8::Context>::New(isolate, context_);
v8::Context::Scope context_scope(context);
context->Global()->Set(
- v8::String::NewFromUtf8(isolate(),
+ v8::String::NewFromUtf8(isolate,
var_name.c_str(),
v8::String::kNormalString,
var_name.length()),
v8::String::NewFromUtf8(
- isolate(), value.c_str(), v8::String::kNormalString, value.length()));
+ isolate, value.c_str(), v8::String::kNormalString, value.length()));
}
void V8UnitTest::ExecuteScriptInContext(const base::StringPiece& script_source,
const base::StringPiece& script_name) {
- v8::HandleScope handle_scope(isolate());
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate(), context_);
+ v8::Local<v8::Context>::New(isolate, context_);
v8::Context::Scope context_scope(context);
v8::Handle<v8::String> source =
- v8::String::NewFromUtf8(isolate(),
+ v8::String::NewFromUtf8(isolate,
script_source.data(),
v8::String::kNormalString,
script_source.size());
v8::Handle<v8::String> name =
- v8::String::NewFromUtf8(isolate(),
+ v8::String::NewFromUtf8(isolate,
script_name.data(),
v8::String::kNormalString,
script_name.size());
@@ -249,13 +254,14 @@ std::string V8UnitTest::ExceptionToString(const v8::TryCatch& try_catch) {
}
void V8UnitTest::TestFunction(const std::string& function_name) {
- v8::HandleScope handle_scope(isolate());
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate(), context_);
+ v8::Local<v8::Context>::New(isolate, context_);
v8::Context::Scope context_scope(context);
v8::Handle<v8::Value> functionProperty = context->Global()->Get(
- v8::String::NewFromUtf8(isolate(), function_name.c_str()));
+ v8::String::NewFromUtf8(isolate, function_name.c_str()));
ASSERT_FALSE(functionProperty.IsEmpty());
ASSERT_TRUE(functionProperty->IsFunction());
v8::Handle<v8::Function> function =
diff --git a/chrome/test/base/v8_unit_test.h b/chrome/test/base/v8_unit_test.h
index 4b056d3c4d..b12238f007 100644
--- a/chrome/test/base/v8_unit_test.h
+++ b/chrome/test/base/v8_unit_test.h
@@ -68,36 +68,12 @@ class V8UnitTest : public testing::Test {
static void ChromeSend(const v8::FunctionCallbackInfo<v8::Value>& args);
private:
- // A helper class to ensure that the lifetimes of the Isolate and the
- // HandleScope are correctly nested.
- class IsolateScope {
- public:
- IsolateScope() : isolate_(v8::Isolate::New()) { isolate_->Enter(); }
-
- ~IsolateScope() {
- isolate_->Exit();
- isolate_->Dispose();
- }
-
- v8::Isolate* isolate() const { return isolate_; }
-
- private:
- v8::Isolate* isolate_;
-
- DISALLOW_COPY_AND_ASSIGN(IsolateScope);
- };
-
- // A handy shortcut.
- v8::Isolate* isolate() const { return isolate_scope_.isolate(); }
-
// Executes all added javascript libraries. Returns true if no errors.
bool ExecuteJavascriptLibraries();
// Initializes paths and libraries.
void InitPathsAndLibraries();
- IsolateScope isolate_scope_;
-
// Handle scope that is used throughout the life of this class.
v8::HandleScope handle_scope_;
diff --git a/chrome/test/base/view_event_test_platform_part_chromeos.cc b/chrome/test/base/view_event_test_platform_part_chromeos.cc
index 9e5e6102f7..007300f1f9 100644
--- a/chrome/test/base/view_event_test_platform_part_chromeos.cc
+++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc
@@ -41,7 +41,7 @@ ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS(
// Ash Shell can't just live on its own without a browser process, we need to
// also create the message center.
message_center::MessageCenter::Initialize();
- chromeos::DBusThreadManager::InitializeWithStub();
+ chromeos::DBusThreadManager::Initialize();
chromeos::CrasAudioHandler::InitializeForTesting();
chromeos::NetworkHandler::Initialize();
ash::test::TestShellDelegate* shell_delegate =
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc
index cf9a2aa645..997c14aefb 100644
--- a/chrome/test/base/web_ui_browser_test.cc
+++ b/chrome/test/base/web_ui_browser_test.cc
@@ -214,7 +214,7 @@ void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) {
web_contents, this, preload_test_fixture_, preload_test_name_);
content::TestNavigationObserver navigation_observer(web_contents);
chrome::NavigateParams params(
- browser(), GURL(browse_to), content::PAGE_TRANSITION_TYPED);
+ browser(), GURL(browse_to), ui::PAGE_TRANSITION_TYPED);
params.disposition = CURRENT_TAB;
chrome::Navigate(&params);
navigation_observer.Wait();
diff --git a/chrome/test/chromedriver/archive.py b/chrome/test/chromedriver/archive.py
index c9e95fb367..2663f62700 100644
--- a/chrome/test/chromedriver/archive.py
+++ b/chrome/test/chromedriver/archive.py
@@ -10,9 +10,9 @@ import urllib
import util
-CHROME_34_REVISION = '251854'
CHROME_35_REVISION = '260135'
CHROME_36_REVISION = '269696'
+CHROME_37_REVISION = '278933'
_SITE = 'http://commondatastorage.googleapis.com'
diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc
index 19ccd76bd7..9e403af735 100644
--- a/chrome/test/chromedriver/capabilities.cc
+++ b/chrome/test/chromedriver/capabilities.cc
@@ -389,6 +389,7 @@ Status ParseChromeOptions(
parser_map["androidUseRunningApp"] =
base::Bind(&ParseBoolean, &capabilities->android_use_running_app);
parser_map["args"] = base::Bind(&ParseSwitches);
+ parser_map["excludeSwitches"] = base::Bind(&ParseExcludeSwitches);
parser_map["loadAsync"] = base::Bind(&IgnoreDeprecatedOption, "loadAsync");
} else if (is_remote) {
parser_map["debuggerAddress"] = base::Bind(&ParseUseRemoteBrowser);
@@ -396,7 +397,6 @@ Status ParseChromeOptions(
parser_map["args"] = base::Bind(&ParseSwitches);
parser_map["binary"] = base::Bind(&ParseFilePath, &capabilities->binary);
parser_map["detach"] = base::Bind(&ParseBoolean, &capabilities->detach);
- parser_map["mobileEmulation"] = base::Bind(&ParseMobileEmulation);
parser_map["excludeSwitches"] = base::Bind(&ParseExcludeSwitches);
parser_map["extensions"] = base::Bind(&ParseExtensions);
parser_map["forceDevToolsScreenshot"] = base::Bind(
@@ -407,6 +407,7 @@ Status ParseChromeOptions(
parser_map["logPath"] = base::Bind(&ParseLogPath);
parser_map["minidumpPath"] =
base::Bind(&ParseString, &capabilities->minidump_path);
+ parser_map["mobileEmulation"] = base::Bind(&ParseMobileEmulation);
parser_map["prefs"] = base::Bind(&ParseDict, &capabilities->prefs);
}
diff --git a/chrome/test/chromedriver/chrome/chrome_finder.cc b/chrome/test/chromedriver/chrome/chrome_finder.cc
index 2cb69c1225..dcc5172ff5 100644
--- a/chrome/test/chromedriver/chrome/chrome_finder.cc
+++ b/chrome/test/chromedriver/chrome/chrome_finder.cc
@@ -10,8 +10,8 @@
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/callback.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/path_service.h"
#include "build/build_config.h"
diff --git a/chrome/test/chromedriver/chrome/device_metrics.cc b/chrome/test/chromedriver/chrome/device_metrics.cc
index 70b9592405..6cb8e236a4 100644
--- a/chrome/test/chromedriver/chrome/device_metrics.cc
+++ b/chrome/test/chromedriver/chrome/device_metrics.cc
@@ -9,7 +9,7 @@ DeviceMetrics::DeviceMetrics(int width, int height, double device_scale_factor)
height(height),
device_scale_factor(device_scale_factor),
mobile(false),
- fit_window(true),
+ fit_window(false),
text_autosizing(true),
font_scale_factor(1) {}
diff --git a/chrome/test/chromedriver/chrome/version.cc b/chrome/test/chromedriver/chrome/version.cc
index 51bebafddf..6caa660f64 100644
--- a/chrome/test/chromedriver/chrome/version.cc
+++ b/chrome/test/chromedriver/chrome/version.cc
@@ -9,7 +9,7 @@
namespace {
// This variable must be able to be found and parsed by the upload script.
-const int kMinimumSupportedChromeVersion[] = {34, 0, 1847, 0};
+const int kMinimumSupportedChromeVersion[] = {35, 0, 1916, 0};
} // namespace
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc
index d54377aab7..21595b0c8b 100644
--- a/chrome/test/chromedriver/chrome_launcher.cc
+++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -11,8 +11,8 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/format_macros.h"
#include "base/json/json_reader.h"
diff --git a/chrome/test/chromedriver/chrome_launcher_unittest.cc b/chrome/test/chromedriver/chrome_launcher_unittest.cc
index e5937e7033..4e2c4dffbf 100644
--- a/chrome/test/chromedriver/chrome_launcher_unittest.cc
+++ b/chrome/test/chromedriver/chrome_launcher_unittest.cc
@@ -5,8 +5,8 @@
#include "base/base64.h"
#include "base/base_paths.h"
#include "base/command_line.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_reader.h"
#include "base/memory/scoped_ptr.h"
diff --git a/chrome/test/chromedriver/js/get_element_region.js b/chrome/test/chromedriver/js/get_element_region.js
index 19cf11c8a8..0ca871891a 100644
--- a/chrome/test/chromedriver/js/get_element_region.js
+++ b/chrome/test/chromedriver/js/get_element_region.js
@@ -11,7 +11,11 @@ function getElementRegion(element) {
// and then the bounding client rect.
// SVG is one case that doesn't have a first client rect.
var clientRects = element.getClientRects();
- if (clientRects.length == 0) {
+
+ // Element area of a map has same first ClientRect and BoundingClientRect
+ // after blink roll at chromium commit position 290738 which includes blink
+ // revision 180610. Thus handle area as a special case.
+ if (clientRects.length == 0 || element.tagName.toLowerCase() == 'area') {
var box = element.getBoundingClientRect();
if (element.tagName.toLowerCase() == 'area') {
var coords = element.coords.split(',');
diff --git a/chrome/test/chromedriver/net/net_util_unittest.cc b/chrome/test/chromedriver/net/net_util_unittest.cc
index e4d8b14db1..801620df7b 100644
--- a/chrome/test/chromedriver/net/net_util_unittest.cc
+++ b/chrome/test/chromedriver/net/net_util_unittest.cc
@@ -20,7 +20,7 @@
#include "net/base/net_errors.h"
#include "net/server/http_server.h"
#include "net/server/http_server_request_info.h"
-#include "net/socket/tcp_listen_socket.h"
+#include "net/socket/tcp_server_socket.h"
#include "net/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -54,8 +54,10 @@ class FetchUrlTest : public testing::Test,
}
void InitOnIO(base::WaitableEvent* event) {
- net::TCPListenSocketFactory factory("127.0.0.1", 0);
- server_ = new net::HttpServer(factory, this);
+ scoped_ptr<net::ServerSocket> server_socket(
+ new net::TCPServerSocket(NULL, net::NetLog::Source()));
+ server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1);
+ server_.reset(new net::HttpServer(server_socket.Pass(), this));
net::IPEndPoint address;
CHECK_EQ(net::OK, server_->GetLocalAddress(&address));
server_url_ = base::StringPrintf("http://127.0.0.1:%d", address.port());
@@ -63,11 +65,13 @@ class FetchUrlTest : public testing::Test,
}
void DestroyServerOnIO(base::WaitableEvent* event) {
- server_ = NULL;
+ server_.reset(NULL);
event->Signal();
}
// Overridden from net::HttpServer::Delegate:
+ virtual void OnConnect(int connection_id) OVERRIDE {}
+
virtual void OnHttpRequest(int connection_id,
const net::HttpServerRequestInfo& info) OVERRIDE {
switch (response_) {
@@ -78,10 +82,7 @@ class FetchUrlTest : public testing::Test,
server_->Send404(connection_id);
break;
case kClose:
- // net::HttpServer doesn't allow us to close connection during callback.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&net::HttpServer::Close, server_, connection_id));
+ server_->Close(connection_id);
break;
default:
break;
@@ -104,7 +105,7 @@ class FetchUrlTest : public testing::Test,
base::Thread io_thread_;
ServerResponse response_;
- scoped_refptr<net::HttpServer> server_;
+ scoped_ptr<net::HttpServer> server_;
scoped_refptr<URLRequestContextGetter> context_getter_;
std::string server_url_;
};
diff --git a/chrome/test/chromedriver/net/test_http_server.cc b/chrome/test/chromedriver/net/test_http_server.cc
index 740a33d78e..6b8a4bcf4c 100644
--- a/chrome/test/chromedriver/net/test_http_server.cc
+++ b/chrome/test/chromedriver/net/test_http_server.cc
@@ -13,9 +13,11 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/server/http_server_request_info.h"
-#include "net/socket/tcp_listen_socket.h"
+#include "net/socket/tcp_server_socket.h"
#include "testing/gtest/include/gtest/gtest.h"
+const int kBufferSize = 100 * 1024 * 1024; // 100 MB
+
TestHttpServer::TestHttpServer()
: thread_("ServerThread"),
all_closed_event_(false, true),
@@ -73,6 +75,11 @@ GURL TestHttpServer::web_socket_url() const {
return web_socket_url_;
}
+void TestHttpServer::OnConnect(int connection_id) {
+ server_->SetSendBufferSize(connection_id, kBufferSize);
+ server_->SetReceiveBufferSize(connection_id, kBufferSize);
+}
+
void TestHttpServer::OnWebSocketRequest(
int connection_id,
const net::HttpServerRequestInfo& info) {
@@ -92,10 +99,7 @@ void TestHttpServer::OnWebSocketRequest(
server_->Send404(connection_id);
break;
case kClose:
- // net::HttpServer doesn't allow us to close connection during callback.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&net::HttpServer::Close, server_, connection_id));
+ server_->Close(connection_id);
break;
}
}
@@ -112,10 +116,7 @@ void TestHttpServer::OnWebSocketMessage(int connection_id,
server_->SendOverWebSocket(connection_id, data);
break;
case kCloseOnMessage:
- // net::HttpServer doesn't allow us to close connection during callback.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&net::HttpServer::Close, server_, connection_id));
+ server_->Close(connection_id);
break;
}
}
@@ -128,8 +129,10 @@ void TestHttpServer::OnClose(int connection_id) {
void TestHttpServer::StartOnServerThread(bool* success,
base::WaitableEvent* event) {
- net::TCPListenSocketFactory factory("127.0.0.1", 0);
- server_ = new net::HttpServer(factory, this);
+ scoped_ptr<net::ServerSocket> server_socket(
+ new net::TCPServerSocket(NULL, net::NetLog::Source()));
+ server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1);
+ server_.reset(new net::HttpServer(server_socket.Pass(), this));
net::IPEndPoint address;
int error = server_->GetLocalAddress(&address);
@@ -139,14 +142,13 @@ void TestHttpServer::StartOnServerThread(bool* success,
web_socket_url_ = GURL(base::StringPrintf("ws://127.0.0.1:%d",
address.port()));
} else {
- server_ = NULL;
+ server_.reset(NULL);
}
*success = server_.get();
event->Signal();
}
void TestHttpServer::StopOnServerThread(base::WaitableEvent* event) {
- if (server_.get())
- server_ = NULL;
+ server_.reset(NULL);
event->Signal();
}
diff --git a/chrome/test/chromedriver/net/test_http_server.h b/chrome/test/chromedriver/net/test_http_server.h
index 697434d2e4..70b26a5f7e 100644
--- a/chrome/test/chromedriver/net/test_http_server.h
+++ b/chrome/test/chromedriver/net/test_http_server.h
@@ -61,6 +61,7 @@ class TestHttpServer : public net::HttpServer::Delegate {
GURL web_socket_url() const;
// Overridden from net::HttpServer::Delegate:
+ virtual void OnConnect(int connection_id) OVERRIDE;
virtual void OnHttpRequest(int connection_id,
const net::HttpServerRequestInfo& info) OVERRIDE {}
virtual void OnWebSocketRequest(
@@ -77,7 +78,7 @@ class TestHttpServer : public net::HttpServer::Delegate {
base::Thread thread_;
// Access only on the server thread.
- scoped_refptr<net::HttpServer> server_;
+ scoped_ptr<net::HttpServer> server_;
// Access only on the server thread.
std::set<int> connections_;
diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py
index dd1a371471..3ce5bea5a5 100755
--- a/chrome/test/chromedriver/run_buildbot_steps.py
+++ b/chrome/test/chromedriver/run_buildbot_steps.py
@@ -31,10 +31,11 @@ GS_SERVER_LOGS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/server_logs'
SERVER_LOGS_LINK = (
'http://chromedriver-data.storage.googleapis.com/server_logs')
TEST_LOG_FORMAT = '%s_log.json'
-GS_GITHASH_TO_SVN_URL = (
+GS_GIT_LOG_URL = (
'https://chromium.googlesource.com/chromium/src/+/%s?format=json')
GS_SEARCH_PATTERN = (
- r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ')
+ r'Cr-Commit-Position: refs/heads/master@{#(\d+)}')
+CR_REV_URL = 'https://cr-rev.appspot.com/_ah/api/crrev/v1/redirect/%s'
SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, 'scripts')
@@ -384,12 +385,13 @@ def _CleanTmpDir():
os.remove(file_path)
-def _GetSVNRevisionFromGitHash(snapshot_hashcode):
- json_url = GS_GITHASH_TO_SVN_URL % snapshot_hashcode
+def _GetCommitPositionFromGitHash(snapshot_hashcode):
+ json_url = GS_GIT_LOG_URL % snapshot_hashcode
try:
response = urllib2.urlopen(json_url)
except urllib2.HTTPError as error:
util.PrintAndFlush('HTTP Error %d' % error.getcode())
+ return None
except urllib2.URLError as error:
util.PrintAndFlush('URL Error %s' % error.message)
return None
@@ -406,6 +408,23 @@ def _GetSVNRevisionFromGitHash(snapshot_hashcode):
return None
+def _GetGitHashFromCommitPosition(commit_position):
+ json_url = CR_REV_URL % commit_position
+ try:
+ response = urllib2.urlopen(json_url)
+ except urllib2.HTTPError as error:
+ util.PrintAndFlush('HTTP Error %d' % error.getcode())
+ return None
+ except urllib2.URLError as error:
+ util.PrintAndFlush('URL Error %s' % error.message)
+ return None
+ data = json.loads(response.read())
+ if 'git_sha' in data:
+ return data['git_sha']
+ util.PrintAndFlush('Failed to get git hash for %s' % commit_position)
+ return None
+
+
def _WaitForLatestSnapshot(revision):
util.MarkBuildStepStart('wait_for_snapshot')
def _IsRevisionNumber(revision):
@@ -415,10 +434,8 @@ def _WaitForLatestSnapshot(revision):
return revision.isdigit()
while True:
snapshot_revision = archive.GetLatestSnapshotVersion()
- if not _IsRevisionNumber(revision):
- revision = _GetSVNRevisionFromGitHash(revision)
if not _IsRevisionNumber(snapshot_revision):
- snapshot_revision = _GetSVNRevisionFromGitHash(snapshot_revision)
+ snapshot_revision = _GetCommitPositionFromGitHash(snapshot_revision)
if revision is not None and snapshot_revision is not None:
if int(snapshot_revision) >= int(revision):
break
@@ -464,7 +481,7 @@ def main():
help=('Comma separated list of application package names, '
'if running tests on Android.'))
parser.add_option(
- '-r', '--revision', type='int', help='Chromium revision')
+ '-r', '--revision', help='Chromium revision')
parser.add_option(
'', '--update-log', action='store_true',
help='Update the test results log (only applicable to Android)')
@@ -479,6 +496,13 @@ def main():
_CleanTmpDir()
+ if not options.revision:
+ commit_position = None
+ elif options.revision.isdigit():
+ commit_position = options.revision
+ else:
+ commit_position = _GetCommitPositionFromGitHash(options.revision)
+
if platform == 'android':
if not options.revision and options.update_log:
parser.error('Must supply a --revision with --update-log')
@@ -487,8 +511,8 @@ def main():
if not options.revision:
parser.error('Must supply a --revision')
if platform == 'linux64':
- _ArchivePrebuilts(options.revision)
- _WaitForLatestSnapshot(options.revision)
+ _ArchivePrebuilts(commit_position)
+ _WaitForLatestSnapshot(commit_position)
_AddToolsToPath(platform)
@@ -506,9 +530,9 @@ def main():
if platform == 'android':
if options.update_log:
util.MarkBuildStepStart('update test result log')
- _UpdateTestResultsLog(platform, options.revision, passed)
+ _UpdateTestResultsLog(platform, commit_position, passed)
elif passed:
- _ArchiveGoodBuild(platform, options.revision)
+ _ArchiveGoodBuild(platform, commit_position)
_MaybeRelease(platform)
if not passed:
diff --git a/chrome/test/chromedriver/server/chromedriver_server.cc b/chrome/test/chromedriver/server/chromedriver_server.cc
index e93091e622..97725407d0 100644
--- a/chrome/test/chromedriver/server/chromedriver_server.cc
+++ b/chrome/test/chromedriver/server/chromedriver_server.cc
@@ -33,11 +33,12 @@
#include "net/server/http_server.h"
#include "net/server/http_server_request_info.h"
#include "net/server/http_server_response_info.h"
-#include "net/socket/tcp_listen_socket.h"
+#include "net/socket/tcp_server_socket.h"
namespace {
const char* kLocalHostAddress = "127.0.0.1";
+const int kBufferSize = 100 * 1024 * 1024; // 100 MB
typedef base::Callback<
void(const net::HttpServerRequestInfo&, const HttpResponseSenderFunc&)>
@@ -55,13 +56,19 @@ class HttpServer : public net::HttpServer::Delegate {
std::string binding_ip = kLocalHostAddress;
if (allow_remote)
binding_ip = "0.0.0.0";
- server_ = new net::HttpServer(
- net::TCPListenSocketFactory(binding_ip, port), this);
+ scoped_ptr<net::ServerSocket> server_socket(
+ new net::TCPServerSocket(NULL, net::NetLog::Source()));
+ server_socket->ListenWithAddressAndPort(binding_ip, port, 1);
+ server_.reset(new net::HttpServer(server_socket.Pass(), this));
net::IPEndPoint address;
return server_->GetLocalAddress(&address) == net::OK;
}
// Overridden from net::HttpServer::Delegate:
+ virtual void OnConnect(int connection_id) OVERRIDE {
+ server_->SetSendBufferSize(connection_id, kBufferSize);
+ server_->SetReceiveBufferSize(connection_id, kBufferSize);
+ }
virtual void OnHttpRequest(int connection_id,
const net::HttpServerRequestInfo& info) OVERRIDE {
handle_request_func_.Run(
@@ -85,11 +92,12 @@ class HttpServer : public net::HttpServer::Delegate {
// the connection to close (e.g., python 2.7 urllib).
response->AddHeader("Connection", "close");
server_->SendResponse(connection_id, *response);
- server_->Close(connection_id);
+ // Don't need to call server_->Close(), since SendResponse() will handle
+ // this for us.
}
HttpRequestHandlerFunc handle_request_func_;
- scoped_refptr<net::HttpServer> server_;
+ scoped_ptr<net::HttpServer> server_;
base::WeakPtrFactory<HttpServer> weak_factory_; // Should be last.
};
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
index dcafba83ad..3eba1b2e09 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/logging.h" // For CHECK macros.
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop_proxy.h"
diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc
index e33439b9f1..d25d9ebc33 100644
--- a/chrome/test/chromedriver/session_commands_unittest.cc
+++ b/chrome/test/chromedriver/session_commands_unittest.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
diff --git a/chrome/test/chromedriver/test/run_all_tests.py b/chrome/test/chromedriver/test/run_all_tests.py
index 63eedd17ff..5c4c3ce473 100755
--- a/chrome/test/chromedriver/test/run_all_tests.py
+++ b/chrome/test/chromedriver/test/run_all_tests.py
@@ -191,9 +191,9 @@ def main():
latest_snapshot_revision = archive.GetLatestSnapshotVersion()
versions = [
['HEAD', latest_snapshot_revision],
+ ['37', archive.CHROME_37_REVISION],
['36', archive.CHROME_36_REVISION],
- ['35', archive.CHROME_35_REVISION],
- ['34', archive.CHROME_34_REVISION]
+ ['35', archive.CHROME_35_REVISION]
]
code = 0
for version in versions:
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py
index d8434411ca..1738f43426 100755
--- a/chrome/test/chromedriver/test/run_py_tests.py
+++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -715,6 +715,16 @@ class ChromeDriverTest(ChromeDriverBaseTest):
def testMobileEmulationDisabledByDefault(self):
self.assertFalse(self._driver.capabilities['mobileEmulationEnabled'])
+ def testChromeDriverSendLargeData(self):
+ script = 's = ""; for (i = 0; i < 10e6; i++) s += "0"; return s;'
+ lots_of_data = self._driver.ExecuteScript(script)
+ self.assertEquals('0'.zfill(int(10e6)), lots_of_data)
+
+ def testChromeDriverRecieveAndSendLargeData(self):
+ lots_of_data = '1'.zfill(int(10e6))
+ result = self._driver.ExecuteScript('return "%s"' % lots_of_data)
+ self.assertEquals(lots_of_data, result)
+
class ChromeDriverAndroidTest(ChromeDriverBaseTest):
"""End to end tests for Android-specific tests."""
@@ -871,6 +881,75 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest):
'5.19',
body_tag.GetText())
+ def testSendKeysToElement(self):
+ driver = self.CreateDriver(
+ mobile_emulation = {'deviceName': 'Google Nexus 5'})
+ text = driver.ExecuteScript(
+ 'document.body.innerHTML = \'<input type="text">\';'
+ 'var input = document.getElementsByTagName("input")[0];'
+ 'input.addEventListener("change", function() {'
+ ' document.body.appendChild(document.createElement("br"));'
+ '});'
+ 'return input;')
+ text.SendKeys('0123456789+-*/ Hi')
+ text.SendKeys(', there!')
+ value = driver.ExecuteScript('return arguments[0].value;', text)
+ self.assertEquals('0123456789+-*/ Hi, there!', value)
+
+ def testHoverOverElement(self):
+ driver = self.CreateDriver(
+ mobile_emulation = {'deviceName': 'Google Nexus 5'})
+ div = driver.ExecuteScript(
+ 'document.body.innerHTML = "<div>old</div>";'
+ 'var div = document.getElementsByTagName("div")[0];'
+ 'div.addEventListener("mouseover", function() {'
+ ' document.body.appendChild(document.createElement("br"));'
+ '});'
+ 'return div;')
+ div.HoverOver()
+ self.assertEquals(1, len(driver.FindElements('tag name', 'br')))
+
+ def testClickElement(self):
+ driver = self.CreateDriver(
+ mobile_emulation = {'deviceName': 'Google Nexus 5'})
+ div = driver.ExecuteScript(
+ 'document.body.innerHTML = "<div>old</div>";'
+ 'var div = document.getElementsByTagName("div")[0];'
+ 'div.addEventListener("click", function() {'
+ ' div.innerHTML="new<br>";'
+ '});'
+ 'return div;')
+ div.Click()
+ self.assertEquals(1, len(driver.FindElements('tag name', 'br')))
+
+ def testSingleTapElement(self):
+ driver = self.CreateDriver(
+ mobile_emulation = {'deviceName': 'Google Nexus 5'})
+ div = driver.ExecuteScript(
+ 'document.body.innerHTML = "<div>old</div>";'
+ 'var div = document.getElementsByTagName("div")[0];'
+ 'div.addEventListener("touchend", function() {'
+ ' div.innerHTML="new<br>";'
+ '});'
+ 'return div;')
+ div.SingleTap()
+ self.assertEquals(1, len(driver.FindElements('tag name', 'br')))
+
+ def testTouchDownUpElement(self):
+ driver = self.CreateDriver(
+ mobile_emulation = {'deviceName': 'Google Nexus 5'})
+ div = driver.ExecuteScript(
+ 'document.body.innerHTML = "<div>old</div>";'
+ 'var div = document.getElementsByTagName("div")[0];'
+ 'div.addEventListener("touchend", function() {'
+ ' div.innerHTML="new<br>";'
+ '});'
+ 'return div;')
+ loc = div.GetLocation()
+ driver.TouchDown(loc['x'], loc['y'])
+ driver.TouchUp(loc['x'], loc['y'])
+ self.assertEquals(1, len(driver.FindElements('tag name', 'br')))
+
class ChromeDriverLogTest(unittest.TestCase):
"""Tests that chromedriver produces the expected log file."""
diff --git a/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java b/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
index aa13b6d066..f1283da8b5 100644
--- a/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
+++ b/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
@@ -6,8 +6,6 @@ package org.chromium.chromedriver_webview_shell;
import android.app.Activity;
import android.content.Intent;
-import android.content.res.Configuration;
-import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
@@ -33,11 +31,13 @@ public class Main extends Activity {
final Activity activity = this;
mWebView.setWebChromeClient(new WebChromeClient() {
+ @Override
public void onProgressChanged(WebView view, int progress) {
activity.setProgress(progress * 100);
}
});
mWebView.setWebViewClient(new WebViewClient() {
+ @Override
public void onReceivedError(WebView view, int errorCode, String description,
String failingUrl) {
Toast.makeText(activity, "Error: " + description, Toast.LENGTH_SHORT).show();
diff --git a/chrome/test/chromedriver/util.cc b/chrome/test/chromedriver/util.cc
index 3c1ab86962..a4a9c5315d 100644
--- a/chrome/test/chromedriver/util.cc
+++ b/chrome/test/chromedriver/util.cc
@@ -5,8 +5,8 @@
#include "chrome/test/chromedriver/util.h"
#include "base/base64.h"
-#include "base/file_util.h"
#include "base/files/file_enumerator.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
diff --git a/chrome/test/chromedriver/util_unittest.cc b/chrome/test/chromedriver/util_unittest.cc
index 85e469e320..8ccb8d3c8c 100644
--- a/chrome/test/chromedriver/util_unittest.cc
+++ b/chrome/test/chromedriver/util_unittest.cc
@@ -5,8 +5,8 @@
#include <string>
#include "base/base64.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/util.h"
diff --git a/chrome/test/ext_auto/auto_provider/manifest.json b/chrome/test/ext_auto/auto_provider/manifest.json
index 6ecc2e2618..ede8acb8ce 100644
--- a/chrome/test/ext_auto/auto_provider/manifest.json
+++ b/chrome/test/ext_auto/auto_provider/manifest.json
@@ -32,7 +32,7 @@
"downloads",
"experimental",
"fileBrowserHandler",
- "fileBrowserPrivate",
+ "fileManagerPrivate",
"fileSystem",
"fileSystem.write",
"fontSettings",
diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc
index e9e1712c60..f906aca3bc 100644
--- a/chrome/test/gpu/webgl_infobar_browsertest.cc
+++ b/chrome/test/gpu/webgl_infobar_browsertest.cc
@@ -25,10 +25,10 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/common/content_paths.h"
-#include "content/public/common/page_transition_types.h"
#include "content/public/test/browser_test_utils.h"
#include "gpu/config/gpu_test_config.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/page_transition_types.h"
#include "ui/gl/gl_implementation.h"
namespace {
@@ -42,9 +42,9 @@ void SimulateGPUCrash(Browser* browser) {
chrome::NavigateParams params(
browser,
GURL(content::kChromeUIGpuCrashURL),
- static_cast<content::PageTransition>(
- content::PAGE_TRANSITION_TYPED |
- content::PAGE_TRANSITION_FROM_ADDRESS_BAR));
+ ui::PageTransitionFromInt(
+ ui::PAGE_TRANSITION_TYPED |
+ ui::PAGE_TRANSITION_FROM_ADDRESS_BAR));
params.disposition = NEW_BACKGROUND_TAB;
chrome::Navigate(&params);
}
diff --git a/chrome/test/logging/win/test_log_collector.cc b/chrome/test/logging/win/test_log_collector.cc
index 083c6b485a..4adfc875e0 100644
--- a/chrome/test/logging/win/test_log_collector.cc
+++ b/chrome/test/logging/win/test_log_collector.cc
@@ -11,8 +11,8 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
diff --git a/chrome/test/mini_installer/chrome_helper.py b/chrome/test/mini_installer/chrome_helper.py
index a9278355fb..1dcedbae23 100644
--- a/chrome/test/mini_installer/chrome_helper.py
+++ b/chrome/test/mini_installer/chrome_helper.py
@@ -4,32 +4,20 @@
"""Common helper module for working with Chrome's processes and windows."""
-import ctypes
-import pywintypes
+import psutil
import re
-import win32con
import win32gui
import win32process
def GetProcessIDAndPathPairs():
"""Returns a list of 2-tuples of (process id, process path).
-
- This is needed because psutil is not available on Windows slave machines (see:
- http://crbug.com/257696).
- TODO(sukolsak): Use psutil.process_iter() once it becomes available.
"""
process_id_and_path_pairs = []
- for process_id in win32process.EnumProcesses():
- process_handle = ctypes.windll.kernel32.OpenProcess(
- win32con.PROCESS_QUERY_INFORMATION | win32con.PROCESS_VM_READ, False,
- process_id)
- if not process_handle:
- continue
+ for process in psutil.process_iter():
try:
- process_path = win32process.GetModuleFileNameEx(process_handle, 0)
- process_id_and_path_pairs.append((process_id, process_path))
- except pywintypes.error:
+ process_id_and_path_pairs.append((process.pid, process.exe))
+ except psutil.Error:
# It's normal that some processes are not accessible.
pass
return process_id_and_path_pairs
diff --git a/chrome/test/mini_installer/config/chrome_system_installed.prop b/chrome/test/mini_installer/config/chrome_system_installed.prop
index ed6876dd6f..1a747f16b9 100644
--- a/chrome/test/mini_installer/config/chrome_system_installed.prop
+++ b/chrome/test/mini_installer/config/chrome_system_installed.prop
@@ -14,24 +14,24 @@
},
"RegistryEntries": {
"HKEY_LOCAL_MACHINE\\$CHROME_UPDATE_REGISTRY_SUBKEY": {
- "exists": true,
+ "exists": "required",
"values": {
"pv": {"type": "SZ", "data": "$MINI_INSTALLER_FILE_VERSION"}
}
},
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$CHROME_LONG_NAME": {
- "exists": true,
+ "exists": "required",
"values": {
"UninstallString": {
"type": "SZ",
- "data": "\"$PROGRAM_FILES\\$CHROME_DIR\\Application\\$MINI_INSTALLER_FILE_VERSION\\Installer\\setup.exe\" --uninstall --multi-install --chrome --system-level"
+ "data": "\"$PROGRAM_FILES\\$CHROME_DIR\\Application\\$MINI_INSTALLER_FILE_VERSION\\Installer\\setup.exe\" --uninstall --multi-install --chrome --system-level --verbose-logging"
},
"Version": {"type": "SZ", "data": "$MINI_INSTALLER_FILE_VERSION"}
}
},
"HKEY_LOCAL_MACHINE\\Software\\Classes\\$CHROME_SHORT_NAME": {
"condition": "$WINDOWS_VERSION >= $VERSION_WIN8",
- "exists": true
+ "exists": "required"
}
}
}
diff --git a/chrome/test/mini_installer/config/chrome_system_no_pv.prop b/chrome/test/mini_installer/config/chrome_system_no_pv.prop
new file mode 100644
index 0000000000..f7162f8279
--- /dev/null
+++ b/chrome/test/mini_installer/config/chrome_system_no_pv.prop
@@ -0,0 +1,10 @@
+{
+ "RegistryEntries": {
+ "HKEY_LOCAL_MACHINE\\$CHROME_UPDATE_REGISTRY_SUBKEY": {
+ "exists": "optional",
+ "values": {
+ "pv": {}
+ }
+ }
+ }
+}
diff --git a/chrome/test/mini_installer/config/chrome_system_not_installed.prop b/chrome/test/mini_installer/config/chrome_system_not_installed.prop
index f1e25e10c6..eaebe44916 100644
--- a/chrome/test/mini_installer/config/chrome_system_not_installed.prop
+++ b/chrome/test/mini_installer/config/chrome_system_not_installed.prop
@@ -3,11 +3,12 @@
"$PROGRAM_FILES\\$CHROME_DIR\\Application": {"exists": false}
},
"RegistryEntries": {
- "HKEY_LOCAL_MACHINE\\$CHROME_UPDATE_REGISTRY_SUBKEY": {"exists": false},
+ "HKEY_LOCAL_MACHINE\\$CHROME_UPDATE_REGISTRY_SUBKEY": {
+ "exists": "forbidden"},
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$CHROME_LONG_NAME":
- {"exists": false},
+ {"exists": "forbidden"},
"HKEY_LOCAL_MACHINE\\Software\\Classes\\$CHROME_SHORT_NAME": {
- "exists": false
+ "exists": "forbidden"
}
}
}
diff --git a/chrome/test/mini_installer/config/chrome_user_installed.prop b/chrome/test/mini_installer/config/chrome_user_installed.prop
index 78944b8348..3fdac9ffdc 100644
--- a/chrome/test/mini_installer/config/chrome_user_installed.prop
+++ b/chrome/test/mini_installer/config/chrome_user_installed.prop
@@ -14,24 +14,24 @@
},
"RegistryEntries": {
"HKEY_CURRENT_USER\\$CHROME_UPDATE_REGISTRY_SUBKEY": {
- "exists": true,
+ "exists": "required",
"values": {
"pv": {"type": "SZ", "data": "$MINI_INSTALLER_FILE_VERSION"}
}
},
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$CHROME_LONG_NAME": {
- "exists": true,
+ "exists": "required",
"values": {
"UninstallString": {
"type": "SZ",
- "data": "\"$LOCAL_APPDATA\\$CHROME_DIR\\Application\\$MINI_INSTALLER_FILE_VERSION\\Installer\\setup.exe\" --uninstall --multi-install --chrome"
+ "data": "\"$LOCAL_APPDATA\\$CHROME_DIR\\Application\\$MINI_INSTALLER_FILE_VERSION\\Installer\\setup.exe\" --uninstall --multi-install --chrome --verbose-logging"
},
"Version": {"type": "SZ", "data": "$MINI_INSTALLER_FILE_VERSION"}
}
},
"HKEY_CURRENT_USER\\Software\\Classes\\$CHROME_SHORT_NAME$USER_SPECIFIC_REGISTRY_SUFFIX": {
"condition": "$WINDOWS_VERSION >= $VERSION_WIN8",
- "exists": true
+ "exists": "required"
}
}
}
diff --git a/chrome/test/mini_installer/config/chrome_user_no_pv.prop b/chrome/test/mini_installer/config/chrome_user_no_pv.prop
new file mode 100644
index 0000000000..968b5e336f
--- /dev/null
+++ b/chrome/test/mini_installer/config/chrome_user_no_pv.prop
@@ -0,0 +1,10 @@
+{
+ "RegistryEntries": {
+ "HKEY_CURRENT_USER\\$CHROME_UPDATE_REGISTRY_SUBKEY": {
+ "exists": "optional",
+ "values": {
+ "pv": {}
+ }
+ }
+ }
+}
diff --git a/chrome/test/mini_installer/config/chrome_user_not_installed.prop b/chrome/test/mini_installer/config/chrome_user_not_installed.prop
index 6313f92ea3..d7d33b1d04 100644
--- a/chrome/test/mini_installer/config/chrome_user_not_installed.prop
+++ b/chrome/test/mini_installer/config/chrome_user_not_installed.prop
@@ -4,11 +4,11 @@
},
"RegistryEntries": {
"HKEY_CURRENT_USER\\$CHROME_UPDATE_REGISTRY_SUBKEY\\Commands":
- {"exists": false},
+ {"exists": "forbidden"},
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$CHROME_LONG_NAME":
- {"exists": false},
+ {"exists": "forbidden"},
"HKEY_CURRENT_USER\\Software\\Classes\\$CHROME_SHORT_NAME$USER_SPECIFIC_REGISTRY_SUFFIX": {
- "exists": false
+ "exists": "forbidden"
}
}
}
diff --git a/chrome/test/mini_installer/config/config.config b/chrome/test/mini_installer/config/config.config
index 550f67edf5..2a8a24db01 100644
--- a/chrome/test/mini_installer/config/config.config
+++ b/chrome/test/mini_installer/config/config.config
@@ -1,5 +1,7 @@
{
"states": [
+ ["no_pv", ["chrome_user_no_pv.prop",
+ "chrome_system_no_pv.prop"]],
["clean", ["chrome_user_not_installed.prop",
"chrome_system_not_installed.prop",
"chrome_user_not_inuse.prop",
@@ -23,9 +25,9 @@
],
"actions": [
["install_chrome_user",
- "\"$MINI_INSTALLER\" --chrome --multi-install --do-not-launch-chrome"],
+ "\"$MINI_INSTALLER\" --chrome --multi-install --verbose-logging --do-not-launch-chrome"],
["install_chrome_system",
- "\"$MINI_INSTALLER\" --chrome --multi-install --system-level --do-not-launch-chrome"],
+ "\"$MINI_INSTALLER\" --chrome --multi-install --verbose-logging --system-level --do-not-launch-chrome"],
["launch_chrome_user",
"python launch_chrome.py \"$LOCAL_APPDATA\\$CHROME_DIR\\Application\\chrome.exe\""],
["launch_chrome_system",
@@ -43,20 +45,16 @@
{
"name": "ChromeUserLevel",
"traversal": [
- "clean",
+ "no_pv",
"install_chrome_user", "chrome_user_installed_not_inuse",
- "launch_chrome_user", "chrome_user_installed_inuse",
- "quit_chrome_user", "chrome_user_installed_not_inuse",
"uninstall_chrome_user", "clean"
]
},
{
"name": "ChromeSystemLevel",
"traversal": [
- "clean",
+ "no_pv",
"install_chrome_system", "chrome_system_installed_not_inuse",
- "launch_chrome_system", "chrome_system_installed_inuse",
- "quit_chrome_system", "chrome_system_installed_not_inuse",
"uninstall_chrome_system", "clean"
]
}
diff --git a/chrome/test/mini_installer/quit_chrome.py b/chrome/test/mini_installer/quit_chrome.py
index 4dbf78d43d..c25d8da4d2 100644
--- a/chrome/test/mini_installer/quit_chrome.py
+++ b/chrome/test/mini_installer/quit_chrome.py
@@ -69,7 +69,8 @@ def QuitChrome(chrome_path):
"""
if not CloseWindows(chrome_path):
# TODO(robertshield): Investigate why Chrome occasionally doesn't shut down.
- print 'Warning: Chrome not responding to window closure. Killing process...'
+ sys.stderr.write('Warning: Chrome not responding to window closure. '
+ 'Killing all processes belonging to %s\n' % chrome_path)
KillNamedProcess(chrome_path)
diff --git a/chrome/test/mini_installer/registry_verifier.py b/chrome/test/mini_installer/registry_verifier.py
index 98ff97c168..20a09b940c 100644
--- a/chrome/test/mini_installer/registry_verifier.py
+++ b/chrome/test/mini_installer/registry_verifier.py
@@ -49,13 +49,17 @@ class RegistryVerifier(verifier.Verifier):
expectation_name: The registry key being verified. It is expanded using
Expand.
expectation: A dictionary with the following keys and values:
- 'exists' a boolean indicating whether the registry key should exist.
+ 'exists' a string indicating whether the registry key's existence is
+ 'required', 'optional', or 'forbidden'. Values are not checked if
+ an 'optional' key is not present in the registry.
'values' (optional) a dictionary where each key is a registry value
and its associated value is a dictionary with the following key
and values:
- 'type' a string indicating the type of the registry value.
- 'data' the associated data of the registry value. If it is a
- string, it is expanded using Expand.
+ 'type' (optional) a string indicating the type of the registry
+ value. If not present, the corresponding value is expected
+ to be absent in the registry.
+ 'data' the associated data of the registry value if 'type' is
+ specified. If it is a string, it is expanded using Expand.
variable_expander: A VariableExpander object.
"""
key = variable_expander.Expand(expectation_name)
@@ -67,11 +71,13 @@ class RegistryVerifier(verifier.Verifier):
_winreg.KEY_QUERY_VALUE)
except WindowsError:
# Key doesn't exist. See that it matches the expectation.
- assert not expectation['exists'], ('Registry key %s is missing' %
- key)
+ assert expectation['exists'] is not 'required', ('Registry key %s is '
+ 'missing' % key)
+ # Values are not checked if the missing key's existence is optional.
return
# The key exists, see that it matches the expectation.
- assert expectation['exists'], ('Registry key %s exists' % key)
+ assert expectation['exists'] is not 'forbidden', ('Registry key %s exists' %
+ key)
# Verify the expected values.
if 'values' not in expectation:
@@ -82,8 +88,13 @@ class RegistryVerifier(verifier.Verifier):
try:
data, value_type = _winreg.QueryValueEx(key_handle, value)
except WindowsError:
- raise KeyError("Value '%s' of registry key %s is missing" % (
- value, key))
+ # The value does not exist. See that this matches the expectation.
+ assert 'type' not in value_expectation, ('Value %s of registry key %s '
+ 'is missing' % (value, key))
+ continue
+
+ assert 'type' in value_expectation, ('Value %s of registry key %s exists '
+ 'with value %s' % (value, key, data))
# Verify the type of the value.
expected_value_type = value_expectation['type']
diff --git a/chrome/test/mini_installer/test_installer.py b/chrome/test/mini_installer/test_installer.py
index 2ce2dd9d45..be003d628f 100644
--- a/chrome/test/mini_installer/test_installer.py
+++ b/chrome/test/mini_installer/test_installer.py
@@ -10,17 +10,34 @@ the design documentation at http://goo.gl/Q0rGM6
"""
import argparse
+import datetime
+import inspect
import json
import os
import subprocess
import sys
import time
import unittest
+import _winreg
from variable_expander import VariableExpander
import verifier_runner
+def LogMessage(message):
+ """Logs a message to stderr.
+
+ Args:
+ message: The message string to be logged.
+ """
+ now = datetime.datetime.now()
+ frameinfo = inspect.getframeinfo(inspect.currentframe().f_back)
+ filename = os.path.basename(frameinfo.filename)
+ line = frameinfo.lineno
+ sys.stderr.write('[%s:%s(%s)] %s\n' % (now.strftime('%m%d/%H%M%S'),
+ filename, line, message))
+
+
class Config:
"""Describes the machine states, actions, and test cases.
@@ -40,7 +57,7 @@ class Config:
class InstallerTest(unittest.TestCase):
"""Tests a test case in the config file."""
- def __init__(self, name, test, config, variable_expander):
+ def __init__(self, name, test, config, variable_expander, quiet):
"""Constructor.
Args:
@@ -55,6 +72,7 @@ class InstallerTest(unittest.TestCase):
self._test = test
self._config = config
self._variable_expander = variable_expander
+ self._quiet = quiet
self._verifier_runner = verifier_runner.VerifierRunner()
self._clean_on_teardown = True
@@ -87,7 +105,11 @@ class InstallerTest(unittest.TestCase):
# Starting at index 1, we loop through pairs of (action, state).
for i in range(1, len(self._test), 2):
action = self._test[i]
+ if not self._quiet:
+ LogMessage('Beginning action %s' % action)
RunCommand(self._config.actions[action], self._variable_expander)
+ if not self._quiet:
+ LogMessage('Finished action %s' % action)
state = self._test[i + 1]
self._VerifyState(state)
@@ -117,6 +139,8 @@ class InstallerTest(unittest.TestCase):
Args:
state: A state name.
"""
+ if not self._quiet:
+ LogMessage('Verifying state %s' % state)
try:
self._verifier_runner.VerifyAll(self._config.states[state],
self._variable_expander)
@@ -144,6 +168,26 @@ def RunCommand(command, variable_expander):
expanded_command, exit_status))
+def DeleteGoogleUpdateRegistration(system_level, variable_expander):
+ """Deletes Chrome's registration with Google Update.
+
+ Args:
+ system_level: True if system-level Chrome is to be deleted.
+ variable_expander: A VariableExpander object.
+ """
+ root = (_winreg.HKEY_LOCAL_MACHINE if system_level
+ else _winreg.HKEY_CURRENT_USER)
+ key_name = variable_expander.Expand('$CHROME_UPDATE_REGISTRY_SUBKEY')
+ try:
+ key_handle = _winreg.OpenKey(root, key_name, 0,
+ _winreg.KEY_SET_VALUE |
+ _winreg.KEY_WOW64_32KEY)
+ _winreg.DeleteValue(key_handle, 'pv')
+ except WindowsError:
+ # The key isn't present, so there is no value to delete.
+ pass
+
+
def RunCleanCommand(force_clean, variable_expander):
"""Puts the machine in the clean state (i.e. Chrome not installed).
@@ -152,17 +196,17 @@ def RunCleanCommand(force_clean, variable_expander):
installations.
variable_expander: A VariableExpander object.
"""
- # TODO(sukolsak): Read the clean state from the config file and clean
- # the machine according to it.
# TODO(sukolsak): Handle Chrome SxS installs.
- commands = []
interactive_option = '--interactive' if not force_clean else ''
- for level_option in ('', '--system-level'):
- commands.append('python uninstall_chrome.py '
- '--chrome-long-name="$CHROME_LONG_NAME" '
- '--no-error-if-absent %s %s' %
- (level_option, interactive_option))
- RunCommand(' && '.join(commands), variable_expander)
+ for system_level in (False, True):
+ level_option = '--system-level' if system_level else ''
+ command = ('python uninstall_chrome.py '
+ '--chrome-long-name="$CHROME_LONG_NAME" '
+ '--no-error-if-absent %s %s' %
+ (level_option, interactive_option))
+ RunCommand(command, variable_expander)
+ if force_clean:
+ DeleteGoogleUpdateRegistration(system_level, variable_expander)
def MergePropertyDictionaries(current_property, new_property):
@@ -255,8 +299,8 @@ def main():
help='Build target (Release or Debug)')
parser.add_argument('--force-clean', action='store_true', default=False,
help='Force cleaning existing installations')
- parser.add_argument('-v', '--verbose', action='count', default=0,
- help='Increase test runner verbosity level')
+ parser.add_argument('-q', '--quiet', action='store_true', default=False,
+ help='Reduce test runner output')
parser.add_argument('--write-full-results-to', metavar='FILENAME',
help='Path to write the list of full results to.')
parser.add_argument('--config', metavar='FILENAME',
@@ -284,21 +328,22 @@ def main():
RunCleanCommand(args.force_clean, variable_expander)
for test in config.tests:
# If tests were specified via |tests|, their names are formatted like so:
- test_name = '%s.%s.%s' % (InstallerTest.__module__,
+ test_name = '%s/%s/%s' % (InstallerTest.__module__,
InstallerTest.__name__,
test['name'])
if not args.test or test_name in args.test:
suite.addTest(InstallerTest(test['name'], test['traversal'], config,
- variable_expander))
+ variable_expander, args.quiet))
- result = unittest.TextTestRunner(verbosity=(args.verbose + 1)).run(suite)
+ verbosity = 2 if not args.quiet else 1
+ result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
if is_component_build:
- print ('Component build is currently unsupported by the mini_installer: '
- 'http://crbug.com/377839')
+ sys.stderr.write('Component build is currently unsupported by the '
+ 'mini_installer: http://crbug.com/377839\n')
if args.write_full_results_to:
with open(args.write_full_results_to, 'w') as fp:
json.dump(_FullResults(suite, result, {}), fp, indent=2)
- fp.write("\n")
+ fp.write('\n')
return 0 if result.wasSuccessful() else 1
diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc
index 30b6053091..db9ccfe7b5 100644
--- a/chrome/test/nacl/nacl_browsertest.cc
+++ b/chrome/test/nacl/nacl_browsertest.cc
@@ -107,9 +107,6 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, BadNative) {
#if defined(OS_WIN)
// crbug.com/98721
# define MAYBE_Crash DISABLED_Crash
-#elif defined(OS_LINUX)
-// crbug.com/366334
-# define MAYBE_Crash DISABLED_Crash
#else
# define MAYBE_Crash Crash
#endif
@@ -117,22 +114,6 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_Crash, {
RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_crash.html"));
})
-// PNaCl version does not work.
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, ManifestFile) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL("pm_manifest_file_test.html"));
-}
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestGLibc, MAYBE_GLIBC(ManifestFile)) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL("pm_manifest_file_test.html"));
-}
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, PreInitManifestFile) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_pre_init_manifest_file_test.html"));
-}
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestGLibc,
- MAYBE_GLIBC(PreInitManifestFile)) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_pre_init_manifest_file_test.html"));
-}
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, IrtManifestFile) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_manifest_file_test.html"));
}
@@ -141,7 +122,13 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclNonSfi,
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_manifest_file_test.html"));
}
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, IrtException) {
+#if defined(OS_WIN)
+// http://crbug.com/416272
+#define MAYBE_IrtException DISABLED_IrtException
+#else
+#define MAYBE_IrtException IrtException
+#endif
+IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, MAYBE_IrtException) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_exception_test.html"));
}
IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclNonSfi,
@@ -149,10 +136,6 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnaclNonSfi,
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_exception_test.html"));
}
-NACL_BROWSER_TEST_F(NaClBrowserTest, Nameservice, {
- RunNaClIntegrationTest(FILE_PATH_LITERAL("pm_nameservice_test.html"));
-})
-
// Some versions of Visual Studio does not like preprocessor
// conditionals inside the argument of a macro, so we put the
// conditionals on a helper function. We are already in an anonymous
@@ -377,68 +360,6 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl, PnaclMimeType) {
RunLoadTest(FILE_PATH_LITERAL("pnacl_mime_type.html"));
}
-class NaClBrowserTestNewlibStdoutPM : public NaClBrowserTestNewlib {
- public:
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- // Env needs to be set early because nacl_helper is spawned before the test
- // body on Linux.
- scoped_ptr<base::Environment> env(base::Environment::Create());
- env->SetVar("NACL_EXE_STDOUT", "DEBUG_ONLY:dev://postmessage");
- NaClBrowserTestNewlib::SetUpInProcessBrowserTestFixture();
- }
-};
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStdoutPM, RedirectFg0) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stdout&thread=fg&delay_us=0"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStdoutPM, RedirectBg0) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stdout&thread=bg&delay_us=0"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStdoutPM, RedirectFg1) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stdout&thread=fg&delay_us=1000000"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStdoutPM, RedirectBg1) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stdout&thread=bg&delay_us=1000000"));
-}
-
-class NaClBrowserTestNewlibStderrPM : public NaClBrowserTestNewlib {
- public:
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- // Env needs to be set early because nacl_helper is spawned before the test
- // body on Linux.
- scoped_ptr<base::Environment> env(base::Environment::Create());
- env->SetVar("NACL_EXE_STDERR", "DEBUG_ONLY:dev://postmessage");
- NaClBrowserTestNewlib::SetUpInProcessBrowserTestFixture();
- }
-};
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStderrPM, RedirectFg0) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stderr&thread=fg&delay_us=0"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStderrPM, RedirectBg0) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stderr&thread=bg&delay_us=0"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStderrPM, RedirectFg1) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stderr&thread=fg&delay_us=1000000"));
-}
-
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibStderrPM, RedirectBg1) {
- RunNaClIntegrationTest(FILE_PATH_LITERAL(
- "pm_redir_test.html?stream=stderr&thread=bg&delay_us=1000000"));
-}
-
// TODO(ncbray) support glibc and PNaCl
// flaky: crbug.com/375894
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibExtension, DISABLED_MimeHandler) {
diff --git a/chrome/test/nacl/pnacl_header_test.cc b/chrome/test/nacl/pnacl_header_test.cc
index e4922aa586..ddb26625b0 100644
--- a/chrome/test/nacl/pnacl_header_test.cc
+++ b/chrome/test/nacl/pnacl_header_test.cc
@@ -12,16 +12,36 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/nacl/nacl_browsertest_util.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
+#include "net/url_request/url_request.h"
using net::test_server::BasicHttpResponse;
using net::test_server::EmbeddedTestServer;
using net::test_server::HttpRequest;
using net::test_server::HttpResponse;
+void TestDispatcherHostDelegate::RequestBeginning(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ content::AppCacheService* appcache_service,
+ content::ResourceType resource_type,
+ ScopedVector<content::ResourceThrottle>* throttles) {
+ // This checks the same condition as the one for PNaCl in
+ // AppendComponentUpdaterThrottles.
+ if (resource_type == content::RESOURCE_TYPE_OBJECT) {
+ const net::HttpRequestHeaders& headers = request->extra_request_headers();
+ std::string accept_headers;
+ if (headers.GetHeader("Accept", &accept_headers)) {
+ if (accept_headers.find("application/x-pnacl") != std::string::npos)
+ found_pnacl_header_ = true;
+ }
+ }
+}
+
PnaclHeaderTest::PnaclHeaderTest() : noncors_loads_(0), cors_loads_(0) {}
PnaclHeaderTest::~PnaclHeaderTest() {}
@@ -41,6 +61,7 @@ void PnaclHeaderTest::StartServer() {
void PnaclHeaderTest::RunLoadTest(const std::string& url,
int expected_noncors,
int expected_cors) {
+ content::ResourceDispatcherHost::Get()->SetDelegate(&test_delegate_);
StartServer();
LoadTestMessageHandler handler;
content::JavascriptTestObserver observer(
@@ -57,12 +78,17 @@ void PnaclHeaderTest::RunLoadTest(const std::string& url,
base::ScopedPathOverride component_dir(chrome::DIR_PNACL_COMPONENT);
ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL(url));
+
// Wait until the NMF and pexe are also loaded, not just the HTML.
// Do this by waiting till the LoadTestMessageHandler responds.
EXPECT_TRUE(observer.Run()) << handler.error_message();
+
+ // Now check the expectations.
EXPECT_TRUE(handler.test_passed()) << "Test failed.";
EXPECT_EQ(expected_noncors, noncors_loads_);
EXPECT_EQ(expected_cors, cors_loads_);
+
+ content::ResourceDispatcherHost::Get()->SetDelegate(NULL);
}
scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch(
@@ -81,14 +107,14 @@ scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch(
if (absolute_url.path().find(".pexe") == std::string::npos)
return scoped_ptr<HttpResponse>();
- // For pexe files, check for the special Accept header.
- // This must match whatever is in:
- // ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+ // For pexe files, check for the special Accept header,
+ // along with the expected ResourceType of the URL request.
EXPECT_NE(0U, request.headers.count("Accept"));
std::map<std::string, std::string>::const_iterator it =
request.headers.find("Accept");
EXPECT_NE(std::string::npos, it->second.find("application/x-pnacl"));
EXPECT_NE(std::string::npos, it->second.find("*/*"));
+ EXPECT_TRUE(test_delegate_.found_pnacl_header());
// Also make sure that other headers like CORS-related headers
// are preserved when injecting the special Accept header.
diff --git a/chrome/test/nacl/pnacl_header_test.h b/chrome/test/nacl/pnacl_header_test.h
index 9134925edd..6c75fdce00 100644
--- a/chrome/test/nacl/pnacl_header_test.h
+++ b/chrome/test/nacl/pnacl_header_test.h
@@ -8,6 +8,8 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "content/public/browser/resource_dispatcher_host_delegate.h"
+#include "content/public/common/resource_type.h"
namespace base {
class FilePath;
@@ -20,6 +22,30 @@ class HttpResponse;
}
}
+using content::ResourceDispatcherHostDelegate;
+
+class TestDispatcherHostDelegate : public ResourceDispatcherHostDelegate {
+ public:
+ explicit TestDispatcherHostDelegate()
+ : ResourceDispatcherHostDelegate(), found_pnacl_header_(false) {}
+
+ virtual ~TestDispatcherHostDelegate() {}
+
+ virtual void RequestBeginning(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ content::AppCacheService* appcache_service,
+ content::ResourceType resource_type,
+ ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
+
+ bool found_pnacl_header() const { return found_pnacl_header_; }
+
+ private:
+ bool found_pnacl_header_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestDispatcherHostDelegate);
+};
+
class PnaclHeaderTest : public InProcessBrowserTest {
public:
PnaclHeaderTest();
@@ -40,6 +66,7 @@ class PnaclHeaderTest : public InProcessBrowserTest {
int noncors_loads_;
int cors_loads_;
+ TestDispatcherHostDelegate test_delegate_;
DISALLOW_COPY_AND_ASSIGN(PnaclHeaderTest);
};
diff --git a/chrome/test/perf/mach_ports_performancetest.cc b/chrome/test/perf/mach_ports_performancetest.cc
index 8208a4f5e3..e80b9439ac 100644
--- a/chrome/test/perf/mach_ports_performancetest.cc
+++ b/chrome/test/perf/mach_ports_performancetest.cc
@@ -75,7 +75,7 @@ class MachPortsTest : public InProcessBrowserTest {
// Adds a tab from the page cycler data at the specified domain.
void AddTab(const std::string& domain) {
GURL url = server_.GetURL("files/" + domain + "/").Resolve("?skip");
- AddTabAtIndex(0, url, content::PageTransition::PAGE_TRANSITION_TYPED);
+ AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED);
}
private:
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc
index c3a679de1f..0c80b23975 100644
--- a/chrome/test/ppapi/ppapi_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -62,22 +62,12 @@ using content::RenderViewHost;
#if defined(DISABLE_NACL)
#define TEST_PPAPI_NACL(test_name)
-#define TEST_PPAPI_NACL_NO_PNACL(test_name)
#define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
#define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
#define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
#else
-// TODO(dmichael): Remove this macro, crbug.com/384539
-#define TEST_PPAPI_NACL_NO_PNACL(test_name) \
- IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
- RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
- } \
- IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
- RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
- } \
-
// NaCl based PPAPI tests
#define TEST_PPAPI_NACL(test_name) \
IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
@@ -978,6 +968,7 @@ IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
LIST_TEST(WebSocket_AbortSendMessageCall) \
LIST_TEST(WebSocket_AbortCloseCall) \
LIST_TEST(WebSocket_AbortReceiveMessageCall) \
+ LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
LIST_TEST(WebSocket_CcInterfaces) \
LIST_TEST(WebSocket_UtilityInvalidConnect) \
LIST_TEST(WebSocket_UtilityProtocols) \
@@ -1124,7 +1115,7 @@ TEST_PPAPI_NACL(View_CreatedVisible);
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
// Make a second tab in the foreground.
GURL url = GetTestFileUrl("View_CreatedInvisible");
- chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK);
+ chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
params.disposition = NEW_BACKGROUND_TAB;
ui_test_utils::NavigateToURL(&params);
}
@@ -1147,7 +1138,7 @@ IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
// Make a new tab to cause the original one to hide, this should trigger the
// next phase of the test.
chrome::NavigateParams params(
- browser(), GURL(url::kAboutBlankURL), content::PAGE_TRANSITION_LINK);
+ browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
params.disposition = NEW_FOREGROUND_TAB;
ui_test_utils::NavigateToURL(&params);
@@ -1287,9 +1278,7 @@ TEST_PPAPI_NACL(VideoSource)
// Printing doesn't work in content_browsertests.
TEST_PPAPI_OUT_OF_PROCESS(Printing)
-// TODO(dmichael): Make this work on PNaCl and remove the macro.
-// crbug.com/384539
-TEST_PPAPI_NACL_NO_PNACL(MessageHandler)
+TEST_PPAPI_NACL(MessageHandler)
TEST_PPAPI_NACL(MessageLoop_Basics)
TEST_PPAPI_NACL(MessageLoop_Post)
diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc
index 4d303fa422..c1cac6f73e 100644
--- a/chrome/test/ppapi/ppapi_test.cc
+++ b/chrome/test/ppapi/ppapi_test.cc
@@ -5,7 +5,7 @@
#include "chrome/test/ppapi/ppapi_test.h"
#include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
diff --git a/chrome/test/remoting/fullscreen_browsertest.cc b/chrome/test/remoting/fullscreen_browsertest.cc
index 6b9f5100a6..40819cdc6f 100644
--- a/chrome/test/remoting/fullscreen_browsertest.cc
+++ b/chrome/test/remoting/fullscreen_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "chrome/test/remoting/remote_desktop_browsertest.h"
#include "chrome/test/remoting/waiter.h"
diff --git a/chrome/test/remoting/install_and_launch_app.py b/chrome/test/remoting/install_and_launch_app.py
new file mode 100755
index 0000000000..5a120ad4b9
--- /dev/null
+++ b/chrome/test/remoting/install_and_launch_app.py
@@ -0,0 +1,206 @@
+#!/usr/bin/python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""A Chromedriver smoke-test that installs and launches a web-app.
+
+ Args:
+ driver_dir: Location of Chromedriver binary on local machine.
+ profile_dir: A user-data-dir containing login token for the app-user.
+ app_id: App ID of web-app in Chrome web-store.
+ app_window_title: The title of the window that should come up on app launch.
+
+ TODO(anandc): Reduce the # of parameters required from the command-line.
+ Maybe read from a JSON file. Also, map appID to expected app window title.
+
+ This script navigates to the app-detail page on Chrome Web Store for the
+ specified app-id. From there, it then installs the app and launches it. It
+ then checks if the resulting new window has the expected title.
+"""
+
+import argparse
+import os
+import shutil
+import tempfile
+import time
+
+from selenium import webdriver
+from selenium.webdriver.chrome.options import Options
+
+CWS_URL = 'https://chrome.google.com/webstore/detail'
+WEBSTORE_BUTTON_LABEL = 'webstore-test-button-label'
+FREE_BUTTON_XPATH = (
+ '//div[contains(@class, \"%s\") and text() = \"Free\"]' %
+ (WEBSTORE_BUTTON_LABEL))
+LAUNCH_BUTTON_XPATH = (
+ '//div[contains(@class, \"%s\") and text() = \"Launch app\"]' %
+ (WEBSTORE_BUTTON_LABEL))
+WAIT_TIME = 2
+
+
+def CreateTempProfileDir(source_dir):
+ """Creates a temporary profile directory, for use by the test.
+
+ This avoids modifying the input user-data-dir by actions that the test
+ performs.
+
+ Args:
+ source_dir: The directory to copy and place in a temp folder.
+
+ Returns:
+ tmp_dir: Name of the temporary folder that was created.
+ profile_dir: Name of the profile-dir under the tmp_dir.
+ """
+
+ tmp_dir = tempfile.mkdtemp()
+ print 'Created folder %s' % (tmp_dir)
+ profile_dir = os.path.join(tmp_dir, 'testuser')
+ # Copy over previous created profile for this execution of Chrome Driver.
+ shutil.copytree(source_dir, profile_dir)
+ return tmp_dir, profile_dir
+
+
+def ParseCmdLineArgs():
+ """Parses command line arguments and returns them.
+
+ Returns:
+ args: Parse command line arguments.
+ """
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '-d', '--driver_dir', required=True,
+ help='path to folder where Chromedriver has been installed.')
+ parser.add_argument(
+ '-p', '--profile_dir', required=True,
+ help='path to user-data-dir with trusted-tester signed in.')
+ parser.add_argument(
+ '-a', '--app_id', required=True,
+ help='app-id of web-store app being tested.')
+ parser.add_argument(
+ '-e', '--app_window_title', required=True,
+ help='Title of the app window that we expect to come up.')
+
+ # Use input json file if specified on command line.
+ args = parser.parse_args()
+ return args
+
+
+def GetLinkAndWait(driver, link_to_get):
+ """Navigates to the specified link.
+
+ Args:
+ driver: Active window for this Chromedriver instance.
+ link_to_get: URL of the destination.
+ """
+ driver.get(link_to_get)
+ # TODO(anandc): Is there any event or state we could wait on? For now,
+ # we have hard-coded sleeps.
+ time.sleep(WAIT_TIME)
+
+
+def ClickAndWait(driver, button_xpath):
+ """Clicks button at the specified XPath of the current document.
+
+ Args:
+ driver: Active window for this Chromedriver instance.
+ button_xpath: XPath in this document to button we want to click.
+ """
+ button = driver.find_element_by_xpath(button_xpath)
+ button.click()
+ time.sleep(WAIT_TIME)
+
+
+def WindowWithTitleExists(driver, title):
+ """Verifies if one of the open windows has the specified title.
+
+ Args:
+ driver: Active window for this Chromedriver instance.
+ title: Title of the window we are looking for.
+
+ Returns:
+ True if an open window in this session with the specified title was found.
+ False otherwise.
+ """
+ for handle in driver.window_handles:
+ driver.switch_to_window(handle)
+ if driver.title == title:
+ return True
+ return False
+
+
+def main():
+
+ args = ParseCmdLineArgs()
+
+ org_profile_dir = args.profile_dir
+ print 'Creating temp-dir using profile-dir %s' % org_profile_dir
+ tmp_dir, profile_dir = CreateTempProfileDir(org_profile_dir)
+
+ options = Options()
+ options.add_argument('--user-data-dir=' + profile_dir)
+ # Suppress the confirmation dialog that comes up.
+ # With M39, this flag will no longer work. See https://crbug/357774.
+ # TODO(anandc): Work with a profile-dir that already has extension downloaded,
+ # and also add support for loading extension from a local directory.
+ options.add_argument('--apps-gallery-install-auto-confirm-for-tests=accept')
+ driver = webdriver.Chrome(args.driver_dir, chrome_options=options)
+
+ try:
+
+ chrome_apps_link = 'chrome://apps'
+ cws_app_detail_link = '%s/%s' % (CWS_URL, args.app_id)
+
+ # Navigate to chrome:apps first.
+ # TODO(anandc): Add check to make sure the app we are testing isn't already
+ # added for this user.
+ GetLinkAndWait(driver, chrome_apps_link)
+
+ # Navigate to the app detail page at the Chrome Web Store.
+ GetLinkAndWait(driver, cws_app_detail_link)
+ # Get the page again, to get all controls. This seems to be a bug, either
+ # in ChromeDriver, or the app-page. Without this additional GET, we don't
+ # get all controls. Even sleeping for 5 seconds doesn't suffice.
+ # TODO(anandc): Investigate why the page doesn't work with just 1 call.
+ GetLinkAndWait(driver, cws_app_detail_link)
+
+ # Install the app by clicking the button that says "Free".
+ ClickAndWait(driver, FREE_BUTTON_XPATH)
+
+ # We should now be at a new tab. Get its handle.
+ current_tab = driver.window_handles[-1]
+ # And switch to it.
+ driver.switch_to_window(current_tab)
+
+ # From this new tab, go to Chrome Apps
+ # TODO(anandc): Add check to make sure the app we are testing is now added.
+ GetLinkAndWait(driver, chrome_apps_link)
+
+ # Back to the app detail page.
+ GetLinkAndWait(driver, cws_app_detail_link)
+ # Again, do this twice, for reasons noted above.
+ GetLinkAndWait(driver, cws_app_detail_link)
+
+ # Click to launch the newly installed app.
+ ClickAndWait(driver, LAUNCH_BUTTON_XPATH)
+
+ # For now, make sure the "connecting" dialog comes up.
+ # TODO(anandc): Add more validation; ideally, wait for the separate app
+ # window to appear.
+ if WindowWithTitleExists(driver, args.app_window_title):
+ print 'Web-App %s launched successfully.' % args.app_window_title
+ else:
+ print 'Web-app %s did not launch successfully.' % args.app_window_title
+
+ except Exception, e:
+ raise e
+ finally:
+ # Cleanup.
+ print 'Deleting %s' % tmp_dir
+ shutil.rmtree(profile_dir)
+ os.rmdir(tmp_dir)
+ driver.quit()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/chrome/test/remoting/me2me_browsertest.cc b/chrome/test/remoting/me2me_browsertest.cc
index a53d07166b..541dbed0f6 100644
--- a/chrome/test/remoting/me2me_browsertest.cc
+++ b/chrome/test/remoting/me2me_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "chrome/test/remoting/remote_desktop_browsertest.h"
#include "chrome/test/remoting/waiter.h"
diff --git a/chrome/test/remoting/pin_browsertest.cc b/chrome/test/remoting/pin_browsertest.cc
index 742113ee28..28c96dd86d 100644
--- a/chrome/test/remoting/pin_browsertest.cc
+++ b/chrome/test/remoting/pin_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "chrome/test/remoting/remote_desktop_browsertest.h"
#include "chrome/test/remoting/waiter.h"
diff --git a/chrome/test/remoting/qunit_browser_test_runner.cc b/chrome/test/remoting/qunit_browser_test_runner.cc
index da3509908e..e476f7725d 100644
--- a/chrome/test/remoting/qunit_browser_test_runner.cc
+++ b/chrome/test/remoting/qunit_browser_test_runner.cc
@@ -4,7 +4,7 @@
#include "chrome/test/remoting/qunit_browser_test_runner.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/values.h"
#include "chrome/browser/ui/browser.h"
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc
index e5ed2e68c6..d9a826510c 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -5,7 +5,7 @@
#include "chrome/test/remoting/remote_desktop_browsertest.h"
#include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -152,7 +152,7 @@ void RemoteDesktopBrowserTest::VerifyChromotingLoaded(bool expected) {
if (installed) {
if (extension_)
- EXPECT_EQ(extension, extension_);
+ EXPECT_EQ(extension.get(), extension_);
else
extension_ = extension.get();
@@ -309,9 +309,8 @@ void RemoteDesktopBrowserTest::Approve() {
&RemoteDesktopBrowserTest::IsAuthenticatedInWindow,
browser()->tab_strip_model()->GetActiveWebContents()));
- ExecuteScript(
- "lso.approveButtonAction();"
- "document.forms[\"connect-approve\"].submit();");
+ // Click to Approve the web-app.
+ ClickOnControl("submit_approve_access");
observer.Wait();
@@ -468,8 +467,8 @@ void RemoteDesktopBrowserTest::SetUpTestForMe2Me() {
VerifyInternetAccess();
Install();
LaunchChromotingApp();
- LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js"));
Auth();
+ LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js"));
ExpandMe2Me();
EnsureRemoteConnectionEnabled();
}
@@ -708,6 +707,20 @@ void RemoteDesktopBrowserTest::RunJavaScriptTest(
void RemoteDesktopBrowserTest::ClickOnControl(const std::string& name) {
ASSERT_TRUE(HtmlElementVisible(name));
+ std::string has_disabled_attribute =
+ "document.getElementById('" + name + "').hasAttribute('disabled')";
+
+ if (ExecuteScriptAndExtractBool(active_web_contents(),
+ has_disabled_attribute)) {
+ // This element has a disabled attribute. Wait for it become enabled.
+ ConditionalTimeoutWaiter waiter(
+ base::TimeDelta::FromSeconds(5),
+ base::TimeDelta::FromMilliseconds(500),
+ base::Bind(&RemoteDesktopBrowserTest::IsEnabled,
+ active_web_contents(), name));
+ ASSERT_TRUE(waiter.Wait());
+ }
+
ExecuteScript("document.getElementById(\"" + name + "\").click();");
}
@@ -801,4 +814,13 @@ bool RemoteDesktopBrowserTest::IsHostActionComplete(
host_action_var);
}
+// static
+bool RemoteDesktopBrowserTest::IsEnabled(
+ content::WebContents* client_web_content,
+ const std::string& element_name) {
+ return !ExecuteScriptAndExtractBool(
+ client_web_content,
+ "document.getElementById(\"" + element_name + "\").disabled");
+}
+
} // namespace remoting
diff --git a/chrome/test/remoting/remote_desktop_browsertest.h b/chrome/test/remoting/remote_desktop_browsertest.h
index e5659945c9..e4a025ec53 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.h
+++ b/chrome/test/remoting/remote_desktop_browsertest.h
@@ -314,6 +314,11 @@ class RemoteDesktopBrowserTest : public extensions::PlatformAppBrowserTest {
return IsAuthenticatedInWindow(active_web_contents());
}
+ // Callback used by Approve to check whether the Accept button is enabled
+ // and ready to receive a click.
+ static bool IsEnabled(
+ content::WebContents* web_contents, const std::string& name);
+
// If the "Host version out-of-date" form is visible, dismiss it.
void DismissHostVersionWarningIfVisible();
diff --git a/chrome/test/remoting/scrollbar_browsertest.cc b/chrome/test/remoting/scrollbar_browsertest.cc
new file mode 100644
index 0000000000..325105c408
--- /dev/null
+++ b/chrome/test/remoting/scrollbar_browsertest.cc
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "chrome/test/remoting/remote_desktop_browsertest.h"
+#include "chrome/test/remoting/waiter.h"
+
+namespace remoting {
+
+class ScrollbarBrowserTest : public RemoteDesktopBrowserTest {
+};
+
+IN_PROC_BROWSER_TEST_F(ScrollbarBrowserTest, MANUAL_Scrollbar_Visibility) {
+ SetUpTestForMe2Me();
+
+ content::WebContents* content = app_web_content();
+ LoadScript(content, FILE_PATH_LITERAL("scrollbar_browser_test.js"));
+
+ RunJavaScriptTest(content, "Scrollbars", "{}");
+
+ Cleanup();
+}
+
+} // namespace remoting