summaryrefslogtreecommitdiff
path: root/chrome/test
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2014-08-19 13:00:08 +0100
committerTorne (Richard Coles) <torne@google.com>2014-08-19 13:00:08 +0100
commit6e8cce623b6e4fe0c9e4af605d675dd9d0338c38 (patch)
tree8d824ad26fac42e008142b86aa9631b2be7e4705 /chrome/test
parent4f7316adb45db5ec3c9c1181ba9510c004566df8 (diff)
downloadchromium_org-6e8cce623b6e4fe0c9e4af605d675dd9d0338c38.tar.gz
Merge from Chromium at DEPS revision 290040
This commit was generated by merge_to_master.py. Change-Id: I694ec52d1e0b553f163c2faf4373d63270ab1aac
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/DEPS3
-rw-r--r--chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java6
-rw-r--r--chrome/test/base/browser_with_test_window_test.h2
-rw-r--r--chrome/test/base/chrome_unit_test_suite.cc8
-rw-r--r--chrome/test/base/in_process_browser_test.cc6
-rw-r--r--chrome/test/base/interactive_test_utils.h26
-rw-r--r--chrome/test/base/interactive_test_utils_mac.mm52
-rw-r--r--chrome/test/base/interactive_test_utils_views.cc17
-rw-r--r--chrome/test/base/test_switches.cc3
-rw-r--r--chrome/test/base/test_switches.h1
-rw-r--r--chrome/test/base/testing_browser_process.cc24
-rw-r--r--chrome/test/base/testing_browser_process.h8
-rw-r--r--chrome/test/base/testing_profile.cc10
-rw-r--r--chrome/test/base/testing_profile_manager.cc3
-rw-r--r--chrome/test/base/view_event_test_base.cc85
-rw-r--r--chrome/test/base/view_event_test_base.h15
-rw-r--r--chrome/test/base/view_event_test_platform_part.h38
-rw-r--r--chrome/test/base/view_event_test_platform_part_ash.cc52
-rw-r--r--chrome/test/base/view_event_test_platform_part_chromeos.cc76
-rw-r--r--chrome/test/base/view_event_test_platform_part_mac.mm27
-rw-r--r--chrome/test/chromedriver/OWNERS1
-rw-r--r--chrome/test/chromedriver/capabilities.cc2
-rw-r--r--chrome/test/chromedriver/chrome/navigation_tracker.cc25
-rw-r--r--chrome/test/chromedriver/chrome/navigation_tracker.h2
-rw-r--r--chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc67
-rw-r--r--chrome/test/chromedriver/chrome_launcher.cc3
-rw-r--r--chrome/test/chromedriver/server/http_handler.cc2
-rw-r--r--chrome/test/gpu/webgl_infobar_browsertest.cc2
-rw-r--r--chrome/test/nacl/nacl_browsertest_uma.cc57
-rw-r--r--chrome/test/nacl/nacl_browsertest_util.cc18
-rw-r--r--chrome/test/nacl/nacl_browsertest_util.h5
-rw-r--r--chrome/test/nacl/pnacl_header_test.cc11
-rw-r--r--chrome/test/ppapi/ppapi_browsertest.cc13
-rw-r--r--chrome/test/remoting/fullscreen_browsertest.cc75
-rw-r--r--chrome/test/remoting/me2me_browsertest.cc50
-rw-r--r--chrome/test/remoting/remote_desktop_browsertest.cc4
36 files changed, 536 insertions, 263 deletions
diff --git a/chrome/test/DEPS b/chrome/test/DEPS
index a3fac31973..db5b57fe42 100644
--- a/chrome/test/DEPS
+++ b/chrome/test/DEPS
@@ -3,6 +3,7 @@ include_rules = [
# rely on components.
"+ash",
"+chrome",
+ "+chrome/grit", # For generated headers
"+chromeos",
"+components",
"+extensions",
@@ -15,7 +16,7 @@ include_rules = [
"+content/public",
"+gin/public",
- "+grit", # For generated headers
+ "+grit", # For generated headers. TODO(thestig): Remove.
"+media/base",
"+mojo/embedder",
"+sandbox/win/tests",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java
index 0133f42efd..bbdb83c924 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java
@@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit;
*/
public class InfoBarTestAnimationListener implements InfoBarContainer.InfoBarAnimationListener {
- private static long WAIT_MILLIS = TimeUnit.SECONDS.toMillis(5);
+ private static final long WAIT_MILLIS = TimeUnit.SECONDS.toMillis(5);
private static class ConditionalWait {
private volatile Boolean mCondition;
@@ -33,7 +33,7 @@ public class InfoBarTestAnimationListener implements InfoBarContainer.InfoBarAni
* @return true if the condition becomes true before the specified {@code millis}.
*/
public boolean waitAndExpire(long millis) throws InterruptedException {
- synchronized(mLock) {
+ synchronized (mLock) {
while (!mCondition && millis > 0) {
long start = SystemClock.elapsedRealtime();
mLock.wait(millis);
@@ -46,7 +46,7 @@ public class InfoBarTestAnimationListener implements InfoBarContainer.InfoBarAni
}
public void set(boolean value) {
- synchronized(mLock) {
+ synchronized (mLock) {
mCondition = value;
if (value) {
mLock.notify();
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h
index cc5cde8054..cb65ebcb4d 100644
--- a/chrome/test/base/browser_with_test_window_test.h
+++ b/chrome/test/base/browser_with_test_window_test.h
@@ -16,7 +16,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/login/users/user_manager.h"
+#include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#endif
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc
index 6d8b4efa7b..22f518893b 100644
--- a/chrome/test/base/chrome_unit_test_suite.cc
+++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -121,10 +121,7 @@ void ChromeUnitTestSuite::InitializeProviders() {
chrome::RegisterPathProvider();
content::RegisterPathProvider();
ui::RegisterPathProvider();
-
- base::FilePath user_data;
- if (PathService::Get(chrome::DIR_USER_DATA, &user_data))
- component_updater::RegisterPathProvider(user_data);
+ component_updater::RegisterPathProvider(chrome::DIR_USER_DATA);
#if defined(OS_CHROMEOS)
chromeos::RegisterPathProvider();
@@ -149,7 +146,8 @@ void ChromeUnitTestSuite::InitializeProviders() {
void ChromeUnitTestSuite::InitializeResourceBundle() {
// Force unittests to run using en-US so if we test against string
// output, it'll pass regardless of the system language.
- ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
+ ui::ResourceBundle::InitSharedInstanceWithLocale(
+ "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
base::FilePath resources_pack_path;
#if defined(OS_MACOSX) && !defined(OS_IOS)
PathService::Get(base::DIR_MODULE, &resources_pack_path);
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 9fa29b50bb..220865d3bb 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -70,6 +70,10 @@
#include "components/storage_monitor/test_storage_monitor.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
+#endif
+
namespace {
// Passed as value of kTestType.
@@ -176,6 +180,8 @@ void InProcessBrowserTest::SetUp() {
// Make sure that the log directory exists.
base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();
base::CreateDirectory(log_dir);
+ // Disable IME extension loading to avoid many browser tests failures.
+ chromeos::input_method::DisableExtensionLoading();
#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
diff --git a/chrome/test/base/interactive_test_utils.h b/chrome/test/base/interactive_test_utils.h
index c7ada3cd56..0779a4f862 100644
--- a/chrome/test/base/interactive_test_utils.h
+++ b/chrome/test/base/interactive_test_utils.h
@@ -9,14 +9,16 @@
#include "chrome/test/base/ui_test_utils.h"
#include "ui/base/test/ui_controls.h"
-#if defined(TOOLKIT_VIEWS)
-#include "ui/views/view.h"
-#endif
-
namespace gfx {
class Point;
}
+#if defined(TOOLKIT_VIEWS)
+namespace views {
+class View;
+}
+#endif
+
namespace ui_test_utils {
// Brings the native window for |browser| to the foreground. Returns true on
@@ -120,18 +122,14 @@ bool SendKeyPressAndWaitWithDetails(
}
// A combination of SendMouseMove to the middle of the view followed by
-// SendMouseEvents.
-void MoveMouseToCenterAndPress(
+// SendMouseEvents. Only exposed for toolkit-views.
+// Alternatives: ClickOnView() and ui::test::EventGenerator.
#if defined(TOOLKIT_VIEWS)
- views::View* view,
-#elif defined(OS_IOS)
- UIView* view,
-#elif defined(OS_MACOSX)
- NSView* view,
+void MoveMouseToCenterAndPress(views::View* view,
+ ui_controls::MouseButton button,
+ int state,
+ const base::Closure& task);
#endif
- ui_controls::MouseButton button,
- int state,
- const base::Closure& task);
namespace internal {
diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm
index 44ad8ccd3f..e2d5cdb5fa 100644
--- a/chrome/test/base/interactive_test_utils_mac.mm
+++ b/chrome/test/base/interactive_test_utils_mac.mm
@@ -17,6 +17,32 @@
namespace ui_test_utils {
+namespace {
+
+void MoveMouseToNSViewCenterAndPress(
+ NSView* view,
+ ui_controls::MouseButton button,
+ int state,
+ const base::Closure& task) {
+ NSWindow* window = [view window];
+ NSScreen* screen = [window screen];
+ DCHECK(screen);
+
+ // Converts the center position of the view into the coordinates accepted
+ // by SendMouseMoveNotifyWhenDone() method.
+ NSRect bounds = [view bounds];
+ NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
+ center = [view convertPoint:center toView:nil];
+ center = [window convertBaseToScreen:center];
+ center = NSMakePoint(center.x, [screen frame].size.height - center.y);
+
+ ui_controls::SendMouseMoveNotifyWhenDone(
+ center.x, center.y,
+ base::Bind(&internal::ClickTask, button, state, task));
+}
+
+} // namespace
+
bool IsViewFocused(const Browser* browser, ViewID vid) {
NSWindow* window = browser->window()->GetNativeWindow();
DCHECK(window);
@@ -44,7 +70,7 @@ void ClickOnView(const Browser* browser, ViewID vid) {
DCHECK(window);
NSView* view = view_id_util::GetView(window, vid);
DCHECK(view);
- MoveMouseToCenterAndPress(
+ MoveMouseToNSViewCenterAndPress(
view,
ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
@@ -66,28 +92,4 @@ bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
return true;
}
-void MoveMouseToCenterAndPress(
- NSView* view,
- ui_controls::MouseButton button,
- int state,
- const base::Closure& task) {
- DCHECK(view);
- NSWindow* window = [view window];
- DCHECK(window);
- NSScreen* screen = [window screen];
- DCHECK(screen);
-
- // Converts the center position of the view into the coordinates accepted
- // by SendMouseMoveNotifyWhenDone() method.
- NSRect bounds = [view bounds];
- NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
- center = [view convertPoint:center toView:nil];
- center = [window convertBaseToScreen:center];
- center = NSMakePoint(center.x, [screen frame].size.height - center.y);
-
- ui_controls::SendMouseMoveNotifyWhenDone(
- center.x, center.y,
- base::Bind(&internal::ClickTask, button, state, task));
-}
-
} // namespace ui_test_utils
diff --git a/chrome/test/base/interactive_test_utils_views.cc b/chrome/test/base/interactive_test_utils_views.cc
index 2a39ba4427..67bcf63360 100644
--- a/chrome/test/base/interactive_test_utils_views.cc
+++ b/chrome/test/base/interactive_test_utils_views.cc
@@ -8,20 +8,23 @@
#include "base/message_loop/message_loop.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "ui/aura/window.h"
#include "ui/base/test/ui_controls.h"
#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_animator.h"
#include "ui/views/focus/focus_manager.h"
namespace ui_test_utils {
+// Until the whole browser UI is ported to tookit-views on Mac, these need to
+// use the definitions in interactive_test_utils_mac.mm.
+#if !defined(OS_MACOSX)
+
bool IsViewFocused(const Browser* browser, ViewID vid) {
BrowserWindow* browser_window = browser->window();
DCHECK(browser_window);
gfx::NativeWindow window = browser_window->GetNativeWindow();
DCHECK(window);
- const views::Widget* widget =
- views::Widget::GetTopLevelWidgetForNativeView(window);
+ const views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
DCHECK(widget);
const views::FocusManager* focus_manager = widget->GetFocusManager();
DCHECK(focus_manager);
@@ -40,6 +43,8 @@ void ClickOnView(const Browser* browser, ViewID vid) {
content::RunMessageLoop();
}
+#endif // defined(OS_MACOSX)
+
void MoveMouseToCenterAndPress(views::View* view,
ui_controls::MouseButton button,
int state,
@@ -49,9 +54,9 @@ void MoveMouseToCenterAndPress(views::View* view,
// Complete any in-progress animation before sending the events so that the
// mouse-event targetting happens reliably, and does not flake because of
// unreliable animation state.
- aura::Window* window = view->GetWidget()->GetNativeView();
- if (window && window->layer()) {
- ui::LayerAnimator* animator = window->layer()->GetAnimator();
+ ui::Layer* layer = view->GetWidget()->GetLayer();
+ if (layer) {
+ ui::LayerAnimator* animator = layer->GetAnimator();
if (animator && animator->is_animating())
animator->StopAnimating();
}
diff --git a/chrome/test/base/test_switches.cc b/chrome/test/base/test_switches.cc
index b1b16ac4a5..a092c42673 100644
--- a/chrome/test/base/test_switches.cc
+++ b/chrome/test/base/test_switches.cc
@@ -9,9 +9,6 @@ namespace switches {
// Also emit full event trace logs for successful tests.
const char kAlsoEmitSuccessLogs[] = "also-emit-success-logs";
-// Enable displaying error dialogs (for debugging).
-const char kEnableErrorDialogs[] = "enable-errdialogs";
-
#if defined(OS_WIN)
// Force browser tests to run in Ash/Metro on Windows 8.
const char kAshBrowserTests[] = "ash-browsertests";
diff --git a/chrome/test/base/test_switches.h b/chrome/test/base/test_switches.h
index 5c801408ac..5d3544c6c2 100644
--- a/chrome/test/base/test_switches.h
+++ b/chrome/test/base/test_switches.h
@@ -12,7 +12,6 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kAlsoEmitSuccessLogs[];
-extern const char kEnableErrorDialogs[];
#if defined(OS_WIN)
extern const char kAshBrowserTests[];
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index 4ab486da4a..f704280101 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_impl.h"
-#include "chrome/browser/extensions/chrome_extensions_browser_client.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"
@@ -28,18 +27,19 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#endif
-#if !defined(OS_IOS) && !defined(OS_ANDROID)
-#include "chrome/browser/media_galleries/media_file_system_registry.h"
-#include "components/storage_monitor/storage_monitor.h"
-#include "components/storage_monitor/test_storage_monitor.h"
-#endif
-
#if defined(ENABLE_CONFIGURATION_POLICY)
#include "components/policy/core/browser/browser_policy_connector.h"
#else
#include "components/policy/core/common/policy_service_stub.h"
#endif // defined(ENABLE_CONFIGURATION_POLICY)
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
+#include "chrome/browser/media_galleries/media_file_system_registry.h"
+#include "components/storage_monitor/storage_monitor.h"
+#include "components/storage_monitor/test_storage_monitor.h"
+#endif
+
#if defined(ENABLE_FULL_PRINTING)
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
@@ -71,13 +71,13 @@ TestingBrowserProcess::TestingBrowserProcess()
local_state_(NULL),
io_thread_(NULL),
system_request_context_(NULL),
- platform_part_(new TestingBrowserProcessPlatformPart()),
- extensions_browser_client_(
- new extensions::ChromeExtensionsBrowserClient) {
+ platform_part_(new TestingBrowserProcessPlatformPart()) {
#if defined(ENABLE_EXTENSIONS)
+ extensions_browser_client_.reset(
+ new extensions::ChromeExtensionsBrowserClient);
apps::AppsClient::Set(ChromeAppsClient::GetInstance());
-#endif
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
+#endif
}
TestingBrowserProcess::~TestingBrowserProcess() {
@@ -85,7 +85,9 @@ TestingBrowserProcess::~TestingBrowserProcess() {
#if defined(ENABLE_CONFIGURATION_POLICY)
SetBrowserPolicyConnector(NULL);
#endif
+#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionsBrowserClient::Set(NULL);
+#endif
// Destructors for some objects owned by TestingBrowserProcess will use
// g_browser_process if it is not NULL, so it must be NULL before proceeding.
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h
index fb4e3568a9..b12410a2cf 100644
--- a/chrome/test/base/testing_browser_process.h
+++ b/chrome/test/base/testing_browser_process.h
@@ -166,10 +166,6 @@ class TestingBrowserProcess : public BrowserProcess {
scoped_refptr<SafeBrowsingService> sb_service_;
#endif // !defined(OS_IOS)
-#if !defined(OS_IOS) && !defined(OS_ANDROID)
- scoped_ptr<MediaFileSystemRegistry> media_file_system_registry_;
-#endif
-
scoped_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
// The following objects are not owned by TestingBrowserProcess:
@@ -179,7 +175,11 @@ class TestingBrowserProcess : public BrowserProcess {
scoped_ptr<BrowserProcessPlatformPart> platform_part_;
+#if defined(ENABLE_EXTENSIONS)
+ scoped_ptr<MediaFileSystemRegistry> media_file_system_registry_;
+
scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_;
+#endif
DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess);
};
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index d49df37d25..7aede511fc 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -19,8 +19,6 @@
#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_system_factory.h"
-#include "chrome/browser/extensions/test_extension_system.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"
@@ -84,8 +82,10 @@
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_special_storage_policy.h"
-#include "chrome/browser/guest_view/guest_view_manager.h"
+#include "chrome/browser/extensions/extension_system_factory.h"
+#include "chrome/browser/extensions/test_extension_system.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/guest_view/guest_view_manager.h"
#endif
#if defined(OS_ANDROID)
@@ -354,8 +354,10 @@ void TestingProfile::Init() {
if (!IsOffTheRecord())
CreateProfilePolicyConnector();
+#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory(
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
@@ -818,7 +820,7 @@ HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() {
content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
- return GuestViewManager::FromBrowserContext(this);
+ return extensions::GuestViewManager::FromBrowserContext(this);
#else
return NULL;
#endif
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc
index 66c54a9570..dd41700b32 100644
--- a/chrome/test/base/testing_profile_manager.cc
+++ b/chrome/test/base/testing_profile_manager.cc
@@ -34,7 +34,8 @@ class ProfileManager : public ::ProfileManagerWithoutInit {
TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process)
: called_set_up_(false),
browser_process_(process),
- local_state_(process) {
+ local_state_(process),
+ profile_manager_(NULL) {
}
TestingProfileManager::~TestingProfileManager() {
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc
index d3c4f1cde5..b8c2a3a248 100644
--- a/chrome/test/base/view_event_test_base.cc
+++ b/chrome/test/base/view_event_test_base.cc
@@ -5,42 +5,16 @@
#include "chrome/test/base/view_event_test_base.h"
#include "base/bind.h"
-#include "base/bind_helpers.h"
#include "base/message_loop/message_loop.h"
-#include "base/strings/string_number_conversions.h"
#include "chrome/test/base/chrome_unit_test_suite.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/testing_browser_process.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "ui/aura/client/event_client.h"
-#include "ui/aura/env.h"
-#include "ui/aura/test/aura_test_helper.h"
-#include "ui/aura/window_event_dispatcher.h"
-#include "ui/aura/window_tree_host.h"
+#include "chrome/test/base/view_event_test_platform_part.h"
#include "ui/base/ime/input_method_initializer.h"
#include "ui/base/test/ui_controls.h"
#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/message_center/message_center.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-#include "ui/wm/core/default_activation_client.h"
-#include "ui/wm/core/wm_state.h"
-
-#if defined(USE_ASH)
-#include "ash/shell.h"
-#include "ash/shell_init_params.h"
-#include "ash/test/test_session_state_delegate.h"
-#include "ash/test/test_shell_delegate.h"
-#endif
-
-#if defined(OS_CHROMEOS)
-#include "chromeos/audio/cras_audio_handler.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/network/network_handler.h"
-#else // !defined(OS_CHROMEOS)
-#include "ui/views/widget/desktop_aura/desktop_screen.h"
-#endif
namespace {
@@ -101,51 +75,16 @@ void ViewEventTestBase::SetUpTestCase() {
}
void ViewEventTestBase::SetUp() {
- wm_state_.reset(new wm::WMState);
-
views::ViewsDelegate::views_delegate = &views_delegate_;
ui::InitializeInputMethodForTesting();
- gfx::NativeView context = NULL;
// The ContextFactory must exist before any Compositors are created.
bool enable_pixel_output = false;
ui::ContextFactory* context_factory =
ui::InitializeContextFactoryForTests(enable_pixel_output);
-#if defined(OS_CHROMEOS)
- // 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::CrasAudioHandler::InitializeForTesting();
- chromeos::NetworkHandler::Initialize();
- ash::test::TestShellDelegate* shell_delegate =
- new ash::test::TestShellDelegate();
- ash::ShellInitParams init_params;
- init_params.delegate = shell_delegate;
- init_params.context_factory = context_factory;
- ash::Shell::CreateInstance(init_params);
- shell_delegate->test_session_state_delegate()
- ->SetActiveUserSessionStarted(true);
- context = ash::Shell::GetPrimaryRootWindow();
- context->GetHost()->Show();
-#elif defined(USE_ASH)
- // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
- // interactive_ui_tests is brought up on that platform.
- gfx::Screen::SetScreenInstance(
- gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
- aura::Env::CreateInstance(true);
- aura::Env::GetInstance()->set_context_factory(context_factory);
-#elif defined(USE_AURA)
- // Instead of using the ash shell, use an AuraTestHelper to create and manage
- // the test screen.
- aura_test_helper_.reset(
- new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
- aura_test_helper_->SetUp(context_factory);
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
- context = aura_test_helper_->root_window();
-#endif
-
+ platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory));
+ gfx::NativeWindow context = platform_part_->GetContext();
window_ = views::Widget::CreateWindowWithContext(this, context);
}
@@ -157,28 +96,12 @@ void ViewEventTestBase::TearDown() {
}
ui::Clipboard::DestroyClipboardForCurrentThread();
-
-#if defined(USE_ASH)
-#if defined(OS_CHROMEOS)
- ash::Shell::DeleteInstance();
- chromeos::NetworkHandler::Shutdown();
- chromeos::CrasAudioHandler::Shutdown();
- chromeos::DBusThreadManager::Shutdown();
- // Ash Shell can't just live on its own without a browser process, we need to
- // also shut down the message center.
- message_center::MessageCenter::Shutdown();
-#endif
- aura::Env::DeleteInstance();
-#elif defined(USE_AURA)
- aura_test_helper_->TearDown();
-#endif // !USE_ASH && USE_AURA
+ platform_part_.reset();
ui::TerminateContextFactoryForTests();
ui::ShutdownInputMethodForTesting();
views::ViewsDelegate::views_delegate = NULL;
-
- wm_state_.reset();
}
bool ViewEventTestBase::CanResize() const {
diff --git a/chrome/test/base/view_event_test_base.h b/chrome/test/base/view_event_test_base.h
index 424ef0f2a3..a3d7290aba 100644
--- a/chrome/test/base/view_event_test_base.h
+++ b/chrome/test/base/view_event_test_base.h
@@ -24,19 +24,11 @@
#include "ui/base/win/scoped_ole_initializer.h"
#endif
-namespace aura {
-namespace test {
-class AuraTestHelper;
-}
-}
-
namespace gfx {
class Size;
}
-namespace wm {
-class WMState;
-}
+class ViewEventTestPlatformPart;
// Base class for Views based tests that dispatch events.
//
@@ -154,10 +146,7 @@ class ViewEventTestBase : public views::WidgetDelegate,
ui::ScopedOleInitializer ole_initializer_;
#endif
-#if defined(USE_AURA)
- scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
- scoped_ptr<wm::WMState> wm_state_;
-#endif
+ scoped_ptr<ViewEventTestPlatformPart> platform_part_;
ChromeViewsDelegate views_delegate_;
diff --git a/chrome/test/base/view_event_test_platform_part.h b/chrome/test/base/view_event_test_platform_part.h
new file mode 100644
index 0000000000..4fe53fcd4c
--- /dev/null
+++ b/chrome/test/base/view_event_test_platform_part.h
@@ -0,0 +1,38 @@
+// 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.
+
+#ifndef CHROME_TEST_BASE_VIEW_EVENT_TEST_PLATFORM_PART_H_
+#define CHROME_TEST_BASE_VIEW_EVENT_TEST_PLATFORM_PART_H_
+
+#include "base/macros.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace ui {
+class ContextFactory;
+}
+
+// A helper class owned by tests that performs platform specific initialization.
+// ViewEventTestPlatformPart behaves a bit like views::ViewsTestHelper, but on
+// ChromeOS it will create an Ash shell environment, rather than using an
+// AuraTestHelper.
+class ViewEventTestPlatformPart {
+ public:
+ virtual ~ViewEventTestPlatformPart() {}
+
+ // Set up the platform-specific environment. Teardown is performed in the
+ // destructor.
+ static ViewEventTestPlatformPart* Create(ui::ContextFactory* context_factory);
+
+ // The Widget context for creating the test window. This will be the Ash root
+ // window on ChromeOS environments. Otherwise it should return NULL.
+ virtual gfx::NativeWindow GetContext() = 0;
+
+ protected:
+ ViewEventTestPlatformPart() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPart);
+};
+
+#endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_PLATFORM_PART_H_
diff --git a/chrome/test/base/view_event_test_platform_part_ash.cc b/chrome/test/base/view_event_test_platform_part_ash.cc
new file mode 100644
index 0000000000..51ed1c42ca
--- /dev/null
+++ b/chrome/test/base/view_event_test_platform_part_ash.cc
@@ -0,0 +1,52 @@
+// 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 "chrome/test/base/view_event_test_platform_part.h"
+
+#include "ui/aura/env.h"
+#include "ui/gfx/screen.h"
+#include "ui/views/widget/desktop_aura/desktop_screen.h"
+#include "ui/wm/core/wm_state.h"
+
+namespace {
+
+// ChromeViewsTestHelper implementation for non-ChromeOS environments, where the
+// Ash desktop environment is available (use_ash=1, chromeos=0).
+class ViewEventTestPlatformPartAsh : public ViewEventTestPlatformPart {
+ public:
+ explicit ViewEventTestPlatformPartAsh(ui::ContextFactory* context_factory);
+ virtual ~ViewEventTestPlatformPartAsh();
+
+ // Overridden from ViewEventTestPlatformPart:
+ virtual gfx::NativeWindow GetContext() OVERRIDE {
+ return NULL; // No context, so that desktop tree hosts are used by default.
+ }
+
+ private:
+ wm::WMState wm_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAsh);
+};
+
+ViewEventTestPlatformPartAsh::ViewEventTestPlatformPartAsh(
+ ui::ContextFactory* context_factory) {
+ // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
+ // interactive_ui_tests is brought up on that platform.
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
+ views::CreateDesktopScreen());
+ aura::Env::CreateInstance(true);
+ aura::Env::GetInstance()->set_context_factory(context_factory);
+}
+
+ViewEventTestPlatformPartAsh::~ViewEventTestPlatformPartAsh() {
+ aura::Env::DeleteInstance();
+}
+
+} // namespace
+
+// static
+ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
+ ui::ContextFactory* context_factory) {
+ return new ViewEventTestPlatformPartAsh(context_factory);
+}
diff --git a/chrome/test/base/view_event_test_platform_part_chromeos.cc b/chrome/test/base/view_event_test_platform_part_chromeos.cc
new file mode 100644
index 0000000000..9e5e6102f7
--- /dev/null
+++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc
@@ -0,0 +1,76 @@
+// 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 "chrome/test/base/view_event_test_platform_part.h"
+
+#include "ash/shell.h"
+#include "ash/shell_init_params.h"
+#include "ash/test/test_session_state_delegate.h"
+#include "ash/test/test_shell_delegate.h"
+#include "chromeos/audio/cras_audio_handler.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/network/network_handler.h"
+#include "ui/aura/env.h"
+#include "ui/aura/window_tree_host.h"
+#include "ui/message_center/message_center.h"
+#include "ui/wm/core/wm_state.h"
+
+namespace {
+
+// ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1).
+class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart {
+ public:
+ explicit ViewEventTestPlatformPartChromeOS(
+ ui::ContextFactory* context_factory);
+ virtual ~ViewEventTestPlatformPartChromeOS();
+
+ // Overridden from ViewEventTestPlatformPart:
+ virtual gfx::NativeWindow GetContext() OVERRIDE {
+ return ash::Shell::GetPrimaryRootWindow();
+ }
+
+ private:
+ wm::WMState wm_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS);
+};
+
+ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS(
+ ui::ContextFactory* context_factory) {
+ // 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::CrasAudioHandler::InitializeForTesting();
+ chromeos::NetworkHandler::Initialize();
+ ash::test::TestShellDelegate* shell_delegate =
+ new ash::test::TestShellDelegate();
+ ash::ShellInitParams init_params;
+ init_params.delegate = shell_delegate;
+ init_params.context_factory = context_factory;
+ ash::Shell::CreateInstance(init_params);
+ shell_delegate->test_session_state_delegate()->SetActiveUserSessionStarted(
+ true);
+ GetContext()->GetHost()->Show();
+}
+
+ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() {
+ ash::Shell::DeleteInstance();
+ chromeos::NetworkHandler::Shutdown();
+ chromeos::CrasAudioHandler::Shutdown();
+ chromeos::DBusThreadManager::Shutdown();
+ // Ash Shell can't just live on its own without a browser process, we need to
+ // also shut down the message center.
+ message_center::MessageCenter::Shutdown();
+
+ aura::Env::DeleteInstance();
+}
+
+} // namespace
+
+// static
+ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
+ ui::ContextFactory* context_factory) {
+ return new ViewEventTestPlatformPartChromeOS(context_factory);
+}
diff --git a/chrome/test/base/view_event_test_platform_part_mac.mm b/chrome/test/base/view_event_test_platform_part_mac.mm
new file mode 100644
index 0000000000..d20ab7fa38
--- /dev/null
+++ b/chrome/test/base/view_event_test_platform_part_mac.mm
@@ -0,0 +1,27 @@
+// 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 "chrome/test/base/view_event_test_platform_part.h"
+
+namespace {
+
+// ViewEventTestPlatformPart implementation for toolkit-views on Mac.
+class ViewEventTestPlatformPartMac : public ViewEventTestPlatformPart {
+ public:
+ ViewEventTestPlatformPartMac() {}
+
+ // Overridden from ViewEventTestPlatformPart:
+ virtual gfx::NativeWindow GetContext() OVERRIDE { return NULL; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartMac);
+};
+
+} // namespace
+
+// static
+ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
+ ui::ContextFactory* context_factory) {
+ return new ViewEventTestPlatformPartMac();
+}
diff --git a/chrome/test/chromedriver/OWNERS b/chrome/test/chromedriver/OWNERS
index b2fe24d732..b397f827df 100644
--- a/chrome/test/chromedriver/OWNERS
+++ b/chrome/test/chromedriver/OWNERS
@@ -1,3 +1,4 @@
craigdh@chromium.org
frankf@chromium.org
+samuong@chromium.org
stgao@chromium.org
diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc
index ad11603a46..474d3dbb88 100644
--- a/chrome/test/chromedriver/capabilities.cc
+++ b/chrome/test/chromedriver/capabilities.cc
@@ -185,7 +185,7 @@ Status ParseProxy(const base::Value& option, Capabilities* capabilities) {
std::string proxy_type;
if (!proxy_dict->GetString("proxyType", &proxy_type))
return Status(kUnknownError, "'proxyType' must be a string");
- proxy_type = StringToLowerASCII(proxy_type);
+ proxy_type = base::StringToLowerASCII(proxy_type);
if (proxy_type == "direct") {
capabilities->switches.SetSwitch("no-proxy-server");
} else if (proxy_type == "system") {
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.cc b/chrome/test/chromedriver/chrome/navigation_tracker.cc
index aad70e5db6..6d3f2f3d2c 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker.cc
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.cc
@@ -14,8 +14,7 @@ NavigationTracker::NavigationTracker(DevToolsClient* client,
const BrowserInfo* browser_info)
: client_(client),
loading_state_(kUnknown),
- browser_info_(browser_info),
- num_frames_pending_(0) {
+ browser_info_(browser_info) {
client_->AddListener(this);
}
@@ -24,8 +23,7 @@ NavigationTracker::NavigationTracker(DevToolsClient* client,
const BrowserInfo* browser_info)
: client_(client),
loading_state_(known_state),
- browser_info_(browser_info),
- num_frames_pending_(0) {
+ browser_info_(browser_info) {
client_->AddListener(this);
}
@@ -87,8 +85,11 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
const std::string& method,
const base::DictionaryValue& params) {
if (method == "Page.frameStartedLoading") {
+ std::string frame_id;
+ if (!params.GetString("frameId", &frame_id))
+ return Status(kUnknownError, "missing or invalid 'frameId'");
+ pending_frame_set_.insert(frame_id);
loading_state_ = kLoading;
- num_frames_pending_++;
} else if (method == "Page.frameStoppedLoading") {
// Versions of Blink before revision 170248 sent a single
// Page.frameStoppedLoading event per page, but 170248 and newer revisions
@@ -111,10 +112,14 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
expecting_single_stop_event = browser_info_->blink_revision < 170248;
}
- num_frames_pending_--;
+ std::string frame_id;
+ if (!params.GetString("frameId", &frame_id))
+ return Status(kUnknownError, "missing or invalid 'frameId'");
+
+ pending_frame_set_.erase(frame_id);
- if (num_frames_pending_ <= 0 || expecting_single_stop_event) {
- num_frames_pending_ = 0;
+ if (pending_frame_set_.empty() || expecting_single_stop_event) {
+ pending_frame_set_.clear();
loading_state_ = kNotLoading;
}
} else if (method == "Page.frameScheduledNavigation") {
@@ -146,7 +151,7 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
// See crbug.com/180742.
const base::Value* unused_value;
if (!params.Get("frame.parentId", &unused_value)) {
- num_frames_pending_ = 0;
+ pending_frame_set_.clear();
scheduled_frame_set_.clear();
}
} else if (method == "Inspector.targetCrashed") {
@@ -200,6 +205,6 @@ Status NavigationTracker::OnCommandSuccess(DevToolsClient* client,
void NavigationTracker::ResetLoadingState(LoadingState loading_state) {
loading_state_ = loading_state;
- num_frames_pending_ = 0;
+ pending_frame_set_.clear();
scheduled_frame_set_.clear();
}
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.h b/chrome/test/chromedriver/chrome/navigation_tracker.h
index e6d198dbe0..0d02138177 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker.h
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.h
@@ -55,7 +55,7 @@ class NavigationTracker : public DevToolsEventListener {
DevToolsClient* client_;
LoadingState loading_state_;
const BrowserInfo* browser_info_;
- int num_frames_pending_;
+ std::set<std::string> pending_frame_set_;
std::set<std::string> scheduled_frame_set_;
void ResetLoadingState(LoadingState loading_state);
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc
index e2f333a451..6febf8de9d 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc
+++ b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc
@@ -27,19 +27,20 @@ void AssertTrackerExpectsSingleStopEvent(BrowserInfo* browser_info) {
StubDevToolsClient client;
NavigationTracker tracker(&client, browser_info);
base::DictionaryValue params;
+ params.SetString("frameId", "f");
- // num_frames_pending_ == 0
+ // pending_frames_set_.size() == 0
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
- // num_frames_pending_ == 1
+ // pending_frames_set_.size() == 1
ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
- // num_frames_pending_ == 2
+ // pending_frames_set_.size() == 2
ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStoppedLoading", params).code());
- // num_frames_pending_ == 0
+ // pending_frames_set_.size() == 0
ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", false));
}
@@ -48,31 +49,36 @@ void AssertTrackerExpectsMultipleStopEvents(BrowserInfo* browser_info) {
NavigationTracker tracker(&client, browser_info);
base::DictionaryValue params;
- // num_frames_pending_ == 0
+ // pending_frames_set_.size() == 0
+ params.SetString("frameId", "1");
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
- // num_frames_pending_ == 1
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
+ // pending_frames_set_.size() == 1
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "1", true));
+ params.SetString("frameId", "2");
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
- // num_frames_pending_ == 2
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
+ // pending_frames_set_.size() == 2
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "2", true));
+ params.SetString("frameId", "2");
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStoppedLoading", params).code());
- // num_frames_pending_ == 1
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
+ // pending_frames_set_.size() == 1
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "2", true));
+ params.SetString("frameId", "1");
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStoppedLoading", params).code());
- // num_frames_pending_ == 0
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", false));
+ // pending_frames_set_.size() == 0
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "1", false));
+ params.SetString("frameId", "3");
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStoppedLoading", params).code());
- // num_frames_pending_ == 0
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", false));
+ // pending_frames_set_.size() == 0
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "3", false));
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
- // num_frames_pending_ == 1
- ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
+ // pending_frames_set_.size() == 1
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "3", true));
}
} // namespace
@@ -83,6 +89,30 @@ TEST(NavigationTracker, FrameLoadStartStop) {
NavigationTracker tracker(&client, &browser_info);
base::DictionaryValue params;
+ params.SetString("frameId", "f");
+
+ ASSERT_EQ(
+ kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
+ ASSERT_EQ(
+ kOk, tracker.OnEvent(&client, "Page.frameStoppedLoading", params).code());
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", false));
+}
+
+// When a frame fails to load due to (for example) a DNS resolution error, we
+// can sometimes see two Page.frameStartedLoading events with only a single
+// Page.frameStoppedLoading event.
+TEST(NavigationTracker, FrameLoadStartStartStop) {
+ StubDevToolsClient client;
+ BrowserInfo browser_info;
+ NavigationTracker tracker(&client, &browser_info);
+
+ base::DictionaryValue params;
+ params.SetString("frameId", "f");
+
+ ASSERT_EQ(
+ kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
+ ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
ASSERT_EQ(
kOk, tracker.OnEvent(&client, "Page.frameStartedLoading", params).code());
ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true));
@@ -298,6 +328,7 @@ TEST(NavigationTracker, UnknownStateForcesStart) {
TEST(NavigationTracker, UnknownStateForcesStartReceivesStop) {
base::DictionaryValue params;
+ params.SetString("frameId", "f");
DeterminingLoadStateDevToolsClient client(
true, "Page.frameStoppedLoading", &params);
BrowserInfo browser_info;
@@ -307,6 +338,7 @@ TEST(NavigationTracker, UnknownStateForcesStartReceivesStop) {
TEST(NavigationTracker, OnSuccessfulNavigate) {
base::DictionaryValue params;
+ params.SetString("frameId", "f");
DeterminingLoadStateDevToolsClient client(
true, "Page.frameStoppedLoading", &params);
BrowserInfo browser_info;
@@ -318,6 +350,7 @@ TEST(NavigationTracker, OnSuccessfulNavigate) {
TEST(NavigationTracker, OnSuccessfulNavigateStillWaiting) {
base::DictionaryValue params;
+ params.SetString("frameId", "f");
DeterminingLoadStateDevToolsClient client(true, std::string(), &params);
BrowserInfo browser_info;
NavigationTracker tracker(
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc
index 480332c5ec..d54377aab7 100644
--- a/chrome/test/chromedriver/chrome_launcher.cc
+++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -538,7 +538,8 @@ void ConvertHexadecimalToIDAlphabet(std::string* id) {
std::string GenerateExtensionId(const std::string& input) {
uint8 hash[16];
crypto::SHA256HashString(input, hash, sizeof(hash));
- std::string output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash)));
+ std::string output =
+ base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash)));
ConvertHexadecimalToIDAlphabet(&output);
return output;
}
diff --git a/chrome/test/chromedriver/server/http_handler.cc b/chrome/test/chromedriver/server/http_handler.cc
index 1d8baf0259..e7150557ba 100644
--- a/chrome/test/chromedriver/server/http_handler.cc
+++ b/chrome/test/chromedriver/server/http_handler.cc
@@ -694,7 +694,7 @@ namespace internal {
const char kNewSessionPathPattern[] = "session";
bool MatchesMethod(HttpMethod command_method, const std::string& method) {
- std::string lower_method = StringToLowerASCII(method);
+ std::string lower_method = base::StringToLowerASCII(method);
switch (command_method) {
case kGet:
return lower_method == "get";
diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc
index 300a73f01e..e9e1712c60 100644
--- a/chrome/test/gpu/webgl_infobar_browsertest.cc
+++ b/chrome/test/gpu/webgl_infobar_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/theme_resources.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/test_launcher_utils.h"
#include "chrome/test/base/test_switches.h"
@@ -27,7 +28,6 @@
#include "content/public/common/page_transition_types.h"
#include "content/public/test/browser_test_utils.h"
#include "gpu/config/gpu_test_config.h"
-#include "grit/theme_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_implementation.h"
diff --git a/chrome/test/nacl/nacl_browsertest_uma.cc b/chrome/test/nacl/nacl_browsertest_uma.cc
index fb7a463f7d..f7ee54beef 100644
--- a/chrome/test/nacl/nacl_browsertest_uma.cc
+++ b/chrome/test/nacl/nacl_browsertest_uma.cc
@@ -78,7 +78,7 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, SuccessfulLoadUMA, {
}
})
-class NaClBrowserTestVcacheExtension:
+class NaClBrowserTestNewlibVcacheExtension:
public NaClBrowserTestNewlibExtension {
public:
virtual base::FilePath::StringType Variant() OVERRIDE {
@@ -86,7 +86,7 @@ class NaClBrowserTestVcacheExtension:
}
};
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestVcacheExtension,
+IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibVcacheExtension,
ValidationCacheOfMainNexe) {
// Hardcoded extension AppID that corresponds to the hardcoded
// public key in the manifest.json file. We need to load the extension
@@ -98,7 +98,7 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestVcacheExtension,
RunNaClIntegrationTest(full_url, true);
// Make sure histograms from child processes have been accumulated in the
- // browser brocess.
+ // browser process.
UMAHistogramHelper histograms;
histograms.Fetch();
// Should have received 2 validation queries (one for IRT and one for NEXE),
@@ -124,6 +124,57 @@ IN_PROC_BROWSER_TEST_F(NaClBrowserTestVcacheExtension,
histograms.ExpectTotalCount("NaCl.ValidationCache.Set", 2);
}
+class NaClBrowserTestGLibcVcacheExtension:
+ public NaClBrowserTestGLibcExtension {
+ public:
+ virtual base::FilePath::StringType Variant() OVERRIDE {
+ return FILE_PATH_LITERAL("extension_vcache_test/glibc");
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(NaClBrowserTestGLibcVcacheExtension,
+ ValidationCacheOfMainNexe) {
+ // Hardcoded extension AppID that corresponds to the hardcoded
+ // public key in the manifest.json file. We need to load the extension
+ // nexe from the same origin, so we can't just try to load the extension
+ // nexe as a mime-type handler from a non-extension URL.
+ base::FilePath::StringType full_url =
+ FILE_PATH_LITERAL("chrome-extension://cbcdidchbppangcjoddlpdjlenngjldk/")
+ FILE_PATH_LITERAL("extension_validation_cache.html");
+ RunNaClIntegrationTest(full_url, true);
+
+ // Make sure histograms from child processes have been accumulated in the
+ // browser process.
+ UMAHistogramHelper histograms;
+ histograms.Fetch();
+ // Should have received 9 validation queries, which respond with misses:
+ // - the IRT
+ // - ld.so (the initial nexe)
+ // - main.nexe
+ // - libppapi_cpp.so
+ // - libpthread.so.9b15f6a6
+ // - libstdc++.so.6
+ // - libgcc_s.so.1
+ // - libc.so.9b15f6a6
+ // - libm.so.9b15f6a6
+ histograms.ExpectBucketCount("NaCl.ValidationCache.Query",
+ nacl::NaClBrowser::CACHE_MISS, 9);
+ // TOTAL should then be 9 queries so far.
+ histograms.ExpectTotalCount("NaCl.ValidationCache.Query", 9);
+ // Should have received a cache setting afterwards for IRT and nexe.
+ histograms.ExpectBucketCount("NaCl.ValidationCache.Set",
+ nacl::NaClBrowser::CACHE_HIT, 9);
+
+ // Load it again to hit the cache.
+ RunNaClIntegrationTest(full_url, true);
+ histograms.Fetch();
+ // Should have received 9 more validation queries and responded with hits.
+ histograms.ExpectBucketCount("NaCl.ValidationCache.Query",
+ nacl::NaClBrowser::CACHE_HIT, 9);
+ histograms.ExpectTotalCount("NaCl.ValidationCache.Query", 18);
+ histograms.ExpectTotalCount("NaCl.ValidationCache.Set", 9);
+}
+
// Test that validation for the 2 PNaCl translator nexes can be cached.
IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl,
ValidationCacheOfTranslatorNexes) {
diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc
index 2112893003..461d9f03a9 100644
--- a/chrome/test/nacl/nacl_browsertest_util.cc
+++ b/chrome/test/nacl/nacl_browsertest_util.cc
@@ -330,3 +330,21 @@ void NaClBrowserTestNewlibExtension::SetUpCommandLine(
command_line->AppendSwitchPath(switches::kLoadExtension,
src_root.Append(document_root));
}
+
+void NaClBrowserTestGLibcExtension::SetUpCommandLine(
+ CommandLine* command_line) {
+ NaClBrowserTestBase::SetUpCommandLine(command_line);
+ base::FilePath src_root;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &src_root));
+
+ // Extension-based tests should specialize the GetDocumentRoot() / Variant()
+ // to point at the isolated the test extension directory.
+ // Otherwise, multiple NaCl extensions tests will end up sharing the
+ // same directory when loading the extension files.
+ base::FilePath document_root;
+ ASSERT_TRUE(GetDocumentRoot(&document_root));
+
+ // Document root is relative to source root, and source root may not be CWD.
+ command_line->AppendSwitchPath(switches::kLoadExtension,
+ src_root.Append(document_root));
+}
diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h
index c972c2f72c..643d56e471 100644
--- a/chrome/test/nacl/nacl_browsertest_util.h
+++ b/chrome/test/nacl/nacl_browsertest_util.h
@@ -151,6 +151,11 @@ class NaClBrowserTestNewlibExtension : public NaClBrowserTestNewlib {
virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
};
+class NaClBrowserTestGLibcExtension : public NaClBrowserTestGLibc {
+ public:
+ virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
+};
+
// PNaCl tests take a long time on windows debug builds
// and sometimes time out. Disable until it is made faster:
// https://code.google.com/p/chromium/issues/detail?id=177555
diff --git a/chrome/test/nacl/pnacl_header_test.cc b/chrome/test/nacl/pnacl_header_test.cc
index 0ebb121139..e4922aa586 100644
--- a/chrome/test/nacl/pnacl_header_test.cc
+++ b/chrome/test/nacl/pnacl_header_test.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/path_service.h"
+#include "base/test/scoped_path_override.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
@@ -45,6 +46,16 @@ void PnaclHeaderTest::RunLoadTest(const std::string& url,
content::JavascriptTestObserver observer(
browser()->tab_strip_model()->GetActiveWebContents(),
&handler);
+
+ // Make sure this is able to do a pexe fetch, even without access
+ // to the PNaCl component files (make DIR_PNACL_COMPONENT empty).
+ // The pexe fetch that is done with special headers must be able to
+ // start before the component files are on disk. This is because it
+ // is the pexe fetch that helps trigger an on-demand installation
+ // which installs the files to disk (if that hasn't already happened
+ // in the background).
+ 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.
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc
index bece9c7a06..b590bfc98f 100644
--- a/chrome/test/ppapi/ppapi_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -1067,8 +1067,14 @@ IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
LIST_TEST(Audio_AudioCallback4) \
)
+#if defined(OS_LINUX)
+// http://crbug.com/396464
+#define MAYBE_Audio DISABLED_Audio
+#else
+#define MAYBE_Audio Audio
+#endif
// PPB_Audio is not supported in-process.
-IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Audio) {
+IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
RUN_AUDIO_SUBTESTS;
}
IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, Audio) {
@@ -1247,8 +1253,9 @@ IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
#define MAYBE_Compositor0 DISABLED_Compositor0
#define MAYBE_Compositor1 DISABLED_Compositor1
#else
-#define MAYBE_Compositor0 Compositor0
-#define MAYBE_Compositor1 Compositor1
+// flaky on Linux: http://crbug.com/396482
+#define MAYBE_Compositor0 DISABLED_Compositor0
+#define MAYBE_Compositor1 DISABLED_Compositor1
#endif
TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
diff --git a/chrome/test/remoting/fullscreen_browsertest.cc b/chrome/test/remoting/fullscreen_browsertest.cc
new file mode 100644
index 0000000000..6b9f5100a6
--- /dev/null
+++ b/chrome/test/remoting/fullscreen_browsertest.cc
@@ -0,0 +1,75 @@
+// 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/file_util.h"
+#include "base/files/file_path.h"
+#include "chrome/test/remoting/remote_desktop_browsertest.h"
+#include "chrome/test/remoting/waiter.h"
+
+namespace remoting {
+
+class FullscreenBrowserTest : public RemoteDesktopBrowserTest {
+ protected:
+ bool WaitForFullscreenChange(bool expect_fullscreen);
+};
+
+bool FullscreenBrowserTest::WaitForFullscreenChange(bool expect_fullscreen) {
+ std::string javascript = expect_fullscreen ?
+ "remoting.fullscreen.isActive()" :
+ "!remoting.fullscreen.isActive()";
+ ConditionalTimeoutWaiter waiter(
+ base::TimeDelta::FromSeconds(20),
+ base::TimeDelta::FromSeconds(1),
+ base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete,
+ active_web_contents(),
+ javascript));
+ bool result = waiter.Wait();
+ // Entering or leaving full-screen mode causes local and remote desktop
+ // reconfigurations that can take a while to settle down, so wait a few
+ // seconds before continuing.
+ TimeoutWaiter(base::TimeDelta::FromSeconds(10)).Wait();
+ return result;
+}
+
+IN_PROC_BROWSER_TEST_F(FullscreenBrowserTest, MANUAL_Me2Me_Fullscreen) {
+ SetUpTestForMe2Me();
+ ConnectToLocalHost(false);
+
+ // Verify that we're initially not full-screen.
+ EXPECT_FALSE(ExecuteScriptAndExtractBool(
+ "remoting.fullscreen.isActive()"));
+
+ // Click the full-screen button and verify that it activates full-screen mode.
+ ClickOnControl("toggle-full-screen");
+ EXPECT_TRUE(WaitForFullscreenChange(true));
+
+ // Click the full-screen button again and verify that it deactivates
+ // full-screen mode.
+ ClickOnControl("toggle-full-screen");
+ EXPECT_TRUE(WaitForFullscreenChange(false));
+
+ // Enter full-screen mode again, then disconnect and verify that full-screen
+ // mode is deactivated upon disconnection.
+ // TODO(jamiewalch): For the v2 app, activate full-screen mode indirectly by
+ // maximizing the window for the second test.
+ ClickOnControl("toggle-full-screen");
+ EXPECT_TRUE(WaitForFullscreenChange(true));
+ DisconnectMe2Me();
+ EXPECT_TRUE(WaitForFullscreenChange(false));
+
+ Cleanup();
+}
+
+IN_PROC_BROWSER_TEST_F(FullscreenBrowserTest, MANUAL_Me2Me_Bump_Scroll) {
+ SetUpTestForMe2Me();
+
+ content::WebContents* content = app_web_content();
+ LoadScript(content, FILE_PATH_LITERAL("bump_scroll_browser_test.js"));
+
+ RunJavaScriptTest(content, "Bump_Scroll", "{pin: '" + me2me_pin() + "'}");
+
+ Cleanup();
+}
+
+} // namespace remoting
diff --git a/chrome/test/remoting/me2me_browsertest.cc b/chrome/test/remoting/me2me_browsertest.cc
index a8bc82ba5d..a53d07166b 100644
--- a/chrome/test/remoting/me2me_browsertest.cc
+++ b/chrome/test/remoting/me2me_browsertest.cc
@@ -16,7 +16,6 @@ class Me2MeBrowserTest : public RemoteDesktopBrowserTest {
void ConnectPinlessAndCleanupPairings(bool cleanup_all);
bool IsPairingSpinnerHidden();
- bool WaitForFullscreenChange(bool expect_fullscreen);
};
IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
@@ -67,42 +66,6 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
Cleanup();
}
-IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, MANUAL_Me2Me_Fullscreen) {
- VerifyInternetAccess();
- Install();
- LaunchChromotingApp();
-
- // Authorize, Authenticate, and Approve.
- Auth();
- ExpandMe2Me();
-
- ConnectToLocalHost(false);
-
- // Verify that we're initially not full-screen.
- EXPECT_FALSE(ExecuteScriptAndExtractBool(
- "remoting.fullscreen.isActive()"));
-
- // Click the full-screen button and verify that it activates full-screen mode.
- ClickOnControl("toggle-full-screen");
- EXPECT_TRUE(WaitForFullscreenChange(true));
-
- // Click the full-screen button again and verify that it deactivates
- // full-screen mode.
- ClickOnControl("toggle-full-screen");
- EXPECT_TRUE(WaitForFullscreenChange(false));
-
- // Enter full-screen mode again, then disconnect and verify that full-screen
- // mode is deactivated upon disconnection.
- // TODO(jamiewalch): For the v2 app, activate full-screen mode indirectly by
- // maximizing the window for the second test.
- ClickOnControl("toggle-full-screen");
- EXPECT_TRUE(WaitForFullscreenChange(true));
- DisconnectMe2Me();
- EXPECT_TRUE(WaitForFullscreenChange(false));
-
- Cleanup();
-}
-
void Me2MeBrowserTest::TestKeyboardInput() {
// We will assume here that the browser window is already open on the host
// and in focus.
@@ -187,17 +150,4 @@ bool Me2MeBrowserTest::IsPairingSpinnerHidden() {
return !HtmlElementVisible("paired-client-manager-dialog-working");
}
-bool Me2MeBrowserTest::WaitForFullscreenChange(bool expect_fullscreen) {
- std::string javascript = expect_fullscreen ?
- "remoting.fullscreen.isActive()" :
- "!remoting.fullscreen.isActive()";
- ConditionalTimeoutWaiter waiter(
- base::TimeDelta::FromSeconds(10),
- base::TimeDelta::FromMilliseconds(500),
- base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete,
- active_web_contents(),
- javascript));
- return waiter.Wait();
-}
-
} // namespace remoting
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc
index 6510489bb7..e5ed2e68c6 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -721,7 +721,7 @@ void RemoteDesktopBrowserTest::EnterPin(const std::string& pin,
// we should verify that it only pops up at the right circumstance. That
// probably belongs in a separate test case though.
ConditionalTimeoutWaiter waiter(
- base::TimeDelta::FromSeconds(5),
+ base::TimeDelta::FromSeconds(30),
base::TimeDelta::FromSeconds(1),
base::Bind(&RemoteDesktopBrowserTest::IsPinFormVisible, this));
EXPECT_TRUE(waiter.Wait());
@@ -747,7 +747,7 @@ void RemoteDesktopBrowserTest::WaitForConnection() {
// TODO(weitaosu): Instead of polling, can we register a callback to
// remoting.clientSession.onStageChange_?
ConditionalTimeoutWaiter waiter(
- base::TimeDelta::FromSeconds(4),
+ base::TimeDelta::FromSeconds(30),
base::TimeDelta::FromSeconds(1),
base::Bind(&RemoteDesktopBrowserTest::IsSessionConnected, this));
EXPECT_TRUE(waiter.Wait());