diff --git a/DEPS b/DEPS index b4a68586..8770fb9 100644 --- a/DEPS +++ b/DEPS
@@ -74,7 +74,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '526c39f41f62f9ab82ebbeb30cc8762bb0eaa417', + 'skia_revision': 'c25db637532cd10dde7855d868c0d033e96f61f2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -636,7 +636,7 @@ Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd', 'src/third_party/webgl/src': - Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '05591bbeae6592fd924caec8e728a4ea86cbb8c9', + Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '1a8ed15c9c25f2b1ccd97149c94ea245ab982252', 'src/third_party/webrtc': Var('webrtc_git') + '/src.git' + '@' + '1aa285974b6b2c5d1afe44b3eafe08f4b80837ed', # commit position 20628
diff --git a/ash/system/night_light/night_light_controller.cc b/ash/system/night_light/night_light_controller.cc index 61f5364..523e1ec55 100644 --- a/ash/system/night_light/night_light_controller.cc +++ b/ash/system/night_light/night_light_controller.cc
@@ -17,6 +17,7 @@ #include "base/metrics/histogram_macros.h" #include "base/numerics/ranges.h" #include "base/time/time.h" +#include "chromeos/dbus/dbus_thread_manager.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "third_party/icu/source/i18n/astro.h" @@ -196,9 +197,13 @@ binding_(this) { Shell::Get()->session_controller()->AddObserver(this); Shell::Get()->window_tree_host_manager()->AddObserver(this); + chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( + this); } NightLightController::~NightLightController() { + chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( + this); Shell::Get()->window_tree_host_manager()->RemoveObserver(this); Shell::Get()->session_controller()->RemoveObserver(this); } @@ -377,6 +382,12 @@ } } +void NightLightController::SuspendDone(const base::TimeDelta& sleep_duration) { + // Time changes while the device is suspended. We need to refresh the schedule + // upon device resume to know what the status should be now. + Refresh(true /* did_schedule_change */); +} + void NightLightController::SetDelegateForTesting( std::unique_ptr<Delegate> delegate) { delegate_ = std::move(delegate); @@ -502,6 +513,7 @@ } // NOTE: Users can set any weird combinations. + const base::Time now = delegate_->GetNow(); if (end_time <= start_time) { // Example: // Start: 9:00 PM, End: 6:00 AM. @@ -511,8 +523,30 @@ // | | // end start // - // From our perspective, the end time is always a day later. - end_time += base::TimeDelta::FromDays(1); + // Note that the above times are times of day (today). It is important to + // know where "now" is with respect to these times to decide how to adjust + // them. + if (end_time >= now) { + // If the end time (today) is greater than the time now, this means "now" + // is within the NightLight schedule, and the start time is actually + // yesterday. The above timeline is interpreted as: + // + // 21:00 (-1day) 6:00 + // <----- + ----------- + ------ + -----> + // | | | + // start now end + // + start_time -= base::TimeDelta::FromDays(1); + } else { + // Two possibilities here: + // - Either "now" is greater than the end time, but less than start time. + // This means NightLight is outside the schedule, waiting for the next + // start time. The end time is actually a day later. + // - Or "now" is greater than both the start and end times. This means + // NightLight is within the schedule, waiting to turn off at the next + // end time, which is also a day later. + end_time += base::TimeDelta::FromDays(1); + } } DCHECK_GE(end_time, start_time); @@ -522,7 +556,6 @@ bool enable_now = false; // Where are we now with respect to the start and end times? - const base::Time now = delegate_->GetNow(); if (now < start_time) { // Example: // Start: 6:00 PM today, End: 6:00 AM tomorrow, Now: 4:00 PM.
diff --git a/ash/system/night_light/night_light_controller.h b/ash/system/night_light/night_light_controller.h index 82afc112..a4671ea 100644 --- a/ash/system/night_light/night_light_controller.h +++ b/ash/system/night_light/night_light_controller.h
@@ -15,6 +15,7 @@ #include "base/observer_list.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chromeos/dbus/power_manager_client.h" #include "components/prefs/pref_change_registrar.h" #include "mojo/public/cpp/bindings/binding.h" @@ -27,9 +28,11 @@ // Controls the NightLight feature that adjusts the color temperature of the // screen. -class ASH_EXPORT NightLightController : public mojom::NightLightController, - public WindowTreeHostManager::Observer, - public SessionObserver { +class ASH_EXPORT NightLightController + : public mojom::NightLightController, + public WindowTreeHostManager::Observer, + public SessionObserver, + public chromeos::PowerManagerClient::Observer { public: using ScheduleType = mojom::NightLightController::ScheduleType; @@ -125,6 +128,9 @@ void SetCurrentGeoposition(mojom::SimpleGeopositionPtr position) override; void SetClient(mojom::NightLightClientPtr client) override; + // chromeos::PowerManagerClient::Observer: + void SuspendDone(const base::TimeDelta& sleep_duration) override; + void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); private:
diff --git a/ash/system/night_light/night_light_controller_unittest.cc b/ash/system/night_light/night_light_controller_unittest.cc index 4215fe8..4e776eec 100644 --- a/ash/system/night_light/night_light_controller_unittest.cc +++ b/ash/system/night_light/night_light_controller_unittest.cc
@@ -615,6 +615,128 @@ controller->timer().GetCurrentDelay()); } +// Tests that on device resume from sleep, the NightLight status is updated +// correctly if the time has changed meanwhile. +TEST_F(NightLightTest, TestCustomScheduleOnResume) { + NightLightController* controller = GetController(); + // Now is 4:00 PM. + delegate()->SetFakeNow(TimeOfDay(16 * 60)); + SetNightLightEnabled(false); + // Start time is at 6:00 PM and end time is at 10:00 PM. NightLight should be + // off. + // 16:00 18:00 22:00 + // <----- + ----------- + ----------- + -----> + // | | | + // now start end + // + controller->SetColorTemperature(0.4f); + controller->SetCustomStartTime(TimeOfDay(18 * 60)); + controller->SetCustomEndTime(TimeOfDay(22 * 60)); + controller->SetScheduleType(NightLightController::ScheduleType::kCustom); + + EXPECT_FALSE(controller->GetEnabled()); + TestCompositorsTemperature(0.0f); + EXPECT_TRUE(controller->timer().IsRunning()); + // NightLight should start in 2 hours. + EXPECT_EQ(base::TimeDelta::FromHours(2), + controller->timer().GetCurrentDelay()); + + // Now simulate that the device was suspended for 3 hours, and the time now + // is 7:00 PM when the devices was resumed. Expect that NightLight turns on. + delegate()->SetFakeNow(TimeOfDay(19 * 60)); + controller->SuspendDone(base::TimeDelta::Max()); + + EXPECT_TRUE(controller->GetEnabled()); + TestCompositorsTemperature(0.4f); + EXPECT_TRUE(controller->timer().IsRunning()); + // NightLight should end in 3 hours. + EXPECT_EQ(base::TimeDelta::FromHours(3), + controller->timer().GetCurrentDelay()); +} + +// The following tests ensure that the NightLight schedule is correctly +// refreshed when the start and end times are inverted (i.e. the "start time" as +// a time of day today is in the future with respect to the "end time" also as a +// time of day today). +// +// Case 1: "Now" is less than both "end" and "start". +TEST_F(NightLightTest, TestCustomScheduleInvertedStartAndEndTimesCase1) { + NightLightController* controller = GetController(); + // Now is 4:00 AM. + delegate()->SetFakeNow(TimeOfDay(4 * 60)); + SetNightLightEnabled(false); + // Start time is at 9:00 PM and end time is at 6:00 AM. "Now" is less than + // both. NightLight should be on. + // 4:00 6:00 21:00 + // <----- + ----------- + ----------- + -----> + // | | | + // now end start + // + controller->SetColorTemperature(0.4f); + controller->SetCustomStartTime(TimeOfDay(21 * 60)); + controller->SetCustomEndTime(TimeOfDay(6 * 60)); + controller->SetScheduleType(NightLightController::ScheduleType::kCustom); + + EXPECT_TRUE(controller->GetEnabled()); + TestCompositorsTemperature(0.4f); + EXPECT_TRUE(controller->timer().IsRunning()); + // NightLight should end in two hours. + EXPECT_EQ(base::TimeDelta::FromHours(2), + controller->timer().GetCurrentDelay()); +} + +// Case 2: "Now" is between "end" and "start". +TEST_F(NightLightTest, TestCustomScheduleInvertedStartAndEndTimesCase2) { + NightLightController* controller = GetController(); + // Now is 6:00 AM. + delegate()->SetFakeNow(TimeOfDay(6 * 60)); + SetNightLightEnabled(false); + // Start time is at 9:00 PM and end time is at 4:00 AM. "Now" is between both. + // NightLight should be off. + // 4:00 6:00 21:00 + // <----- + ----------- + ----------- + -----> + // | | | + // end now start + // + controller->SetColorTemperature(0.4f); + controller->SetCustomStartTime(TimeOfDay(21 * 60)); + controller->SetCustomEndTime(TimeOfDay(4 * 60)); + controller->SetScheduleType(NightLightController::ScheduleType::kCustom); + + EXPECT_FALSE(controller->GetEnabled()); + TestCompositorsTemperature(0.0f); + EXPECT_TRUE(controller->timer().IsRunning()); + // NightLight should start in 15 hours. + EXPECT_EQ(base::TimeDelta::FromHours(15), + controller->timer().GetCurrentDelay()); +} + +// Case 3: "Now" is greater than both "start" and "end". +TEST_F(NightLightTest, TestCustomScheduleInvertedStartAndEndTimesCase3) { + NightLightController* controller = GetController(); + // Now is 11:00 PM. + delegate()->SetFakeNow(TimeOfDay(23 * 60)); + SetNightLightEnabled(false); + // Start time is at 9:00 PM and end time is at 4:00 AM. "Now" is greater than + // both. NightLight should be on. + // 4:00 21:00 23:00 + // <----- + ----------- + ----------- + -----> + // | | | + // end start now + // + controller->SetColorTemperature(0.4f); + controller->SetCustomStartTime(TimeOfDay(21 * 60)); + controller->SetCustomEndTime(TimeOfDay(4 * 60)); + controller->SetScheduleType(NightLightController::ScheduleType::kCustom); + + EXPECT_TRUE(controller->GetEnabled()); + TestCompositorsTemperature(0.4f); + EXPECT_TRUE(controller->timer().IsRunning()); + // NightLight should end in 5 hours. + EXPECT_EQ(base::TimeDelta::FromHours(5), + controller->timer().GetCurrentDelay()); +} + } // namespace } // namespace ash
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index f15adbe1..ae5b9a4 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc
@@ -115,6 +115,17 @@ ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); ui::InitializeInputMethodForTesting(); + if (config_ == Config::MUS && !::switches::IsMusHostingViz()) { + ui::ContextFactory* context_factory = nullptr; + ui::ContextFactoryPrivate* context_factory_private = nullptr; + ui::InitializeContextFactoryForTests(false /* enable_pixel_output */, + &context_factory, + &context_factory_private); + auto* env = aura::Env::GetInstance(); + env->set_context_factory(context_factory); + env->set_context_factory_private(context_factory_private); + } + // Creates Shell and hook with Desktop. if (!test_shell_delegate_) test_shell_delegate_ = new TestShellDelegate; @@ -221,8 +232,7 @@ dbus_thread_manager_initialized_ = false; } - if (config_ == Config::CLASSIC) - ui::TerminateContextFactoryForTests(); + ui::TerminateContextFactoryForTests(); ui::ShutdownInputMethodForTesting(); zero_duration_mode_.reset();
diff --git a/ash/test/ash_test_helper.h b/ash/test/ash_test_helper.h index 6f293b09..e745c2d 100644 --- a/ash/test/ash_test_helper.h +++ b/ash/test/ash_test_helper.h
@@ -63,6 +63,9 @@ explicit AshTestHelper(AshTestEnvironment* ash_test_environment); ~AshTestHelper(); + // This is intended to be called from TestSuites, not individual configs. + static void set_config(Config config) { config_ = config; } + // Returns the configuration that tests are run in. See ash::Config enum for // details. static Config config() { return config_; }
diff --git a/ash/test/ash_test_suite.cc b/ash/test/ash_test_suite.cc index 74b22840..40d7d7f2 100644 --- a/ash/test/ash_test_suite.cc +++ b/ash/test/ash_test_suite.cc
@@ -18,6 +18,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" +#include "ui/compositor/test/context_factories_for_test.h" #include "ui/gfx/gfx_paths.h" #include "ui/gl/test/gl_surface_test_support.h" @@ -70,15 +71,13 @@ env_ = aura::Env::CreateInstance(is_mus || is_mash ? aura::Env::Mode::MUS : aura::Env::Mode::LOCAL); - if (is_mus || is_mash) { + if (is_mash) { context_factory_ = std::make_unique<aura::test::AuraTestContextFactory>(); env_->set_context_factory(context_factory_.get()); env_->set_context_factory_private(nullptr); // mus needs to host viz, because ash by itself cannot. - if (is_mash) { - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kMus, switches::kMusHostVizValue); - } + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( + switches::kMus, switches::kMusHostVizValue); } }
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index 40a6486..e47349f1 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -654,6 +654,7 @@ "tiles/picture_layer_tiling_set_unittest.cc", "tiles/picture_layer_tiling_unittest.cc", "tiles/software_image_decode_cache_unittest.cc", + "tiles/software_image_decode_cache_unittest_combinations.cc", "tiles/tile_manager_unittest.cc", "tiles/tile_priority_unittest.cc", "trees/damage_tracker_unittest.cc", @@ -712,6 +713,13 @@ ] } + if (is_win) { + # TODO(vmpstr): Some SoftwareImageDecodeCacheTests use virtual inheritance, + # which MSVC doesn't like. Suppress "Foo inherits Bar via dominance" + # warnings for now. + cflags = [ "/wd4250" ] + } + # TODO(khushalsagar): Remove once crbug.com/683263 is fixed. configs = [ "//build/config/compiler:no_size_t_to_int_warning" ]
diff --git a/cc/debug/picture_debug_util.cc b/cc/debug/picture_debug_util.cc index 1174cb8..86ca1c6 100644 --- a/cc/debug/picture_debug_util.cc +++ b/cc/debug/picture_debug_util.cc
@@ -12,65 +12,19 @@ #include "base/base64.h" #include "base/logging.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkData.h" -#include "third_party/skia/include/core/SkImageInfo.h" #include "third_party/skia/include/core/SkPicture.h" -#include "third_party/skia/include/core/SkPixelSerializer.h" -#include "third_party/skia/include/core/SkStream.h" #include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/codec/png_codec.h" -namespace { - -class BitmapSerializer : public SkPixelSerializer { - protected: - bool onUseEncodedData(const void* data, size_t len) override { return true; } - - SkData* onEncode(const SkPixmap& pixmap) override { - std::vector<unsigned char> data; - - // If bitmap is opaque, encode as JPEG. - // Otherwise encode as PNG. - bool encoding_succeeded = false; - if (pixmap.isOpaque()) { - constexpr int kJpegQuality = 80; - encoding_succeeded = gfx::JPEGCodec::Encode(pixmap, kJpegQuality, &data); - } else { - const SkImageInfo& info = pixmap.info(); - const void* pixels = pixmap.addr(); - size_t row_bytes = pixmap.rowBytes(); - - SkBitmap bm; - // The cast is ok, since we only read the bm. - if (!bm.installPixels(info, const_cast<void*>(pixels), row_bytes)) { - return nullptr; - } - encoding_succeeded = gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &data); - } - - if (encoding_succeeded) { - return SkData::MakeWithCopy(&data.front(), data.size()).release(); - } - return nullptr; - } -}; - -} // namespace - namespace cc { void PictureDebugUtil::SerializeAsBase64(const SkPicture* picture, std::string* output) { - SkDynamicMemoryWStream stream; - BitmapSerializer serializer; - picture->serialize(&stream, &serializer); - - size_t serialized_size = stream.bytesWritten(); - std::unique_ptr<char[]> serialized_picture(new char[serialized_size]); - stream.copyTo(serialized_picture.get()); + sk_sp<SkData> data = picture->serialize(); base::Base64Encode( - base::StringPiece(serialized_picture.get(), serialized_size), output); + base::StringPiece(static_cast<const char*>(data->data()), data->size()), + output); } } // namespace cc
diff --git a/cc/paint/paint_image.cc b/cc/paint/paint_image.cc index 6a1dee3..d74a86f 100644 --- a/cc/paint/paint_image.cc +++ b/cc/paint/paint_image.cc
@@ -143,13 +143,6 @@ return SkISize::Make(width(), height()); } -SkImageInfo PaintImage::CreateDecodeImageInfo(const SkISize& size, - SkColorType color_type) const { - DCHECK(GetSupportedDecodeSize(size) == size); - return SkImageInfo::Make(size.width(), size.height(), color_type, - kPremul_SkAlphaType); -} - bool PaintImage::Decode(void* memory, SkImageInfo* info, sk_sp<SkColorSpace> color_space,
diff --git a/cc/paint/paint_image.h b/cc/paint/paint_image.h index 1d4f6f14..b5da344 100644 --- a/cc/paint/paint_image.h +++ b/cc/paint/paint_image.h
@@ -116,11 +116,6 @@ // GetSupportedDecodeSize(size). SkISize GetSupportedDecodeSize(const SkISize& requested_size) const; - // Returns SkImageInfo that should be used to decode this image to the given - // size and color type. The size must be supported. - SkImageInfo CreateDecodeImageInfo(const SkISize& size, - SkColorType color_type) const; - // Decode the image into the given memory for the given SkImageInfo. // - Size in |info| must be supported. // - The amount of memory allocated must be at least
diff --git a/cc/test/fake_paint_image_generator.cc b/cc/test/fake_paint_image_generator.cc index 0d84795..f47036f2 100644 --- a/cc/test/fake_paint_image_generator.cc +++ b/cc/test/fake_paint_image_generator.cc
@@ -27,6 +27,8 @@ size_t row_bytes, size_t frame_index, uint32_t lazy_pixel_ref) { + if (image_backing_memory_.empty()) + return false; frames_decoded_.insert(frame_index); CHECK(image_pixmap_.readPixels(info, pixels, row_bytes, 0, 0)); return true;
diff --git a/cc/tiles/software_image_decode_cache.cc b/cc/tiles/software_image_decode_cache.cc index 732c2bc..171a189 100644 --- a/cc/tiles/software_image_decode_cache.cc +++ b/cc/tiles/software_image_decode_cache.cc
@@ -53,7 +53,7 @@ const int kMinDimensionToSubrect = 4 * 1024; const float kMemoryRatioToSubrect = 0.5f; -// Tracing ID sequence for use in DecodedImage. +// Tracing ID sequence for use in CacheEntry. base::AtomicSequenceNumber g_next_tracing_id_; class AutoRemoveKeyFromTaskMap { @@ -73,36 +73,18 @@ const SoftwareImageDecodeCache::ImageKey& key_; }; -class AutoDrawWithImageFinished { - public: - AutoDrawWithImageFinished(SoftwareImageDecodeCache* cache, - const DrawImage& draw_image, - const DecodedDrawImage& decoded_draw_image) - : cache_(cache), - draw_image_(draw_image), - decoded_draw_image_(decoded_draw_image) {} - ~AutoDrawWithImageFinished() { - cache_->DrawWithImageFinished(draw_image_, decoded_draw_image_); - } - - private: - SoftwareImageDecodeCache* cache_; - const DrawImage& draw_image_; - const DecodedDrawImage& decoded_draw_image_; -}; - class SoftwareImageDecodeTaskImpl : public TileTask { public: SoftwareImageDecodeTaskImpl( SoftwareImageDecodeCache* cache, const SoftwareImageDecodeCache::ImageKey& image_key, - const DrawImage& image, + const PaintImage& paint_image, SoftwareImageDecodeCache::DecodeTaskType task_type, const ImageDecodeCache::TracingInfo& tracing_info) : TileTask(true), cache_(cache), image_key_(image_key), - image_(image), + paint_image_(paint_image), task_type_(task_type), tracing_info_(tracing_info) {} @@ -112,15 +94,15 @@ "software", "source_prepare_tiles_id", tracing_info_.prepare_tiles_id); devtools_instrumentation::ScopedImageDecodeTask image_decode_task( - image_.paint_image().GetSkImage().get(), + paint_image_.GetSkImage().get(), devtools_instrumentation::ScopedImageDecodeTask::kSoftware, ImageDecodeCache::ToScopedTaskType(tracing_info_.task_type)); - cache_->DecodeImage(image_key_, image_, task_type_); + cache_->DecodeImageInTask(image_key_, paint_image_, task_type_); } // Overridden from TileTask: void OnTaskCompleted() override { - cache_->RemovePendingTask(image_key_, task_type_); + cache_->OnImageDecodeTaskCompleted(image_key_, task_type_); } protected: @@ -129,7 +111,7 @@ private: SoftwareImageDecodeCache* cache_; SoftwareImageDecodeCache::ImageKey image_key_; - DrawImage image_; + PaintImage paint_image_; SoftwareImageDecodeCache::DecodeTaskType task_type_; const ImageDecodeCache::TracingInfo tracing_info_; @@ -157,10 +139,9 @@ return std::min(key.filter_quality(), kLow_SkFilterQuality); } -SkImageInfo CreateImageInfo(size_t width, - size_t height, - SkColorType color_type) { - return SkImageInfo::Make(width, height, color_type, kPremul_SkAlphaType); +SkImageInfo CreateImageInfo(const SkISize& size, SkColorType color_type) { + return SkImageInfo::Make(size.width(), size.height(), color_type, + kPremul_SkAlphaType); } void RecordLockExistingCachedImageHistogram(TilePriority::PriorityBin bin, @@ -189,13 +170,19 @@ return gfx::Rect(x, y, right - x, bottom - y); } +std::unique_ptr<base::DiscardableMemory> AllocateDiscardable( + const SkImageInfo& info) { + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), "AllocateDiscardable"); + return base::DiscardableMemoryAllocator::GetInstance() + ->AllocateLockedDiscardableMemory(info.minRowBytes() * info.height()); +} + } // namespace SoftwareImageDecodeCache::SoftwareImageDecodeCache( SkColorType color_type, size_t locked_memory_limit_bytes) : decoded_images_(ImageMRUCache::NO_AUTO_EVICT), - at_raster_decoded_images_(ImageMRUCache::NO_AUTO_EVICT), locked_images_budget_(locked_memory_limit_bytes), color_type_(color_type), max_items_in_cache_(kNormalMaxItemsInCacheForSoftware) { @@ -211,10 +198,6 @@ } SoftwareImageDecodeCache::~SoftwareImageDecodeCache() { - // Debugging crbug.com/650234 - CHECK_EQ(0u, decoded_images_ref_counts_.size()); - CHECK_EQ(0u, at_raster_decoded_images_ref_counts_.size()); - // It is safe to unregister, even if we didn't register in the constructor. base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( this); @@ -254,597 +237,399 @@ const DrawImage& image, const TracingInfo& tracing_info, DecodeTaskType task_type) { - // If the image already exists or if we're going to create a task for it, then - // we'll likely need to ref this image (the exception is if we're prerolling - // the image only). That means the image is or will be in the cache. When the - // ref goes to 0, it will be unpinned but will remain in the cache. If the - // image does not fit into the budget, then we don't ref this image, since it - // will be decoded at raster time which is when it will be temporarily put in - // the cache. ImageKey key = ImageKey::FromDrawImage(image, color_type_); TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetTaskForImageAndRef", "key", + "SoftwareImageDecodeCache::GetTaskForImageAndRefInternal", "key", key.ToString()); // If the target size is empty, we can skip this image during draw (and thus // we don't need to decode it or ref it). - if (key.target_size().IsEmpty()) { + if (key.target_size().IsEmpty()) return TaskResult(false); - } base::AutoLock lock(lock_); - // If we already have the image in cache, then we can return it. - auto decoded_it = decoded_images_.Get(key); bool new_image_fits_in_memory = locked_images_budget_.AvailableMemoryBytes() >= key.locked_bytes(); - if (decoded_it != decoded_images_.end()) { - bool image_was_locked = decoded_it->second->is_locked(); - if (image_was_locked || - (new_image_fits_in_memory && decoded_it->second->Lock())) { - RefImage(key); - // If the image wasn't locked, then we just succeeded in locking it. - if (!image_was_locked) { - RecordLockExistingCachedImageHistogram(tracing_info.requesting_tile_bin, - true); - } - return TaskResult(true); + // Get or generate the cache entry. + auto decoded_it = decoded_images_.Get(key); + CacheEntry* cache_entry = nullptr; + if (decoded_it == decoded_images_.end()) { + // There is no reason to create a new entry if we know it won't fit anyway. + if (!new_image_fits_in_memory) + return TaskResult(false); + cache_entry = AddCacheEntry(key); + if (task_type == DecodeTaskType::USE_OUT_OF_RASTER_TASKS) + cache_entry->mark_out_of_raster(); + } else { + cache_entry = decoded_it->second.get(); + } + DCHECK(cache_entry); + + if (!cache_entry->is_budgeted) { + if (!new_image_fits_in_memory) { + // We don't need to ref anything here because this image will be at + // raster. + return TaskResult(false); } - - // If the image fits in memory, then we at least tried to lock it and - // failed. This means that it's not valid anymore. - if (new_image_fits_in_memory) { - RecordLockExistingCachedImageHistogram(tracing_info.requesting_tile_bin, - false); - CleanupDecodedImagesCache(key, decoded_it); - } + AddBudgetForImage(key, cache_entry); } + DCHECK(cache_entry->is_budgeted); - DCHECK(task_type == DecodeTaskType::USE_IN_RASTER_TASKS || - task_type == DecodeTaskType::USE_OUT_OF_RASTER_TASKS); - // If the task exists, return it. Note that if we always need to create a new - // task, then just set |existing_task| to reference the passed in task (which - // is set to nullptr above). - scoped_refptr<TileTask>& existing_task = - (task_type == DecodeTaskType::USE_IN_RASTER_TASKS) - ? pending_in_raster_image_tasks_[key] - : pending_out_of_raster_image_tasks_[key]; - if (existing_task) { - RefImage(key); - return TaskResult(existing_task); + // The rest of the code will return either true or a task, so we should ref + // the image once now for the caller to unref. + ++cache_entry->ref_count; + + // If we already have a locked entry, then we can just use that. Otherwise + // we'll have to create a task. + if (cache_entry->is_locked) + return TaskResult(true); + + scoped_refptr<TileTask>& task = + task_type == DecodeTaskType::USE_IN_RASTER_TASKS + ? cache_entry->in_raster_task + : cache_entry->out_of_raster_task; + if (!task) { + // Ref image once for the decode task. + ++cache_entry->ref_count; + task = base::MakeRefCounted<SoftwareImageDecodeTaskImpl>( + this, key, image.paint_image(), task_type, tracing_info); } - - // At this point, we have to create a new image/task, so we need to abort if - // it doesn't fit into memory and there are currently no raster tasks that - // would have already accounted for memory. The latter part is possible if - // there's a running raster task that could not be canceled, and still has a - // ref to the image that is now being reffed for the new schedule. - if (!new_image_fits_in_memory && (decoded_images_ref_counts_.find(key) == - decoded_images_ref_counts_.end())) { - return TaskResult(false); - } - - // Actually create the task. RefImage will account for memory on the first - // ref. - RefImage(key); - existing_task = base::MakeRefCounted<SoftwareImageDecodeTaskImpl>( - this, key, image, task_type, tracing_info); - return TaskResult(existing_task); + return TaskResult(task); } -void SoftwareImageDecodeCache::RefImage(const ImageKey& key) { +void SoftwareImageDecodeCache::AddBudgetForImage(const ImageKey& key, + CacheEntry* entry) { TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::RefImage", "key", key.ToString()); + "SoftwareImageDecodeCache::AddBudgetForImage", "key", + key.ToString()); lock_.AssertAcquired(); - int ref = ++decoded_images_ref_counts_[key]; - if (ref == 1) { - DCHECK_GE(locked_images_budget_.AvailableMemoryBytes(), key.locked_bytes()); - locked_images_budget_.AddUsage(key.locked_bytes()); - } + + DCHECK(!entry->is_budgeted); + DCHECK_GE(locked_images_budget_.AvailableMemoryBytes(), key.locked_bytes()); + locked_images_budget_.AddUsage(key.locked_bytes()); + entry->is_budgeted = true; +} + +void SoftwareImageDecodeCache::RemoveBudgetForImage(const ImageKey& key, + CacheEntry* entry) { + TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), + "SoftwareImageDecodeCache::RemoveBudgetForImage", "key", + key.ToString()); + lock_.AssertAcquired(); + + DCHECK(entry->is_budgeted); + locked_images_budget_.SubtractUsage(key.locked_bytes()); + entry->is_budgeted = false; } void SoftwareImageDecodeCache::UnrefImage(const DrawImage& image) { - // When we unref the image, there are several situations we need to consider: - // 1. The ref did not reach 0, which means we have to keep the image locked. - // 2. The ref reached 0, we should unlock it. - // 2a. The image isn't in the locked cache because we didn't get to decode - // it yet (or failed to decode it). - // 2b. Unlock the image but keep it in list. const ImageKey& key = ImageKey::FromDrawImage(image, color_type_); TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), "SoftwareImageDecodeCache::UnrefImage", "key", key.ToString()); base::AutoLock lock(lock_); - auto ref_count_it = decoded_images_ref_counts_.find(key); - DCHECK(ref_count_it != decoded_images_ref_counts_.end()); + UnrefImage(key); +} - --ref_count_it->second; - if (ref_count_it->second == 0) { - decoded_images_ref_counts_.erase(ref_count_it); - locked_images_budget_.SubtractUsage(key.locked_bytes()); - - auto decoded_image_it = decoded_images_.Peek(key); - // If we've never decoded the image before ref reached 0, then we wouldn't - // have it in our cache. This would happen if we canceled tasks. - if (decoded_image_it == decoded_images_.end()) - return; - DCHECK(decoded_image_it->second->is_locked()); - decoded_image_it->second->Unlock(); +void SoftwareImageDecodeCache::UnrefImage(const ImageKey& key) { + lock_.AssertAcquired(); + auto decoded_image_it = decoded_images_.Peek(key); + DCHECK(decoded_image_it != decoded_images_.end()); + auto* entry = decoded_image_it->second.get(); + DCHECK_GT(entry->ref_count, 0); + if (--entry->ref_count == 0) { + if (entry->is_budgeted) + RemoveBudgetForImage(key, entry); + if (entry->is_locked) + entry->Unlock(); } } -void SoftwareImageDecodeCache::DecodeImage(const ImageKey& key, - const DrawImage& image, - DecodeTaskType task_type) { - TRACE_EVENT1("cc", "SoftwareImageDecodeCache::DecodeImage", "key", +void SoftwareImageDecodeCache::DecodeImageInTask(const ImageKey& key, + const PaintImage& paint_image, + DecodeTaskType task_type) { + TRACE_EVENT1("cc", "SoftwareImageDecodeCache::DecodeImageInTask", "key", key.ToString()); base::AutoLock lock(lock_); - AutoRemoveKeyFromTaskMap remove_key_from_task_map( - (task_type == DecodeTaskType::USE_IN_RASTER_TASKS) - ? &pending_in_raster_image_tasks_ - : &pending_out_of_raster_image_tasks_, - key); - - // We could have finished all of the raster tasks (cancelled) while the task - // was just starting to run. Since this task already started running, it - // wasn't cancelled. So, if the ref count for the image is 0 then we can just - // abort. - if (decoded_images_ref_counts_.find(key) == - decoded_images_ref_counts_.end()) { - return; - } auto image_it = decoded_images_.Peek(key); - if (image_it != decoded_images_.end()) { - if (image_it->second->is_locked() || image_it->second->Lock()) - return; - CleanupDecodedImagesCache(key, image_it); - } + DCHECK(image_it != decoded_images_.end()); + auto* cache_entry = image_it->second.get(); + // These two checks must be true because we're running this from a task, which + // means that we've budgeted this entry when we got the task and the ref count + // is also held by the task (released in OnTaskCompleted). + DCHECK_GT(cache_entry->ref_count, 0); + DCHECK(cache_entry->is_budgeted); - std::unique_ptr<DecodedImage> decoded_image; - { - base::AutoUnlock unlock(lock_); - decoded_image = DecodeImageInternal(key, image); - } - - // Abort if we failed to decode the image. - if (!decoded_image) - return; - - // At this point, it could have been the case that this image was decoded in - // place by an already running raster task from a previous schedule. If that's - // the case, then it would have already been placed into the cache (possibly - // locked). Remove it if that was the case. - image_it = decoded_images_.Peek(key); - if (image_it != decoded_images_.end()) { - if (image_it->second->is_locked() || image_it->second->Lock()) { - // Make sure to unlock the decode we did in this function. - decoded_image->Unlock(); - return; - } - CleanupDecodedImagesCache(key, image_it); - } - - // We could have finished all of the raster tasks (cancelled) while this image - // decode task was running, which means that we now have a locked image but no - // ref counts. Unlock it immediately in this case. - if (decoded_images_ref_counts_.find(key) == - decoded_images_ref_counts_.end()) { - decoded_image->Unlock(); - } - - if (task_type == DecodeTaskType::USE_OUT_OF_RASTER_TASKS) - decoded_image->mark_out_of_raster(); - + DecodeImageIfNecessary(key, paint_image, cache_entry); + DCHECK(cache_entry->decode_failed || cache_entry->is_locked); RecordImageMipLevelUMA( MipMapUtil::GetLevelForSize(key.src_rect().size(), key.target_size())); - - CacheDecodedImages(key, std::move(decoded_image)); } -std::unique_ptr<SoftwareImageDecodeCache::DecodedImage> -SoftwareImageDecodeCache::DecodeImageInternal(const ImageKey& key, - const DrawImage& draw_image) { +void SoftwareImageDecodeCache::DecodeImageIfNecessary( + const ImageKey& key, + const PaintImage& paint_image, + CacheEntry* entry) { TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::DecodeImageInternal", "key", + "SoftwareImageDecodeCache::DecodeImageIfNecessary", "key", key.ToString()); - const PaintImage& paint_image = draw_image.paint_image(); - if (!paint_image) - return nullptr; + lock_.AssertAcquired(); + DCHECK_GT(entry->ref_count, 0); - // Special case subrect into a special function. - if (key.should_use_subrect()) - return GetSubrectImageDecode(key, paint_image); - - // There are two cases where we can use the exact size image decode: - // - If we we're using full image (no subset) and we can decode natively to - // that scale, or - // - If we're not doing a scale at all (which is supported by all decoders and - // subsetting is handled in the draw calls). - // TODO(vmpstr): See if we can subrect the result of decoded to scale. - SkIRect full_size_rect = - SkIRect::MakeWH(paint_image.width(), paint_image.height()); - bool need_subset = (gfx::RectToSkIRect(key.src_rect()) != full_size_rect); - SkISize exact_size = - SkISize::Make(key.target_size().width(), key.target_size().height()); - // TODO(vmpstr): If an image of a bigger size is already decoded and is - // lock-able then it might be faster to just scale that instead of redecoding - // to exact scale. We need to profile this. - if ((!need_subset && - exact_size == paint_image.GetSupportedDecodeSize(exact_size)) || - SkIRect::MakeSize(exact_size) == full_size_rect) { - return GetExactSizeImageDecode(key, paint_image); - } - return GetScaledImageDecode(key, paint_image); -} - -DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDraw( - const DrawImage& draw_image) { - ImageKey key = ImageKey::FromDrawImage(draw_image, color_type_); - TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetDecodedImageForDraw", "key", - key.ToString()); - // If the target size is empty, we can skip this image draw. if (key.target_size().IsEmpty()) - return DecodedDrawImage(nullptr, kNone_SkFilterQuality); + entry->decode_failed = true; - return GetDecodedImageForDrawInternal(key, draw_image); -} + if (entry->decode_failed) + return; -DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDrawInternal( - const ImageKey& key, - const DrawImage& draw_image) { - TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetDecodedImageForDrawInternal", - "key", key.ToString()); + if (entry->memory) { + if (entry->is_locked) + return; - base::AutoLock lock(lock_); - auto decoded_images_it = decoded_images_.Get(key); - // If we found the image and it's locked, then return it. If it's not locked, - // erase it from the cache since it might be put into the at-raster cache. - std::unique_ptr<DecodedImage> scoped_decoded_image; - DecodedImage* decoded_image = nullptr; - if (decoded_images_it != decoded_images_.end()) { - decoded_image = decoded_images_it->second.get(); - if (decoded_image->is_locked()) { - RefImage(key); - decoded_image->mark_used(); - return DecodedDrawImage( - decoded_image->image(), decoded_image->src_rect_offset(), - GetScaleAdjustment(key), GetDecodedFilterQuality(key)); - } else { - scoped_decoded_image = std::move(decoded_images_it->second); - CleanupDecodedImagesCache(key, decoded_images_it); - } + bool lock_succeeded = entry->Lock(); + // TODO(vmpstr): Deprecate the prepaint split, since it doesn't matter. + RecordLockExistingCachedImageHistogram(TilePriority::NOW, lock_succeeded); + + if (lock_succeeded) + return; } - // See if another thread already decoded this image at raster time. If so, we - // can just use that result directly. - auto at_raster_images_it = at_raster_decoded_images_.Get(key); - if (at_raster_images_it != at_raster_decoded_images_.end()) { - DCHECK(at_raster_images_it->second->is_locked()); - RefAtRasterImage(key); - DecodedImage* at_raster_decoded_image = at_raster_images_it->second.get(); - at_raster_decoded_image->mark_used(); + std::unique_ptr<CacheEntry> local_cache_entry; + // If we can use the original decode, we'll definitely need a decode. + if (key.can_use_original_size_decode()) { + base::AutoUnlock release(lock_); + local_cache_entry = DoDecodeImage(key, paint_image); + } else { + // Use the full image decode to generate a scaled/subrected decode. + // TODO(vmpstr): This part needs to handle decode to scale. + base::Optional<ImageKey> candidate_key; + auto image_keys_it = frame_key_to_image_keys_.find(key.frame_key()); + // We know that we must have at least our own |entry| in this list, so it + // won't be empty. + DCHECK(image_keys_it != frame_key_to_image_keys_.end()); + + auto& available_keys = image_keys_it->second; + std::sort(available_keys.begin(), available_keys.end(), + [](const ImageKey& one, const ImageKey& two) { + // Return true if |one| scale is less than |two| scale. + return one.target_size().width() < two.target_size().width() && + one.target_size().height() < two.target_size().height(); + }); + + for (auto& available_key : available_keys) { + // Only consider keys coming from the same src rect, since otherwise the + // resulting image was extracted using a different src. + if (available_key.src_rect() != key.src_rect()) + continue; + + // that are at least as big as the required |key|. + if (available_key.target_size().width() < key.target_size().width() || + available_key.target_size().height() < key.target_size().height()) { + continue; + } + auto image_it = decoded_images_.Peek(available_key); + DCHECK(image_it != decoded_images_.end()); + auto* available_entry = image_it->second.get(); + if (available_entry->is_locked || available_entry->Lock()) { + candidate_key.emplace(available_key); + break; + } + } + + if (!candidate_key) { + // IMPORTANT: There is a bit of a subtlety here. We would normally want to + // generate a new candidate with the key.src_rect() as the src_rect. This + // would ensure that when scaling we won't need to peek pixels, since it's + // unclear how to adjust the src rect to account for the candidate scale + // if the candidate came from above. + // + // However, if we're in the key.should_use_subrect() case, then this would + // generate an exactly same key as we want in the first place, causing + // infinite recursion. (There is a CHECK guard for this below, since this + // is a pretty bad case.) + // + // In order to avoid this, if we have key.should_use_subrect(), then it + // means that we have no scale associated with this key. So, instead, we + // use the full image rect as the src for this temporary candidate so that + // the GenerateCacheEntryFromCandidate() function will simply extract the + // subset and be done with it. + auto src_rect = + key.should_use_subrect() + ? SkIRect::MakeWH(paint_image.width(), paint_image.height()) + : gfx::RectToSkIRect(key.src_rect()); + DrawImage candidate_draw_image( + paint_image, src_rect, kNone_SkFilterQuality, SkMatrix::I(), + key.frame_key().frame_index(), key.target_color_space()); + candidate_key.emplace( + ImageKey::FromDrawImage(candidate_draw_image, color_type_)); + } + CHECK(*candidate_key != key) << key.ToString(); + auto decoded_draw_image = - DecodedDrawImage(at_raster_decoded_image->image(), - at_raster_decoded_image->src_rect_offset(), - GetScaleAdjustment(key), GetDecodedFilterQuality(key)); - decoded_draw_image.set_at_raster_decode(true); - return decoded_draw_image; - } - - // Now we know that we don't have a locked image, and we seem to be the first - // thread encountering this image (that might not be true, since other threads - // might be decoding it already). This means that we need to decode the image - // assuming we can't lock the one we found in the cache. - bool check_at_raster_cache = false; - if (!decoded_image || !decoded_image->Lock()) { - // Note that we have to release the lock, since this lock is also accessed - // on the compositor thread. This means holding on to the lock might stall - // the compositor thread for the duration of the decode! - base::AutoUnlock unlock(lock_); - scoped_decoded_image = DecodeImageInternal(key, draw_image); - decoded_image = scoped_decoded_image.get(); - - // Skip the image if we couldn't decode it. - if (!decoded_image) - return DecodedDrawImage(nullptr, kNone_SkFilterQuality); - check_at_raster_cache = true; - } - - DCHECK(decoded_image == scoped_decoded_image.get()); - - // While we unlocked the lock, it could be the case that another thread - // already decoded this already and put it in the at-raster cache. Look it up - // first. - if (check_at_raster_cache) { - at_raster_images_it = at_raster_decoded_images_.Get(key); - if (at_raster_images_it != at_raster_decoded_images_.end()) { - // We have to drop our decode, since the one in the cache is being used by - // another thread. - decoded_image->Unlock(); - decoded_image = at_raster_images_it->second.get(); - scoped_decoded_image = nullptr; + GetDecodedImageForDrawInternal(*candidate_key, paint_image); + if (!decoded_draw_image.image()) { + local_cache_entry = nullptr; + } else { + base::AutoUnlock release(lock_); + // IMPORTANT: More subtleties: + // If the candidate could have used the original decode, that means we + // need to extractSubset from it. In all other cases, this would have + // already been done to generate the candidate. + local_cache_entry = GenerateCacheEntryFromCandidate( + key, decoded_draw_image, + candidate_key->can_use_original_size_decode()); } + + // Unref to balance the GetDecodedImageForDrawInternal() call. + UnrefImage(*candidate_key); } - // If we really are the first ones, or if the other thread already unlocked - // the image, then put our work into at-raster time cache. - if (scoped_decoded_image) - at_raster_decoded_images_.Put(key, std::move(scoped_decoded_image)); + if (!local_cache_entry) { + entry->decode_failed = true; + return; + } - DCHECK(decoded_image); - DCHECK(decoded_image->is_locked()); - RefAtRasterImage(key); - decoded_image->mark_used(); - auto decoded_draw_image = - DecodedDrawImage(decoded_image->image(), decoded_image->src_rect_offset(), - GetScaleAdjustment(key), GetDecodedFilterQuality(key)); - decoded_draw_image.set_at_raster_decode(true); - return decoded_draw_image; + // Just in case someone else did this already, just unlock our work. + // TODO(vmpstr): It's possible to have a pending decode state where the + // thread would just block on a cv and wait for that decode to finish + // instead of actually doing the work. + if (entry->memory) { + // This would have to be locked because we hold a ref count on the entry. So + // if someone ever populated the entry with memory, they would not be able + // to unlock it. + DCHECK(entry->is_locked); + // Unlock our local memory though. + local_cache_entry->Unlock(); + } else { + local_cache_entry->MoveImageMemoryTo(entry); + DCHECK(entry->is_locked); + } } -std::unique_ptr<SoftwareImageDecodeCache::DecodedImage> -SoftwareImageDecodeCache::GetExactSizeImageDecode( - const ImageKey& key, - const PaintImage& paint_image) { - SkISize decode_size = +std::unique_ptr<SoftwareImageDecodeCache::CacheEntry> +SoftwareImageDecodeCache::DoDecodeImage(const ImageKey& key, + const PaintImage& paint_image) { + SkISize target_size = SkISize::Make(key.target_size().width(), key.target_size().height()); - DCHECK(decode_size == paint_image.GetSupportedDecodeSize(decode_size)); + DCHECK(target_size == paint_image.GetSupportedDecodeSize(target_size)); - SkImageInfo decoded_info = - paint_image.CreateDecodeImageInfo(decode_size, color_type_); + SkImageInfo target_info = CreateImageInfo(target_size, color_type_); + std::unique_ptr<base::DiscardableMemory> target_pixels = + AllocateDiscardable(target_info); + DCHECK(target_pixels); - std::unique_ptr<base::DiscardableMemory> decoded_pixels; - { - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetOriginalSizeImageDecode - " - "allocate decoded pixels"); - decoded_pixels = - base::DiscardableMemoryAllocator::GetInstance() - ->AllocateLockedDiscardableMemory(decoded_info.minRowBytes() * - decoded_info.height()); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), + "SoftwareImageDecodeCache::DoDecodeImage - " + "decode"); + DCHECK(!key.should_use_subrect()); + bool result = paint_image.Decode(target_pixels->data(), &target_info, + key.target_color_space().ToSkColorSpace(), + key.frame_key().frame_index()); + if (!result) { + target_pixels->Unlock(); + return nullptr; } - { - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetOriginalSizeImageDecode - " - "decode"); - bool result = paint_image.Decode(decoded_pixels->data(), &decoded_info, - key.target_color_space().ToSkColorSpace(), - key.frame_key().frame_index()); - if (!result) { - decoded_pixels->Unlock(); - return nullptr; - } - } - - return std::make_unique<DecodedImage>(decoded_info, std::move(decoded_pixels), - SkSize::Make(0, 0)); + return std::make_unique<CacheEntry>(target_info, std::move(target_pixels), + SkSize::Make(0, 0)); } -std::unique_ptr<SoftwareImageDecodeCache::DecodedImage> -SoftwareImageDecodeCache::GetSubrectImageDecode(const ImageKey& key, - const PaintImage& image) { - // Construct a key to use in GetDecodedImageForDrawInternal(). - // This allows us to reuse an image in any cache if available. - // This uses the original sized image, since when we're subrecting, there is - // no scale. - // TODO(vmpstr): This doesn't have to be true, but the Key generation makes it - // so. We could also subrect scaled images. - SkIRect exact_size_rect = SkIRect::MakeWH(image.width(), image.height()); - DrawImage exact_size_draw_image(image, exact_size_rect, kNone_SkFilterQuality, - SkMatrix::I(), key.frame_key().frame_index(), - key.target_color_space()); - ImageKey exact_size_key = - ImageKey::FromDrawImage(exact_size_draw_image, color_type_); +std::unique_ptr<SoftwareImageDecodeCache::CacheEntry> +SoftwareImageDecodeCache::GenerateCacheEntryFromCandidate( + const ImageKey& key, + const DecodedDrawImage& candidate_image, + bool needs_extract_subset) { + SkISize target_size = + SkISize::Make(key.target_size().width(), key.target_size().height()); + SkImageInfo target_info = CreateImageInfo(target_size, color_type_); + std::unique_ptr<base::DiscardableMemory> target_pixels = + AllocateDiscardable(target_info); + DCHECK(target_pixels); -// Sanity checks. -#if DCHECK_IS_ON() - SkISize exact_target_size = - SkISize::Make(exact_size_key.target_size().width(), - exact_size_key.target_size().height()); - DCHECK(image.GetSupportedDecodeSize(exact_target_size) == exact_target_size); - DCHECK(!exact_size_key.should_use_subrect()); -#endif - - auto decoded_draw_image = - GetDecodedImageForDrawInternal(exact_size_key, exact_size_draw_image); - AutoDrawWithImageFinished auto_finish_draw(this, exact_size_draw_image, - decoded_draw_image); - if (!decoded_draw_image.image()) - return nullptr; - - DCHECK(SkColorSpace::Equals(decoded_draw_image.image()->colorSpace(), - key.target_color_space().ToSkColorSpace().get())); - SkImageInfo subrect_info = CreateImageInfo( - key.target_size().width(), key.target_size().height(), color_type_); - std::unique_ptr<base::DiscardableMemory> subrect_pixels; - { + if (key.should_use_subrect()) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetSubrectImageDecode - " - "allocate subrect pixels"); - // TODO(vmpstr): This is using checked math to diagnose a problem reported - // in crbug.com/662217. If this is causing crashes, then it should be fixed - // elsewhere by skipping images that are too large. - base::CheckedNumeric<size_t> byte_size = subrect_info.minRowBytes(); - byte_size *= subrect_info.height(); - subrect_pixels = - base::DiscardableMemoryAllocator::GetInstance() - ->AllocateLockedDiscardableMemory(byte_size.ValueOrDie()); - } - { - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::GetSubrectImageDecode - " - "read pixels"); - bool result = decoded_draw_image.image()->readPixels( - subrect_info, subrect_pixels->data(), subrect_info.minRowBytes(), + "SoftwareImageDecodeCache::GenerateCacheEntryFromCandidate - " + "subrect"); + bool result = candidate_image.image()->readPixels( + target_info, target_pixels->data(), target_info.minRowBytes(), key.src_rect().x(), key.src_rect().y(), SkImage::kDisallow_CachingHint); // We have a decoded image, and we're reading into already allocated memory. // This should never fail. - DCHECK(result); + DCHECK(result) << key.ToString(); + return std::make_unique<CacheEntry>( + target_info.makeColorSpace(candidate_image.image()->refColorSpace()), + std::move(target_pixels), + SkSize::Make(-key.src_rect().x(), -key.src_rect().y())); } - return std::make_unique<DecodedImage>( - subrect_info.makeColorSpace(decoded_draw_image.image()->refColorSpace()), - std::move(subrect_pixels), - SkSize::Make(-key.src_rect().x(), -key.src_rect().y())); -} - -std::unique_ptr<SoftwareImageDecodeCache::DecodedImage> -SoftwareImageDecodeCache::GetScaledImageDecode(const ImageKey& key, - const PaintImage& image) { - // Construct a key to use in GetDecodedImageForDrawInternal(). - // This allows us to reuse an image in any cache if available. - // TODO(vmpstr): If we're using a subrect, then we need to decode the original - // image and subset it since the subset might be strict. If we plumb whether - // the subrect is strict or not, we can loosen this condition. - SkIRect full_size_rect = SkIRect::MakeWH(image.width(), image.height()); - bool need_subset = (gfx::RectToSkIRect(key.src_rect()) != full_size_rect); - SkIRect exact_size_rect = - need_subset - ? full_size_rect - : SkIRect::MakeSize(image.GetSupportedDecodeSize(SkISize::Make( - key.target_size().width(), key.target_size().height()))); - - DrawImage exact_size_draw_image(image, exact_size_rect, kNone_SkFilterQuality, - SkMatrix::I(), key.frame_key().frame_index(), - key.target_color_space()); - ImageKey exact_size_key = - ImageKey::FromDrawImage(exact_size_draw_image, color_type_); - -// Sanity checks. -#if DCHECK_IS_ON() - SkISize exact_target_size = - SkISize::Make(exact_size_key.target_size().width(), - exact_size_key.target_size().height()); - DCHECK(image.GetSupportedDecodeSize(exact_target_size) == exact_target_size); - DCHECK(!need_subset || exact_size_key.target_size() == - gfx::Size(image.width(), image.height())); - DCHECK(!exact_size_key.should_use_subrect()); -#endif - - auto decoded_draw_image = - GetDecodedImageForDrawInternal(exact_size_key, exact_size_draw_image); - AutoDrawWithImageFinished auto_finish_draw(this, exact_size_draw_image, - decoded_draw_image); - if (!decoded_draw_image.image()) - return nullptr; - + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), + "SoftwareImageDecodeCache::GenerateCacheEntryFromCandidate - " + "scale"); SkPixmap decoded_pixmap; - bool result = decoded_draw_image.image()->peekPixels(&decoded_pixmap); + // We don't need to subrect this image, since all candidates passed in would + // already have a src_rect applied to them. + bool result = candidate_image.image()->peekPixels(&decoded_pixmap); DCHECK(result) << key.ToString(); - if (need_subset) { + if (needs_extract_subset) { result = decoded_pixmap.extractSubset(&decoded_pixmap, gfx::RectToSkIRect(key.src_rect())); DCHECK(result) << key.ToString(); } - DCHECK(!key.target_size().IsEmpty()); - DCHECK(SkColorSpace::Equals(decoded_draw_image.image()->colorSpace(), - key.target_color_space().ToSkColorSpace().get())); - SkImageInfo scaled_info = CreateImageInfo( - key.target_size().width(), key.target_size().height(), color_type_); - std::unique_ptr<base::DiscardableMemory> scaled_pixels; - { - TRACE_EVENT0( - TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::ScaleImage - allocate scaled pixels"); - scaled_pixels = base::DiscardableMemoryAllocator::GetInstance() - ->AllocateLockedDiscardableMemory( - scaled_info.minRowBytes() * scaled_info.height()); - } - SkPixmap scaled_pixmap(scaled_info, scaled_pixels->data(), - scaled_info.minRowBytes()); - DCHECK(key.filter_quality() == kMedium_SkFilterQuality); - { - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::ScaleImage - scale pixels"); - bool result = - decoded_pixmap.scalePixels(scaled_pixmap, key.filter_quality()); - DCHECK(result) << key.ToString(); - } - - return std::make_unique<DecodedImage>( - scaled_info.makeColorSpace(decoded_draw_image.image()->refColorSpace()), - std::move(scaled_pixels), + SkPixmap target_pixmap(target_info, target_pixels->data(), + target_info.minRowBytes()); + result = decoded_pixmap.scalePixels(target_pixmap, key.filter_quality()); + DCHECK(result) << key.ToString(); + return std::make_unique<CacheEntry>( + target_info.makeColorSpace(candidate_image.image()->refColorSpace()), + std::move(target_pixels), SkSize::Make(-key.src_rect().x(), -key.src_rect().y())); } +DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDraw( + const DrawImage& draw_image) { + base::AutoLock hold(lock_); + return GetDecodedImageForDrawInternal( + ImageKey::FromDrawImage(draw_image, color_type_), + draw_image.paint_image()); +} + +DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDrawInternal( + const ImageKey& key, + const PaintImage& paint_image) { + TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), + "SoftwareImageDecodeCache::GetDecodedImageForDrawInternal", + "key", key.ToString()); + + lock_.AssertAcquired(); + auto decoded_it = decoded_images_.Get(key); + CacheEntry* cache_entry = nullptr; + if (decoded_it == decoded_images_.end()) + cache_entry = AddCacheEntry(key); + else + cache_entry = decoded_it->second.get(); + + // We'll definitely ref this cache entry and use it. + ++cache_entry->ref_count; + cache_entry->mark_used(); + + DecodeImageIfNecessary(key, paint_image, cache_entry); + auto decoded_draw_image = + DecodedDrawImage(cache_entry->image(), cache_entry->src_rect_offset(), + GetScaleAdjustment(key), GetDecodedFilterQuality(key)); + decoded_draw_image.set_at_raster_decode(!cache_entry->is_budgeted); + return decoded_draw_image; +} + void SoftwareImageDecodeCache::DrawWithImageFinished( const DrawImage& image, const DecodedDrawImage& decoded_image) { TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), "SoftwareImageDecodeCache::DrawWithImageFinished", "key", ImageKey::FromDrawImage(image, color_type_).ToString()); - ImageKey key = ImageKey::FromDrawImage(image, color_type_); - if (!decoded_image.image()) - return; - - if (decoded_image.is_at_raster_decode()) - UnrefAtRasterImage(key); - else - UnrefImage(image); -} - -void SoftwareImageDecodeCache::RefAtRasterImage(const ImageKey& key) { - TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::RefAtRasterImage", "key", - key.ToString()); - DCHECK(at_raster_decoded_images_.Peek(key) != - at_raster_decoded_images_.end()); - ++at_raster_decoded_images_ref_counts_[key]; -} - -void SoftwareImageDecodeCache::UnrefAtRasterImage(const ImageKey& key) { - TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "SoftwareImageDecodeCache::UnrefAtRasterImage", "key", - key.ToString()); - base::AutoLock lock(lock_); - - auto ref_it = at_raster_decoded_images_ref_counts_.find(key); - DCHECK(ref_it != at_raster_decoded_images_ref_counts_.end()); - --ref_it->second; - if (ref_it->second == 0) { - at_raster_decoded_images_ref_counts_.erase(ref_it); - auto at_raster_image_it = at_raster_decoded_images_.Peek(key); - DCHECK(at_raster_image_it != at_raster_decoded_images_.end()); - - // The ref for our image reached 0 and it's still locked. We need to figure - // out what the best thing to do with the image. There are several - // situations: - // 1. The image is not in the main cache and... - // 1a. ... its ref count is 0: unlock our image and put it in the main - // cache. - // 1b. ... ref count is not 0: keep the image locked and put it in the - // main cache. - // 2. The image is in the main cache... - // 2a. ... and is locked: unlock our image and discard it - // 2b. ... and is unlocked and... - // 2b1. ... its ref count is 0: unlock our image and replace the - // existing one with ours. - // 2b2. ... its ref count is not 0: this shouldn't be possible. - auto image_it = decoded_images_.Peek(key); - if (image_it == decoded_images_.end()) { - if (decoded_images_ref_counts_.find(key) == - decoded_images_ref_counts_.end()) { - at_raster_image_it->second->Unlock(); - } - CacheDecodedImages(key, std::move(at_raster_image_it->second)); - } else if (image_it->second->is_locked()) { - at_raster_image_it->second->Unlock(); - } else { - DCHECK(decoded_images_ref_counts_.find(key) == - decoded_images_ref_counts_.end()); - at_raster_image_it->second->Unlock(); - // Access decoded_images_ directly here to avoid deletion and entry - // of same key in ImageKey vector of decoded_images_unique_ids_. - decoded_images_.Erase(image_it); - decoded_images_.Put(key, std::move(at_raster_image_it->second)); - } - at_raster_decoded_images_.Erase(at_raster_image_it); - } + UnrefImage(image); } void SoftwareImageDecodeCache::ReduceCacheUsageUntilWithinLimit(size_t limit) { @@ -852,17 +637,23 @@ "SoftwareImageDecodeCache::ReduceCacheUsageUntilWithinLimit"); lifetime_max_items_in_cache_ = std::max(lifetime_max_items_in_cache_, decoded_images_.size()); - size_t num_to_remove = - (decoded_images_.size() > limit) ? (decoded_images_.size() - limit) : 0; for (auto it = decoded_images_.rbegin(); - num_to_remove != 0 && it != decoded_images_.rend();) { - if (it->second->is_locked()) { + decoded_images_.size() > limit && it != decoded_images_.rend();) { + if (it->second->ref_count != 0) { ++it; continue; } + const ImageKey& key = it->first; + auto vector_it = frame_key_to_image_keys_.find(key.frame_key()); + auto item_it = + std::find(vector_it->second.begin(), vector_it->second.end(), key); + DCHECK(item_it != vector_it->second.end()); + vector_it->second.erase(item_it); + if (vector_it->second.empty()) + frame_key_to_image_keys_.erase(vector_it); + it = decoded_images_.Erase(it); - --num_to_remove; } } @@ -888,29 +679,37 @@ if (it == frame_key_to_image_keys_.end()) return; - for (auto key = it->second.begin(); key != it->second.end(); ++key) { + for (auto key_it = it->second.begin(); key_it != it->second.end();) { // This iterates over the ImageKey vector for the given skimage_id, // and deletes all entries from decoded_images_ corresponding to the // skimage_id. - auto image_it = decoded_images_.Peek(*key); - // TODO(sohanjg) :Find an optimized way to cleanup locked images. - if (image_it != decoded_images_.end() && !image_it->second->is_locked()) + auto image_it = decoded_images_.Peek(*key_it); + // TODO(sohanjg): Find an optimized way to cleanup locked images. + if (image_it != decoded_images_.end() && image_it->second->ref_count == 0) { decoded_images_.Erase(image_it); + key_it = it->second.erase(key_it); + } else { + ++key_it; + } } - frame_key_to_image_keys_.erase(it); + if (it->second.empty()) + frame_key_to_image_keys_.erase(it); } -void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, - DecodeTaskType task_type) { - base::AutoLock lock(lock_); - switch (task_type) { - case DecodeTaskType::USE_IN_RASTER_TASKS: - pending_in_raster_image_tasks_.erase(key); - break; - case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: - pending_out_of_raster_image_tasks_.erase(key); - break; - } +void SoftwareImageDecodeCache::OnImageDecodeTaskCompleted( + const ImageKey& key, + DecodeTaskType task_type) { + base::AutoLock hold(lock_); + + auto image_it = decoded_images_.Peek(key); + DCHECK(image_it != decoded_images_.end()); + CacheEntry* cache_entry = image_it->second.get(); + auto& task = task_type == DecodeTaskType::USE_IN_RASTER_TASKS + ? cache_entry->in_raster_task + : cache_entry->out_of_raster_task; + task = nullptr; + + UnrefImage(key); } bool SoftwareImageDecodeCache::OnMemoryDump( @@ -925,40 +724,37 @@ dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, locked_images_budget_.GetCurrentUsageSafe()); } else { - // Dump each of our caches. - DumpImageMemoryForCache(decoded_images_, "cached", pmd); - DumpImageMemoryForCache(at_raster_decoded_images_, "at_raster", pmd); + for (const auto& image_pair : decoded_images_) { + int image_id = static_cast<int>(image_pair.first.frame_key().hash()); + CacheEntry* entry = image_pair.second.get(); + DCHECK(entry); + // We might not have memory for this cache entry, depending on where int + // he CacheEntry lifecycle we are. If we don't have memory, then we don't + // have to record it in the dump. + if (!entry->memory) + continue; + + std::string dump_name = base::StringPrintf( + "cc/image_memory/cache_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d", + reinterpret_cast<uintptr_t>(this), + entry->is_budgeted ? "budgeted" : "at_raster", entry->tracing_id(), + image_id); + // CreateMemoryAllocatorDump will automatically add tracking values for + // the total size. We also add a "locked_size" below. + MemoryAllocatorDump* dump = + entry->memory->CreateMemoryAllocatorDump(dump_name.c_str(), pmd); + DCHECK(dump); + size_t locked_bytes = + entry->is_locked ? image_pair.first.locked_bytes() : 0u; + dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, + locked_bytes); + } } // Memory dump can't fail, always return true. return true; } -void SoftwareImageDecodeCache::DumpImageMemoryForCache( - const ImageMRUCache& cache, - const char* cache_name, - base::trace_event::ProcessMemoryDump* pmd) const { - lock_.AssertAcquired(); - - for (const auto& image_pair : cache) { - int image_id = static_cast<int>(image_pair.first.frame_key().hash()); - std::string dump_name = base::StringPrintf( - "cc/image_memory/cache_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d", - reinterpret_cast<uintptr_t>(this), cache_name, - image_pair.second->tracing_id(), image_id); - // CreateMemoryAllocatorDump will automatically add tracking values for the - // total size. We also add a "locked_size" below. - MemoryAllocatorDump* dump = - image_pair.second->memory()->CreateMemoryAllocatorDump( - dump_name.c_str(), pmd); - DCHECK(dump); - size_t locked_bytes = - image_pair.second->is_locked() ? image_pair.first.locked_bytes() : 0u; - dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, - locked_bytes); - } -} - // SoftwareImageDecodeCacheKey ImageDecodeCacheKey ImageDecodeCacheKey::FromDrawImage(const DrawImage& image, SkColorType color_type) { @@ -1109,23 +905,26 @@ return str.str(); } -// DecodedImage -SoftwareImageDecodeCache::DecodedImage::DecodedImage( +// CacheEntry +SoftwareImageDecodeCache::CacheEntry::CacheEntry() + : tracing_id_(g_next_tracing_id_.GetNext()) {} +SoftwareImageDecodeCache::CacheEntry::CacheEntry( const SkImageInfo& info, - std::unique_ptr<base::DiscardableMemory> memory, + std::unique_ptr<base::DiscardableMemory> in_memory, const SkSize& src_rect_offset) - : locked_(true), + : is_locked(true), + memory(std::move(in_memory)), image_info_(info), - memory_(std::move(memory)), src_rect_offset_(src_rect_offset), tracing_id_(g_next_tracing_id_.GetNext()) { - SkPixmap pixmap(image_info_, memory_->data(), image_info_.minRowBytes()); + DCHECK(memory); + SkPixmap pixmap(image_info_, memory->data(), image_info_.minRowBytes()); image_ = SkImage::MakeFromRaster( pixmap, [](const void* pixels, void* context) {}, nullptr); } -SoftwareImageDecodeCache::DecodedImage::~DecodedImage() { - DCHECK(!locked_); +SoftwareImageDecodeCache::CacheEntry::~CacheEntry() { + DCHECK(!is_locked); // lock_count | used | last lock failed | result state // ===========+=======+==================+================== // 1 | false | false | WASTED @@ -1171,22 +970,45 @@ usage_stats_.first_lock_wasted); } -bool SoftwareImageDecodeCache::DecodedImage::Lock() { - DCHECK(!locked_); - bool success = memory_->Lock(); +void SoftwareImageDecodeCache::CacheEntry::MoveImageMemoryTo( + CacheEntry* entry) { + DCHECK(!is_budgeted); + DCHECK_EQ(ref_count, 0); + + // Copy/move most things except budgeted and ref counts. + entry->decode_failed = decode_failed; + entry->is_locked = is_locked; + is_locked = false; + + entry->memory = std::move(memory); + entry->image_info_ = std::move(image_info_); + entry->src_rect_offset_ = std::move(src_rect_offset_); + entry->image_ = std::move(image_); +} + +bool SoftwareImageDecodeCache::CacheEntry::Lock() { + if (!memory) + return false; + + DCHECK(!is_locked); + bool success = memory->Lock(); if (!success) { + memory = nullptr; usage_stats_.last_lock_failed = true; return false; } - locked_ = true; + is_locked = true; ++usage_stats_.lock_count; return true; } -void SoftwareImageDecodeCache::DecodedImage::Unlock() { - DCHECK(locked_); - memory_->Unlock(); - locked_ = false; +void SoftwareImageDecodeCache::CacheEntry::Unlock() { + if (!memory) + return; + + DCHECK(is_locked); + memory->Unlock(); + is_locked = false; if (usage_stats_.lock_count == 1) usage_stats_.first_lock_wasted = !usage_stats_.used; } @@ -1242,31 +1064,12 @@ ReduceCacheUsageUntilWithinLimit(0); } -void SoftwareImageDecodeCache::CleanupDecodedImagesCache( - const ImageKey& key, - ImageMRUCache::iterator it) { - lock_.AssertAcquired(); - auto vector_it = frame_key_to_image_keys_.find(key.frame_key()); - - // TODO(sohanjg): Check if we can DCHECK here. - if (vector_it != frame_key_to_image_keys_.end()) { - auto iter = - std::find(vector_it->second.begin(), vector_it->second.end(), key); - DCHECK(iter != vector_it->second.end()); - vector_it->second.erase(iter); - if (vector_it->second.empty()) - frame_key_to_image_keys_.erase(vector_it); - } - - decoded_images_.Erase(it); -} - -void SoftwareImageDecodeCache::CacheDecodedImages( - const ImageKey& key, - std::unique_ptr<DecodedImage> decoded_image) { +SoftwareImageDecodeCache::CacheEntry* SoftwareImageDecodeCache::AddCacheEntry( + const ImageKey& key) { lock_.AssertAcquired(); frame_key_to_image_keys_[key.frame_key()].push_back(key); - decoded_images_.Put(key, std::move(decoded_image)); + auto it = decoded_images_.Put(key, std::make_unique<CacheEntry>()); + return it->second.get(); } } // namespace cc
diff --git a/cc/tiles/software_image_decode_cache.h b/cc/tiles/software_image_decode_cache.h index 120df10..78e6e82 100644 --- a/cc/tiles/software_image_decode_cache.h +++ b/cc/tiles/software_image_decode_cache.h
@@ -142,11 +142,12 @@ // Decode the given image and store it in the cache. This is only called by an // image decode task from a worker thread. - void DecodeImage(const ImageKey& key, - const DrawImage& image, - DecodeTaskType task_type); + void DecodeImageInTask(const ImageKey& key, + const PaintImage& paint_image, + DecodeTaskType task_type); - void RemovePendingTask(const ImageKey& key, DecodeTaskType task_type); + void OnImageDecodeTaskCompleted(const ImageKey& key, + DecodeTaskType task_type); // MemoryDumpProvider overrides. bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, @@ -155,29 +156,30 @@ size_t GetNumCacheEntriesForTesting() const { return decoded_images_.size(); } private: - // DecodedImage is a convenience storage for discardable memory. It can also + // CacheEntry is a convenience storage for discardable memory. It can also // construct an image out of SkImageInfo and stored discardable memory. - class DecodedImage { + class CacheEntry { public: - DecodedImage(const SkImageInfo& info, - std::unique_ptr<base::DiscardableMemory> memory, - const SkSize& src_rect_offset); - ~DecodedImage(); + CacheEntry(); + CacheEntry(const SkImageInfo& info, + std::unique_ptr<base::DiscardableMemory> memory, + const SkSize& src_rect_offset); + ~CacheEntry(); - const sk_sp<SkImage>& image() const { - DCHECK(locked_); + void MoveImageMemoryTo(CacheEntry* entry); + + sk_sp<SkImage> image() const { + if (!memory) + return nullptr; + DCHECK(is_locked); return image_; } - const SkSize& src_rect_offset() const { return src_rect_offset_; } - bool is_locked() const { return locked_; } bool Lock(); void Unlock(); - const base::DiscardableMemory* memory() const { return memory_.get(); } - - // An ID which uniquely identifies this DecodedImage within the image decode + // An ID which uniquely identifies this CacheEntry within the image decode // cache. Used in memory tracing. uint64_t tracing_id() const { return tracing_id_; } // Mark this image as being used in either a draw or as a source for a @@ -186,6 +188,21 @@ void mark_used() { usage_stats_.used = true; } void mark_out_of_raster() { usage_stats_.first_lock_out_of_raster = true; } + // Since this is an inner class, we expose these variables publicly for + // simplicity. + // TODO(vmpstr): A good simple clean-up would be to rethink this class + // and its interactions to instead expose a few functions which would also + // facilitate easier DCHECKs. + int ref_count = 0; + bool decode_failed = false; + bool is_locked = false; + bool is_budgeted = false; + + scoped_refptr<TileTask> in_raster_task; + scoped_refptr<TileTask> out_of_raster_task; + + std::unique_ptr<base::DiscardableMemory> memory; + private: struct UsageStats { // We can only create a decoded image in a locked state, so the initial @@ -197,9 +214,7 @@ bool first_lock_out_of_raster = false; }; - bool locked_; SkImageInfo image_info_; - std::unique_ptr<base::DiscardableMemory> memory_; sk_sp<SkImage> image_; SkSize src_rect_offset_; uint64_t tracing_id_; @@ -225,62 +240,22 @@ }; using ImageMRUCache = base:: - HashingMRUCache<ImageKey, std::unique_ptr<DecodedImage>, ImageKeyHash>; - - // Looks for the key in the cache and returns true if it was found and was - // successfully locked (or if it was already locked). Note that if this - // function returns true, then a ref count is increased for the image. - bool LockDecodedImageIfPossibleAndRef(const ImageKey& key); + HashingMRUCache<ImageKey, std::unique_ptr<CacheEntry>, ImageKeyHash>; // Actually decode the image. Note that this function can (and should) be // called with no lock acquired, since it can do a lot of work. Note that it // can also return nullptr to indicate the decode failed. - std::unique_ptr<DecodedImage> DecodeImageInternal( - const ImageKey& key, - const DrawImage& draw_image); - - // Get the decoded draw image for the given key and draw_image. Note that this - // function has to be called with no lock acquired, since it will acquire its - // own locks and might call DecodeImageInternal above. Also note that this - // function will use the provided key, even if - // ImageKey::FromDrawImage(draw_image) would return a different key. - // Note that when used internally, we still require that - // DrawWithImageFinished() is called afterwards. - DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, + std::unique_ptr<CacheEntry> DecodeImageInternal(const ImageKey& key, const DrawImage& draw_image); - // GetExactSizeImageDecode is called by DecodeImageInternal when the - // quality does not scale the image. Like DecodeImageInternal, it should be - // called with no lock acquired and it returns nullptr if the decoding failed. - std::unique_ptr<DecodedImage> GetExactSizeImageDecode( + // Get the decoded draw image for the given key and paint_image. Note that + // this function has to be called with no lock acquired, since it will acquire + // its own locks and might call DecodeImageInternal above. Note that + // when used internally, we still require that DrawWithImageFinished() is + // called afterwards. + DecodedDrawImage GetDecodedImageForDrawInternal( const ImageKey& key, - const PaintImage& image); - - // GetSubrectImageDecode is similar to GetExactSizeImageDecode in that the - // image is decoded to exact scale. However, we extract a subrect (copy it - // out) and only return this subrect in order to cache a smaller amount of - // memory. Note that this uses GetExactSizeImageDecode to get the initial - // data, which ensures that we cache an unlocked version of the original image - // in case we need to extract multiple subrects (as would be the case in an - // atlas). - std::unique_ptr<DecodedImage> GetSubrectImageDecode(const ImageKey& key, - const PaintImage& image); - - // GetScaledImageDecode is called by DecodeImageInternal when the quality - // requires the image be scaled. Like DecodeImageInternal, it should be - // called with no lock acquired and it returns nullptr if the decoding or - // scaling failed. - std::unique_ptr<DecodedImage> GetScaledImageDecode(const ImageKey& key, - const PaintImage& image); - - void RefImage(const ImageKey& key); - void RefAtRasterImage(const ImageKey& key); - void UnrefAtRasterImage(const ImageKey& key); - - // Helper function which dumps all images in a specific ImageMRUCache. - void DumpImageMemoryForCache(const ImageMRUCache& cache, - const char* cache_name, - base::trace_event::ProcessMemoryDump* pmd) const; + const PaintImage& paint_image); // Removes unlocked decoded images until the number of decoded images is // reduced within the given limit. @@ -296,10 +271,22 @@ const TracingInfo& tracing_info, DecodeTaskType type); - void CacheDecodedImages(const ImageKey& key, - std::unique_ptr<DecodedImage> decoded_image); - void CleanupDecodedImagesCache(const ImageKey& key, - ImageMRUCache::iterator it); + CacheEntry* AddCacheEntry(const ImageKey& key); + + void DecodeImageIfNecessary(const ImageKey& key, + const PaintImage& paint_image, + CacheEntry* cache_entry); + void AddBudgetForImage(const ImageKey& key, CacheEntry* entry); + void RemoveBudgetForImage(const ImageKey& key, CacheEntry* entry); + + std::unique_ptr<CacheEntry> DoDecodeImage(const ImageKey& key, + const PaintImage& image); + std::unique_ptr<CacheEntry> GenerateCacheEntryFromCandidate( + const ImageKey& key, + const DecodedDrawImage& candidate, + bool needs_extract_subset); + + void UnrefImage(const ImageKey& key); std::unordered_map<ImageKey, scoped_refptr<TileTask>, ImageKeyHash> pending_in_raster_image_tasks_; @@ -314,7 +301,6 @@ // Decoded images and ref counts (predecode path). ImageMRUCache decoded_images_; - std::unordered_map<ImageKey, int, ImageKeyHash> decoded_images_ref_counts_; // A map of PaintImage::FrameKey to the ImageKeys for cached decodes of this // PaintImage. @@ -323,11 +309,6 @@ PaintImage::FrameKeyHash> frame_key_to_image_keys_; - // Decoded image and ref counts (at-raster decode path). - ImageMRUCache at_raster_decoded_images_; - std::unordered_map<ImageKey, int, ImageKeyHash> - at_raster_decoded_images_ref_counts_; - MemoryBudget locked_images_budget_; SkColorType color_type_;
diff --git a/cc/tiles/software_image_decode_cache_unittest.cc b/cc/tiles/software_image_decode_cache_unittest.cc index c5e0ff91..1a3c1ac0 100644 --- a/cc/tiles/software_image_decode_cache_unittest.cc +++ b/cc/tiles/software_image_decode_cache_unittest.cc
@@ -654,6 +654,36 @@ cache.UnrefImage(draw_image); } +TEST(SoftwareImageDecodeCacheTest, GetTaskForImageProcessUnrefCancel) { + TestSoftwareImageDecodeCache cache; + PaintImage paint_image = CreatePaintImage(100, 100); + bool is_decomposable = true; + SkFilterQuality quality = kHigh_SkFilterQuality; + + DrawImage draw_image( + paint_image, SkIRect::MakeWH(paint_image.width(), paint_image.height()), + quality, CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable), + PaintImage::kDefaultFrameIndex, DefaultColorSpace()); + ImageDecodeCache::TaskResult result = + cache.GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo()); + EXPECT_TRUE(result.need_unref); + EXPECT_TRUE(result.task); + + TestTileTaskRunner::ProcessTask(result.task.get()); + cache.UnrefImage(draw_image); + + result = + cache.GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo()); + EXPECT_TRUE(result.need_unref); + EXPECT_TRUE(result.task); + + TestTileTaskRunner::CancelTask(result.task.get()); + TestTileTaskRunner::CompleteTask(result.task.get()); + // This is expected to pass instead of DCHECKing since we're reducing the ref + // for an image which isn't locked to begin with. + cache.UnrefImage(draw_image); +} + TEST(SoftwareImageDecodeCacheTest, GetTaskForImageSameImageDifferentQuality) { TestSoftwareImageDecodeCache cache; PaintImage paint_image = CreatePaintImage(100, 100); @@ -1082,97 +1112,6 @@ cache.DrawWithImageFinished(draw_image, another_decoded_draw_image); } -TEST(SoftwareImageDecodeCacheTest, - GetDecodedImageForDrawAtRasterDecodeDoesNotPreventTasks) { - TestSoftwareImageDecodeCache cache; - bool is_decomposable = true; - SkFilterQuality quality = kHigh_SkFilterQuality; - - PaintImage paint_image = CreatePaintImage(100, 100); - DrawImage draw_image( - paint_image, SkIRect::MakeWH(paint_image.width(), paint_image.height()), - quality, CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable), - PaintImage::kDefaultFrameIndex, DefaultColorSpace()); - - DecodedDrawImage decoded_draw_image = - cache.GetDecodedImageForDraw(draw_image); - EXPECT_TRUE(decoded_draw_image.image()); - EXPECT_EQ(50, decoded_draw_image.image()->width()); - EXPECT_EQ(50, decoded_draw_image.image()->height()); - EXPECT_FLOAT_EQ(0.5f, decoded_draw_image.scale_adjustment().width()); - EXPECT_FLOAT_EQ(0.5f, decoded_draw_image.scale_adjustment().height()); - EXPECT_EQ(kLow_SkFilterQuality, decoded_draw_image.filter_quality()); - EXPECT_FALSE(decoded_draw_image.is_scale_adjustment_identity()); - EXPECT_TRUE(decoded_draw_image.is_at_raster_decode()); - - ImageDecodeCache::TaskResult result = - cache.GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo()); - EXPECT_TRUE(result.need_unref); - EXPECT_TRUE(result.task); - - TestTileTaskRunner::ProcessTask(result.task.get()); - - DecodedDrawImage another_decoded_draw_image = - cache.GetDecodedImageForDraw(draw_image); - // This should get the new decoded/locked image, not the one we're using at - // raster. - // TODO(vmpstr): We can possibly optimize this so that the decode simply moves - // the image to the right spot. - EXPECT_NE(decoded_draw_image.image()->uniqueID(), - another_decoded_draw_image.image()->uniqueID()); - EXPECT_FALSE(another_decoded_draw_image.is_at_raster_decode()); - - cache.DrawWithImageFinished(draw_image, decoded_draw_image); - cache.DrawWithImageFinished(draw_image, another_decoded_draw_image); - cache.UnrefImage(draw_image); -} - -TEST(SoftwareImageDecodeCacheTest, - GetDecodedImageForDrawAtRasterDecodeIsUsedForLockedCache) { - TestSoftwareImageDecodeCache cache; - bool is_decomposable = true; - SkFilterQuality quality = kHigh_SkFilterQuality; - - PaintImage paint_image = CreatePaintImage(100, 100); - DrawImage draw_image( - paint_image, SkIRect::MakeWH(paint_image.width(), paint_image.height()), - quality, CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable), - PaintImage::kDefaultFrameIndex, DefaultColorSpace()); - - DecodedDrawImage decoded_draw_image = - cache.GetDecodedImageForDraw(draw_image); - EXPECT_TRUE(decoded_draw_image.image()); - EXPECT_EQ(50, decoded_draw_image.image()->width()); - EXPECT_EQ(50, decoded_draw_image.image()->height()); - EXPECT_FLOAT_EQ(0.5f, decoded_draw_image.scale_adjustment().width()); - EXPECT_FLOAT_EQ(0.5f, decoded_draw_image.scale_adjustment().height()); - EXPECT_EQ(kLow_SkFilterQuality, decoded_draw_image.filter_quality()); - EXPECT_FALSE(decoded_draw_image.is_scale_adjustment_identity()); - EXPECT_TRUE(decoded_draw_image.is_at_raster_decode()); - - ImageDecodeCache::TaskResult result = - cache.GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo()); - EXPECT_TRUE(result.need_unref); - EXPECT_TRUE(result.task); - - // If we finish the draw here, then we will use it for the locked decode - // instead of decoding again. - cache.DrawWithImageFinished(draw_image, decoded_draw_image); - - TestTileTaskRunner::ProcessTask(result.task.get()); - - DecodedDrawImage another_decoded_draw_image = - cache.GetDecodedImageForDraw(draw_image); - // This should get the decoded/locked image which we originally decoded at - // raster time, since it's now in the locked cache. - EXPECT_EQ(decoded_draw_image.image()->uniqueID(), - another_decoded_draw_image.image()->uniqueID()); - EXPECT_FALSE(another_decoded_draw_image.is_at_raster_decode()); - - cache.DrawWithImageFinished(draw_image, another_decoded_draw_image); - cache.UnrefImage(draw_image); -} - TEST(SoftwareImageDecodeCacheTest, ZeroSizedImagesAreSkipped) { TestSoftwareImageDecodeCache cache; bool is_decomposable = true; @@ -1638,20 +1577,18 @@ std::vector<PaintImage::FrameKey> frame_keys; for (int i = 0; i < 10; ++i) { + SCOPED_TRACE(i); PaintImage paint_image = CreatePaintImage(100, 100); DrawImage draw_image( paint_image, SkIRect::MakeWH(paint_image.width(), paint_image.height()), quality, CreateMatrix(SkSize::Make(1.0f, 1.0f), is_decomposable), PaintImage::kDefaultFrameIndex, DefaultColorSpace()); frame_keys.push_back(draw_image.frame_key()); - DecodedDrawImage decoded_draw_image = - cache.GetDecodedImageForDraw(draw_image); ImageDecodeCache::TaskResult result = cache.GetTaskForImageAndRef( draw_image, ImageDecodeCache::TracingInfo()); EXPECT_TRUE(result.need_unref); EXPECT_TRUE(result.task); TestTileTaskRunner::ProcessTask(result.task.get()); - cache.DrawWithImageFinished(draw_image, decoded_draw_image); cache.UnrefImage(draw_image); } @@ -1718,5 +1655,35 @@ cache.DrawWithImageFinished(subset_draw_image, decoded_image); } +TEST(SoftwareImageDecodeCacheTest, SizeSubrectingIsHandled) { + const int min_dimension = 4 * 1024 + 2; + TestSoftwareImageDecodeCache cache; + bool is_decomposable = true; + SkFilterQuality quality = kLow_SkFilterQuality; + + auto paint_image = + CreateDiscardablePaintImage(gfx::Size(min_dimension, min_dimension), + DefaultColorSpace().ToSkColorSpace(), false); + DrawImage draw_image(paint_image, SkIRect::MakeXYWH(0, 0, 10, 10), quality, + CreateMatrix(SkSize::Make(1.f, 1.f), is_decomposable), + PaintImage::kDefaultFrameIndex, DefaultColorSpace()); + + ImageDecodeCache::TaskResult result = + cache.GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo()); + EXPECT_TRUE(result.task); + EXPECT_TRUE(result.need_unref); + + TestTileTaskRunner::ProcessTask(result.task.get()); + + DecodedDrawImage decoded_draw_image = + cache.GetDecodedImageForDraw(draw_image); + // Since we didn't allocate any backing for the memory, we expect this to be + // false. This test is here to ensure that we at least got to the point where + // we tried to decode something instead of recursing infinitely. + EXPECT_FALSE(decoded_draw_image.image()); + cache.DrawWithImageFinished(draw_image, decoded_draw_image); + cache.UnrefImage(draw_image); +} + } // namespace } // namespace cc
diff --git a/cc/tiles/software_image_decode_cache_unittest_combinations.cc b/cc/tiles/software_image_decode_cache_unittest_combinations.cc new file mode 100644 index 0000000..9dca164 --- /dev/null +++ b/cc/tiles/software_image_decode_cache_unittest_combinations.cc
@@ -0,0 +1,451 @@ +// Copyright 2017 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 "cc/tiles/software_image_decode_cache.h" + +#include "base/strings/stringprintf.h" +#include "cc/paint/draw_image.h" +#include "cc/paint/paint_image_builder.h" +#include "cc/test/fake_paint_image_generator.h" +#include "cc/test/skia_common.h" +#include "cc/test/test_tile_task_runner.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkRefCnt.h" + +namespace cc { +namespace { + +size_t kLockedMemoryLimitBytes = 128 * 1024 * 1024; +SkMatrix CreateMatrix(const SkSize& scale, bool is_decomposable) { + SkMatrix matrix; + matrix.setScale(scale.width(), scale.height()); + + if (!is_decomposable) { + // Perspective is not decomposable, add it. + matrix[SkMatrix::kMPersp0] = 0.1f; + } + + return matrix; +} + +class BaseTest : public testing::Test { + public: + void SetUp() override { + cache_ = CreateCache(); + paint_image_ = CreatePaintImage(gfx::Size(512, 512)); + } + + void TearDown() override { + paint_image_ = PaintImage(); + cache_.reset(); + } + + DrawImage CreateDrawImageForScale( + float scale, + const SkIRect src_rect = SkIRect::MakeEmpty()) { + return DrawImage( + paint_image(), + src_rect.isEmpty() + ? SkIRect::MakeWH(paint_image().width(), paint_image().height()) + : src_rect, + kMedium_SkFilterQuality, CreateMatrix(SkSize::Make(scale, scale), true), + PaintImage::kDefaultFrameIndex, GetColorSpace()); + } + + SoftwareImageDecodeCache& cache() { return *cache_; } + PaintImage& paint_image() { return paint_image_; } + + protected: + struct CacheEntryResult { + bool has_task = false; + bool needs_unref = false; + }; + + virtual std::unique_ptr<SoftwareImageDecodeCache> CreateCache() = 0; + virtual CacheEntryResult GenerateCacheEntry(const DrawImage& image) = 0; + virtual PaintImage CreatePaintImage(const gfx::Size& size) = 0; + virtual gfx::ColorSpace GetColorSpace() = 0; + virtual void VerifyEntryExists(int line, + const DrawImage& draw_image, + const gfx::Size& expected_size) = 0; + + private: + std::unique_ptr<SoftwareImageDecodeCache> cache_; + PaintImage paint_image_; +}; + +class N32Cache : public virtual BaseTest { + protected: + std::unique_ptr<SoftwareImageDecodeCache> CreateCache() override { + return std::make_unique<SoftwareImageDecodeCache>(kN32_SkColorType, + kLockedMemoryLimitBytes); + } +}; + +class RGBA4444Cache : public virtual BaseTest { + protected: + std::unique_ptr<SoftwareImageDecodeCache> CreateCache() override { + return std::make_unique<SoftwareImageDecodeCache>(kARGB_4444_SkColorType, + kLockedMemoryLimitBytes); + } +}; + +class AtRaster : public virtual BaseTest { + protected: + CacheEntryResult GenerateCacheEntry(const DrawImage& image) override { + // At raster doesn't generate cache entries. + return {false, false}; + } + void VerifyEntryExists(int line, + const DrawImage& draw_image, + const gfx::Size& expected_size) override { + auto decoded = cache().GetDecodedImageForDraw(draw_image); + SCOPED_TRACE(base::StringPrintf("Failure from line %d", line)); + EXPECT_EQ(decoded.image()->width(), expected_size.width()); + EXPECT_EQ(decoded.image()->height(), expected_size.height()); + EXPECT_TRUE(decoded.is_at_raster_decode()); + cache().DrawWithImageFinished(draw_image, decoded); + } +}; + +class Predecode : public virtual BaseTest { + protected: + CacheEntryResult GenerateCacheEntry(const DrawImage& image) override { + auto task_result = + cache().GetTaskForImageAndRef(image, ImageDecodeCache::TracingInfo()); + CacheEntryResult result = {!!task_result.task, task_result.need_unref}; + + if (task_result.task) + TestTileTaskRunner::ProcessTask(task_result.task.get()); + return result; + } + + void VerifyEntryExists(int line, + const DrawImage& draw_image, + const gfx::Size& expected_size) override { + auto decoded = cache().GetDecodedImageForDraw(draw_image); + SCOPED_TRACE(base::StringPrintf("Failure from line %d", line)); + EXPECT_EQ(decoded.image()->width(), expected_size.width()); + EXPECT_EQ(decoded.image()->height(), expected_size.height()); + EXPECT_FALSE(decoded.is_at_raster_decode()); + cache().DrawWithImageFinished(draw_image, decoded); + } +}; + +class NoDecodeToScaleSupport : public virtual BaseTest { + protected: + PaintImage CreatePaintImage(const gfx::Size& size) override { + return CreateDiscardablePaintImage(size, GetColorSpace().ToSkColorSpace()); + } +}; + +class DefaultColorSpace : public virtual BaseTest { + protected: + gfx::ColorSpace GetColorSpace() override { + return gfx::ColorSpace::CreateSRGB(); + } +}; + +class ExoticColorSpace : public virtual BaseTest { + protected: + gfx::ColorSpace GetColorSpace() override { + return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::XYZ_D50, + gfx::ColorSpace::TransferID::IEC61966_2_1); + } +}; + +class SoftwareImageDecodeCacheTest_Typical : public N32Cache, + public Predecode, + public NoDecodeToScaleSupport, + public DefaultColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_Typical, UseClosestAvailableDecode) { + auto draw_image_50 = CreateDrawImageForScale(0.5f); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(256, 256)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + result = GenerateCacheEntry(draw_image_125); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(64, 64)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 0.5 scale and 0.125 scale. + EXPECT_EQ(2u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +TEST_F(SoftwareImageDecodeCacheTest_Typical, + UseClosestAvailableDecodeNotSmaller) { + auto draw_image_25 = CreateDrawImageForScale(0.25f); + auto result = GenerateCacheEntry(draw_image_25); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_25, gfx::Size(128, 128)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_50 = CreateDrawImageForScale(0.5f); + result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(256, 256)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 1.0 scale, 0.5 scale and 0.25 scale. + EXPECT_EQ(3u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_25); +} + +TEST_F(SoftwareImageDecodeCacheTest_Typical, + UseClosestAvailableDecodeFirstImageSubrected) { + auto draw_image_50 = CreateDrawImageForScale(0.5f, SkIRect::MakeWH(500, 500)); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(250, 250)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + result = GenerateCacheEntry(draw_image_125); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(64, 64)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 1.0 scale, 0.5 scale subrected and 0.125 scale. + EXPECT_EQ(3u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +TEST_F(SoftwareImageDecodeCacheTest_Typical, + UseClosestAvailableDecodeSecondImageSubrected) { + auto draw_image_50 = CreateDrawImageForScale(0.5f); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(256, 256)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = + CreateDrawImageForScale(0.125f, SkIRect::MakeWH(400, 400)); + result = GenerateCacheEntry(draw_image_125); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(50, 50)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 1.0 scale, 0.5 scale and 0.125 scale subrected. + EXPECT_EQ(3u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +TEST_F(SoftwareImageDecodeCacheTest_Typical, + UseClosestAvailableDecodeBothSubrected) { + auto draw_image_50 = CreateDrawImageForScale(0.5f, SkIRect::MakeWH(400, 400)); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(200, 200)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = + CreateDrawImageForScale(0.125f, SkIRect::MakeWH(400, 400)); + result = GenerateCacheEntry(draw_image_125); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(50, 50)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 0.5 scale subrected and 0.125 scale subrected. + EXPECT_EQ(2u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +TEST_F(SoftwareImageDecodeCacheTest_Typical, + UseClosestAvailableDecodeBothPastPostScaleSize) { + auto draw_image_50 = + CreateDrawImageForScale(0.5f, SkIRect::MakeXYWH(300, 300, 52, 52)); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(26, 26)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_25 = + CreateDrawImageForScale(0.25, SkIRect::MakeXYWH(300, 300, 52, 52)); + result = GenerateCacheEntry(draw_image_25); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_25, gfx::Size(13, 13)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 0.5 scale subrected and 0.25 scale subrected. + EXPECT_EQ(2u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_25); +} + +class SoftwareImageDecodeCacheTest_AtRaster : public N32Cache, + public AtRaster, + public NoDecodeToScaleSupport, + public DefaultColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_AtRaster, UseClosestAvailableDecode) { + auto draw_image_50 = CreateDrawImageForScale(0.5f); + auto decoded = cache().GetDecodedImageForDraw(draw_image_50); + { + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(256, 256)); + cache().ClearCache(); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(64, 64)); + } + cache().DrawWithImageFinished(draw_image_50, decoded); + + // We should only expect to find these entries: 0.5 scale and 0.125 scale. + EXPECT_EQ(2u, cache().GetNumCacheEntriesForTesting()); +} + +TEST_F(SoftwareImageDecodeCacheTest_AtRaster, + UseClosestAvailableDecodeSubrected) { + auto draw_image_50 = CreateDrawImageForScale(0.5f, SkIRect::MakeWH(500, 500)); + auto decoded = cache().GetDecodedImageForDraw(draw_image_50); + { + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(250, 250)); + cache().ClearCache(); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(64, 64)); + } + cache().DrawWithImageFinished(draw_image_50, decoded); + + // We should only expect to find these entries: 1.0 scale, 0.5 scale subrected + // and 0.125 scale. + EXPECT_EQ(3u, cache().GetNumCacheEntriesForTesting()); +} + +class SoftwareImageDecodeCacheTest_RGBA4444 : public RGBA4444Cache, + public Predecode, + public NoDecodeToScaleSupport, + public DefaultColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_RGBA4444, AlwaysUseOriginalDecode) { + auto draw_image_50 = CreateDrawImageForScale(0.5f); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(512, 512)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + result = GenerateCacheEntry(draw_image_125); + EXPECT_FALSE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(512, 512)); + + // We didn't clear the cache the second time, and should only expect to find + // one entry: 1.0 scale. + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +TEST_F(SoftwareImageDecodeCacheTest_RGBA4444, + AlwaysUseOriginalDecodeEvenSubrected) { + auto draw_image_50 = CreateDrawImageForScale(0.5f, SkIRect::MakeWH(10, 10)); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(512, 512)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = + CreateDrawImageForScale(0.125f, SkIRect::MakeWH(20, 20)); + result = GenerateCacheEntry(draw_image_125); + EXPECT_FALSE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(512, 512)); + + // We didn't clear the cache the second time, and should only expect to find + // one entry: 1.0 scale. + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +class SoftwareImageDecodeCacheTest_ExoticColorSpace + : public N32Cache, + public Predecode, + public NoDecodeToScaleSupport, + public ExoticColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_ExoticColorSpace, + UseClosestAvailableDecode) { + auto draw_image_50 = CreateDrawImageForScale(0.5f); + auto result = GenerateCacheEntry(draw_image_50); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + + // Clear the cache to eliminate the transient 1.f scale from the cache. + cache().ClearCache(); + VerifyEntryExists(__LINE__, draw_image_50, gfx::Size(256, 256)); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + auto draw_image_125 = CreateDrawImageForScale(0.125f); + result = GenerateCacheEntry(draw_image_125); + EXPECT_TRUE(result.has_task); + EXPECT_TRUE(result.needs_unref); + VerifyEntryExists(__LINE__, draw_image_125, gfx::Size(64, 64)); + + // We didn't clear the cache the second time, and should only expect to find + // these entries: 0.5 scale and 0.125 scale. + EXPECT_EQ(2u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image_50); + cache().UnrefImage(draw_image_125); +} + +} // namespace +} // namespace cc
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index a8424ac..432f97f0 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1375,6 +1375,8 @@ "ssl/security_state_tab_helper.h", "ssl/ssl_blocking_page.cc", "ssl/ssl_blocking_page.h", + "ssl/ssl_blocking_page_base.cc", + "ssl/ssl_blocking_page_base.h", "ssl/ssl_cert_reporter.h", "ssl/ssl_client_certificate_selector.h", "ssl/ssl_error_assistant.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index d614fe62..74dcfba 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -761,10 +761,12 @@ {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flag_descriptions::kTLS13VariantDisabled, switches::kTLS13Variant, switches::kTLS13VariantDisabled}, - {flag_descriptions::kTLS13VariantDraft, switches::kTLS13Variant, - switches::kTLS13VariantDraft}, - {flag_descriptions::kTLS13VariantExperiment, switches::kTLS13Variant, - switches::kTLS13VariantExperiment}, + // The Draft 18 variant was deprecated. + {flag_descriptions::kTLS13VariantDeprecated, switches::kTLS13Variant, + switches::kTLS13VariantDisabled}, + // The Experiment variant was deprecated. + {flag_descriptions::kTLS13VariantDeprecated, switches::kTLS13Variant, + switches::kTLS13VariantDisabled}, // The RecordType variant was deprecated. {flag_descriptions::kTLS13VariantDeprecated, switches::kTLS13Variant, switches::kTLS13VariantDisabled}, @@ -773,8 +775,11 @@ switches::kTLS13VariantDisabled}, {flag_descriptions::kTLS13VariantExperiment2, switches::kTLS13Variant, switches::kTLS13VariantExperiment2}, - {flag_descriptions::kTLS13VariantExperiment3, switches::kTLS13Variant, - switches::kTLS13VariantExperiment3}, + // The Experiment3 variant was deprecated. + {flag_descriptions::kTLS13VariantDeprecated, switches::kTLS13Variant, + switches::kTLS13VariantDisabled}, + {flag_descriptions::kTLS13VariantDraft22, switches::kTLS13Variant, + switches::kTLS13VariantDraft22}, }; #if !defined(OS_ANDROID)
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 60f212ac..7e5c869 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1402,10 +1402,8 @@ const char kTLS13VariantDescription[] = "Sets the TLS 1.3 variant used."; const char kTLS13VariantDisabled[] = "Disabled"; const char kTLS13VariantDeprecated[] = "Disabled (Deprecated Setting)"; -const char kTLS13VariantDraft[] = "Enabled (Draft)"; -const char kTLS13VariantExperiment[] = "Enabled (Experiment)"; +const char kTLS13VariantDraft22[] = "Enabled (Draft 22)"; const char kTLS13VariantExperiment2[] = "Enabled (Experiment 2)"; -const char kTLS13VariantExperiment3[] = "Enabled (Experiment 3)"; const char kTopDocumentIsolationName[] = "Top document isolation"; const char kTopDocumentIsolationDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index ac0eb294..2f93034 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -831,10 +831,8 @@ extern const char kTLS13VariantDescription[]; extern const char kTLS13VariantDisabled[]; extern const char kTLS13VariantDeprecated[]; -extern const char kTLS13VariantDraft[]; -extern const char kTLS13VariantExperiment[]; +extern const char kTLS13VariantDraft22[]; extern const char kTLS13VariantExperiment2[]; -extern const char kTLS13VariantExperiment3[]; extern const char kSuggestionsWithSubStringMatchName[]; extern const char kSuggestionsWithSubStringMatchDescription[];
diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc index 1783a10..154bc72 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.cc +++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc
@@ -8,11 +8,9 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -#include "chrome/browser/engagement/site_engagement_service.h" #include "chrome/browser/plugins/flash_temporary_permission_tracker.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/plugins/plugin_metadata.h" @@ -112,14 +110,6 @@ // ChromePluginServiceFilter definitions. // static -const char ChromePluginServiceFilter::kEngagementSettingAllowedHistogram[] = - "Plugin.Flash.Engagement.ContentSettingAllowed"; -const char ChromePluginServiceFilter::kEngagementSettingBlockedHistogram[] = - "Plugin.Flash.Engagement.ContentSettingBlocked"; -const char ChromePluginServiceFilter::kEngagementNoSettingHistogram[] = - "Plugin.Flash.Engagement.NoSetting"; - -// static ChromePluginServiceFilter* ChromePluginServiceFilter::GetInstance() { return base::Singleton<ChromePluginServiceFilter>::get(); } @@ -227,20 +217,12 @@ settings_map, main_frame_origin, plugin_content_url, &is_managed); flash_setting = PluginsFieldTrial::EffectiveContentSetting( settings_map, CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); - double engagement = SiteEngagementService::GetScoreFromSettings( - settings_map, main_frame_origin.GetURL()); - if (flash_setting == CONTENT_SETTING_ALLOW) { - UMA_HISTOGRAM_COUNTS_100(kEngagementSettingAllowedHistogram, engagement); + if (flash_setting == CONTENT_SETTING_ALLOW) return true; - } - if (flash_setting == CONTENT_SETTING_BLOCK) { - UMA_HISTOGRAM_COUNTS_100(kEngagementSettingBlockedHistogram, engagement); + if (flash_setting == CONTENT_SETTING_BLOCK) return false; - } - - UMA_HISTOGRAM_COUNTS_100(kEngagementNoSettingHistogram, engagement); // If the content setting is being managed by enterprise policy and is an // ASK setting, we check to see if it has been temporarily granted. @@ -249,12 +231,7 @@ main_frame_origin.GetURL()); } - // If the content setting isn't managed by enterprise policy, but is ASK, - // check whether the site meets the engagement cutoff for making Flash - // available without a prompt.This should only happen if the setting isn't - // being enforced by an enterprise policy. - if (engagement < PluginsFieldTrial::GetSiteEngagementThresholdForFlash()) - return false; + return false; } return true;
diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.h b/chrome/browser/plugins/chrome_plugin_service_filter.h index f8b651f..133145db 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.h +++ b/chrome/browser/plugins/chrome_plugin_service_filter.h
@@ -33,11 +33,6 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, public content::NotificationObserver { public: - // Public for testing purposes. - static const char kEngagementSettingAllowedHistogram[]; - static const char kEngagementSettingBlockedHistogram[]; - static const char kEngagementNoSettingHistogram[]; - static ChromePluginServiceFilter* GetInstance(); // This method should be called on the UI thread.
diff --git a/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc b/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc index f499b1a..244ec34 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc +++ b/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc
@@ -14,11 +14,8 @@ #include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -#include "chrome/browser/engagement/site_engagement_score.h" -#include "chrome/browser/engagement/site_engagement_service.h" #include "chrome/browser/plugins/flash_temporary_permission_tracker.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/plugins/plugin_metadata.h" @@ -31,7 +28,6 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/pref_names.h" #include "components/sync_preferences/testing_pref_service_syncable.h" -#include "components/variations/variations_associated_data.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/render_frame_host.h" @@ -41,13 +37,6 @@ #include "content/public/test/test_utils.h" #include "url/origin.h" -namespace { - -const char kTrialName[] = "PreferHtmlOverPlugins"; -const char kGroupName[] = "Group1"; - -} // namespace - class ChromePluginServiceFilterTest : public ChromeRenderViewHostTestHarness { public: ChromePluginServiceFilterTest() @@ -79,7 +68,7 @@ protected: void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - SiteEngagementScore::SetParamValuesForTesting(); + // Ensure that the testing profile is registered for creating a PluginPrefs. PluginPrefs::GetForTestingProfile(profile()); PluginFinder::GetInstance(); @@ -108,18 +97,13 @@ content::WebPluginInfo flash_plugin( base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); - base::HistogramTester histograms; - // The default content setting should block Flash, as there should be 0 - // engagement. + // The default content setting should block Flash. GURL url("http://www.google.com"); url::Origin main_frame_origin = url::Origin::Create(url); EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 1); - // Block plugins. HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile()); @@ -129,11 +113,6 @@ EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 1); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementSettingBlockedHistogram, 0, 1); - // Allow plugins. map->SetContentSettingDefaultScope(url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_ALLOW); @@ -141,27 +120,13 @@ EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 1); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementSettingAllowedHistogram, 0, 1); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementSettingBlockedHistogram, 0, 1); - - // Detect important content should block on 0 engagement. + // Detect important content should block plugins without user gesture. map->SetContentSettingDefaultScope(url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 2); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementSettingAllowedHistogram, 0, 1); - histograms.ExpectUniqueSample( - ChromePluginServiceFilter::kEngagementSettingBlockedHistogram, 0, 1); } TEST_F(ChromePluginServiceFilterTest, @@ -169,7 +134,6 @@ content::WebPluginInfo flash_plugin( base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); - base::HistogramTester histograms; GURL url("http://www.google.com"); url::Origin main_frame_origin = url::Origin::Create(url); @@ -182,162 +146,22 @@ EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementSettingAllowedHistogram, 0, 1); - + // Plugins should be hidden on ASK mode. map->SetContentSettingDefaultScope(url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - - // This should be blocked due to 0 engagement and a detect content setting. EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 1); - SiteEngagementService* service = SiteEngagementService::Get(profile()); - service->ResetBaseScoreForURL(url, 10.0); - - // Should still be blocked. - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 10, 1); - - // Reaching 30.0 engagement should allow Flash. - service->ResetBaseScoreForURL(url, 30.0); - EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, - profile()->GetResourceContext(), flash_plugin)); - - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 1); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 10, 1); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 30, 1); - - // Blocked content setting should override engagement + // Block plugins. map->SetContentSettingDefaultScope(url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_BLOCK); EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementSettingBlockedHistogram, 30, 1); -} - -TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsCustomEngagement) { - content::WebPluginInfo flash_plugin( - base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, - base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); - base::HistogramTester histograms; - - // Activate PreferHtmlOverPlugins and set a custom variation value in the - // feature. - base::FieldTrialList field_trials_(nullptr); - base::FieldTrial* trial = - base::FieldTrialList::CreateFieldTrial(kTrialName, kGroupName); - std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); - feature_list->RegisterFieldTrialOverride( - features::kPreferHtmlOverPlugins.name, - base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial); - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureList(std::move(feature_list)); - EXPECT_EQ( - base::FeatureList::GetFieldTrial(features::kPreferHtmlOverPlugins), - trial); - - // Set the custom engagement threshold for Flash. - std::map<std::string, std::string> params; - params[PluginsFieldTrial::kSiteEngagementThresholdForFlashKey] = "50"; - ASSERT_TRUE( - variations::AssociateVariationParams(kTrialName, kGroupName, params)); - std::map<std::string, std::string> actualParams; - EXPECT_TRUE(variations::GetVariationParamsByFeature( - features::kPreferHtmlOverPlugins, &actualParams)); - EXPECT_EQ(params, actualParams); - - // Set to detect important content by default. - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(profile()); - map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - - // This should be blocked due to 0 engagement. - GURL url("http://www.google.com"); - url::Origin main_frame_origin = url::Origin::Create(url); - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - - // Should still be blocked until engagement reaches 50. - SiteEngagementService* service = SiteEngagementService::Get(profile()); - service->ResetBaseScoreForURL(url, 0.0); - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - service->ResetBaseScoreForURL(url, 10.0); - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - service->ResetBaseScoreForURL(url, 40.0); - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); - service->ResetBaseScoreForURL(url, 60.0); - EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, - profile()->GetResourceContext(), flash_plugin)); - - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 0, 2); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 10, 1); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 40, 1); - histograms.ExpectBucketCount( - ChromePluginServiceFilter::kEngagementNoSettingHistogram, 60, 1); - - variations::testing::ClearAllVariationParams(); } TEST_F(ChromePluginServiceFilterTest, - PreferHtmlOverPluginsIncognitoBlockToDetect) { - Profile* incognito = profile()->GetOffTheRecordProfile(); - filter_->RegisterResourceContext(incognito, incognito->GetResourceContext()); - - content::WebPluginInfo flash_plugin( - base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, - base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); - - // Block plugins in the original profile. This should inherit into incognito. - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(profile()); - map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTING_BLOCK); - - // We should fail the availablity check in incognito. - GURL url("http://www.google.com"); - url::Origin main_frame_origin = url::Origin::Create(url); - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); - - // Add sufficient engagement to allow Flash in the original profile. - SiteEngagementService* service = SiteEngagementService::Get(profile()); - service->ResetBaseScoreForURL(url, 30.0); - - // We should still fail the engagement check due to the block. - EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); - - // Change to detect important content in the original profile. - map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - - // Ensure we pass the engagement check in the incognito profile (i.e. it falls - // back to checking engagement from the original profile when nothing is found - // in the incognito profile). - EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, - incognito->GetResourceContext(), flash_plugin)); -} - -TEST_F(ChromePluginServiceFilterTest, - PreferHtmlOverPluginsIncognitoAllowToDetect) { + PreferHtmlOverPluginsIncognitoHasIndependentSetting) { Profile* incognito = profile()->GetOffTheRecordProfile(); filter_->RegisterResourceContext(incognito, incognito->GetResourceContext()); @@ -348,38 +172,20 @@ GURL url("http://www.google.com"); // Allow plugins for this url in the incognito profile. - HostContentSettingsMap* map = + HostContentSettingsMap* incognito_map = HostContentSettingsMapFactory::GetForProfile(incognito); - map->SetContentSettingDefaultScope( - url, url, - CONTENT_SETTINGS_TYPE_PLUGINS, - std::string(), + incognito_map->SetContentSettingDefaultScope( + url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_ALLOW); - // We pass the availablity check in incognito based on the original content - // setting. + // We pass the availablity check in incognito. url::Origin main_frame_origin = url::Origin::Create(url); EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); - map->SetContentSettingDefaultScope( - url, url, - CONTENT_SETTINGS_TYPE_PLUGINS, - std::string(), - CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - - // Now we fail the availability check due to the content setting carrying - // over. + // But the original profile still fails the availability check. EXPECT_FALSE(IsPluginAvailable( - url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); - - // Add sufficient engagement to allow Flash in the incognito profile. - SiteEngagementService* service = SiteEngagementService::Get(incognito); - service->ResetBaseScoreForURL(url, 30.0); - - // Ensure we pass the engagement check in the incognito profile. - EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, - incognito->GetResourceContext(), flash_plugin)); + url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); } TEST_F(ChromePluginServiceFilterTest, ManagedSetting) { @@ -387,24 +193,16 @@ base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(profile()); - map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - sync_preferences::TestingPrefServiceSyncable* prefs = profile()->GetTestingPrefService(); prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, base::MakeUnique<base::Value>(CONTENT_SETTING_ASK)); - SiteEngagementService* service = SiteEngagementService::Get(profile()); GURL url("http://www.google.com"); url::Origin main_frame_origin = url::Origin::Create(url); NavigateAndCommit(url); - service->ResetBaseScoreForURL(url, 30.0); - // Reaching 30.0 engagement would usually allow Flash, but not for enterprise. - service->ResetBaseScoreForURL(url, 0); + // Flash is normally blocked on the ASK managed policy. EXPECT_FALSE(IsPluginAvailable( url, main_frame_origin, profile()->GetResourceContext(), flash_plugin));
diff --git a/chrome/browser/plugins/flash_permission_browsertest.cc b/chrome/browser/plugins/flash_permission_browsertest.cc index 927c251..31db114 100644 --- a/chrome/browser/plugins/flash_permission_browsertest.cc +++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -61,17 +61,6 @@ switches::kOverridePluginPowerSaverForTesting, "never"); } - void SetUpOnMainThread() override { - // Set a high engagement threshhold so it doesn't interfere with testing the - // permission. - std::map<std::string, std::string> parameters; - parameters["engagement_threshold_for_flash"] = "100"; - scoped_feature_list_.InitAndEnableFeatureWithParameters( - features::kPreferHtmlOverPlugins, parameters); - - PermissionsBrowserTest::SetUpOnMainThread(); - } - void TriggerPrompt() override { if (prompt_factory()->response_type() == PermissionRequestManager::ACCEPT_ALL) {
diff --git a/chrome/browser/plugins/plugins_field_trial.cc b/chrome/browser/plugins/plugins_field_trial.cc index 8168f1b8..f38af0d 100644 --- a/chrome/browser/plugins/plugins_field_trial.cc +++ b/chrome/browser/plugins/plugins_field_trial.cc
@@ -9,21 +9,6 @@ #include "base/feature_list.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/plugins/plugin_utils.h" -#include "chrome/common/chrome_features.h" -#include "components/variations/variations_associated_data.h" - -namespace { - -// The default site engagement threshold to allow Flash to be presented as an -// available plugin. This value is not used for normal uses, but only for -// developers / testers that don't have a field trial configuration. -const double kDefaultSiteEngagementThresholdForFlash = 30.0; - -} // namespace - -// static -const char PluginsFieldTrial::kSiteEngagementThresholdForFlashKey[] = - "engagement_threshold_for_flash"; // static ContentSetting PluginsFieldTrial::EffectiveContentSetting( @@ -41,14 +26,3 @@ ? ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT : ContentSetting::CONTENT_SETTING_BLOCK; } - -// static -double PluginsFieldTrial::GetSiteEngagementThresholdForFlash() { - double threshold = -1; - std::string param = variations::GetVariationParamValueByFeature( - features::kPreferHtmlOverPlugins, - PluginsFieldTrial::kSiteEngagementThresholdForFlashKey); - if (base::StringToDouble(param, &threshold) && threshold >= 0) - return threshold; - return kDefaultSiteEngagementThresholdForFlash; -}
diff --git a/chrome/browser/plugins/plugins_field_trial.h b/chrome/browser/plugins/plugins_field_trial.h index 788ce15..b65dd9a 100644 --- a/chrome/browser/plugins/plugins_field_trial.h +++ b/chrome/browser/plugins/plugins_field_trial.h
@@ -14,10 +14,6 @@ // This class manages the Plugins field trials. class PluginsFieldTrial { public: - // The name of the variations parameter used for updating the amount of site - // engagement required to permit Flash. - static const char kSiteEngagementThresholdForFlashKey[]; - // Returns the effective content setting for plugins. Passes non-plugin // content settings through without modification. static ContentSetting EffectiveContentSetting( @@ -25,9 +21,6 @@ ContentSettingsType type, ContentSetting setting); - // Returns the engagement cutoff for permitting Flash to run without a prompt. - static double GetSiteEngagementThresholdForFlash(); - private: DISALLOW_IMPLICIT_CONSTRUCTORS(PluginsFieldTrial); };
diff --git a/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc b/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc index f58f451..7bf34dd3 100644 --- a/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc +++ b/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc
@@ -38,7 +38,7 @@ base::CommandLine command_line(base::CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1.1"); command_line.AppendSwitchASCII(switches::kSSLVersionMax, "tls1.2"); - command_line.AppendSwitchASCII(switches::kTLS13Variant, "draft"); + command_line.AppendSwitchASCII(switches::kTLS13Variant, "draft22"); sync_preferences::PrefServiceMockFactory factory; factory.set_user_prefs(local_state_store); @@ -60,7 +60,7 @@ // Command-line flags should be respected. EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_1, ssl_config.version_min); EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantDraft, ssl_config.tls13_variant); + EXPECT_EQ(net::kTLS13VariantDraft22, ssl_config.tls13_variant); // Explicitly double-check the settings are not in the preference store. const PrefService::Preference* version_min_pref = @@ -92,7 +92,7 @@ base::MakeRefCounted<TestingPrefStore>(); base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - command_line.AppendSwitchASCII(switches::kTLS13Variant, "experiment"); + command_line.AppendSwitchASCII(switches::kTLS13Variant, "experiment2"); sync_preferences::PrefServiceMockFactory factory; factory.set_user_prefs(local_state_store); @@ -113,7 +113,7 @@ config_service->GetSSLConfig(&ssl_config); // Command-line flags should be respected. EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantExperiment, ssl_config.tls13_variant); + EXPECT_EQ(net::kTLS13VariantExperiment2, ssl_config.tls13_variant); } // Test that setting a disabled TLS 1.3 variant correctly sets SSLVersionMax.
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc b/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc index f70e241..e9f7cc3c 100644 --- a/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc +++ b/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/ssl/certificate_reporting_test_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/certificate_reporting/error_report.h" @@ -63,7 +64,9 @@ // - If a report is expected to hang, the test waits for the corresponding URL // request job to be created. Only after resuming the hung request job the // test waits for the request to be destroyed. -class CertificateReportingServiceBrowserTest : public InProcessBrowserTest { +class CertificateReportingServiceBrowserTest + : public InProcessBrowserTest, + public testing::WithParamInterface<bool> { public: CertificateReportingServiceBrowserTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { @@ -117,6 +120,9 @@ variations::testing::VariationParamsManager::AppendVariationParams( "ReportCertificateErrors", "ShowAndPossiblySend", {{"sendingThreshold", "1.0"}}, command_line); + if (GetParam()) { + command_line->AppendSwitch(switches::kCommittedInterstitials); + } } CertificateReportingServiceTestHelper* test_helper() { return &test_helper_; } @@ -138,11 +144,16 @@ TabStripModel* tab_strip_model = browser()->tab_strip_model(); content::WebContents* contents = tab_strip_model->GetActiveWebContents(); ui_test_utils::NavigateToURL(browser(), kCertErrorURL); - content::WaitForInterstitialAttach(contents); + // When GetParam() is true, committed interstitials are enabled. In this + // case, no interstitial attaches; once a navigation commits, the error page + // is present. + if (!GetParam()) + content::WaitForInterstitialAttach(contents); // Navigate away from the interstitial to trigger report upload. ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); - content::WaitForInterstitialDetach(contents); + if (!GetParam()) + content::WaitForInterstitialDetach(contents); } void SendPendingReports() { service()->SendPending(); } @@ -218,9 +229,13 @@ DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceBrowserTest); }; +INSTANTIATE_TEST_CASE_P(, + CertificateReportingServiceBrowserTest, + ::testing::Values(false, true)); + // Tests that report send attempt should be cancelled when extended // reporting is not opted in. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, NotOptedIn_ShouldNotSendReports) { SetExpectedHistogramCountOnTeardown(0); @@ -237,7 +252,7 @@ // Tests that report send attempts are not cancelled when extended reporting is // opted in. Goes to an interstitial page and navigates away to force a report // send event. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, OptedIn_ShouldSendSuccessfulReport) { SetExpectedHistogramCountOnTeardown(0); @@ -261,7 +276,7 @@ // Tests that report send attempts are not cancelled when extended reporting is // opted in. Goes to an interstitial page and navigate away to force a report // send event. Repeats this three times and checks expected number of reports. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, OptedIn_ShouldQueueFailedReport) { SetExpectedHistogramCountOnTeardown(2); @@ -310,7 +325,7 @@ // Opting in then opting out of extended reporting should clear the pending // report queue. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, OptedIn_ThenOptedOut) { SetExpectedHistogramCountOnTeardown(1); @@ -338,7 +353,7 @@ } // Opting out, then in, then out of extended reporting should work as expected. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, OptedOut_ThenOptedIn_ThenOptedOut) { SetExpectedHistogramCountOnTeardown(1); @@ -383,7 +398,7 @@ // Disabling SafeBrowsing should clear pending reports queue in // CertificateReportingService. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, DisableSafebrowsing) { SetExpectedHistogramCountOnTeardown(2); @@ -425,7 +440,7 @@ } // CertificateReportingService should ignore reports older than the report TTL. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, DontSendOldReports) { SetExpectedHistogramCountOnTeardown(5); @@ -506,7 +521,7 @@ // CertificateReportingService should drop old reports from its pending report // queue, if the queue is full. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, DropOldReportsFromQueue) { SetExpectedHistogramCountOnTeardown(7); @@ -585,7 +600,7 @@ 9 /* submitted */, 7 /* failed */, 2 /* successful */, 2 /* dropped */); } -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, Delayed_Resumed) { SetExpectedHistogramCountOnTeardown(0); @@ -614,7 +629,7 @@ // Same as above, but the service is shut down before resuming the delayed // request. Should not crash. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, Delayed_Resumed_ServiceShutdown) { SetExpectedHistogramCountOnTeardown(0); @@ -642,7 +657,7 @@ // Trigger a delayed report, then disable Safebrowsing. Certificate reporting // service should clear its in-flight reports list. -IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, Delayed_Reset) { +IN_PROC_BROWSER_TEST_P(CertificateReportingServiceBrowserTest, Delayed_Reset) { SetExpectedHistogramCountOnTeardown(0); certificate_reporting_test_utils::SetCertReportingOptIn(
diff --git a/chrome/browser/ssl/bad_clock_blocking_page.cc b/chrome/browser/ssl/bad_clock_blocking_page.cc index d87f5dce..f0d5ba6d 100644 --- a/chrome/browser/ssl/bad_clock_blocking_page.cc +++ b/chrome/browser/ssl/bad_clock_blocking_page.cc
@@ -69,9 +69,14 @@ ssl_errors::ClockState clock_state, std::unique_ptr<SSLCertReporter> ssl_cert_reporter, const base::Callback<void(content::CertificateRequestResultType)>& callback) - : SecurityInterstitialPage( + : SSLBlockingPageBase( web_contents, + certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, + ssl_info, request_url, + std::move(ssl_cert_reporter), + false /* overridable */, + time_triggered, base::MakeUnique<SSLErrorControllerClient>( web_contents, ssl_info, @@ -79,15 +84,6 @@ CreateMetricsHelper(web_contents, request_url))), callback_(callback), ssl_info_(ssl_info), - cert_report_helper_(new CertReportHelper( - std::move(ssl_cert_reporter), - web_contents, - request_url, - ssl_info, - certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, - false /* overridable */, - time_triggered, - controller()->metrics_helper())), bad_clock_ui_(new security_interstitials::BadClockUI(request_url, cert_error, ssl_info, @@ -114,7 +110,7 @@ void BadClockBlockingPage::PopulateInterstitialStrings( base::DictionaryValue* load_time_data) { bad_clock_ui_->PopulateStringsForHTML(load_time_data); - cert_report_helper_->PopulateExtendedReportingOption(load_time_data); + cert_report_helper()->PopulateExtendedReportingOption(load_time_data); } void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) { @@ -123,7 +119,7 @@ void BadClockBlockingPage::SetSSLCertReporterForTesting( std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { - cert_report_helper_->SetSSLCertReporterForTesting( + cert_report_helper()->SetSSLCertReporterForTesting( std::move(ssl_cert_reporter)); } @@ -139,25 +135,14 @@ bool retval = base::StringToInt(command, &cmd); DCHECK(retval); + // Let the CertReportHelper handle commands first, This allows it to get set + // up to send reports, so that the report is populated properly if + // BadClockErrorUI's command handling triggers a report to be sent. + cert_report_helper()->HandleReportingCommands( + static_cast<security_interstitials::SecurityInterstitialCommand>(cmd), + controller()->GetPrefService()); bad_clock_ui_->HandleCommand( static_cast<security_interstitials::SecurityInterstitialCommand>(cmd)); - - // Special handling for the reporting preference being changed. - switch (cmd) { - case security_interstitials::CMD_DO_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), true, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - case security_interstitials::CMD_DONT_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), false, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - default: - // Other commands can be ignored. - break; - } } void BadClockBlockingPage::OverrideRendererPrefs( @@ -169,9 +154,7 @@ } void BadClockBlockingPage::OnDontProceed() { - UpdateMetricsAfterSecurityInterstitial(); - cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); + OnInterstitialClosing(); NotifyDenyCertificate(); }
diff --git a/chrome/browser/ssl/bad_clock_blocking_page.h b/chrome/browser/ssl/bad_clock_blocking_page.h index ed8b1b1..1adacd23b 100644 --- a/chrome/browser/ssl/bad_clock_blocking_page.h +++ b/chrome/browser/ssl/bad_clock_blocking_page.h
@@ -11,13 +11,12 @@ #include "base/callback.h" #include "base/macros.h" #include "base/time/time.h" +#include "chrome/browser/ssl/ssl_blocking_page_base.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" -#include "components/security_interstitials/content/security_interstitial_page.h" #include "components/ssl_errors/error_classification.h" #include "content/public/browser/certificate_request_result_type.h" #include "net/ssl/ssl_info.h" -class CertReportHelper; class GURL; namespace security_interstitials { @@ -28,8 +27,7 @@ // occurs when an SSL error is triggered by a clock misconfiguration. It // creates the UI using security_interstitials::BadClockUI and then // displays it. It deletes itself when the interstitial page is closed. -class BadClockBlockingPage - : public security_interstitials::SecurityInterstitialPage { +class BadClockBlockingPage : public SSLBlockingPageBase { public: // Interstitial type, used in tests. static const InterstitialPageDelegate::TypeID kTypeForTesting; @@ -73,7 +71,6 @@ base::Callback<void(content::CertificateRequestResultType)> callback_; const net::SSLInfo ssl_info_; - const std::unique_ptr<CertReportHelper> cert_report_helper_; const std::unique_ptr<security_interstitials::BadClockUI> bad_clock_ui_; DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage);
diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc index 2b01a75a..afa5389 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page.cc
@@ -74,9 +74,14 @@ std::unique_ptr<SSLCertReporter> ssl_cert_reporter, const net::SSLInfo& ssl_info, const base::Callback<void(content::CertificateRequestResultType)>& callback) - : SecurityInterstitialPage( + : SSLBlockingPageBase( web_contents, + certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, + ssl_info, request_url, + std::move(ssl_cert_reporter), + false /* overridable */, + base::Time::Now(), base::MakeUnique<SSLErrorControllerClient>( web_contents, ssl_info, @@ -85,13 +90,6 @@ login_url_(login_url), ssl_info_(ssl_info), callback_(callback) { - if (ssl_cert_reporter) { - cert_report_helper_.reset(new CertReportHelper( - std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, - certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, - base::Time::Now(), nullptr)); - } - captive_portal::CaptivePortalMetrics::LogCaptivePortalBlockingPageEvent( captive_portal::CaptivePortalMetrics::SHOW_ALL); } @@ -209,8 +207,8 @@ load_time_data->SetString("explanationParagraph", base::string16()); load_time_data->SetString("finalParagraph", base::string16()); - if (cert_report_helper_) - cert_report_helper_->PopulateExtendedReportingOption(load_time_data); + if (cert_report_helper()) + cert_report_helper()->PopulateExtendedReportingOption(load_time_data); else load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox, false); } @@ -227,6 +225,8 @@ security_interstitials::SecurityInterstitialCommand cmd = static_cast<security_interstitials::SecurityInterstitialCommand>( command_num); + cert_report_helper()->HandleReportingCommands(cmd, + controller()->GetPrefService()); switch (cmd) { case security_interstitials::CMD_OPEN_LOGIN: captive_portal::CaptivePortalMetrics::LogCaptivePortalBlockingPageEvent( @@ -247,18 +247,6 @@ CaptivePortalTabHelper::OpenLoginTabForWebContents(web_contents(), true); #endif break; - case security_interstitials::CMD_DO_REPORT: - controller()->SetReportingPreference(true); - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), true, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - case security_interstitials::CMD_DONT_REPORT: - controller()->SetReportingPreference(false); - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), false, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: controller()->OpenExtendedReportingPrivacyPolicy(true); break; @@ -286,13 +274,7 @@ } void CaptivePortalBlockingPage::OnDontProceed() { - UpdateMetricsAfterSecurityInterstitial(); - if (cert_report_helper_) { - // Finish collecting information about invalid certificates, if the - // user opted in to. - cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); - } + OnInterstitialClosing(); // Need to explicity deny the certificate via the callback, otherwise memory // is leaked.
diff --git a/chrome/browser/ssl/captive_portal_blocking_page.h b/chrome/browser/ssl/captive_portal_blocking_page.h index dd6cab3..326c6aa6 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.h +++ b/chrome/browser/ssl/captive_portal_blocking_page.h
@@ -10,8 +10,8 @@ #include "base/callback.h" #include "base/macros.h" +#include "chrome/browser/ssl/ssl_blocking_page_base.h" #include "chrome/common/features.h" -#include "components/security_interstitials/content/security_interstitial_page.h" #include "content/public/browser/certificate_request_result_type.h" #include "net/ssl/ssl_info.h" #include "url/gurl.h" @@ -25,7 +25,6 @@ class SSLInfo; } -class CertReportHelper; class SSLCertReporter; // This class is responsible for showing/hiding the interstitial page that is @@ -35,8 +34,7 @@ // This class should only be used on the UI thread because its implementation // uses captive_portal::CaptivePortalService, which can only be accessed on the // UI thread. Only used when ENABLE_CAPTIVE_PORTAL_DETECTION is true. -class CaptivePortalBlockingPage - : public security_interstitials::SecurityInterstitialPage { +class CaptivePortalBlockingPage : public SSLBlockingPageBase { public: // Interstitial type, for testing. static const void* const kTypeForTesting; @@ -76,7 +74,6 @@ // If empty, the default captive portal detection URL for the platform will be // used. const GURL login_url_; - std::unique_ptr<CertReportHelper> cert_report_helper_; const net::SSLInfo ssl_info_; base::Callback<void(content::CertificateRequestResultType)> callback_;
diff --git a/chrome/browser/ssl/cert_report_helper.cc b/chrome/browser/ssl/cert_report_helper.cc index 02c67fb..d7cfff6 100644 --- a/chrome/browser/ssl/cert_report_helper.cc +++ b/chrome/browser/ssl/cert_report_helper.cc
@@ -110,8 +110,38 @@ base::UTF8ToUTF16(privacy_link))); } -void CertReportHelper::FinishCertCollection( - certificate_reporting::ErrorReport::ProceedDecision user_proceeded) { +void CertReportHelper::SetSSLCertReporterForTesting( + std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { + ssl_cert_reporter_ = std::move(ssl_cert_reporter); +} + +void CertReportHelper::HandleReportingCommands( + security_interstitials::SecurityInterstitialCommand command, + PrefService* pref_service) { + switch (command) { + case security_interstitials::CMD_DO_REPORT: + safe_browsing::SetExtendedReportingPrefAndMetric( + pref_service, true, /* value */ + safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); + break; + case security_interstitials::CMD_DONT_REPORT: + safe_browsing::SetExtendedReportingPrefAndMetric( + pref_service, false, /* value */ + safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); + break; + case security_interstitials::CMD_PROCEED: + user_action_ = certificate_reporting::ErrorReport::USER_PROCEEDED; + break; + case security_interstitials::CMD_DONT_PROCEED: + user_action_ = certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED; + break; + default: + // Other commands can be ignored. + break; + } +} + +void CertReportHelper::FinishCertCollection() { if (!ShouldShowCertificateReporterCheckbox()) return; @@ -143,7 +173,7 @@ #endif report.SetInterstitialInfo( - interstitial_reason_, user_proceeded, + interstitial_reason_, user_action_, overridable_ ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE, @@ -157,11 +187,6 @@ ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report); } -void CertReportHelper::SetSSLCertReporterForTesting( - std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { - ssl_cert_reporter_ = std::move(ssl_cert_reporter); -} - bool CertReportHelper::ShouldShowCertificateReporterCheckbox() { // Only show the checkbox iff the user is part of the respective Finch group // and the window is not incognito and the feature is not disabled by policy.
diff --git a/chrome/browser/ssl/cert_report_helper.h b/chrome/browser/ssl/cert_report_helper.h index 0222524..0d7ceb79 100644 --- a/chrome/browser/ssl/cert_report_helper.h +++ b/chrome/browser/ssl/cert_report_helper.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "components/certificate_reporting/error_report.h" +#include "components/security_interstitials/core/controller_client.h" #include "net/ssl/ssl_info.h" #include "url/gurl.h" @@ -27,7 +28,12 @@ class SSLCertReporter; // CertReportHelper helps SSL interstitials report invalid certificate -// chains. +// chains. Its main methods are: +// - HandleReportingCommands() which processes commands from the interstitial +// page that are related to certificate reporting: toggling the preference, and +// proceeding or going back. +// - FinishCertCollection() which should be called when an interstitial is +// closing to send a certificate report. class CertReportHelper { public: // Constants for the HTTPSErrorReporter Finch experiment @@ -56,16 +62,22 @@ // the checkbox. void PopulateExtendedReportingOption(base::DictionaryValue* load_time_data); - // Sends a report about an invalid certificate to the - // server. |user_proceeded| indicates whether the user clicked through - // the interstitial or not, and will be included in the report. - void FinishCertCollection( - certificate_reporting::ErrorReport::ProceedDecision user_proceeded); - // Allows tests to inject a mock reporter. void SetSSLCertReporterForTesting( std::unique_ptr<SSLCertReporter> ssl_cert_reporter); + // Handles reporting-related commands from the interstitial page: toggling the + // report preference, and sending reports on proceed/do not proceed. For + // preference-toggling commands, this method updates the corresponding prefs + // in |pref_service|. For proceeding/going back, the user action is saved to + // be reported when FinishCertCollection() is called. + void HandleReportingCommands( + security_interstitials::SecurityInterstitialCommand command, + PrefService* pref_service); + + // Sends a report about an invalid certificate to the server. + void FinishCertCollection(); + private: // Checks whether a checkbox should be shown on the page that allows // the user to opt in to Safe Browsing extended reporting. @@ -96,6 +108,12 @@ const base::Time interstitial_time_; // Helpful for recording metrics about cert reports. security_interstitials::MetricsHelper* metrics_helper_; + // Default to DID_NOT_PROCEED. If no user action is processed via + // HandleReportingCommands() before FinishCertCollection(), then act as if the + // user did not proceed for reporting purposes -- e.g. closing the tab without + // taking an action on the interstitial is counted as not proceeding. + certificate_reporting::ErrorReport::ProceedDecision user_action_ = + certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED; DISALLOW_COPY_AND_ASSIGN(CertReportHelper); };
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.cc b/chrome/browser/ssl/mitm_software_blocking_page.cc index 9200f12..d63bdbd 100644 --- a/chrome/browser/ssl/mitm_software_blocking_page.cc +++ b/chrome/browser/ssl/mitm_software_blocking_page.cc
@@ -69,9 +69,14 @@ const std::string& mitm_software_name, bool is_enterprise_managed, const base::Callback<void(content::CertificateRequestResultType)>& callback) - : SecurityInterstitialPage( + : SSLBlockingPageBase( web_contents, + certificate_reporting::ErrorReport::INTERSTITIAL_MITM_SOFTWARE, + ssl_info, request_url, + std::move(ssl_cert_reporter), + false /* overridable */, + base::Time::Now(), base::MakeUnique<SSLErrorControllerClient>( web_contents, ssl_info, @@ -79,15 +84,6 @@ CreateMetricsHelper(web_contents, request_url))), callback_(callback), ssl_info_(ssl_info), - cert_report_helper_(new CertReportHelper( - std::move(ssl_cert_reporter), - web_contents, - request_url, - ssl_info, - certificate_reporting::ErrorReport::INTERSTITIAL_MITM_SOFTWARE, - false /* overridable */, - base::Time::Now(), - nullptr)), mitm_software_ui_( new security_interstitials::MITMSoftwareUI(request_url, cert_error, @@ -115,7 +111,7 @@ void MITMSoftwareBlockingPage::PopulateInterstitialStrings( base::DictionaryValue* load_time_data) { mitm_software_ui_->PopulateStringsForHTML(load_time_data); - cert_report_helper_->PopulateExtendedReportingOption(load_time_data); + cert_report_helper()->PopulateExtendedReportingOption(load_time_data); } void MITMSoftwareBlockingPage::OverrideEntry(NavigationEntry* entry) { @@ -124,7 +120,7 @@ void MITMSoftwareBlockingPage::SetSSLCertReporterForTesting( std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { - cert_report_helper_->SetSSLCertReporterForTesting( + cert_report_helper()->SetSSLCertReporterForTesting( std::move(ssl_cert_reporter)); } @@ -140,25 +136,14 @@ bool retval = base::StringToInt(command, &cmd); DCHECK(retval); + // Let the CertReportHelper handle commands first, This allows it to get set + // up to send reports, so that the report is populated properly if + // MITMSoftwareUI's command handling triggers a report to be sent. + cert_report_helper()->HandleReportingCommands( + static_cast<security_interstitials::SecurityInterstitialCommand>(cmd), + controller()->GetPrefService()); mitm_software_ui_->HandleCommand( static_cast<security_interstitials::SecurityInterstitialCommand>(cmd)); - - // Special handling for the reporting preference being changed. - switch (cmd) { - case security_interstitials::CMD_DO_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), true, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - case security_interstitials::CMD_DONT_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), false, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - default: - // Other commands can be ignored. - break; - } } void MITMSoftwareBlockingPage::OverrideRendererPrefs( @@ -170,9 +155,7 @@ } void MITMSoftwareBlockingPage::OnDontProceed() { - UpdateMetricsAfterSecurityInterstitial(); - cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); + OnInterstitialClosing(); NotifyDenyCertificate(); }
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.h b/chrome/browser/ssl/mitm_software_blocking_page.h index b9b39b74..dfa94ce 100644 --- a/chrome/browser/ssl/mitm_software_blocking_page.h +++ b/chrome/browser/ssl/mitm_software_blocking_page.h
@@ -10,13 +10,12 @@ #include "base/callback.h" #include "base/macros.h" +#include "chrome/browser/ssl/ssl_blocking_page_base.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" -#include "components/security_interstitials/content/security_interstitial_page.h" #include "components/ssl_errors/error_classification.h" #include "content/public/browser/certificate_request_result_type.h" #include "net/ssl/ssl_info.h" -class CertReportHelper; class GURL; namespace security_interstitials { @@ -29,8 +28,7 @@ // software that intercepts and rewrites the user's connection. This class // creates the interstitial UI using security_interstitials::MITMSoftwareUI and // then displays it. It deletes itself when the interstitial page is closed. -class MITMSoftwareBlockingPage - : public security_interstitials::SecurityInterstitialPage { +class MITMSoftwareBlockingPage : public SSLBlockingPageBase { public: // Interstitial type, used in tests. static const InterstitialPageDelegate::TypeID kTypeForTesting; @@ -75,7 +73,6 @@ base::Callback<void(content::CertificateRequestResultType)> callback_; const net::SSLInfo ssl_info_; - const std::unique_ptr<CertReportHelper> cert_report_helper_; const std::unique_ptr<security_interstitials::MITMSoftwareUI> mitm_software_ui_;
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index abcf1c9b..4a996d5a 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -48,15 +48,6 @@ const char kEventNotOverridable[] = "notoverridable_"; const char kEventOverridable[] = "overridable_"; -// Events for UMA. Do not reorder or change! -enum SSLExpirationAndDecision { - EXPIRED_AND_PROCEED, - EXPIRED_AND_DO_NOT_PROCEED, - NOT_EXPIRED_AND_PROCEED, - NOT_EXPIRED_AND_DO_NOT_PROCEED, - END_OF_SSL_EXPIRATION_AND_DECISION, -}; - std::string GetSamplingEventName(const bool overridable, const int cert_error) { std::string event_name(kEventNameBase); if (overridable) @@ -67,32 +58,6 @@ return event_name; } -void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, - bool proceed, - bool overridable) { - SSLExpirationAndDecision event; - if (expired_but_previously_allowed && proceed) - event = EXPIRED_AND_PROCEED; - else if (expired_but_previously_allowed && !proceed) - event = EXPIRED_AND_DO_NOT_PROCEED; - else if (!expired_but_previously_allowed && proceed) - event = NOT_EXPIRED_AND_PROCEED; - else - event = NOT_EXPIRED_AND_DO_NOT_PROCEED; - - if (overridable) { - UMA_HISTOGRAM_ENUMERATION( - "interstitial.ssl.expiration_and_decision.overridable", - event, - END_OF_SSL_EXPIRATION_AND_DECISION); - } else { - UMA_HISTOGRAM_ENUMERATION( - "interstitial.ssl.expiration_and_decision.nonoverridable", - event, - END_OF_SSL_EXPIRATION_AND_DECISION); - } -} - std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper( content::WebContents* web_contents, int cert_error, @@ -152,8 +117,6 @@ if (!callback_.is_null()) { // The page is closed without the user having chosen what to do, default to // deny. - RecordSSLExpirationPageEventState(expired_but_previously_allowed_, false, - overridable_); NotifyDenyCertificate(); } } @@ -161,7 +124,7 @@ void SSLBlockingPage::PopulateInterstitialStrings( base::DictionaryValue* load_time_data) { ssl_error_ui_->PopulateStringsForHTML(load_time_data); - cert_report_helper_->PopulateExtendedReportingOption(load_time_data); + cert_report_helper()->PopulateExtendedReportingOption(load_time_data); } // Note that we always create a navigation entry with SSL errors. @@ -178,29 +141,26 @@ std::unique_ptr<ChromeMetricsHelper> metrics_helper, bool is_superfish, const base::Callback<void(content::CertificateRequestResultType)>& callback) - : SecurityInterstitialPage(web_contents, - request_url, - base::MakeUnique<SSLErrorControllerClient>( - web_contents, - ssl_info, - request_url, - std::move(metrics_helper))), + : SSLBlockingPageBase( + web_contents, + is_superfish + ? certificate_reporting::ErrorReport::INTERSTITIAL_SUPERFISH + : certificate_reporting::ErrorReport::INTERSTITIAL_SSL, + ssl_info, + request_url, + std::move(ssl_cert_reporter), + overridable, + time_triggered, + base::MakeUnique<SSLErrorControllerClient>( + web_contents, + ssl_info, + request_url, + std::move(metrics_helper))), callback_(callback), ssl_info_(ssl_info), overridable_(overridable), expired_but_previously_allowed_( (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), - cert_report_helper_(new CertReportHelper( - std::move(ssl_cert_reporter), - web_contents, - request_url, - ssl_info, - is_superfish - ? certificate_reporting::ErrorReport::INTERSTITIAL_SUPERFISH - : certificate_reporting::ErrorReport::INTERSTITIAL_SSL, - overridable_, - time_triggered, - controller()->metrics_helper())), ssl_error_ui_( is_superfish ? base::MakeUnique<security_interstitials::SuperfishErrorUI>( @@ -226,7 +186,7 @@ void SSLBlockingPage::SetSSLCertReporterForTesting( std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { - cert_report_helper_->SetSSLCertReporterForTesting( + cert_report_helper()->SetSSLCertReporterForTesting( std::move(ssl_cert_reporter)); } @@ -241,25 +201,15 @@ int cmd = 0; bool retval = base::StringToInt(command, &cmd); DCHECK(retval); + + // Let the CertReportHelper handle commands first, This allows it to get set + // up to send reports, so that the report is populated properly if + // SSLErrorUI's command handling triggers a report to be sent. + cert_report_helper()->HandleReportingCommands( + static_cast<security_interstitials::SecurityInterstitialCommand>(cmd), + controller()->GetPrefService()); ssl_error_ui_->HandleCommand( static_cast<security_interstitials::SecurityInterstitialCommand>(cmd)); - - // Special handling for the reporting preference being changed. - switch (cmd) { - case security_interstitials::CMD_DO_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), true, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - case security_interstitials::CMD_DONT_REPORT: - safe_browsing::SetExtendedReportingPrefAndMetric( - controller()->GetPrefService(), false, - safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL); - break; - default: - // Other commands can be ignored. - break; - } } void SSLBlockingPage::OverrideRendererPrefs( @@ -271,13 +221,7 @@ } void SSLBlockingPage::OnProceed() { - UpdateMetricsAfterSecurityInterstitial(); - - // Finish collecting metrics, if the user opted into it. - cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_PROCEEDED); - RecordSSLExpirationPageEventState( - expired_but_previously_allowed_, true, overridable_); + OnInterstitialClosing(); // Accepting the certificate resumes the loading of the page. DCHECK(!callback_.is_null()); @@ -286,14 +230,7 @@ } void SSLBlockingPage::OnDontProceed() { - UpdateMetricsAfterSecurityInterstitial(); - - // Finish collecting metrics, if the user opted into it. - cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); - RecordSSLExpirationPageEventState( - expired_but_previously_allowed_, false, overridable_); - + OnInterstitialClosing(); NotifyDenyCertificate(); }
diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h index 803d7c2..eb5f27b7 100644 --- a/chrome/browser/ssl/ssl_blocking_page.h +++ b/chrome/browser/ssl/ssl_blocking_page.h
@@ -14,8 +14,8 @@ #include "base/task/cancelable_task_tracker.h" #include "base/time/time.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ssl/ssl_blocking_page_base.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" -#include "components/certificate_reporting/error_report.h" #include "components/security_interstitials/content/security_interstitial_page.h" #include "content/public/browser/certificate_request_result_type.h" #include "extensions/features/features.h" @@ -30,14 +30,12 @@ class SSLErrorUI; } -class CertReportHelper; class ChromeMetricsHelper; // This class is responsible for showing/hiding the interstitial page that is // shown when a certificate error happens. // It deletes itself when the interstitial page is closed. -class SSLBlockingPage - : public security_interstitials::SecurityInterstitialPage { +class SSLBlockingPage : public SSLBlockingPageBase { public: // Interstitial type, used in tests. static const InterstitialPageDelegate::TypeID kTypeForTesting; @@ -113,7 +111,6 @@ // expired. const bool expired_but_previously_allowed_; - const std::unique_ptr<CertReportHelper> cert_report_helper_; const std::unique_ptr<security_interstitials::SSLErrorUI> ssl_error_ui_; DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage);
diff --git a/chrome/browser/ssl/ssl_blocking_page_base.cc b/chrome/browser/ssl/ssl_blocking_page_base.cc new file mode 100644 index 0000000..49caec6 --- /dev/null +++ b/chrome/browser/ssl/ssl_blocking_page_base.cc
@@ -0,0 +1,45 @@ +// Copyright 2017 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/browser/ssl/ssl_blocking_page_base.h" + +#include "chrome/browser/ssl/cert_report_helper.h" +#include "chrome/browser/ssl/ssl_cert_reporter.h" +#include "components/security_interstitials/content/security_interstitial_controller_client.h" + +SSLBlockingPageBase::SSLBlockingPageBase( + content::WebContents* web_contents, + certificate_reporting::ErrorReport::InterstitialReason interstitial_reason, + const net::SSLInfo& ssl_info, + const GURL& request_url, + std::unique_ptr<SSLCertReporter> ssl_cert_reporter, + bool overridable, + const base::Time& time_triggered, + std::unique_ptr< + security_interstitials::SecurityInterstitialControllerClient> + controller_client) + : security_interstitials::SecurityInterstitialPage( + web_contents, + request_url, + std::move(controller_client)), + cert_report_helper_( + new CertReportHelper(std::move(ssl_cert_reporter), + web_contents, + request_url, + ssl_info, + interstitial_reason, + overridable, + time_triggered, + controller()->metrics_helper())) {} + +SSLBlockingPageBase::~SSLBlockingPageBase() {} + +void SSLBlockingPageBase::OnInterstitialClosing() { + UpdateMetricsAfterSecurityInterstitial(); + cert_report_helper_->FinishCertCollection(); +} + +CertReportHelper* SSLBlockingPageBase::cert_report_helper() { + return cert_report_helper_.get(); +}
diff --git a/chrome/browser/ssl/ssl_blocking_page_base.h b/chrome/browser/ssl/ssl_blocking_page_base.h new file mode 100644 index 0000000..23fd1fa6 --- /dev/null +++ b/chrome/browser/ssl/ssl_blocking_page_base.h
@@ -0,0 +1,52 @@ +// Copyright 2017 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_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_ +#define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_ + +#include "components/certificate_reporting/error_report.h" +#include "components/security_interstitials/content/security_interstitial_page.h" + +namespace base { +class Time; +} // namespace base + +namespace net { +class SSLInfo; +} // namespace net + +class CertReportHelper; +class SSLCertReporter; + +// This is the base class for blocking pages representing SSL certificate +// errors. +class SSLBlockingPageBase + : public security_interstitials::SecurityInterstitialPage { + public: + SSLBlockingPageBase( + content::WebContents* web_contents, + certificate_reporting::ErrorReport::InterstitialReason + interstitial_reason, + const net::SSLInfo& ssl_info, + const GURL& request_url, + std::unique_ptr<SSLCertReporter> ssl_cert_reporter, + bool overridable, + const base::Time& time_triggered, + std::unique_ptr< + security_interstitials::SecurityInterstitialControllerClient> + controller_client); + ~SSLBlockingPageBase() override; + + // security_interstitials::SecurityInterstitialPage: + void OnInterstitialClosing() override; + + protected: + CertReportHelper* cert_report_helper(); + + private: + const std::unique_ptr<CertReportHelper> cert_report_helper_; + DISALLOW_COPY_AND_ASSIGN(SSLBlockingPageBase); +}; + +#endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index e15e25b..ba0902e2 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -660,6 +660,11 @@ tab->GetInterstitialPage()->GetDelegateForTesting()); } + virtual BadClockBlockingPage* GetBadClockBlockingPage(WebContents* tab) { + return static_cast<BadClockBlockingPage*>( + tab->GetInterstitialPage()->GetDelegateForTesting()); + } + // Helper function for testing invalid certificate chain reporting. void TestBrokenHTTPSReporting( certificate_reporting_test_utils::OptIn opt_in, @@ -761,8 +766,7 @@ expect_report); ExpectBadClockInterstitial(tab); - BadClockBlockingPage* clock_page = static_cast<BadClockBlockingPage*>( - tab->GetInterstitialPage()->GetDelegateForTesting()); + BadClockBlockingPage* clock_page = GetBadClockBlockingPage(tab); clock_page->SetSSLCertReporterForTesting(std::move(ssl_cert_reporter)); EXPECT_EQ(std::string(), reporter_callback.GetLatestHostnameReported()); @@ -885,6 +889,18 @@ return SSLUITestBase::GetSSLBlockingPage(tab); } + BadClockBlockingPage* GetBadClockBlockingPage(WebContents* tab) override { + if (IsCommittedInterstitialTest()) { + SSLErrorTabHelper* helper = SSLErrorTabHelper::FromWebContents(tab); + if (!helper) { + return nullptr; + } + return static_cast<BadClockBlockingPage*>( + helper->GetBlockingPageForCurrentlyCommittedNavigationForTesting()); + } + return SSLUITestBase::GetBadClockBlockingPage(tab); + } + bool IsCommittedInterstitialTest() const { return GetParam(); } void DontProceedThroughInterstitial(WebContents* tab) override { @@ -1018,11 +1034,9 @@ } }; -// TODO(estark): enable these tests for committed interstitials, which requires -// some refactoring of how reporting and metrics work. https://crbug.com/792324 INSTANTIATE_TEST_CASE_P(, SSLUITestWithExtendedReporting, - ::testing::Values(false)); + ::testing::Values(false, true)); class SSLUITestHSTS : public SSLUITest { public: @@ -2109,6 +2123,49 @@ AuthState::DISPLAYED_FORM_WITH_INSECURE_ACTION); } +// Test that a report is sent if the user closes the tab on an interstitial +// before making a decision to proceed or go back. +IN_PROC_BROWSER_TEST_P(SSLUITestWithExtendedReporting, + TestBrokenHTTPSReportingCloseTab) { + ASSERT_TRUE(https_server_expired_.Start()); + + base::RunLoop run_loop; + certificate_reporting_test_utils::SSLCertReporterCallback reporter_callback( + &run_loop); + + // Opt in to sending reports for invalid certificate chains. + certificate_reporting_test_utils::SetCertReportingOptIn( + browser(), certificate_reporting_test_utils::EXTENDED_REPORTING_OPT_IN); + + ui_test_utils::NavigateToURL(browser(), + https_server_expired_.GetURL("/title1.html")); + + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(tab != nullptr); + CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, + AuthState::SHOWING_INTERSTITIAL); + + std::unique_ptr<SSLCertReporter> ssl_cert_reporter = + certificate_reporting_test_utils::CreateMockSSLCertReporter( + base::Bind(&certificate_reporting_test_utils:: + SSLCertReporterCallback::ReportSent, + base::Unretained(&reporter_callback)), + certificate_reporting_test_utils::CERT_REPORT_EXPECTED); + + SSLBlockingPage* interstitial_page = GetSSLBlockingPage(tab); + ASSERT_TRUE(interstitial_page); + interstitial_page->SetSSLCertReporterForTesting(std::move(ssl_cert_reporter)); + + EXPECT_EQ(std::string(), reporter_callback.GetLatestHostnameReported()); + + // Leave the interstitial by closing the tab. + chrome::CloseWebContents(browser(), tab, false); + // Check that the mock reporter received a request to send a report. + run_loop.Run(); + EXPECT_EQ(https_server_expired_.GetURL("/title1.html").host(), + reporter_callback.GetLatestHostnameReported()); +} + // Test that if the user proceeds and the checkbox is checked, a report // is sent or not sent depending on the Finch config. IN_PROC_BROWSER_TEST_P(SSLUITestWithExtendedReporting,
diff --git a/chrome/browser/ssl/ssl_error_tab_helper.cc b/chrome/browser/ssl/ssl_error_tab_helper.cc index 2ae03e36..8a76432cb 100644 --- a/chrome/browser/ssl/ssl_error_tab_helper.cc +++ b/chrome/browser/ssl/ssl_error_tab_helper.cc
@@ -21,6 +21,11 @@ navigation_handle->GetNavigationId()); if (navigation_handle->HasCommitted()) { + if (blocking_page_for_currently_committed_navigation_) { + blocking_page_for_currently_committed_navigation_ + ->OnInterstitialClosing(); + } + if (it == blocking_pages_for_navigations_.end()) { blocking_page_for_currently_committed_navigation_.reset(); } else { @@ -33,6 +38,12 @@ } } +void SSLErrorTabHelper::WebContentsDestroyed() { + if (blocking_page_for_currently_committed_navigation_) { + blocking_page_for_currently_committed_navigation_->OnInterstitialClosing(); + } +} + // static void SSLErrorTabHelper::AssociateBlockingPage( content::WebContents* web_contents,
diff --git a/chrome/browser/ssl/ssl_error_tab_helper.h b/chrome/browser/ssl/ssl_error_tab_helper.h index 1c3608f..2b950cc 100644 --- a/chrome/browser/ssl/ssl_error_tab_helper.h +++ b/chrome/browser/ssl/ssl_error_tab_helper.h
@@ -29,6 +29,7 @@ // WebContentsObserver: void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; + void WebContentsDestroyed() override; // Associates |blocking_page| with an SSLErrorTabHelper for the given // |web_contents| and |navigation_id|, to manage the |blocking_page|'s
diff --git a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc index aa06364..5bf092fb 100644 --- a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
@@ -22,6 +22,7 @@ #include "components/sessions/core/session_types.h" #include "components/sync/base/time.h" #include "components/sync/driver/sync_driver_switches.h" +#include "components/sync/protocol/proto_value_conversions.h" #include "components/sync/test/fake_server/sessions_hierarchy.h" #include "ui/base/mojo/window_open_disposition.mojom.h" @@ -377,6 +378,13 @@ EXPECT_EQ(new_tab_helper->source_tab_id(), source_tab_id); } +void DumpSessionsOnServer(fake_server::FakeServer* fake_server) { + auto entities = fake_server->GetSyncEntitiesByModelType(syncer::SESSIONS); + for (const auto& entity : entities) { + DVLOG(0) << "Session entity:\n" << *syncer::SyncEntityToValue(entity, true); + } +} + // TODO(pavely): This test is flaky. Report failures in // https://crbug.com/789129. IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, @@ -410,6 +418,10 @@ true, 1); } + // Log sessions entities on fake server to verify that the last known tab's + // url is kURL1. + DumpSessionsOnServer(GetFakeServer()); + // Trigger a cookie jar change (user signing in to content area). // Updating the cookie jar has to travel to the sync engine. It is possible // something is already running or scheduled to run on the sync thread. We @@ -429,6 +441,10 @@ // Verify the cookie jar mismatch bool is set to false. ASSERT_TRUE(GetFakeServer()->GetLastCommitMessage(&message)); ASSERT_FALSE(message.commit().config_params().cookie_jar_mismatch()); + // Log last commit message to verify that commit message was triggered by + // navigation to kURL2. + DVLOG(0) << "Commit message:\n" + << *syncer::ClientToServerMessageToValue(message, true); // Verify the histograms were recorded properly. ExpectUniqueSampleGE(histogram_tester, "Sync.CookieJarMatchOnNavigation",
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index bc7d2ce..d533968 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4190,6 +4190,13 @@ "//chrome/install_static/test:test_support", ] } + + if (is_chromeos) { + deps = [ + "//ash:test_support_with_content", + "//ash/public/cpp", + ] + } } if (is_win) {
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc index 418a809..a8da474 100644 --- a/chrome/test/base/chrome_unit_test_suite.cc +++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -30,7 +30,11 @@ #include "ui/gl/test/gl_surface_test_support.h" #if defined(OS_CHROMEOS) +#include "ash/public/cpp/config.h" +#include "ash/test/ash_test_helper.h" #include "chromeos/chromeos_paths.h" +#include "ui/aura/env.h" +#include "ui/aura/test/aura_test_context_factory.h" #endif #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -107,6 +111,16 @@ base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); ProfileShortcutManager::DisableForUnitTests(); + +#if defined(OS_CHROMEOS) + aura::Env* env = aura::Env::GetInstance(); + if (env->mode() == aura::Env::Mode::MUS) { + ash::AshTestHelper::set_config(ash::Config::MUS); + context_factory_ = std::make_unique<aura::test::AuraTestContextFactory>(); + env->set_context_factory(context_factory_.get()); + env->set_context_factory_private(nullptr); + } +#endif } void ChromeUnitTestSuite::Shutdown() {
diff --git a/chrome/test/base/chrome_unit_test_suite.h b/chrome/test/base/chrome_unit_test_suite.h index 42dc9c3a..1e2121f 100644 --- a/chrome/test/base/chrome_unit_test_suite.h +++ b/chrome/test/base/chrome_unit_test_suite.h
@@ -5,12 +5,20 @@ #ifndef CHROME_TEST_BASE_CHROME_UNIT_TEST_SUITE_H_ #define CHROME_TEST_BASE_CHROME_UNIT_TEST_SUITE_H_ +#include <memory> + #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/test/test_discardable_memory_allocator.h" #include "chrome/test/base/chrome_test_suite.h" +#if defined(OS_CHROMEOS) +namespace ui { +class ContextFactory; +} +#endif + // Test suite for unit tests. Creates additional stub services that are not // needed for browser tests (e.g. a TestingBrowserProcess). class ChromeUnitTestSuite : public ChromeTestSuite { @@ -31,6 +39,12 @@ private: base::TestDiscardableMemoryAllocator discardable_memory_allocator_; +#if defined(OS_CHROMEOS) + // Only used when running in mus/mash, and is set as the context_factory + // on aura::Env. + std::unique_ptr<ui::ContextFactory> context_factory_; +#endif + DISALLOW_COPY_AND_ASSIGN(ChromeUnitTestSuite); };
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 19e7cfd..0997da6 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -57,6 +57,8 @@ "migrate_sessions_on_network_change"; const char kQuicMigrateSessionsOnNetworkChangeV2[] = "migrate_sessions_on_network_change_v2"; +const char kQuicMaxTimeOnNonDefaultNetworkSeconds[] = + "max_time_on_non_default_network_seconds"; const char kQuicUserAgentId[] = "user_agent_id"; const char kQuicMigrateSessionsEarly[] = "migrate_sessions_early"; const char kQuicMigrateSessionsEarlyV2[] = "migrate_sessions_early_v2"; @@ -301,10 +303,18 @@ } bool quic_migrate_sessions_on_network_change_v2 = false; + int quic_max_time_on_non_default_network_seconds = 0; if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChangeV2, &quic_migrate_sessions_on_network_change_v2)) { session_params->quic_migrate_sessions_on_network_change_v2 = quic_migrate_sessions_on_network_change_v2; + if (quic_args->GetInteger( + kQuicMaxTimeOnNonDefaultNetworkSeconds, + &quic_max_time_on_non_default_network_seconds)) { + session_params->quic_max_time_on_non_default_network = + base::TimeDelta::FromSeconds( + quic_max_time_on_non_default_network_seconds); + } } bool quic_migrate_sessions_early_v2 = false;
diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index 3627616fd..c5671e5e 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc
@@ -191,7 +191,8 @@ "fake agent", // JSON encoded experimental options. "{\"QUIC\":{\"migrate_sessions_on_network_change_v2\":true," - "\"migrate_sessions_early_v2\":true}}", + "\"migrate_sessions_early_v2\":true," + "\"max_time_on_non_default_network_seconds\":10}}", // MockCertVerifier to use for testing purposes. std::unique_ptr<net::CertVerifier>(), // Enable network quality estimator. @@ -214,6 +215,8 @@ EXPECT_TRUE(params->quic_migrate_sessions_on_network_change_v2); EXPECT_TRUE(params->quic_migrate_sessions_early_v2); + EXPECT_EQ(base::TimeDelta::FromSeconds(10), + params->quic_max_time_on_non_default_network); } TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) {
diff --git a/components/network_session_configurator/browser/network_session_configurator.cc b/components/network_session_configurator/browser/network_session_configurator.cc index 88f874f..7849e70 100644 --- a/components/network_session_configurator/browser/network_session_configurator.cc +++ b/components/network_session_configurator/browser/network_session_configurator.cc
@@ -274,6 +274,19 @@ GetVariationParam(quic_trial_params, "migrate_sessions_early_v2"), "true"); } + +int GetQuicMaxTimeOnNonDefaultNetworkSeconds( + const VariationParameters& quic_trial_params) { + int value; + if (base::StringToInt( + GetVariationParam(quic_trial_params, + "max_time_on_non_default_network_seconds"), + &value)) { + return value; + } + return 0; +} + bool ShouldQuicAllowServerMigration( const VariationParameters& quic_trial_params) { return base::LowerCaseEqualsASCII( @@ -377,6 +390,12 @@ ShouldQuicMigrateSessionsOnNetworkChangeV2(quic_trial_params); params->quic_migrate_sessions_early_v2 = ShouldQuicMigrateSessionsEarlyV2(quic_trial_params); + int max_time_on_non_default_network_seconds = + GetQuicMaxTimeOnNonDefaultNetworkSeconds(quic_trial_params); + if (max_time_on_non_default_network_seconds > 0) { + params->quic_max_time_on_non_default_network = + base::TimeDelta::FromSeconds(max_time_on_non_default_network_seconds); + } params->quic_allow_server_migration = ShouldQuicAllowServerMigration(quic_trial_params); params->quic_host_whitelist = GetQuicHostWhitelist(quic_trial_params);
diff --git a/components/network_session_configurator/browser/network_session_configurator_unittest.cc b/components/network_session_configurator/browser/network_session_configurator_unittest.cc index b507e67..561a269 100644 --- a/components/network_session_configurator/browser/network_session_configurator_unittest.cc +++ b/components/network_session_configurator/browser/network_session_configurator_unittest.cc
@@ -360,6 +360,19 @@ } TEST_F(NetworkSessionConfiguratorTest, + QuicMaxTimeOnNonDefaultNetworkFromFieldTrialParams) { + std::map<std::string, std::string> field_trial_params; + field_trial_params["max_time_on_non_default_network_seconds"] = "10"; + variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); + base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); + + ParseFieldTrials(); + + EXPECT_EQ(base::TimeDelta::FromSeconds(10), + params_.quic_max_time_on_non_default_network); +} + +TEST_F(NetworkSessionConfiguratorTest, QuicAllowServerMigrationFromFieldTrialParams) { std::map<std::string, std::string> field_trial_params; field_trial_params["allow_server_migration"] = "true";
diff --git a/components/safe_browsing/base_blocking_page.cc b/components/safe_browsing/base_blocking_page.cc index 70197b1..3b3d589 100644 --- a/components/safe_browsing/base_blocking_page.cc +++ b/components/safe_browsing/base_blocking_page.cc
@@ -123,7 +123,7 @@ void BaseBlockingPage::OnProceed() { set_proceeded(true); - UpdateMetricsAfterSecurityInterstitial(); + OnInterstitialClosing(); // Send the threat details, if we opted to. FinishThreatDetails( @@ -149,7 +149,7 @@ if (proceeded_) return; - UpdateMetricsAfterSecurityInterstitial(); + OnInterstitialClosing(); if (!sb_error_ui_->is_proceed_anyway_disabled()) { controller()->metrics_helper()->RecordUserDecision( security_interstitials::MetricsHelper::DONT_PROCEED); @@ -213,6 +213,10 @@ sb_error_ui_->PopulateStringsForHtml(load_time_data); } +void BaseBlockingPage::OnInterstitialClosing() { + UpdateMetricsAfterSecurityInterstitial(); +} + void BaseBlockingPage::FinishThreatDetails(const base::TimeDelta& delay, bool did_proceed, int num_visits) {}
diff --git a/components/safe_browsing/base_blocking_page.h b/components/safe_browsing/base_blocking_page.h index 62fc29ed..2d40d062 100644 --- a/components/safe_browsing/base_blocking_page.h +++ b/components/safe_browsing/base_blocking_page.h
@@ -72,6 +72,7 @@ bool ShouldCreateNewNavigation() const override; void PopulateInterstitialStrings( base::DictionaryValue* load_time_data) override; + void OnInterstitialClosing() override; // Called when the interstitial is going away. Intentionally do nothing in // this base class.
diff --git a/components/security_interstitials/content/security_interstitial_page.cc b/components/security_interstitials/content/security_interstitial_page.cc index c5a4d156..f81a05e 100644 --- a/components/security_interstitials/content/security_interstitial_page.cc +++ b/components/security_interstitials/content/security_interstitial_page.cc
@@ -41,6 +41,7 @@ safe_browsing::UpdatePrefsBeforeSecurityInterstitial( controller_->GetPrefService()); } + SetUpMetrics(); // Creating interstitial_page_ without showing it leaks memory, so don't // create it here. @@ -86,18 +87,7 @@ interstitial_page_->Show(); - // Remember the initial state of the extended reporting pref, to be compared - // to the same data when the interstitial is closed. - PrefService* prefs = controller_->GetPrefService(); - if (prefs) { - on_show_extended_reporting_pref_exists_ = - safe_browsing::ExtendedReportingPrefExists(*prefs); - on_show_extended_reporting_pref_value_ = - safe_browsing::IsExtendedReportingEnabled(*prefs); - } - controller_->set_interstitial_page(interstitial_page_); - AfterShow(); } SecurityInterstitialControllerClient* SecurityInterstitialPage::controller() @@ -113,6 +103,18 @@ } } +void SecurityInterstitialPage::SetUpMetrics() { + // Remember the initial state of the extended reporting pref, to be compared + // to the same data when the interstitial is closed. + PrefService* prefs = controller_->GetPrefService(); + if (prefs) { + on_show_extended_reporting_pref_exists_ = + safe_browsing::ExtendedReportingPrefExists(*prefs); + on_show_extended_reporting_pref_value_ = + safe_browsing::IsExtendedReportingEnabled(*prefs); + } +} + base::string16 SecurityInterstitialPage::GetFormattedHostName() const { return security_interstitials::common_string_util::GetFormattedHostName( request_url_);
diff --git a/components/security_interstitials/content/security_interstitial_page.h b/components/security_interstitials/content/security_interstitial_page.h index 3bca87c8..0855d45 100644 --- a/components/security_interstitials/content/security_interstitial_page.h +++ b/components/security_interstitials/content/security_interstitial_page.h
@@ -35,7 +35,9 @@ std::unique_ptr<SecurityInterstitialControllerClient> controller); ~SecurityInterstitialPage() override; - // Creates an interstitial and shows it. + // Creates an interstitial and shows it. This is used for the pre-committed + // interstitials code path, when an interstitial is generated as an + // overlay. virtual void Show(); // Prevents creating the actual interstitial view for testing. @@ -44,6 +46,10 @@ // InterstitialPageDelegate method: std::string GetHTMLContents() override; + // Must be called when the interstitial is closed, to give subclasses a chance + // to e.g. update metrics. + virtual void OnInterstitialClosing() = 0; + protected: // Returns true if the interstitial should create a new navigation entry. virtual bool ShouldCreateNewNavigation() const = 0; @@ -52,10 +58,6 @@ virtual void PopulateInterstitialStrings( base::DictionaryValue* load_time_data) = 0; - // Gives an opportunity for child classes to react to Show() having run. The - // interstitial_page_ will now have a value. - virtual void AfterShow() {} - virtual int GetHTMLTemplateId(); // Returns the formatted host name for the request url. @@ -71,6 +73,8 @@ void UpdateMetricsAfterSecurityInterstitial(); private: + void SetUpMetrics(); + // The WebContents with which this interstitial page is // associated. Not available in ~SecurityInterstitialPage, since it // can be destroyed before this class is destroyed.
diff --git a/components/ssl_config/ssl_config_service_manager_pref.cc b/components/ssl_config/ssl_config_service_manager_pref.cc index b96163b..f34c62e7 100644 --- a/components/ssl_config/ssl_config_service_manager_pref.cc +++ b/components/ssl_config/ssl_config_service_manager_pref.cc
@@ -199,18 +199,12 @@ const char* experiment_value = nullptr; if (tls13_variant == "disabled") { tls13_value = switches::kTLS13VariantDisabled; - } else if (tls13_variant == "draft") { - tls13_value = switches::kTLS13VariantDraft; - experiment_value = switches::kSSLVersionTLSv13; - } else if (tls13_variant == "experiment") { - tls13_value = switches::kTLS13VariantExperiment; + } else if (tls13_variant == "draft22") { + tls13_value = switches::kTLS13VariantDraft22; experiment_value = switches::kSSLVersionTLSv13; } else if (tls13_variant == "experiment2") { tls13_value = switches::kTLS13VariantExperiment2; experiment_value = switches::kSSLVersionTLSv13; - } else if (tls13_variant == "experiment3") { - tls13_value = switches::kTLS13VariantExperiment3; - experiment_value = switches::kSSLVersionTLSv13; } if (tls13_value) { @@ -327,14 +321,10 @@ if (tls13_variant_str == switches::kTLS13VariantDisabled) { if (config->version_max > net::SSL_PROTOCOL_VERSION_TLS1_2) config->version_max = net::SSL_PROTOCOL_VERSION_TLS1_2; - } else if (tls13_variant_str == switches::kTLS13VariantDraft) { - config->tls13_variant = net::kTLS13VariantDraft; - } else if (tls13_variant_str == switches::kTLS13VariantExperiment) { - config->tls13_variant = net::kTLS13VariantExperiment; + } else if (tls13_variant_str == switches::kTLS13VariantDraft22) { + config->tls13_variant = net::kTLS13VariantDraft22; } else if (tls13_variant_str == switches::kTLS13VariantExperiment2) { config->tls13_variant = net::kTLS13VariantExperiment2; - } else if (tls13_variant_str == switches::kTLS13VariantExperiment3) { - config->tls13_variant = net::kTLS13VariantExperiment3; } config->disabled_cipher_suites = disabled_cipher_suites_;
diff --git a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc index 4b605f3..346b982 100644 --- a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc +++ b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc
@@ -250,48 +250,6 @@ EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, ssl_config.version_max); } -// Tests that Draft TLS 1.3 can be enabled via field trials. -TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureDraft) { - // Toggle the field trial. - variations::testing::VariationParamsManager variation_params( - "TLS13Variant", {{"variant", "draft"}}); - - TestingPrefServiceSimple local_state; - SSLConfigServiceManager::RegisterPrefs(local_state.registry()); - - std::unique_ptr<SSLConfigServiceManager> config_manager( - SSLConfigServiceManager::CreateDefaultManager( - &local_state, base::ThreadTaskRunnerHandle::Get())); - scoped_refptr<SSLConfigService> config_service(config_manager->Get()); - ASSERT_TRUE(config_service.get()); - - SSLConfig ssl_config; - config_service->GetSSLConfig(&ssl_config); - EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantDraft, ssl_config.tls13_variant); -} - -// Tests that Experiment TLS 1.3 can be enabled via field trials. -TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureExperiment) { - // Toggle the field trial. - variations::testing::VariationParamsManager variation_params( - "TLS13Variant", {{"variant", "experiment"}}); - - TestingPrefServiceSimple local_state; - SSLConfigServiceManager::RegisterPrefs(local_state.registry()); - - std::unique_ptr<SSLConfigServiceManager> config_manager( - SSLConfigServiceManager::CreateDefaultManager( - &local_state, base::ThreadTaskRunnerHandle::Get())); - scoped_refptr<SSLConfigService> config_service(config_manager->Get()); - ASSERT_TRUE(config_service.get()); - - SSLConfig ssl_config; - config_service->GetSSLConfig(&ssl_config); - EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantExperiment, ssl_config.tls13_variant); -} - // Tests that Experiment2 TLS 1.3 can be enabled via field trials. TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureExperiment2) { // Toggle the field trial. @@ -313,11 +271,11 @@ EXPECT_EQ(net::kTLS13VariantExperiment2, ssl_config.tls13_variant); } -// Tests that Experiment3 TLS 1.3 can be enabled via field trials. -TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureExperiment3) { +// Tests that Draft22 TLS 1.3 can be enabled via field trials. +TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureDraft22) { // Toggle the field trial. variations::testing::VariationParamsManager variation_params( - "TLS13Variant", {{"variant", "experiment3"}}); + "TLS13Variant", {{"variant", "draft22"}}); TestingPrefServiceSimple local_state; SSLConfigServiceManager::RegisterPrefs(local_state.registry()); @@ -331,7 +289,7 @@ SSLConfig ssl_config; config_service->GetSSLConfig(&ssl_config); EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantExperiment3, ssl_config.tls13_variant); + EXPECT_EQ(net::kTLS13VariantDraft22, ssl_config.tls13_variant); } // Tests that the SSLVersionMax preference overwites the TLS 1.3 variant @@ -398,7 +356,7 @@ local_state.SetUserPref(ssl_config::prefs::kSSLVersionMax, base::MakeUnique<base::Value>("tls1.3")); local_state.SetUserPref(ssl_config::prefs::kTLS13Variant, - base::MakeUnique<base::Value>("experiment")); + base::MakeUnique<base::Value>("experiment2")); SSLConfigServiceManager::RegisterPrefs(local_state.registry()); std::unique_ptr<SSLConfigServiceManager> config_manager( @@ -411,7 +369,7 @@ SSLConfig ssl_config; config_service->GetSSLConfig(&ssl_config); EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); - EXPECT_EQ(net::kTLS13VariantExperiment, ssl_config.tls13_variant); + EXPECT_EQ(net::kTLS13VariantExperiment2, ssl_config.tls13_variant); } // Tests that SHA-1 signatures for local trust anchors can be enabled.
diff --git a/components/ssl_config/ssl_config_switches.cc b/components/ssl_config/ssl_config_switches.cc index 1b47b7b1..054ed91 100644 --- a/components/ssl_config/ssl_config_switches.cc +++ b/components/ssl_config/ssl_config_switches.cc
@@ -25,9 +25,7 @@ const char kSSLVersionTLSv13[] = "tls1.3"; const char kTLS13VariantDisabled[] = "disabled"; -const char kTLS13VariantDraft[] = "draft"; -const char kTLS13VariantExperiment[] = "experiment"; +const char kTLS13VariantDraft22[] = "draft22"; const char kTLS13VariantExperiment2[] = "experiment2"; -const char kTLS13VariantExperiment3[] = "experiment3"; } // namespace switches
diff --git a/components/ssl_config/ssl_config_switches.h b/components/ssl_config/ssl_config_switches.h index 9265414..6c8832b 100644 --- a/components/ssl_config/ssl_config_switches.h +++ b/components/ssl_config/ssl_config_switches.h
@@ -15,10 +15,8 @@ extern const char kSSLVersionTLSv12[]; extern const char kSSLVersionTLSv13[]; extern const char kTLS13VariantDisabled[]; -extern const char kTLS13VariantDraft[]; -extern const char kTLS13VariantExperiment[]; +extern const char kTLS13VariantDraft22[]; extern const char kTLS13VariantExperiment2[]; -extern const char kTLS13VariantExperiment3[]; } // namespace switches
diff --git a/components/sync/test/fake_server/fake_server_verifier.cc b/components/sync/test/fake_server/fake_server_verifier.cc index f74c28f7..aae4929f 100644 --- a/components/sync/test/fake_server/fake_server_verifier.cc +++ b/components/sync/test/fake_server/fake_server_verifier.cc
@@ -132,14 +132,12 @@ std::map<int, int> tab_ids_to_window_ids; std::map<int, std::string> tab_ids_to_urls; std::string session_tag; - for (std::vector<sync_pb::SyncEntity>::const_iterator it = sessions.begin(); - it != sessions.end(); ++it) { - sync_pb::SyncEntity entity = *it; + for (const auto& entity : sessions) { sync_pb::SessionSpecifics session_specifics = entity.specifics().session(); // Ensure that all session tags match the first entity. Only one session is // supported for verification at this time. - if (it == sessions.begin()) + if (session_tag.empty()) session_tag = session_specifics.session_tag(); else if (session_specifics.session_tag() != session_tag) return AssertionFailure() << "Multiple session tags found."; @@ -169,16 +167,9 @@ // the SessionHeader also ensures its data corresponds to the data stored in // each SessionTab. SessionsHierarchy actual_sessions; - ::google::protobuf::RepeatedPtrField<sync_pb::SessionWindow>::const_iterator - window_it; - for (window_it = session_header.window().begin(); - window_it != session_header.window().end(); ++window_it) { - sync_pb::SessionWindow window = *window_it; + for (const auto& window : session_header.window()) { std::multiset<std::string> tab_urls; - ::google::protobuf::RepeatedField<int>::const_iterator tab_it; - for (tab_it = window.tab().begin(); tab_it != window.tab().end(); - ++tab_it) { - int tab_id = *tab_it; + for (int tab_id : window.tab()) { if (tab_ids_to_window_ids.find(tab_id) == tab_ids_to_window_ids.end()) { return AssertionFailure() << "Malformed data: Tab entity not found."; }
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc index a4f3acf..dc6023c 100644 --- a/components/viz/host/host_frame_sink_manager.cc +++ b/components/viz/host/host_frame_sink_manager.cc
@@ -176,9 +176,13 @@ frame_sink_manager_->UnregisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); + // The reference parent_data will become invalid when the container is + // modified. So we have to call IsEmpty() in advance. + bool parent_data_is_empty = parent_data.IsEmpty(); if (child_data.IsEmpty()) frame_sink_data_map_.erase(child_frame_sink_id); - if (parent_data.IsEmpty()) + + if (parent_data_is_empty) frame_sink_data_map_.erase(parent_frame_sink_id); }
diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc index a37bc56d..6e9b778 100644 --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -27,6 +27,7 @@ #include "content/browser/download/download_manager_impl.h" #include "content/browser/download/download_task_runner.h" #include "content/browser/frame_host/interstitial_page_impl.h" +#include "content/browser/frame_host/navigator.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/devtools_agent_host.h" @@ -2011,7 +2012,7 @@ Attach(); command_params.reset(new base::DictionaryValue()); command_params->SetBoolean("autoAttach", true); - command_params->SetBoolean("waitForDebuggerOnStart", true); + command_params->SetBoolean("waitForDebuggerOnStart", false); SendCommand("Target.setAutoAttach", std::move(command_params), true); EXPECT_TRUE(notifications_.empty()); command_params.reset(new base::DictionaryValue());
diff --git a/content/browser/devtools/protocol/target_auto_attacher.cc b/content/browser/devtools/protocol/target_auto_attacher.cc index 3c04539..b42737c 100644 --- a/content/browser/devtools/protocol/target_auto_attacher.cc +++ b/content/browser/devtools/protocol/target_auto_attacher.cc
@@ -9,6 +9,7 @@ #include "content/browser/devtools/service_worker_devtools_agent_host.h" #include "content/browser/frame_host/frame_tree.h" #include "content/browser/frame_host/frame_tree_node.h" +#include "content/browser/frame_host/navigation_handle_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h" namespace content { @@ -138,6 +139,29 @@ auto_attached_hosts_.erase(base::WrapRefCounted(host)); } +bool TargetAutoAttacher::ShouldThrottleFramesNavigation() { + return auto_attach_ && attach_to_frames_ && wait_for_debugger_on_start_; +} + +DevToolsAgentHost* TargetAutoAttacher::AutoAttachToFrame( + NavigationHandle* navigation_handle) { + if (!ShouldThrottleFramesNavigation()) + return nullptr; + bool cross_process = + navigation_handle->GetRenderFrameHost()->IsCrossProcessSubframe(); + if (!cross_process) + return nullptr; + scoped_refptr<DevToolsAgentHost> agent_host = + RenderFrameDevToolsAgentHost::GetOrCreateForDangling( + static_cast<NavigationHandleImpl*>(navigation_handle) + ->frame_tree_node()); + if (auto_attached_hosts_.find(agent_host) != auto_attached_hosts_.end()) + return nullptr; + attach_callback_.Run(agent_host.get(), true /* waiting_for_debugger */); + auto_attached_hosts_.insert(agent_host); + return agent_host.get(); +} + void TargetAutoAttacher::ReattachServiceWorkers(bool waiting_for_debugger) { if (!auto_attach_) return;
diff --git a/content/browser/devtools/protocol/target_auto_attacher.h b/content/browser/devtools/protocol/target_auto_attacher.h index 87dbbce..c0b00481 100644 --- a/content/browser/devtools/protocol/target_auto_attacher.h +++ b/content/browser/devtools/protocol/target_auto_attacher.h
@@ -11,6 +11,7 @@ namespace content { +class NavigationHandle; class RenderFrameHostImpl; namespace protocol { @@ -33,6 +34,9 @@ void UpdateFrames(); void AgentHostClosed(DevToolsAgentHost* host); + bool ShouldThrottleFramesNavigation(); + DevToolsAgentHost* AutoAttachToFrame(NavigationHandle* navigation_handle); + private: using Hosts = base::flat_set<scoped_refptr<DevToolsAgentHost>>;
diff --git a/content/browser/devtools/protocol/target_handler.cc b/content/browser/devtools/protocol/target_handler.cc index eae300c..5552688 100644 --- a/content/browser/devtools/protocol/target_handler.cc +++ b/content/browser/devtools/protocol/target_handler.cc
@@ -4,16 +4,22 @@ #include "content/browser/devtools/protocol/target_handler.h" +#include "base/json/json_reader.h" #include "base/strings/stringprintf.h" +#include "base/values.h" #include "content/browser/devtools/devtools_manager.h" #include "content/browser/devtools/devtools_session.h" #include "content/public/browser/devtools_agent_host_client.h" +#include "content/public/browser/navigation_throttle.h" namespace content { namespace protocol { namespace { +static const char kMethod[] = "method"; +static const char kResumeMethod[] = "Runtime.runIfWaitingForDebugger"; + std::unique_ptr<Target::TargetInfo> CreateInfo(DevToolsAgentHost* host) { std::unique_ptr<Target::TargetInfo> target_info = Target::TargetInfo::Create() @@ -30,6 +36,24 @@ } // namespace +// Throttle is owned externally by the navigation subsystem. +class TargetHandler::Throttle : public content::NavigationThrottle { + public: + Throttle(base::WeakPtr<protocol::TargetHandler> target_handler, + content::NavigationHandle* navigation_handle); + ~Throttle() override; + void Clear(); + // content::NavigationThrottle implementation: + NavigationThrottle::ThrottleCheckResult WillProcessResponse() override; + const char* GetNameForLogging() override; + + private: + base::WeakPtr<protocol::TargetHandler> target_handler_; + scoped_refptr<DevToolsAgentHost> agent_host_; + + DISALLOW_COPY_AND_ASSIGN(Throttle); +}; + class TargetHandler::Session : public DevToolsAgentHostClient { public: static std::string Attach(TargetHandler* handler, @@ -61,7 +85,21 @@ handler_->attached_sessions_.erase(id_); } + void SetThrottle(Throttle* throttle) { throttle_ = throttle; } + void SendMessageToAgentHost(const std::string& message) { + if (throttle_) { + bool resuming = false; + std::unique_ptr<base::Value> value = base::JSONReader::Read(message); + if (value && value->is_dict()) { + base::Value* method = value->FindKey(kMethod); + resuming = method && method->is_string() && + method->GetString() == kResumeMethod; + } + if (resuming) + throttle_->Clear(); + } + agent_host_->DispatchProtocolMessage(this, message); } @@ -91,16 +129,63 @@ TargetHandler* handler_; scoped_refptr<DevToolsAgentHost> agent_host_; std::string id_; + Throttle* throttle_ = nullptr; DISALLOW_COPY_AND_ASSIGN(Session); }; +TargetHandler::Throttle::Throttle( + base::WeakPtr<protocol::TargetHandler> target_handler, + content::NavigationHandle* navigation_handle) + : content::NavigationThrottle(navigation_handle), + target_handler_(target_handler) { + target_handler->throttles_.insert(this); +} + +TargetHandler::Throttle::~Throttle() { + if (target_handler_) + target_handler_->throttles_.erase(this); +} + +NavigationThrottle::ThrottleCheckResult +TargetHandler::Throttle::WillProcessResponse() { + if (!target_handler_) + return PROCEED; + agent_host_ = + target_handler_->auto_attacher_.AutoAttachToFrame(navigation_handle()); + if (!agent_host_.get()) + return PROCEED; + target_handler_->auto_attached_sessions_[agent_host_.get()]->SetThrottle( + this); + return DEFER; +} + +const char* TargetHandler::Throttle::GetNameForLogging() { + return "DevToolsTargetNavigationThrottle"; +} + +void TargetHandler::Throttle::Clear() { + bool deferred = agent_host_.get(); + if (target_handler_ && deferred) { + auto it = target_handler_->auto_attached_sessions_.find(agent_host_.get()); + if (it != target_handler_->auto_attached_sessions_.end()) + it->second->SetThrottle(nullptr); + } + agent_host_ = nullptr; + if (target_handler_) + target_handler_->throttles_.erase(this); + target_handler_.reset(); + if (deferred) + Resume(); +} + TargetHandler::TargetHandler() : DevToolsDomainHandler(Target::Metainfo::domainName), auto_attacher_( base::Bind(&TargetHandler::AutoAttach, base::Unretained(this)), base::Bind(&TargetHandler::AutoDetach, base::Unretained(this))), - discover_(false) {} + discover_(false), + weak_factory_(this) {} TargetHandler::~TargetHandler() { } @@ -138,6 +223,21 @@ auto_attacher_.UpdateFrames(); } +std::unique_ptr<NavigationThrottle> TargetHandler::CreateThrottleForNavigation( + NavigationHandle* navigation_handle) { + if (!auto_attacher_.ShouldThrottleFramesNavigation()) + return nullptr; + return std::make_unique<Throttle>(weak_factory_.GetWeakPtr(), + navigation_handle); +} + +void TargetHandler::ClearThrottles() { + base::flat_set<Throttle*> copy(throttles_); + for (Throttle* throttle : copy) + throttle->Clear(); + throttles_.clear(); +} + void TargetHandler::AutoAttach(DevToolsAgentHost* host, bool waiting_for_debugger) { std::string session_id = Session::Attach(this, host, waiting_for_debugger); @@ -204,11 +304,15 @@ Response TargetHandler::SetAutoAttach( bool auto_attach, bool wait_for_debugger_on_start) { auto_attacher_.SetAutoAttach(auto_attach, wait_for_debugger_on_start); + if (!auto_attacher_.ShouldThrottleFramesNavigation()) + ClearThrottles(); return Response::FallThrough(); } Response TargetHandler::SetAttachToFrames(bool value) { auto_attacher_.SetAttachToFrames(value); + if (!auto_attacher_.ShouldThrottleFramesNavigation()) + ClearThrottles(); return Response::OK(); }
diff --git a/content/browser/devtools/protocol/target_handler.h b/content/browser/devtools/protocol/target_handler.h index f25ff62..d9d4a89 100644 --- a/content/browser/devtools/protocol/target_handler.h +++ b/content/browser/devtools/protocol/target_handler.h
@@ -8,6 +8,8 @@ #include <map> #include <set> +#include "base/containers/flat_set.h" +#include "base/memory/weak_ptr.h" #include "content/browser/devtools/protocol/devtools_domain_handler.h" #include "content/browser/devtools/protocol/target.h" #include "content/browser/devtools/protocol/target_auto_attacher.h" @@ -16,6 +18,8 @@ namespace content { class DevToolsAgentHostImpl; +class NavigationHandle; +class NavigationThrottle; class RenderFrameHostImpl; namespace protocol { @@ -36,6 +40,8 @@ void DidCommitNavigation(); void RenderFrameHostChanged(); + std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( + NavigationHandle* navigation_handle); // Domain implementation. Response SetDiscoverTargets(bool discover) override; @@ -72,6 +78,7 @@ private: class Session; + class Throttle; void AutoAttach(DevToolsAgentHost* host, bool waiting_for_debugger); void AutoDetach(DevToolsAgentHost* host); @@ -79,6 +86,7 @@ Maybe<std::string> target_id, Session** session, bool fall_through); + void ClearThrottles(); // DevToolsAgentHostObserver implementation. bool ShouldForceDevToolsAgentHostCreation() override; @@ -95,6 +103,8 @@ std::map<DevToolsAgentHost*, Session*> auto_attached_sessions_; std::set<DevToolsAgentHost*> reported_hosts_; int last_session_id_ = 0; + base::flat_set<Throttle*> throttles_; + base::WeakPtrFactory<TargetHandler> weak_factory_; DISALLOW_COPY_AND_ASSIGN(TargetHandler); };
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index 46fdb8a..7b4b1f1 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -81,7 +81,7 @@ } bool ShouldCreateDevToolsForNode(FrameTreeNode* ftn) { - return ShouldCreateDevToolsForHost(ftn->current_frame_host()); + return !ftn->parent() || ftn->current_frame_host()->IsCrossProcessSubframe(); } FrameTreeNode* GetFrameTreeNodeAncestor(FrameTreeNode* frame_tree_node) { @@ -361,6 +361,21 @@ } // static +scoped_refptr<DevToolsAgentHost> +RenderFrameDevToolsAgentHost::GetOrCreateForDangling( + FrameTreeNode* frame_tree_node) { + // Note that this method does not use FrameTreeNode::current_frame_host(), + // since it is used while the frame host may not be set as current yet, + // for example right before commit time. + // So the caller must be sure that passed frame will indeed be a correct + // devtools target (see ShouldCreateDevToolsForNode above). + RenderFrameDevToolsAgentHost* result = FindAgentHost(frame_tree_node); + if (!result) + result = new RenderFrameDevToolsAgentHost(frame_tree_node); + return result; +} + +// static bool DevToolsAgentHost::HasFor(WebContents* web_contents) { FrameTreeNode* node = static_cast<WebContentsImpl*>(web_contents)->GetFrameTree()->root(); @@ -432,21 +447,43 @@ } // static -std::unique_ptr<NavigationThrottle> -RenderFrameDevToolsAgentHost::CreateThrottleForNavigation( +std::vector<std::unique_ptr<NavigationThrottle>> +RenderFrameDevToolsAgentHost::CreateNavigationThrottles( NavigationHandle* navigation_handle) { - RenderFrameDevToolsAgentHost* agent_host = FindAgentHost( - static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node()); - if (!agent_host) - return nullptr; - for (auto* network_handler : - protocol::NetworkHandler::ForAgentHost(agent_host)) { - std::unique_ptr<NavigationThrottle> throttle = - network_handler->CreateThrottleForNavigation(navigation_handle); - if (throttle) - return throttle; + std::vector<std::unique_ptr<NavigationThrottle>> result; + FrameTreeNode* frame_tree_node = + static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); + + // Interception might throttle navigations in inspected frames. + RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); + if (agent_host) { + for (auto* network_handler : + protocol::NetworkHandler::ForAgentHost(agent_host)) { + std::unique_ptr<NavigationThrottle> throttle = + network_handler->CreateThrottleForNavigation(navigation_handle); + if (throttle) + result.push_back(std::move(throttle)); + } } - return nullptr; + + agent_host = nullptr; + if (frame_tree_node->parent()) { + // Target domain of the parent frame's DevTools may want to pause + // this frame to do some setup. + agent_host = + FindAgentHost(GetFrameTreeNodeAncestor(frame_tree_node->parent())); + } + if (agent_host) { + for (auto* target_handler : + protocol::TargetHandler::ForAgentHost(agent_host)) { + std::unique_ptr<NavigationThrottle> throttle = + target_handler->CreateThrottleForNavigation(navigation_handle); + if (throttle) + result.push_back(std::move(throttle)); + } + } + + return result; } // static
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.h b/content/browser/devtools/render_frame_devtools_agent_host.h index 9d5e806..17300dc 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.h +++ b/content/browser/devtools/render_frame_devtools_agent_host.h
@@ -51,14 +51,20 @@ static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( FrameTreeNode* frame_tree_node); + // This method does not climb up to the suitable parent frame, + // so only use it when we are sure the frame will be a local root. + // Prefer GetOrCreateFor instead. + static scoped_refptr<DevToolsAgentHost> GetOrCreateForDangling( + FrameTreeNode* frame_tree_node); + static void OnCancelPendingNavigation(RenderFrameHost* pending, RenderFrameHost* current); static void OnBeforeNavigation(RenderFrameHost* current, RenderFrameHost* pending); static void OnResetNavigationRequest(NavigationRequest* navigation_request); - static std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( - NavigationHandle* navigation_handle); + static std::vector<std::unique_ptr<NavigationThrottle>> + CreateNavigationThrottles(NavigationHandle* navigation_handle); static bool IsNetworkHandlerEnabled(FrameTreeNode* frame_tree_node); static void AppendDevToolsHeaders(FrameTreeNode* frame_tree_node, net::HttpRequestHeaders* headers);
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index 6fc37beb..3682467 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -1322,7 +1322,10 @@ AddThrottle( MixedContentNavigationThrottle::CreateThrottleForNavigation(this)); - AddThrottle(RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this)); + for (auto& throttle : + RenderFrameDevToolsAgentHost::CreateNavigationThrottles(this)) { + AddThrottle(std::move(throttle)); + } // Insert all testing NavigationThrottles last. throttles_.insert(throttles_.end(),
diff --git a/content/browser/renderer_host/input/mouse_wheel_phase_handler.cc b/content/browser/renderer_host/input/mouse_wheel_phase_handler.cc index 1b37047..942701b20 100644 --- a/content/browser/renderer_host/input/mouse_wheel_phase_handler.cc +++ b/content/browser/renderer_host/input/mouse_wheel_phase_handler.cc
@@ -15,6 +15,7 @@ RenderWidgetHostViewBase* const host_view) : host_(host), host_view_(host_view), + mouse_wheel_end_dispatch_timeout_(kDefaultMouseWheelLatchingTransaction), scroll_phase_state_(SCROLL_STATE_UNKNOWN) {} void MouseWheelPhaseHandler::AddPhaseIfNeededAndScheduleEndEvent( @@ -28,7 +29,9 @@ if (mouse_wheel_event.phase == blink::WebMouseWheelEvent::kPhaseEnded) { // Don't send the wheel end event immediately, start a timer instead to // see whether momentum phase of the scrolling starts or not. - ScheduleMouseWheelEndDispatching(should_route_event); + ScheduleMouseWheelEndDispatching( + should_route_event, + kMaximumTimeBetweenPhaseEndedAndMomentumPhaseBegan); } else if (mouse_wheel_event.phase == blink::WebMouseWheelEvent::kPhaseBegan) { // A new scrolling sequence has started, send the pending wheel end @@ -45,9 +48,19 @@ switch (scroll_phase_state_) { case SCROLL_STATE_UNKNOWN: { mouse_wheel_event.has_synthetic_phase = true; + // Break the latching when the location difference between the current + // and the initial wheel event positions exceeds the maximum allowed + // threshold. + if (!IsWithinSlopRegion(mouse_wheel_event)) + DispatchPendingWheelEndEvent(); + if (!mouse_wheel_end_dispatch_timer_.IsRunning()) { mouse_wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan; - ScheduleMouseWheelEndDispatching(should_route_event); + first_wheel_location_ = + gfx::Vector2dF(mouse_wheel_event.PositionInWidget().x, + mouse_wheel_event.PositionInWidget().y); + ScheduleMouseWheelEndDispatching(should_route_event, + mouse_wheel_end_dispatch_timeout_); } else { // mouse_wheel_end_dispatch_timer_.IsRunning() bool non_zero_delta = mouse_wheel_event.delta_x || mouse_wheel_event.delta_y; @@ -129,13 +142,21 @@ } void MouseWheelPhaseHandler::ScheduleMouseWheelEndDispatching( - bool should_route_event) { + bool should_route_event, + const base::TimeDelta timeout) { mouse_wheel_end_dispatch_timer_.Start( - FROM_HERE, - base::TimeDelta::FromMilliseconds( - kDefaultMouseWheelLatchingTransactionMs), + FROM_HERE, timeout, base::Bind(&MouseWheelPhaseHandler::SendSyntheticWheelEventWithPhaseEnded, base::Unretained(this), should_route_event)); } +bool MouseWheelPhaseHandler::IsWithinSlopRegion( + blink::WebMouseWheelEvent wheel_event) const { + DCHECK(scroll_phase_state_ == SCROLL_STATE_UNKNOWN); + gfx::Vector2dF current_wheel_location(wheel_event.PositionInWidget().x, + wheel_event.PositionInWidget().y); + return (current_wheel_location - first_wheel_location_).LengthSquared() < + kWheelLatchingSlopRegion * kWheelLatchingSlopRegion; +} + } // namespace content
diff --git a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h index 1399bed..02c2b09b 100644 --- a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h +++ b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h
@@ -15,7 +15,18 @@ // The duration after which a synthetic wheel with zero deltas and // phase = |kPhaseEnded| will be sent after the last wheel event. -const int64_t kDefaultMouseWheelLatchingTransactionMs = 100; +constexpr base::TimeDelta kDefaultMouseWheelLatchingTransaction = + base::TimeDelta::FromMilliseconds(500); + +// Maximum time that the phase handler waits for arrival of a wheel event with +// momentum_phase = kPhaseBegan before sending its previous wheel event with +// phase = kPhaseEnded. +constexpr base::TimeDelta kMaximumTimeBetweenPhaseEndedAndMomentumPhaseBegan = + base::TimeDelta::FromMilliseconds(100); + +// Maximum allowed difference between coordinates of two mouse wheel events in +// the same scroll sequence. +const double kWheelLatchingSlopRegion = 10.0; // On ChromeOS wheel events don't have phase information; However, whenever the // user puts down or lifts their fingers a GFC or GFS is received. @@ -44,6 +55,11 @@ void SendWheelEndIfNeeded(); void ScrollingMayBegin(); + // Used to set the timer timeout for testing. + void set_mouse_wheel_end_dispatch_timeout(base::TimeDelta timeout) { + mouse_wheel_end_dispatch_timeout_ = timeout; + } + bool HasPendingWheelEndEvent() const { return mouse_wheel_end_dispatch_timer_.IsRunning(); } @@ -51,13 +67,21 @@ private: void SendSyntheticWheelEventWithPhaseEnded( bool should_route_event); - void ScheduleMouseWheelEndDispatching(bool should_route_event); + void ScheduleMouseWheelEndDispatching(bool should_route_event, + const base::TimeDelta timeout); + bool IsWithinSlopRegion(blink::WebMouseWheelEvent wheel_event) const; RenderWidgetHostImpl* const host_; RenderWidgetHostViewBase* const host_view_; base::OneShotTimer mouse_wheel_end_dispatch_timer_; + base::TimeDelta mouse_wheel_end_dispatch_timeout_; blink::WebMouseWheelEvent last_mouse_wheel_event_; ScrollPhaseState scroll_phase_state_; + // This is used to break the timer based latching when the difference between + // the locations of the first wheel event and the current wheel event is + // larger than some threshold. The variable value is only valid while the + // dispatch timer is running. + gfx::Vector2dF first_wheel_location_; DISALLOW_COPY_AND_ASSIGN(MouseWheelPhaseHandler); };
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index a3e14ab..3cffd68 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -746,6 +746,9 @@ delegates_.back()->set_widget_host(widget_host_); widget_host_->Init(); view_ = new FakeRenderWidgetHostViewAura(widget_host_, is_guest_view_hack_); + // Set the mouse_wheel_phase_handler_ timer timeout to 100ms. + view_->event_handler()->set_mouse_wheel_wheel_phase_handler_timeout( + base::TimeDelta::FromMilliseconds(100)); base::RunLoop().RunUntilIdle(); } @@ -1948,8 +1951,7 @@ // synthetic wheel event with zero deltas and kPhaseEnded will be sent. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), - base::TimeDelta::FromMilliseconds( - kDefaultMouseWheelLatchingTransactionMs)); + base::TimeDelta::FromMilliseconds(100)); base::RunLoop().Run(); events = GetAndResetDispatchedMessages(); @@ -1970,6 +1972,66 @@ EXPECT_TRUE(gesture_event->data.scroll_end.synthetic); } +// Tests that latching breaks when the difference between location of the first +// wheel event in the sequence and the location of the current wheel event is +// larger than some maximum threshold. +TEST_F(RenderWidgetHostViewAuraWheelScrollLatchingEnabledTest, + TimerBasedLatchingBreaksWithMouseMove) { + view_->InitAsChild(nullptr); + view_->Show(); + sink_->ClearMessages(); + + ui::MouseWheelEvent event(gfx::Vector2d(0, 5), gfx::Point(2, 2), + gfx::Point(2, 2), ui::EventTimeForNow(), 0, 0); + view_->OnMouseEvent(&event); + base::RunLoop().RunUntilIdle(); + MockWidgetInputHandler::MessageVector events = + GetAndResetDispatchedMessages(); + + EXPECT_TRUE(events[0]->ToEvent()); + const WebMouseWheelEvent* wheel_event = + static_cast<const WebMouseWheelEvent*>( + events[0]->ToEvent()->Event()->web_event.get()); + EXPECT_EQ(WebMouseWheelEvent::kPhaseBegan, wheel_event->phase); + events[0]->ToEvent()->CallCallback(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); + events = GetAndResetDispatchedMessages(); + + // Send the second wheel event with a location within the slop region. The + // second wheel event will still be part of the current scrolling sequence + // since the location difference is less than the allowed threshold. + ui::MouseWheelEvent event2(gfx::Vector2d(0, 5), + gfx::Point(2 + kWheelLatchingSlopRegion / 2, 2), + gfx::Point(2 + kWheelLatchingSlopRegion / 2, 2), + ui::EventTimeForNow(), 0, 0); + view_->OnMouseEvent(&event2); + base::RunLoop().RunUntilIdle(); + events = GetAndResetDispatchedMessages(); + EXPECT_EQ("MouseWheel", GetMessageNames(events)); + wheel_event = static_cast<const WebMouseWheelEvent*>( + events[0]->ToEvent()->Event()->web_event.get()); + EXPECT_EQ(WebMouseWheelEvent::kPhaseChanged, wheel_event->phase); + events[0]->ToEvent()->CallCallback(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); + events = GetAndResetDispatchedMessages(); + + // Send the third wheel event with a location outside of the slop region. The + // third wheel event will break the latching since the location difference is + // larger than the allowed threshold. + ui::MouseWheelEvent event3( + gfx::Vector2d(0, 5), gfx::Point(2 + kWheelLatchingSlopRegion, 2), + gfx::Point(2 + kWheelLatchingSlopRegion, 2), ui::EventTimeForNow(), 0, 0); + view_->OnMouseEvent(&event3); + base::RunLoop().RunUntilIdle(); + events = GetAndResetDispatchedMessages(); + EXPECT_EQ("MouseWheel GestureScrollEnd MouseWheel", GetMessageNames(events)); + wheel_event = static_cast<const WebMouseWheelEvent*>( + events[0]->ToEvent()->Event()->web_event.get()); + EXPECT_EQ(WebMouseWheelEvent::kPhaseEnded, wheel_event->phase); + + wheel_event = static_cast<const WebMouseWheelEvent*>( + events[2]->ToEvent()->Event()->web_event.get()); + EXPECT_EQ(WebMouseWheelEvent::kPhaseBegan, wheel_event->phase); +} + // Tests that a gesture fling start with touchpad source resets wheel phase // state. TEST_F(RenderWidgetHostViewAuraWheelScrollLatchingEnabledTest, @@ -2013,8 +2075,7 @@ base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), - base::TimeDelta::FromMilliseconds( - 2 * kDefaultMouseWheelLatchingTransactionMs)); + base::TimeDelta::FromMilliseconds(200)); run_loop.Run(); ui::ScrollEvent scroll1(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(), 0, 0, 15, 0, 15, 2);
diff --git a/content/browser/renderer_host/render_widget_host_view_event_handler.h b/content/browser/renderer_host/render_widget_host_view_event_handler.h index 073b4916..5bdd7a8 100644 --- a/content/browser/renderer_host/render_widget_host_view_event_handler.h +++ b/content/browser/renderer_host/render_widget_host_view_event_handler.h
@@ -147,6 +147,11 @@ void OnTouchEvent(ui::TouchEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override; + // Used to set the mouse_wheel_phase_handler_ timer timeout for testing. + void set_mouse_wheel_wheel_phase_handler_timeout(base::TimeDelta timeout) { + mouse_wheel_phase_handler_.set_mouse_wheel_end_dispatch_timeout(timeout); + } + private: FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, FinishImeCompositionSession);
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index c3b2435..336e898 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -471,6 +471,11 @@ MouseWheelPhaseHandler mouse_wheel_phase_handler_; + // Used to set the mouse_wheel_phase_handler_ timer timeout for testing. + void set_mouse_wheel_wheel_phase_handler_timeout(base::TimeDelta timeout) { + mouse_wheel_phase_handler_.set_mouse_wheel_end_dispatch_timeout(timeout); + } + NSWindow* pepper_fullscreen_window() const { return pepper_fullscreen_window_; }
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index cab38ae..f9f6b59 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -1296,6 +1296,9 @@ // generated from this type of devices. TEST_F(RenderWidgetHostViewMacWithWheelScrollLatchingEnabledTest, TimerBasedPhaseInfo) { + rwhv_mac_->set_mouse_wheel_wheel_phase_handler_timeout( + base::TimeDelta::FromMilliseconds(100)); + // Send a wheel event without phase information for scrolling by 3 lines. NSEvent* wheelEvent = MockScrollWheelEventWithoutPhase(3); [rwhv_mac_->cocoa_view() scrollWheel:wheelEvent]; @@ -1384,7 +1387,7 @@ base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), - base::TimeDelta::FromMilliseconds(100)); + kMaximumTimeBetweenPhaseEndedAndMomentumPhaseBegan); run_loop.Run(); }
diff --git a/content/network/network_sandbox_hook_linux.cc b/content/network/network_sandbox_hook_linux.cc index 1db587e..a3068ff 100644 --- a/content/network/network_sandbox_hook_linux.cc +++ b/content/network/network_sandbox_hook_linux.cc
@@ -14,8 +14,10 @@ namespace content { bool NetworkPreSandboxHook(service_manager::SandboxLinux::Options options) { + auto* instance = service_manager::SandboxLinux::GetInstance(); + // TODO(tsepez): remove universal permission under filesytem root. - service_manager::SandboxLinux::GetInstance()->StartBrokerProcess( + instance->StartBrokerProcess( MakeBrokerCommandSet({ sandbox::syscall_broker::COMMAND_ACCESS, sandbox::syscall_broker::COMMAND_MKDIR, @@ -29,6 +31,7 @@ {BrokerFilePermission::ReadWriteCreateRecursive("/")}, service_manager::SandboxLinux::PreSandboxHook(), options); + instance->EngageNamespaceSandbox(false /* from_zygote */); return true; }
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc index 3d9797f1..bdb5716 100644 --- a/content/renderer/gpu/gpu_benchmarking_extension.cc +++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -54,14 +54,12 @@ #include "third_party/skia/include/core/SkGraphics.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "third_party/skia/include/core/SkPixelRef.h" -#include "third_party/skia/include/core/SkPixelSerializer.h" +#include "third_party/skia/include/core/SkSerialProcs.h" #include "third_party/skia/include/core/SkStream.h" // Note that headers in third_party/skia/src are fragile. This is // an experimental, fragile, and diagnostic-only document type. #include "third_party/skia/src/utils/SkMultiPictureDocument.h" #include "ui/events/base_event_utils.h" -#include "ui/gfx/codec/png_codec.h" #include "v8/include/v8.h" #if defined(OS_WIN) && !defined(NDEBUG) @@ -80,59 +78,6 @@ namespace content { namespace { - -class EncodingSerializer : public SkPixelSerializer { - protected: - bool onUseEncodedData(const void* data, size_t len) override { return true; } - - SkData* onEncode(const SkPixmap& pixmap) override { - std::vector<uint8_t> vector; - - const base::CommandLine& commandLine = - *base::CommandLine::ForCurrentProcess(); - if (commandLine.HasSwitch(switches::kSkipReencodingOnSKPCapture)) { - // In this case, we just want to store some useful information - // about the image to replace the missing encoded data. - - // First make sure that the data does not accidentally match any - // image signatures. - vector.push_back(0xFF); - vector.push_back(0xFF); - vector.push_back(0xFF); - vector.push_back(0xFF); - - // Save the width and height. - uint32_t width = pixmap.width(); - uint32_t height = pixmap.height(); - vector.push_back(width & 0xFF); - vector.push_back((width >> 8) & 0xFF); - vector.push_back((width >> 16) & 0xFF); - vector.push_back((width >> 24) & 0xFF); - vector.push_back(height & 0xFF); - vector.push_back((height >> 8) & 0xFF); - vector.push_back((height >> 16) & 0xFF); - vector.push_back((height >> 24) & 0xFF); - - // Save any additional information about the bitmap that may be - // interesting. - vector.push_back(pixmap.colorType()); - vector.push_back(pixmap.alphaType()); - return SkData::MakeWithCopy(&vector.front(), vector.size()).release(); - } else { - SkBitmap bm; - // The const_cast is fine, since we only read from the bitmap. - if (bm.installPixels(pixmap.info(), - const_cast<void*>(pixmap.addr()), - pixmap.rowBytes())) { - if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { - return SkData::MakeWithCopy(&vector.front(), vector.size()).release(); - } - } - } - return nullptr; - } -}; - class SkPictureSerializer { public: explicit SkPictureSerializer(const base::FilePath& dirpath) @@ -163,8 +108,21 @@ SkFILEWStream file(filepath.c_str()); DCHECK(file.isValid()); - EncodingSerializer serializer; - picture->serialize(&file, &serializer); + SkSerialProcs procs; + procs.fImageProc = [](SkImage* image, void*) { + auto data = image->refEncodedData(); + if (!data) { + const base::CommandLine& commandLine = + *base::CommandLine::ForCurrentProcess(); + if (commandLine.HasSwitch(switches::kSkipReencodingOnSKPCapture)) { + data = SkData::MakeEmpty(); + } + // else data is null, which triggers skia's default PNG encode + } + return data; + }; + auto data = picture->serialize(procs); + file.write(data->data(), data->size()); file.fsync(); } }
diff --git a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc index 96b3648..958d7f33 100644 --- a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc +++ b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc
@@ -132,13 +132,6 @@ } void LayoutTestContentRendererClient::RenderThreadStarted() { -// Unless/until WebM files are added to the media layout tests, we need to -// avoid removing MP4/H264/AAC so that layout tests can run on Android. -// TODO(chcunningham): We should fix the tests to always use non-proprietary -// codecs and just delete this code. http://crbug.com/787575 -#if !defined(OS_ANDROID) - media::RemoveProprietaryMediaTypesAndCodecsForTests(); -#endif ShellContentRendererClient::RenderThreadStarted(); shell_observer_.reset(new LayoutTestRenderThreadObserver()); }
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 8f3bd7d..4bd0c28 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -81,6 +81,12 @@ # Need to implement new lifetime/deletion semantics. self.Fail('conformance2/vertex_arrays/vertex-array-object.html', bug=739604) + # The following actually passes on gl_passthrough and also Mac Intel with + # command buffer. + self.Fail('deqp/functional/gles3/shadertexturefunction/' + + 'texturelodoffset.html', + bug=794335) + # Windows only. self.Fail('conformance2/buffers/uniform-buffers.html', ['win'], bug=757098) @@ -177,6 +183,8 @@ ['win', 'nvidia', 'opengl'], bug=786716) self.Fail('conformance2/rendering/instanced-rendering-bug.html', ['win', 'nvidia', 'opengl'], bug=791289) + self.Fail('conformance2/rendering/canvas-resizing-with-pbo-bound.html', + ['win', 'nvidia', 'opengl'], bug=794613) # Win / AMD self.Fail('conformance2/rendering/blitframebuffer-stencil-only.html', @@ -315,6 +323,11 @@ self.Fail('conformance/renderbuffers/framebuffer-state-restoration.html', ['passthrough', 'opengl', 'intel'], bug=602688) + # Passthrough command decoder / Win / OpenGL / NVIDIA + self.Fail('conformance2/textures/canvas_sub_rectangle/' + + 'tex-2d-rg32f-rg-float.html', + ['win', 'passthrough', 'opengl', 'nvidia'], bug=794340) + # Passthrough command decoder / Linux / OpenGL / NVIDIA self.Fail('conformance/textures/image_bitmap_from_video/' + 'tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html', @@ -330,6 +343,8 @@ ['linux', 'passthrough', 'opengl', 'nvidia'], bug=766918) self.Fail('deqp/functional/gles3/shaderoperator/common_functions.html', ['linux', 'passthrough', 'opengl', 'nvidia'], bug=793055) + self.Fail('deqp/functional/gles3/shaderpackingfunction.html', + ['linux', 'passthrough', 'opengl', 'nvidia'], bug=794341) # Regressions in 10.12.4. self.Fail('conformance2/textures/misc/tex-base-level-bug.html',
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index 6f07c59..b594bd7 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -220,6 +220,11 @@ self.Flaky('conformance/programs/program-test.html', ['win', 'nvidia', 'passthrough', 'd3d11'], bug=737016) + # Passthrough command decoder / Win / OpenGL / NVIDIA + self.Fail('conformance/renderbuffers/' + + 'depth-renderbuffer-initialization.html', + ['win', 'passthrough', 'opengl', 'nvidia'], bug=794339) + # Win failures # TODO(kbr): re-enable suppression for same test below once fixed. self.Skip('conformance/glsl/bugs/sampler-struct-function-arg.html',
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_revision.txt b/content/test/gpu/gpu_tests/webgl_conformance_revision.txt index 76eabf3..c94a12bb 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_revision.txt +++ b/content/test/gpu/gpu_tests/webgl_conformance_revision.txt
@@ -1,3 +1,3 @@ # AUTOGENERATED FILE - DO NOT EDIT # SEE roll_webgl_conformance.py -Current webgl revision 05591bbeae6592fd924caec8e728a4ea86cbb8c9 +Current webgl revision 1a8ed15c9c25f2b1ccd97149c94ea245ab982252
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 64be169..a3a18e3 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1072,6 +1072,12 @@ <message name="IDS_IOS_EXPORT_PASSWORDS" desc="Button that the user can press to export passwords. [Length: 22em] [iOS only]"> Export Passwords... </message> + <message name="IDS_IOS_EXPORT_PASSWORDS_ALERT_MESSAGE" desc="The message of the alert displayed as a warning to the user who tapped on the button to export passwords. [iOS only]"> + Your passwords will be visible to anyone who can see the exported file. Do not share this file with anyone. + </message> + <message name="IDS_IOS_EXPORT_PASSWORDS_CANCEL_BUTTON" desc="Label of a confirmation dialog button which allows the user to cancel passwords export. [Length: 22em] [iOS only]"> + Cancel + </message> <message name="IDS_IOS_SAVE_PASSWORDS_MANAGE_ACCOUNT" desc="Header text with link for the view in Settings for managing saved passwords. [Length: unlimited] [iOS only]"> View and manage saved passwords at <ph name="BEGIN_LINK">BEGIN_LINK</ph>passwords.google.com<ph name="END_LINK">END_LINK</ph> </message>
diff --git a/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm b/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm index 1f1e8f4..25968f6f 100644 --- a/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm +++ b/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm
@@ -85,7 +85,8 @@ @implementation FeatureEngagementTestCase // Verifies that the Badged Reading List feature shows when triggering -// conditions are met. +// conditions are met. Also verifies that the Badged Reading List does not +// appear again after being shown. - (void)testBadgedReadingListFeatureShouldShow { base::test::ScopedFeatureList scoped_feature_list; @@ -105,6 +106,15 @@ [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] assertWithMatcher:grey_sufficientlyVisible()]; + + // Close tools menu by tapping reload. + [[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()] + performAction:grey_tap()]; + + // Reopen tools menu to verify that the badge does not appear again. + [ChromeEarlGreyUI openToolsMenu]; + [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] + assertWithMatcher:grey_notVisible()]; } // Verifies that the Badged Reading List feature does not show if Chrome has @@ -126,4 +136,32 @@ [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] assertWithMatcher:grey_notVisible()]; } + +// Verifies that the Badged Reading List feature does not show if the reading +// list has already been used. +- (void)testBadgedReadingListFeatureReadingListAlreadyUsed { + base::test::ScopedFeatureList scoped_feature_list; + + EnableBadgedReadingListTriggering(scoped_feature_list); + + // Ensure that the FeatureEngagementTracker picks up the new feature + // configuration provided by |scoped_feature_list|. + LoadFeatureEngagementTracker(); + + // Ensure that Chrome has been launched enough times to mee the trigger + // condition + for (int index = 0; index < kMinChromeOpensRequired; index++) { + SimulateChromeOpenedEvent(); + } + + [chrome_test_util::BrowserCommandDispatcherForMainBVC() showReadingList]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Done")] + performAction:grey_tap()]; + + [ChromeEarlGreyUI openToolsMenu]; + + [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] + assertWithMatcher:grey_notVisible()]; +} + @end
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder.mm b/ios/chrome/browser/metrics/tab_usage_recorder.mm index fb242bf..72ac72cb 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder.mm
@@ -370,7 +370,7 @@ web::NavigationItem* pending_item = web_state->GetNavigationManager()->GetPendingItem(); if (pending_item) - return pending_item->GetURL().SchemeIs(kChromeUIScheme); + return pending_item->GetVirtualURL().SchemeIs(kChromeUIScheme); web::NavigationItem* last_committed_item = web_state->GetNavigationManager()->GetLastCommittedItem();
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm b/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm index bb836d3..a8b7f19 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm
@@ -59,10 +59,9 @@ WebStateInMemoryOption in_memory) { auto test_navigation_manager = std::make_unique<web::TestNavigationManager>(); - test_navigation_manager->AddItem(GURL(url), ui::PAGE_TRANSITION_LINK); - test_navigation_manager->SetLastCommittedItem( - test_navigation_manager->GetItemAtIndex( - test_navigation_manager->GetLastCommittedItemIndex())); + web::NavigationItem* item = + InsertItemToTestNavigationManager(test_navigation_manager.get(), url); + test_navigation_manager->SetLastCommittedItem(item); auto test_web_state = std::make_unique<web::TestWebState>(); test_web_state->SetNavigationManager(std::move(test_navigation_manager)); @@ -76,6 +75,16 @@ web_state_list_.GetWebStateAt(insertion_index)); } + web::NavigationItem* InsertItemToTestNavigationManager( + web::TestNavigationManager* test_navigation_manager, + const char* url) { + test_navigation_manager->AddItem(GURL(), ui::PAGE_TRANSITION_LINK); + web::NavigationItem* item = test_navigation_manager->GetItemAtIndex( + test_navigation_manager->GetLastCommittedItemIndex()); + item->SetVirtualURL(GURL(url)); + return item; + } + void AddTimeToDequeInTabUsageRecorder(base::TimeTicks time) { tab_usage_recorder_.termination_timestamps_.push_back(time); } @@ -138,6 +147,7 @@ kNumReloads, 1); } +// Tests that chrome:// URLs are not counted in page load stats. TEST_F(TabUsageRecorderTest, CountNativePageLoadsBeforeEvictedTab) { web::TestWebState* mock_tab_a = InsertTestWebState(kNativeURL, IN_MEMORY); web::TestWebState* mock_tab_b = InsertTestWebState(kNativeURL, NOT_IN_MEMORY); @@ -147,10 +157,29 @@ for (int i = 0; i < kNumReloads; i++) { tab_usage_recorder_.RecordPageLoadStart(mock_tab_a); } + tab_usage_recorder_.RecordTabSwitched(mock_tab_a, mock_tab_b); histogram_tester_.ExpectTotalCount(kPageLoadsBeforeEvictedTabSelected, 0); } +// Tests that page load stats is not updated for an evicted tab that has a +// pending chrome:// URL. +TEST_F(TabUsageRecorderTest, CountPendingNativePageLoadBeforeEvictedTab) { + web::TestWebState* old_tab = InsertTestWebState(kURL, IN_MEMORY); + web::TestWebState* new_evicted_tab = InsertTestWebState(kURL, NOT_IN_MEMORY); + + tab_usage_recorder_.RecordPageLoadStart(old_tab); + + auto* test_navigation_manager = static_cast<web::TestNavigationManager*>( + new_evicted_tab->GetNavigationManager()); + web::NavigationItem* item = + InsertItemToTestNavigationManager(test_navigation_manager, kNativeURL); + test_navigation_manager->SetPendingItem(item); + + tab_usage_recorder_.RecordTabSwitched(old_tab, new_evicted_tab); + histogram_tester_.ExpectTotalCount(kPageLoadsBeforeEvictedTabSelected, 0); +} + TEST_F(TabUsageRecorderTest, TestColdStartTabs) { web::TestWebState* mock_tab_a = InsertTestWebState(kURL, NOT_IN_MEMORY); web::TestWebState* mock_tab_b = InsertTestWebState(kURL, NOT_IN_MEMORY);
diff --git a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm index 29bfbd5..5a87fee8 100644 --- a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
@@ -4,6 +4,8 @@ #import "ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.h" +#import <UIKit/UIKit.h> + #include "base/ios/ios_util.h" #include "base/logging.h" #include "base/mac/foundation_util.h" @@ -148,9 +150,14 @@ // Module containing the reauthentication mechanism for viewing and copying // passwords. ReauthenticationModule* reauthenticationModule_; + // Boolean containing whether the export button and functionality are enabled + // or not. + BOOL exportEnabled_; } + // Kick off async request to get logins from password store. - (void)getLoginsFromPasswordStore; + @end @implementation SavePasswordsCollectionViewController @@ -470,9 +477,36 @@ exportPasswordsItem_.textColor = [[MDCPalette greyPalette] tint500]; exportPasswordsItem_.accessibilityTraits = UIAccessibilityTraitNotEnabled; [self reconfigureCellsForItems:@[ exportPasswordsItem_ ]]; + exportEnabled_ = NO; + } else { + exportEnabled_ = YES; } } +- (void)startPasswordsExportFlow { + UIAlertController* exportConfirmation = [UIAlertController + alertControllerWithTitle:nil + message:l10n_util::GetNSString( + IDS_IOS_EXPORT_PASSWORDS_ALERT_MESSAGE) + preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertAction* cancelAction = + [UIAlertAction actionWithTitle:l10n_util::GetNSString( + IDS_IOS_EXPORT_PASSWORDS_CANCEL_BUTTON) + style:UIAlertActionStyleCancel + handler:nil]; + [exportConfirmation addAction:cancelAction]; + + // TODO(crbug.com/789122): Ask for password serialization + // and wire re-authentication. + UIAlertAction* exportAction = [UIAlertAction + actionWithTitle:l10n_util::GetNSString(IDS_IOS_EXPORT_PASSWORDS) + style:UIAlertActionStyleDefault + handler:nil]; + [exportConfirmation addAction:exportAction]; + + [self presentViewController:exportConfirmation animated:YES completion:nil]; +} + #pragma mark UICollectionViewDelegate - (void)openDetailedViewForForm:(const autofill::PasswordForm&)form { @@ -518,10 +552,13 @@ [self openDetailedViewForForm:*blacklistedForms_[indexPath.item]]; break; case ItemTypeExportPasswordsButton: + DCHECK_EQ(SectionIdentifierExportPasswordsButton, + [model sectionIdentifierForSection:indexPath.section]); DCHECK(base::FeatureList::IsEnabled( password_manager::features::kPasswordExport)); - // TODO(crbug.com/789122): Trigger alert dialogue to confirm passwords - // export. + if (exportEnabled_) { + [self startPasswordsExportFlow]; + } break; default: NOTREACHED();
diff --git a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller_unittest.mm index fd5093c..b7a19ca 100644 --- a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller_unittest.mm
@@ -36,12 +36,27 @@ namespace { +typedef struct { + bool export_enabled; + int section_offset; +} ExportPasswordsFeatureStatus; + class SavePasswordsCollectionViewControllerTest - : public CollectionViewControllerTest { + : public CollectionViewControllerTest, + public ::testing::WithParamInterface<ExportPasswordsFeatureStatus> { protected: SavePasswordsCollectionViewControllerTest() = default; void SetUp() override { + // TODO(crbug.com/792840): Remove parametrized tests once the feature is + // enabled. + if (GetParam().export_enabled) { + scoped_feature_list_.InitAndEnableFeature( + password_manager::features::kPasswordExport); + } else { + scoped_feature_list_.InitAndDisableFeature( + password_manager::features::kPasswordExport); + } TestChromeBrowserState::Builder test_cbs_builder; chrome_browser_state_ = test_cbs_builder.Build(); CollectionViewControllerTest::SetUp(); @@ -145,119 +160,107 @@ web::TestWebThreadBundle thread_bundle_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; -}; - -// TODO(crbug.com/792840): Remove subclasses and keep the enabled feature -// versions of the tests. -class SavePasswordsCollectionViewControllerExportDisabledTest - : public SavePasswordsCollectionViewControllerTest { - void SetUp() override { - scoped_feature_list_.InitAndDisableFeature( - password_manager::features::kPasswordExport); - SavePasswordsCollectionViewControllerTest::SetUp(); - } - - base::test::ScopedFeatureList scoped_feature_list_; -}; - -class SavePasswordsCollectionViewControllerExportEnabledTest - : public SavePasswordsCollectionViewControllerTest { - void SetUp() override { - scoped_feature_list_.InitAndEnableFeature( - password_manager::features::kPasswordExport); - SavePasswordsCollectionViewControllerTest::SetUp(); - } - base::test::ScopedFeatureList scoped_feature_list_; }; // Tests default case has no saved sites and no blacklisted sites. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - TestInitialization) { +TEST_P(SavePasswordsCollectionViewControllerTest, TestInitialization) { CheckController(); - EXPECT_EQ(2, NumberOfSections()); + EXPECT_EQ(GetParam().section_offset + 2, NumberOfSections()); } // Tests adding one item in saved password section. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - AddSavedPasswords) { +TEST_P(SavePasswordsCollectionViewControllerTest, AddSavedPasswords) { AddSavedForm1(); - EXPECT_EQ(3, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(2)); + int section_offset = GetParam().section_offset; + EXPECT_EQ(section_offset + 3, NumberOfSections()); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); } // Tests adding one item in blacklisted password section. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - AddBlacklistedPasswords) { +TEST_P(SavePasswordsCollectionViewControllerTest, AddBlacklistedPasswords) { AddBlacklistedForm1(); - EXPECT_EQ(3, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(2)); + int section_offset = GetParam().section_offset; + + EXPECT_EQ(section_offset + 3, NumberOfSections()); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); } // Tests adding one item in saved password section, and two items in blacklisted // password section. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - AddSavedAndBlacklisted) { +TEST_P(SavePasswordsCollectionViewControllerTest, AddSavedAndBlacklisted) { AddSavedForm1(); AddBlacklistedForm1(); AddBlacklistedForm2(); + int section_offset = GetParam().section_offset; + // There should be two sections added. - EXPECT_EQ(4, NumberOfSections()); + EXPECT_EQ(section_offset + 4, NumberOfSections()); // There should be 1 row in saved password section. - EXPECT_EQ(1, NumberOfItemsInSection(2)); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); // There should be 2 rows in blacklisted password section. - EXPECT_EQ(2, NumberOfItemsInSection(3)); + EXPECT_EQ(2, NumberOfItemsInSection(section_offset + 3)); } // Tests the order in which the saved passwords are displayed. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - TestSavedPasswordsOrder) { +TEST_P(SavePasswordsCollectionViewControllerTest, TestSavedPasswordsOrder) { + int section_offset = GetParam().section_offset; + AddSavedForm2(); - CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", 2, 0); + CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", + section_offset + 2, 0); AddSavedForm1(); - CheckTextCellTitleAndSubtitle(@"example.com", @"test@egmail.com", 2, 0); - CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", 2, 1); + CheckTextCellTitleAndSubtitle(@"example.com", @"test@egmail.com", + section_offset + 2, 0); + CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", + section_offset + 2, 1); } // Tests the order in which the blacklisted passwords are displayed. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, +TEST_P(SavePasswordsCollectionViewControllerTest, TestBlacklistedPasswordsOrder) { + int section_offset = GetParam().section_offset; + AddBlacklistedForm2(); - CheckTextCellTitle(@"secret2.com", 2, 0); + CheckTextCellTitle(@"secret2.com", section_offset + 2, 0); AddBlacklistedForm1(); - CheckTextCellTitle(@"secret.com", 2, 0); - CheckTextCellTitle(@"secret2.com", 2, 1); + CheckTextCellTitle(@"secret.com", section_offset + 2, 0); + CheckTextCellTitle(@"secret2.com", section_offset + 2, 1); } // Tests displaying passwords in the saved passwords section when there are // duplicates in the password store. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - AddSavedDuplicates) { +TEST_P(SavePasswordsCollectionViewControllerTest, AddSavedDuplicates) { AddSavedForm1(); AddSavedForm1(); - EXPECT_EQ(3, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(2)); + + int section_offset = GetParam().section_offset; + + EXPECT_EQ(section_offset + 3, NumberOfSections()); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); } // Tests displaying passwords in the blacklisted passwords section when there // are duplicates in the password store. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - AddBlacklistedDuplicates) { +TEST_P(SavePasswordsCollectionViewControllerTest, AddBlacklistedDuplicates) { AddBlacklistedForm1(); AddBlacklistedForm1(); - EXPECT_EQ(3, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(2)); + + int section_offset = GetParam().section_offset; + + EXPECT_EQ(section_offset + 3, NumberOfSections()); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); } // Tests deleting items from saved passwords and blacklisted passwords sections. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, DeleteItems) { +TEST_P(SavePasswordsCollectionViewControllerTest, DeleteItems) { AddSavedForm1(); AddBlacklistedForm1(); AddBlacklistedForm2(); @@ -273,25 +276,26 @@ })); }; + int section_offset = GetParam().section_offset; + // Delete item in save passwords section. - deleteItemWithWait(2, 0); - EXPECT_EQ(3, NumberOfSections()); + deleteItemWithWait(section_offset + 2, 0); + EXPECT_EQ(section_offset + 3, NumberOfSections()); // Section 2 should now be the blacklisted passwords section, and should still // have both its items. - EXPECT_EQ(2, NumberOfItemsInSection(2)); + EXPECT_EQ(2, NumberOfItemsInSection(section_offset + 2)); // Delete item in blacklisted passwords section. - deleteItemWithWait(2, 0); - EXPECT_EQ(1, NumberOfItemsInSection(2)); - deleteItemWithWait(2, 0); + deleteItemWithWait(section_offset + 2, 0); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); + deleteItemWithWait(section_offset + 2, 0); // There should be no password sections remaining. - EXPECT_EQ(2, NumberOfSections()); + EXPECT_EQ(section_offset + 2, NumberOfSections()); } // Tests deleting items from saved passwords and blacklisted passwords sections // when there are duplicates in the store. -TEST_F(SavePasswordsCollectionViewControllerExportDisabledTest, - DeleteItemsWithDuplicates) { +TEST_P(SavePasswordsCollectionViewControllerTest, DeleteItemsWithDuplicates) { AddSavedForm1(); AddSavedForm1(); AddBlacklistedForm1(); @@ -309,176 +313,28 @@ })); }; - // Delete item in save passwords section. - deleteItemWithWait(2, 0); - EXPECT_EQ(3, NumberOfSections()); - // Section 2 should now be the blacklisted passwords section, and should still - // have both its items. - EXPECT_EQ(2, NumberOfItemsInSection(2)); - - // Delete item in blacklisted passwords section. - deleteItemWithWait(2, 0); - EXPECT_EQ(1, NumberOfItemsInSection(2)); - deleteItemWithWait(2, 0); - // There should be no password sections remaining. - EXPECT_EQ(2, NumberOfSections()); -} - -// Tests default case has no saved sites and no blacklisted sites. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - TestInitialization) { - CheckController(); - EXPECT_EQ(3, NumberOfSections()); -} - -// Tests adding one item in saved password section. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - AddSavedPasswords) { - AddSavedForm1(); - - EXPECT_EQ(4, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(3)); -} - -// Tests adding one item in blacklisted password section. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - AddBlacklistedPassword) { - AddBlacklistedForm1(); - - EXPECT_EQ(4, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(3)); -} - -// Tests adding one item in saved password section, and two items in blacklisted -// password section. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - AddSavedAndBlacklisted) { - AddSavedForm1(); - AddBlacklistedForm1(); - AddBlacklistedForm2(); - - // There should be two sections added. - EXPECT_EQ(5, NumberOfSections()); - - // There should be 1 row in saved password section. - EXPECT_EQ(1, NumberOfItemsInSection(3)); - // There should be 2 rows in blacklisted password section. - EXPECT_EQ(2, NumberOfItemsInSection(4)); -} - -// Tests the order in which the saved passwords are displayed. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - TestSavedPasswordsOrder) { - AddSavedForm2(); - - CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", 3, 0); - - AddSavedForm1(); - CheckTextCellTitleAndSubtitle(@"example.com", @"test@egmail.com", 3, 0); - CheckTextCellTitleAndSubtitle(@"example2.com", @"test@egmail.com", 3, 1); -} - -// Tests the order in which the blacklisted passwords are displayed. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - TestBlacklistedPasswordsOrder) { - AddBlacklistedForm2(); - CheckTextCellTitle(@"secret2.com", 3, 0); - - AddBlacklistedForm1(); - CheckTextCellTitle(@"secret.com", 3, 0); - CheckTextCellTitle(@"secret2.com", 3, 1); -} - -// Tests displaying passwords in the saved passwords section when there are -// duplicates in the password store. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - AddSavedDuplicates) { - AddSavedForm1(); - AddSavedForm1(); - EXPECT_EQ(4, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(3)); -} - -// Tests displaying passwords in the blacklisted passwords section when there -// are duplicates in the password store. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - AddBlacklistedDuplicates) { - AddBlacklistedForm1(); - AddBlacklistedForm1(); - EXPECT_EQ(4, NumberOfSections()); - EXPECT_EQ(1, NumberOfItemsInSection(3)); -} - -// Tests deleting items from saved passwords and blacklisted passwords sections. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, DeleteItems) { - AddSavedForm1(); - AddBlacklistedForm1(); - AddBlacklistedForm2(); - - void (^deleteItemWithWait)(int, int) = ^(int i, int j) { - __block BOOL completionCalled = NO; - this->DeleteItem(i, j, ^{ - completionCalled = YES; - }); - EXPECT_TRUE(testing::WaitUntilConditionOrTimeout( - testing::kWaitForUIElementTimeout, ^bool() { - return completionCalled; - })); - }; + int section_offset = GetParam().section_offset; // Delete item in save passwords section. - deleteItemWithWait(3, 0); - EXPECT_EQ(4, NumberOfSections()); + deleteItemWithWait(section_offset + 2, 0); + EXPECT_EQ(section_offset + 3, NumberOfSections()); // Section 2 should now be the blacklisted passwords section, and should still // have both its items. - EXPECT_EQ(2, NumberOfItemsInSection(3)); + EXPECT_EQ(2, NumberOfItemsInSection(section_offset + 2)); // Delete item in blacklisted passwords section. - deleteItemWithWait(3, 0); - EXPECT_EQ(1, NumberOfItemsInSection(3)); - deleteItemWithWait(3, 0); + deleteItemWithWait(section_offset + 2, 0); + EXPECT_EQ(1, NumberOfItemsInSection(section_offset + 2)); + deleteItemWithWait(section_offset + 2, 0); // There should be no password sections remaining. - EXPECT_EQ(3, NumberOfSections()); + EXPECT_EQ(section_offset + 2, NumberOfSections()); } -// Tests deleting items from saved passwords and blacklisted passwords sections -// when there are duplicates in the store. -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, - DeleteItemsWithDuplicates) { - AddSavedForm1(); - AddSavedForm1(); - AddBlacklistedForm1(); - AddBlacklistedForm1(); - AddBlacklistedForm2(); - - void (^deleteItemWithWait)(int, int) = ^(int i, int j) { - __block BOOL completionCalled = NO; - this->DeleteItem(i, j, ^{ - completionCalled = YES; - }); - EXPECT_TRUE(testing::WaitUntilConditionOrTimeout( - testing::kWaitForUIElementTimeout, ^bool() { - return completionCalled; - })); - }; - - // Delete item in save passwords section. - deleteItemWithWait(3, 0); - EXPECT_EQ(4, NumberOfSections()); - // Section 2 should now be the blacklisted passwords section, and should still - // have both its items. - EXPECT_EQ(2, NumberOfItemsInSection(3)); - - // Delete item in blacklisted passwords section. - deleteItemWithWait(3, 0); - EXPECT_EQ(1, NumberOfItemsInSection(3)); - deleteItemWithWait(3, 0); - // There should be no password sections remaining. - EXPECT_EQ(3, NumberOfSections()); -} - -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, +TEST_P(SavePasswordsCollectionViewControllerTest, TestExportButtonDisabledNoSavedPasswords) { + if (!GetParam().export_enabled) + return; + CollectionViewTextItem* exportButton = GetCollectionViewItem(2, 0); UIColor* disabledColor = [[MDCPalette greyPalette] tint500]; EXPECT_NSEQ(disabledColor, exportButton.textColor); @@ -492,15 +348,17 @@ EXPECT_EQ(UIAccessibilityTraitNotEnabled, exportButton.accessibilityTraits); } -TEST_F(SavePasswordsCollectionViewControllerExportEnabledTest, +TEST_P(SavePasswordsCollectionViewControllerTest, TestExportButtonEnabledWithSavedPasswords) { + if (!GetParam().export_enabled) + return; AddSavedForm1(); CollectionViewTextItem* exportButton = GetCollectionViewItem(2, 0); EXPECT_NSEQ([[MDCPalette greyPalette] tint900], exportButton.textColor); EXPECT_NE(UIAccessibilityTraitNotEnabled, exportButton.accessibilityTraits); } -TEST_F(SavePasswordsCollectionViewControllerTest, PropagateDeletionToStore) { +TEST_P(SavePasswordsCollectionViewControllerTest, PropagateDeletionToStore) { SavePasswordsCollectionViewController* save_password_controller = static_cast<SavePasswordsCollectionViewController*>(controller()); autofill::PasswordForm form; @@ -521,4 +379,14 @@ [save_password_controller deletePassword:form]; } +const std::vector<ExportPasswordsFeatureStatus> kExportFeatureStatusCases{ + // Passwords export disabled + {FALSE, 0}, + // Passwords export enabled + {TRUE, 1}}; + +INSTANTIATE_TEST_CASE_P(ExportDisabledAndEnabled, + SavePasswordsCollectionViewControllerTest, + ::testing::ValuesIn(kExportFeatureStatusCases)); + } // namespace
diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc index 1bd72ff..1409e8ec 100644 --- a/media/base/mime_util.cc +++ b/media/base/mime_util.cc
@@ -55,8 +55,4 @@ mime_type, codec_id, ambiguous_codec_string, out_codec); } -void RemoveProprietaryMediaTypesAndCodecsForTests() { - GetMimeUtil()->RemoveProprietaryMediaTypesAndCodecs(); -} - } // namespace media
diff --git a/media/base/mime_util.h b/media/base/mime_util.h index 0ff6703..33f01fe 100644 --- a/media/base/mime_util.h +++ b/media/base/mime_util.h
@@ -85,12 +85,6 @@ IsSupportedEncryptedMediaFormat(const std::string& mime_type, const std::vector<std::string>& codecs); -// Test only method that removes proprietary media types and codecs from the -// list of supported MIME types and codecs. These types and codecs must be -// removed to ensure consistent layout test results across all Chromium -// variations. -MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests(); - } // namespace media #endif // MEDIA_BASE_MIME_UTIL_H_
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc index 9c929b21..ed864dc 100644 --- a/media/base/mime_util_internal.cc +++ b/media/base/mime_util_internal.cc
@@ -518,25 +518,6 @@ return AreSupportedCodecs(parsed_results, mime_type_lower_case, is_encrypted); } -void MimeUtil::RemoveProprietaryMediaTypesAndCodecs() { - for (const auto& container : proprietary_media_containers_) - media_format_map_.erase(container); - - // TODO(chcunningham): Delete this hack (really this whole test-only method). - // This is done as short term workaround for LayoutTests to pass. MP4 is no - // longer proprietary, but may still contain proprietary codecs (e.g. AVC). - // Many layout tests only check for container support and may break (absent - // this hack) if run on a non-proprietary build. This mess is being fixed in - // https://chromium-review.googlesource.com/c/chromium/src/+/807604 - media_format_map_.erase("video/mp4"); - media_format_map_.erase("audio/mp4"); - media_format_map_.erase("audio/mpeg"); - media_format_map_.erase("audio/mp3"); - media_format_map_.erase("audio/x-mp3"); - - allow_proprietary_codecs_ = false; -} - // static bool MimeUtil::IsCodecSupportedOnAndroid( Codec codec,
diff --git a/media/base/mime_util_internal.h b/media/base/mime_util_internal.h index d8677316..7c528d4 100644 --- a/media/base/mime_util_internal.h +++ b/media/base/mime_util_internal.h
@@ -86,8 +86,6 @@ const std::vector<std::string>& codecs, bool is_encrypted) const; - void RemoveProprietaryMediaTypesAndCodecs(); - // Checks android platform specific codec restrictions. Returns true if // |codec| is supported when contained in |mime_type_lower_case|. // |is_encrypted| means the codec will be used with encrypted blocks.
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 80057fc2..6bd72f9 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc
@@ -1473,6 +1473,12 @@ ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); EXPECT_GE(30, cache_->GetEntryCount()); ANNOTATE_IGNORE_READS_AND_WRITES_END(); + + // For extra messiness, the integrity check for the cache can actually cause + // evictions if it's over-capacity, which would race with above. So change the + // size we pass to CheckCacheIntegrity (but don't mess with existing backend's + // state. + size_ = 0; } // We'll be leaking memory from this test. @@ -2168,7 +2174,7 @@ cache_.reset(); cache_impl_ = NULL; - ASSERT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask)); + ASSERT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, MaxSize(), mask)); success_ = true; } @@ -2427,7 +2433,8 @@ ASSERT_THAT(cb.GetResult(rv), IsOk()); base::ThreadRestrictions::SetIOAllowed(prev); cache_.reset(); - EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_)); + EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, /*max_size = */ 0, + mask_)); } #endif
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index d5e9431..8df5c20 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <limits> +#include <memory> #include <string> #include "base/barrier_closure.h" @@ -40,6 +41,17 @@ namespace { +const size_t kNumEntries = 10000; +const int kHeadersSize = 2000; + +const int kBodySize = 72 * 1024 - 1; + +// HttpCache likes this chunk size. +const int kChunkSize = 32 * 1024; + +// As of 2017-01-12, this is a typical per-tab limit on HTTP connections. +const int kMaxParallelOperations = 10; + void MaybeSetFdLimit(unsigned int max_descriptors) { #if defined(OS_POSIX) base::SetFdLimit(max_descriptors); @@ -51,6 +63,11 @@ int data_len; }; +enum class WhatToRead { + HEADERS_ONLY, + HEADERS_AND_BODY, +}; + class DiskCachePerfTest : public DiskCacheTestWithCache { public: DiskCachePerfTest() @@ -65,26 +82,29 @@ MaybeSetFdLimit(saved_fd_limit_); } + const std::vector<TestEntry>& entries() const { return entries_; } + protected: - enum class WhatToRead { - HEADERS_ONLY, - HEADERS_AND_BODY, - }; // Helper methods for constructing tests. - bool TimeWrite(); - bool TimeRead(WhatToRead what_to_read, const char* timer_message); + bool TimeWrites(); + bool TimeReads(WhatToRead what_to_read, const char* timer_message); void ResetAndEvictSystemDiskCache(); + // Callbacks used within tests for intermediate operations. + void WriteCallback(const net::CompletionCallback& final_callback, + scoped_refptr<net::IOBuffer> headers_buffer, + scoped_refptr<net::IOBuffer> body_buffer, + disk_cache::Entry* cache_entry, + int entry_index, + size_t write_offset, + int result); + // Complete perf tests. void CacheBackendPerformance(); const size_t kFdLimitForCacheTests = 8192; - const int kNumEntries = 1000; - const int kHeadersSize = 800; - const int kBodySize = 256 * 1024 - 1; - std::vector<TestEntry> entries_; private: @@ -92,109 +112,291 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; }; -// Creates num_entries on the cache, and writes kHeaderSize bytes of metadata -// and up to kBodySize of data to each entry. -bool DiskCachePerfTest::TimeWrite() { - // TODO(gavinp): This test would be significantly more realistic if it didn't - // do single reads and writes. Perhaps entries should be written 64kb at a - // time. As well, not all entries should be created and written essentially - // simultaneously; some number of entries in flight at a time would be a - // likely better testing load. - scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize)); - scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize)); +class WriteHandler { + public: + WriteHandler(const DiskCachePerfTest* test, + disk_cache::Backend* cache, + net::CompletionCallback final_callback) + : test_(test), cache_(cache), final_callback_(final_callback) { + CacheTestFillBuffer(headers_buffer_->data(), kHeadersSize, false); + CacheTestFillBuffer(body_buffer_->data(), kChunkSize, false); + } - CacheTestFillBuffer(buffer1->data(), kHeadersSize, false); - CacheTestFillBuffer(buffer2->data(), kBodySize, false); + void Run(); - int expected = 0; + protected: + void CreateNextEntry(); - MessageLoopHelper helper; - CallbackTest callback(&helper, true); + void CreateCallback(std::unique_ptr<disk_cache::Entry*> unique_entry_ptr, + int data_len, + int result); + void WriteDataCallback(disk_cache::Entry* entry, + int next_offset, + int data_len, + int expected_result, + int result); - base::PerfTimeLogger timer("Write disk cache entries"); + private: + bool CheckForErrorAndCancel(int result); - for (int i = 0; i < kNumEntries; i++) { + const DiskCachePerfTest* test_; + disk_cache::Backend* cache_; + net::CompletionCallback final_callback_; + + size_t next_entry_index_ = 0; + size_t pending_operations_count_ = 0; + + int pending_result_ = net::OK; + + scoped_refptr<net::IOBuffer> headers_buffer_ = + new net::IOBuffer(kHeadersSize); + scoped_refptr<net::IOBuffer> body_buffer_ = new net::IOBuffer(kChunkSize); +}; + +void WriteHandler::Run() { + for (int i = 0; i < kMaxParallelOperations; ++i) { + ++pending_operations_count_; + CreateNextEntry(); + } +} + +void WriteHandler::CreateNextEntry() { + ASSERT_GT(kNumEntries, next_entry_index_); + TestEntry test_entry = test_->entries()[next_entry_index_++]; + disk_cache::Entry** entry_ptr = new disk_cache::Entry*(); + std::unique_ptr<disk_cache::Entry*> unique_entry_ptr(entry_ptr); + net::CompletionCallback callback = + base::Bind(&WriteHandler::CreateCallback, base::Unretained(this), + base::Passed(&unique_entry_ptr), test_entry.data_len); + int result = cache_->CreateEntry(test_entry.key, entry_ptr, callback); + if (result != net::ERR_IO_PENDING) + callback.Run(result); +} + +void WriteHandler::CreateCallback(std::unique_ptr<disk_cache::Entry*> entry_ptr, + int data_len, + int result) { + if (CheckForErrorAndCancel(result)) + return; + + disk_cache::Entry* entry = *entry_ptr; + + net::CompletionCallback callback = + base::Bind(&WriteHandler::WriteDataCallback, base::Unretained(this), + entry, 0, data_len, kHeadersSize); + int new_result = entry->WriteData(0, 0, headers_buffer_.get(), kHeadersSize, + callback, false); + if (new_result != net::ERR_IO_PENDING) + callback.Run(new_result); +} + +void WriteHandler::WriteDataCallback(disk_cache::Entry* entry, + int next_offset, + int data_len, + int expected_result, + int result) { + if (CheckForErrorAndCancel(result)) { + entry->Close(); + return; + } + DCHECK_LE(next_offset, data_len); + if (next_offset == data_len) { + entry->Close(); + if (next_entry_index_ < kNumEntries) { + CreateNextEntry(); + } else { + --pending_operations_count_; + if (pending_operations_count_ == 0) + final_callback_.Run(net::OK); + } + return; + } + + int write_size = std::min(kChunkSize, data_len - next_offset); + net::CompletionCallback callback = + base::Bind(&WriteHandler::WriteDataCallback, base::Unretained(this), + entry, next_offset + write_size, data_len, write_size); + int new_result = entry->WriteData(1, next_offset, body_buffer_.get(), + write_size, callback, true); + if (new_result != net::ERR_IO_PENDING) + callback.Run(new_result); +} + +bool WriteHandler::CheckForErrorAndCancel(int result) { + DCHECK_NE(net::ERR_IO_PENDING, result); + if (result != net::OK && !(result > 0)) + pending_result_ = result; + if (pending_result_ != net::OK) { + --pending_operations_count_; + if (pending_operations_count_ == 0) + final_callback_.Run(pending_result_); + return true; + } + return false; +} + +class ReadHandler { + public: + ReadHandler(const DiskCachePerfTest* test, + WhatToRead what_to_read, + disk_cache::Backend* cache, + net::CompletionCallback final_callback) + : test_(test), + what_to_read_(what_to_read), + cache_(cache), + final_callback_(final_callback) { + for (int i = 0; i < kMaxParallelOperations; ++i) + read_buffers_[i] = new net::IOBuffer(std::max(kHeadersSize, kChunkSize)); + } + + void Run(); + + protected: + void OpenNextEntry(int parallel_operation_index); + + void OpenCallback(int parallel_operation_index, + std::unique_ptr<disk_cache::Entry*> unique_entry_ptr, + int data_len, + int result); + void ReadDataCallback(int parallel_operation_index, + disk_cache::Entry* entry, + int next_offset, + int data_len, + int expected_result, + int result); + + private: + bool CheckForErrorAndCancel(int result); + + const DiskCachePerfTest* test_; + const WhatToRead what_to_read_; + + disk_cache::Backend* cache_; + net::CompletionCallback final_callback_; + + size_t next_entry_index_ = 0; + size_t pending_operations_count_ = 0; + + int pending_result_ = net::OK; + + scoped_refptr<net::IOBuffer> read_buffers_[kMaxParallelOperations]; +}; + +void ReadHandler::Run() { + for (int i = 0; i < kMaxParallelOperations; ++i) { + OpenNextEntry(pending_operations_count_); + ++pending_operations_count_; + } +} + +void ReadHandler::OpenNextEntry(int parallel_operation_index) { + ASSERT_GT(kNumEntries, next_entry_index_); + TestEntry test_entry = test_->entries()[next_entry_index_++]; + disk_cache::Entry** entry_ptr = new disk_cache::Entry*(); + std::unique_ptr<disk_cache::Entry*> unique_entry_ptr(entry_ptr); + net::CompletionCallback callback = + base::Bind(&ReadHandler::OpenCallback, base::Unretained(this), + parallel_operation_index, base::Passed(&unique_entry_ptr), + test_entry.data_len); + int result = cache_->OpenEntry(test_entry.key, entry_ptr, callback); + if (result != net::ERR_IO_PENDING) + callback.Run(result); +} + +void ReadHandler::OpenCallback(int parallel_operation_index, + std::unique_ptr<disk_cache::Entry*> entry_ptr, + int data_len, + int result) { + if (CheckForErrorAndCancel(result)) + return; + + disk_cache::Entry* entry = *entry_ptr; + + EXPECT_EQ(data_len, entry->GetDataSize(1)); + + net::CompletionCallback callback = + base::Bind(&ReadHandler::ReadDataCallback, base::Unretained(this), + parallel_operation_index, entry, 0, data_len, kHeadersSize); + int new_result = + entry->ReadData(0, 0, read_buffers_[parallel_operation_index].get(), + kChunkSize, callback); + if (new_result != net::ERR_IO_PENDING) + callback.Run(new_result); +} + +void ReadHandler::ReadDataCallback(int parallel_operation_index, + disk_cache::Entry* entry, + int next_offset, + int data_len, + int expected_result, + int result) { + if (CheckForErrorAndCancel(result)) { + entry->Close(); + return; + } + DCHECK_LE(next_offset, data_len); + if (what_to_read_ == WhatToRead::HEADERS_ONLY || next_offset == data_len) { + entry->Close(); + if (next_entry_index_ < kNumEntries) { + OpenNextEntry(parallel_operation_index); + } else { + --pending_operations_count_; + if (pending_operations_count_ == 0) + final_callback_.Run(net::OK); + } + return; + } + + int expected_read_size = std::min(kChunkSize, data_len - next_offset); + net::CompletionCallback callback = base::Bind( + &ReadHandler::ReadDataCallback, base::Unretained(this), + parallel_operation_index, entry, next_offset + expected_read_size, + data_len, expected_read_size); + int new_result = entry->ReadData( + 1, next_offset, read_buffers_[parallel_operation_index].get(), kChunkSize, + callback); + if (new_result != net::ERR_IO_PENDING) + callback.Run(new_result); +} + +bool ReadHandler::CheckForErrorAndCancel(int result) { + DCHECK_NE(net::ERR_IO_PENDING, result); + if (result != net::OK && !(result > 0)) + pending_result_ = result; + if (pending_result_ != net::OK) { + --pending_operations_count_; + if (pending_operations_count_ == 0) + final_callback_.Run(pending_result_); + return true; + } + return false; +} + +bool DiskCachePerfTest::TimeWrites() { + for (size_t i = 0; i < kNumEntries; i++) { TestEntry entry; entry.key = GenerateKey(true); entry.data_len = base::RandInt(0, kBodySize); entries_.push_back(entry); - - disk_cache::Entry* cache_entry; - net::TestCompletionCallback cb; - int rv = cache_->CreateEntry(entry.key, &cache_entry, cb.callback()); - if (net::OK != cb.GetResult(rv)) - break; - int ret = cache_entry->WriteData( - 0, 0, buffer1.get(), kHeadersSize, - base::Bind(&CallbackTest::Run, base::Unretained(&callback)), false); - if (net::ERR_IO_PENDING == ret) - expected++; - else if (kHeadersSize != ret) - break; - - ret = cache_entry->WriteData( - 1, 0, buffer2.get(), entry.data_len, - base::Bind(&CallbackTest::Run, base::Unretained(&callback)), false); - if (net::ERR_IO_PENDING == ret) - expected++; - else if (entry.data_len != ret) - break; - cache_entry->Close(); } - helper.WaitUntilCacheIoFinished(expected); - timer.Done(); + net::TestCompletionCallback cb; - return expected == helper.callbacks_called(); + base::PerfTimeLogger timer("Write disk cache entries"); + + WriteHandler write_handler(this, cache_.get(), cb.callback()); + write_handler.Run(); + return cb.WaitForResult() == net::OK; } -// Reads the data and metadata from each entry listed on |entries|. -bool DiskCachePerfTest::TimeRead(WhatToRead what_to_read, - const char* timer_message) { - scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize)); - scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize)); - - CacheTestFillBuffer(buffer1->data(), kHeadersSize, false); - CacheTestFillBuffer(buffer2->data(), kBodySize, false); - - int expected = 0; - - MessageLoopHelper helper; - CallbackTest callback(&helper, true); - +bool DiskCachePerfTest::TimeReads(WhatToRead what_to_read, + const char* timer_message) { base::PerfTimeLogger timer(timer_message); - for (int i = 0; i < kNumEntries; i++) { - disk_cache::Entry* cache_entry; - net::TestCompletionCallback cb; - int rv = cache_->OpenEntry(entries_[i].key, &cache_entry, cb.callback()); - if (net::OK != cb.GetResult(rv)) - break; - int ret = cache_entry->ReadData( - 0, 0, buffer1.get(), kHeadersSize, - base::Bind(&CallbackTest::Run, base::Unretained(&callback))); - if (net::ERR_IO_PENDING == ret) - expected++; - else if (kHeadersSize != ret) - break; - - if (what_to_read == WhatToRead::HEADERS_AND_BODY) { - ret = cache_entry->ReadData( - 1, 0, buffer2.get(), entries_[i].data_len, - base::Bind(&CallbackTest::Run, base::Unretained(&callback))); - if (net::ERR_IO_PENDING == ret) - expected++; - else if (entries_[i].data_len != ret) - break; - } - - cache_entry->Close(); - } - - helper.WaitUntilCacheIoFinished(expected); - timer.Done(); - - return (expected == helper.callbacks_called()); + net::TestCompletionCallback cb; + ReadHandler read_handler(this, what_to_read, cache_.get(), cb.callback()); + read_handler.Run(); + return cb.WaitForResult() == net::OK; } TEST_F(DiskCachePerfTest, BlockfileHashes) { @@ -233,26 +435,28 @@ } void DiskCachePerfTest::CacheBackendPerformance() { + LOG(ERROR) << "Using cache at:" << cache_path_.MaybeAsASCII(); + SetMaxSize(500 * 1024 * 1024); InitCache(); - EXPECT_TRUE(TimeWrite()); + EXPECT_TRUE(TimeWrites()); disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); base::RunLoop().RunUntilIdle(); ResetAndEvictSystemDiskCache(); - EXPECT_TRUE(TimeRead(WhatToRead::HEADERS_ONLY, - "Read disk cache headers only (cold)")); - EXPECT_TRUE(TimeRead(WhatToRead::HEADERS_ONLY, - "Read disk cache headers only (warm)")); + EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_ONLY, + "Read disk cache headers only (cold)")); + EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_ONLY, + "Read disk cache headers only (warm)")); disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); base::RunLoop().RunUntilIdle(); ResetAndEvictSystemDiskCache(); - EXPECT_TRUE( - TimeRead(WhatToRead::HEADERS_AND_BODY, "Read disk cache entries (cold)")); - EXPECT_TRUE( - TimeRead(WhatToRead::HEADERS_AND_BODY, "Read disk cache entries (warm)")); + EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_AND_BODY, + "Read disk cache entries (cold)")); + EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_AND_BODY, + "Read disk cache entries (warm)")); disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); base::RunLoop().RunUntilIdle();
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 727dbb8f..b5483cf 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc
@@ -117,7 +117,7 @@ cache_impl_->ClearRefCountForTest(); cache_.reset(); - EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_)); + EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, size_, mask_)); CreateBackend(disk_cache::kNoRandom); } @@ -287,7 +287,7 @@ cache_.reset(); if (!memory_only_ && !simple_cache_mode_ && integrity_) { - EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_)); + EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, size_, mask_)); } scoped_task_env_->RunUntilIdle(); if (simple_cache_mode_ && simple_file_tracker_)
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h index cfa463c..b70ee389 100644 --- a/net/disk_cache/disk_cache_test_base.h +++ b/net/disk_cache/disk_cache_test_base.h
@@ -108,6 +108,9 @@ void SetMaxSize(int size); + // Returns value last given to SetMaxSize (or 0). + int MaxSize() const { return size_; } + // Deletes and re-creates the files on initialization errors. void SetForceCreation() { force_creation_ = true;
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index 69314c5..7382adaa 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc
@@ -61,9 +61,12 @@ bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, + int max_size, uint32_t mask) { std::unique_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( path, mask, base::ThreadTaskRunnerHandle::Get(), NULL)); + if (max_size) + cache->SetMaxSize(max_size); if (!cache.get()) return false; if (new_eviction)
diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h index 2f59a46..02dd6f4 100644 --- a/net/disk_cache/disk_cache_test_util.h +++ b/net/disk_cache/disk_cache_test_util.h
@@ -29,9 +29,11 @@ // Generates a random key of up to 200 bytes. std::string GenerateKey(bool same_length); -// Returns true if the cache is not corrupt. +// Returns true if the cache is not corrupt. Assumes blockfile cache. +// |max_size|, if non-zero, will be set as its size. bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, + int max_size, uint32_t mask); // -----------------------------------------------------------------------
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index cb75df0..53c2c42 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc
@@ -125,6 +125,8 @@ quic_migrate_sessions_early(false), quic_migrate_sessions_on_network_change_v2(false), quic_migrate_sessions_early_v2(false), + quic_max_time_on_non_default_network( + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs)), quic_allow_server_migration(false), quic_allow_remote_alt_svc(false), quic_disable_bidirectional_streams(false), @@ -206,6 +208,7 @@ params.quic_migrate_sessions_early, params.quic_migrate_sessions_on_network_change_v2, params.quic_migrate_sessions_early_v2, + params.quic_max_time_on_non_default_network, params.quic_allow_server_migration, params.quic_race_cert_verification, params.quic_estimate_initial_rtt, @@ -361,6 +364,8 @@ params_.quic_migrate_sessions_on_network_change_v2); dict->SetBoolean("migrate_sessions_early_v2", params_.quic_migrate_sessions_early_v2); + dict->SetInteger("max_time_on_non_default_network_seconds", + params_.quic_max_time_on_non_default_network.InSeconds()); dict->SetBoolean("allow_server_migration", params_.quic_allow_server_migration); dict->SetBoolean("estimate_initial_rtt", params_.quic_estimate_initial_rtt);
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 59d1949..a00cf40 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h
@@ -175,6 +175,9 @@ // If true, connection migration v2 may be used to migrate active QUIC // sessions to alternative network if current network connectivity is poor. bool quic_migrate_sessions_early_v2; + // Maximum time the session could be on non-default network before migrates + // back to default network. Defaults to kMaxTimeOnNonDefaultNetwork. + base::TimeDelta quic_max_time_on_non_default_network; // If true, allows migration of QUIC connections to a server-specified // alternate server address. bool quic_allow_server_migration;
diff --git a/net/http/http_proxy_client_socket_wrapper_unittest.cc b/net/http/http_proxy_client_socket_wrapper_unittest.cc index 5c893ca..dbb78d5 100644 --- a/net/http/http_proxy_client_socket_wrapper_unittest.cc +++ b/net/http/http_proxy_client_socket_wrapper_unittest.cc
@@ -125,6 +125,7 @@ /*connect_using_default_network=*/true, migrate_sessions_on_network_change_, migrate_sessions_early_, migrate_sessions_on_network_change_v2_, migrate_sessions_early_v2_, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), allow_server_migration_, race_cert_verification_, estimate_initial_rtt_, connection_options_, client_connection_options_, /*enable_token_binding=*/false));
diff --git a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc index 1ec9ce0..d694f59 100644 --- a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
@@ -491,6 +491,7 @@ /*migrate_session_on_network_change*/ false, /*migrate_session_early*/ false, /*migrate_session_on_network_change_v2*/ false, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), kQuicYieldAfterPacketsRead, QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
diff --git a/net/quic/chromium/quic_chromium_client_session.cc b/net/quic/chromium/quic_chromium_client_session.cc index 4c2d22d6..c3b8cf6 100644 --- a/net/quic/chromium/quic_chromium_client_session.cc +++ b/net/quic/chromium/quic_chromium_client_session.cc
@@ -66,9 +66,6 @@ // migrating sessions need to wait for a new network to connect. const size_t kWaitTimeForNewNetworkSecs = 10; -// With exponential backoff, altogether we allow using non-default network -// for up to 255 seconds before close the session. -const int kMaxRetryCount = 7; const size_t kMinRetryTimeForDefaultNetworkSecs = 1; // Maximum RTT time for this session when set initial timeout for probing @@ -661,6 +658,7 @@ bool migrate_sessions_on_network_change, bool migrate_session_early_v2, bool migrate_sessions_on_network_change_v2, + base::TimeDelta max_time_on_non_default_network, int yield_after_packets, QuicTime::Delta yield_after_duration, int cert_verify_flags, @@ -682,6 +680,7 @@ migrate_session_early_v2_(migrate_session_early_v2), migrate_session_on_network_change_v2_( migrate_sessions_on_network_change_v2), + max_time_on_non_default_network_(max_time_on_non_default_network), clock_(clock), yield_after_packets_(yield_after_packets), yield_after_duration_(yield_after_duration), @@ -2135,13 +2134,14 @@ } void QuicChromiumClientSession::MaybeRetryMigrateBackToDefaultNetwork() { - if (retry_migrate_back_count_ > kMaxRetryCount) { + base::TimeDelta retry_migrate_back_timeout = + base::TimeDelta::FromSeconds(UINT64_C(1) << retry_migrate_back_count_); + if (retry_migrate_back_timeout > max_time_on_non_default_network_) { // Mark session as going away to accept no more streams. stream_factory_->OnSessionGoingAway(this); return; } - TryMigrateBackToDefaultNetwork( - base::TimeDelta::FromSeconds(UINT64_C(1) << retry_migrate_back_count_)); + TryMigrateBackToDefaultNetwork(retry_migrate_back_timeout); } bool QuicChromiumClientSession::ShouldMigrateSession(
diff --git a/net/quic/chromium/quic_chromium_client_session.h b/net/quic/chromium/quic_chromium_client_session.h index ec43184..f1b6d1e2 100644 --- a/net/quic/chromium/quic_chromium_client_session.h +++ b/net/quic/chromium/quic_chromium_client_session.h
@@ -332,6 +332,7 @@ bool migrate_session_on_network_change, bool migrate_sesion_early_v2, bool migrate_session_on_network_change_v2, + base::TimeDelta max_time_on_non_default_network, int yield_after_packets, QuicTime::Delta yield_after_duration, int cert_verify_flags, @@ -669,6 +670,7 @@ bool migrate_session_on_network_change_; bool migrate_session_early_v2_; bool migrate_session_on_network_change_v2_; + base::TimeDelta max_time_on_non_default_network_; QuicClock* clock_; // Unowned. int yield_after_packets_; QuicTime::Delta yield_after_duration_;
diff --git a/net/quic/chromium/quic_chromium_client_session_test.cc b/net/quic/chromium/quic_chromium_client_session_test.cc index 62b66c5..64c23972 100644 --- a/net/quic/chromium/quic_chromium_client_session_test.cc +++ b/net/quic/chromium/quic_chromium_client_session_test.cc
@@ -137,6 +137,7 @@ /*migrate_session_on_network_change*/ false, /*migrate_session_early_v2*/ false, /*migrate_session_on_network_change_v2*/ false, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), kQuicYieldAfterPacketsRead, QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
diff --git a/net/quic/chromium/quic_http_stream_test.cc b/net/quic/chromium/quic_http_stream_test.cc index 682444b..818023da 100644 --- a/net/quic/chromium/quic_http_stream_test.cc +++ b/net/quic/chromium/quic_http_stream_test.cc
@@ -306,6 +306,7 @@ /*migrate_session_on_network_change*/ false, /*migrate_session_early_v2*/ false, /*migrate_session_on_network_change_v2*/ false, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), kQuicYieldAfterPacketsRead, QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
diff --git a/net/quic/chromium/quic_proxy_client_socket_unittest.cc b/net/quic/chromium/quic_proxy_client_socket_unittest.cc index fa49500..73a23cf 100644 --- a/net/quic/chromium/quic_proxy_client_socket_unittest.cc +++ b/net/quic/chromium/quic_proxy_client_socket_unittest.cc
@@ -198,6 +198,7 @@ /*migrate_session_on_network_change*/ false, /*migrate_session_early_v2*/ false, /*migrate_session_on_network_change_v2*/ false, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), kQuicYieldAfterPacketsRead, QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc index 33e96c21..eb1efa7 100644 --- a/net/quic/chromium/quic_stream_factory.cc +++ b/net/quic/chromium/quic_stream_factory.cc
@@ -671,6 +671,7 @@ bool migrate_sessions_early, bool migrate_sessions_on_network_change_v2, bool migrate_sessions_early_v2, + base::TimeDelta max_time_on_non_default_network, bool allow_server_migration, bool race_cert_verification, bool estimate_initial_rtt, @@ -720,6 +721,7 @@ NetworkChangeNotifier::AreNetworkHandlesSupported()), migrate_sessions_early_v2_(migrate_sessions_early_v2 && migrate_sessions_on_network_change_v2_), + max_time_on_non_default_network_(max_time_on_non_default_network), migrate_sessions_on_network_change_( !migrate_sessions_on_network_change_v2_ && migrate_sessions_on_network_change && @@ -1437,11 +1439,12 @@ clock_, transport_security_state_, std::move(server_info), server_id, require_confirmation, migrate_sessions_early_, migrate_sessions_on_network_change_, migrate_sessions_early_v2_, - migrate_sessions_on_network_change_v2_, yield_after_packets_, - yield_after_duration_, cert_verify_flags, config, &crypto_config_, - network_connection_.connection_description(), dns_resolution_start_time, - dns_resolution_end_time, &push_promise_index_, push_delegate_, - task_runner_, std::move(socket_performance_watcher), net_log.net_log()); + migrate_sessions_on_network_change_v2_, max_time_on_non_default_network_, + yield_after_packets_, yield_after_duration_, cert_verify_flags, config, + &crypto_config_, network_connection_.connection_description(), + dns_resolution_start_time, dns_resolution_end_time, &push_promise_index_, + push_delegate_, task_runner_, std::move(socket_performance_watcher), + net_log.net_log()); all_sessions_[*session] = key; // owning pointer writer->set_delegate(*session);
diff --git a/net/quic/chromium/quic_stream_factory.h b/net/quic/chromium/quic_stream_factory.h index ae26f7f4..17677fe7 100644 --- a/net/quic/chromium/quic_stream_factory.h +++ b/net/quic/chromium/quic_stream_factory.h
@@ -211,6 +211,7 @@ bool migrate_sessions_early, bool migrate_sessions_on_network_change_v2, bool migrate_sessions_early_v2, + base::TimeDelta max_time_on_non_default_network, bool allow_server_migration, bool race_cert_verification, bool estimate_initial_rtt, @@ -506,6 +507,10 @@ // connection experiences poor connectivity. const bool migrate_sessions_early_v2_; + // Maximum time sessions could use on non-default network before try to + // migrate back to default network. + const base::TimeDelta max_time_on_non_default_network_; + // Set if migration should be attempted on active sessions when primary // interface changes. const bool migrate_sessions_on_network_change_;
diff --git a/net/quic/chromium/quic_stream_factory_fuzzer.cc b/net/quic/chromium/quic_stream_factory_fuzzer.cc index 1939324..049f12f 100644 --- a/net/quic/chromium/quic_stream_factory_fuzzer.cc +++ b/net/quic/chromium/quic_stream_factory_fuzzer.cc
@@ -143,9 +143,11 @@ kMaxTimeForCryptoHandshakeSecs, kInitialIdleTimeoutSecs, connect_using_default_network, migrate_sessions_on_network_change, migrate_sessions_early, migrate_sessions_on_network_change_v2, - migrate_sessions_early_v2, allow_server_migration, - race_cert_verification, estimate_initial_rtt, env->connection_options, - env->client_connection_options, enable_token_binding); + migrate_sessions_early_v2, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), + allow_server_migration, race_cert_verification, estimate_initial_rtt, + env->connection_options, env->client_connection_options, + enable_token_binding); QuicStreamRequest request(factory.get()); TestCompletionCallback callback;
diff --git a/net/quic/chromium/quic_stream_factory_test.cc b/net/quic/chromium/quic_stream_factory_test.cc index 7f484e2..cbad9d6 100644 --- a/net/quic/chromium/quic_stream_factory_test.cc +++ b/net/quic/chromium/quic_stream_factory_test.cc
@@ -256,6 +256,7 @@ /*connect_using_default_network*/ true, migrate_sessions_on_network_change_, migrate_sessions_early_, migrate_sessions_on_network_change_v2_, migrate_sessions_early_v2_, + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), allow_server_migration_, race_cert_verification_, estimate_initial_rtt_, connection_options_, client_connection_options_, /*enable_token_binding*/ false));
diff --git a/net/quic/core/quic_constants.h b/net/quic/core/quic_constants.h index 80c4868f..395248fd 100644 --- a/net/quic/core/quic_constants.h +++ b/net/quic/core/quic_constants.h
@@ -113,6 +113,10 @@ // The default timeout for a connection until the crypto handshake succeeds. const int64_t kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs. +// The default maximum time QUIC session could be on non-default network before +// migrate back to default network. +const int64_t kMaxTimeOnNonDefaultNetworkSecs = 128; + // Default limit on the number of undecryptable packets the connection buffers // before the CHLO/SHLO arrive. const size_t kDefaultMaxUndecryptablePackets = 10;
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index f8965b3..a4cec450 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -852,18 +852,12 @@ } switch (ssl_config_.tls13_variant) { - case kTLS13VariantDraft: - SSL_set_tls13_variant(ssl_.get(), tls13_default); - break; - case kTLS13VariantExperiment: - SSL_set_tls13_variant(ssl_.get(), tls13_experiment); + case kTLS13VariantDraft22: + SSL_set_tls13_variant(ssl_.get(), tls13_draft22); break; case kTLS13VariantExperiment2: SSL_set_tls13_variant(ssl_.get(), tls13_experiment2); break; - case kTLS13VariantExperiment3: - SSL_set_tls13_variant(ssl_.get(), tls13_experiment3); - break; } // OpenSSL defaults some options to on, others to off. To avoid ambiguity,
diff --git a/net/ssl/ssl_config.cc b/net/ssl/ssl_config.cc index a460ebe..23b140c5 100644 --- a/net/ssl/ssl_config.cc +++ b/net/ssl/ssl_config.cc
@@ -12,7 +12,7 @@ const uint16_t kDefaultSSLVersionMax = SSL_PROTOCOL_VERSION_TLS1_2; -const TLS13Variant kDefaultTLS13Variant = kTLS13VariantDraft; +const TLS13Variant kDefaultTLS13Variant = kTLS13VariantDraft22; SSLConfig::CertAndStatus::CertAndStatus() = default; SSLConfig::CertAndStatus::CertAndStatus(scoped_refptr<X509Certificate> cert_arg,
diff --git a/net/ssl/ssl_config.h b/net/ssl/ssl_config.h index cf6c693..1cef729 100644 --- a/net/ssl/ssl_config.h +++ b/net/ssl/ssl_config.h
@@ -36,10 +36,8 @@ }; enum TLS13Variant { - kTLS13VariantDraft, - kTLS13VariantExperiment, kTLS13VariantExperiment2, - kTLS13VariantExperiment3, + kTLS13VariantDraft22, }; // Default minimum protocol version.
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 651eb57..3b5123e 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -4428,25 +4428,26 @@ ], "name": "viz_content_browsertests", "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true, + "shards": 2 }, "test": "content_browsertests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "media_service_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "services_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "views_mus_interactive_ui_tests" }
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 329e3c1..1abe673 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -1138,7 +1138,6 @@ 'test_suites': { 'gtest_tests': 'mojo_windows_gtests', }, - 'use_swarming': False, }, 'Out of Process Profiling Android': { 'swarming': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 7a56a3c4..aed988c 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1535,9 +1535,6 @@ "experiments": [ { "name": "Enabled", - "params": { - "engagement_threshold_for_flash": "101" - }, "enable_features": [ "PreferHtmlOverPlugins" ] @@ -3622,27 +3619,15 @@ ], "experiments": [ { - "name": "Experiment2V2", + "name": "Experiment2V3", "params": { "variant": "experiment2" } }, { - "name": "ExperimentV2", + "name": "Draft22V3", "params": { - "variant": "experiment" - } - }, - { - "name": "Draft", - "params": { - "variant": "draft" - } - }, - { - "name": "Experiment3V2", - "params": { - "variant": "experiment3" + "variant": "draft22" } } ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 49c7cb46..82630fd 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1865,8 +1865,6 @@ # were matched on pass/fail but not exact error messages. crbug.com/626703 external/wpt/resource-timing/resource_TAO_space.htm [ Pass Failure ] -crbug.com/698077 http/tests/devtools/sources/debugger/debug-inlined-scripts.js [ NeedsManualRebaseline ] - # Working on getting the CSP tests going: crbug.com/694525 external/wpt/content-security-policy/object-src [ Skip ] crbug.com/694525 external/wpt/content-security-policy/reporting [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/compositing/geometry/clipped-video-controller.html b/third_party/WebKit/LayoutTests/compositing/geometry/clipped-video-controller.html index f0909ef..5d11cbf 100644 --- a/third_party/WebKit/LayoutTests/compositing/geometry/clipped-video-controller.html +++ b/third_party/WebKit/LayoutTests/compositing/geometry/clipped-video-controller.html
@@ -3,7 +3,7 @@ <html> <head> <style> - + #box { position: absolute; top: 50px; @@ -13,15 +13,14 @@ overflow: hidden; border: 10px solid green; } - + </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> <script type="text/javascript" charset="utf-8"> if (window.testRunner) testRunner.dumpAsText(); - + function testDone() { if (window.testRunner) @@ -31,7 +30,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, '../resources/video', testDone); + setupVideo(video, '../resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/geometry/video-fixed-scrolling.html b/third_party/WebKit/LayoutTests/compositing/geometry/video-fixed-scrolling.html index 521430ab..72ff181 100644 --- a/third_party/WebKit/LayoutTests/compositing/geometry/video-fixed-scrolling.html +++ b/third_party/WebKit/LayoutTests/compositing/geometry/video-fixed-scrolling.html
@@ -8,13 +8,13 @@ body { height: 1000px; } - + video { margin-top: 80px; width: 400px; height: 300px; } - + #fixed-bar { position: fixed; left: 0; @@ -25,8 +25,7 @@ } </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> - <script type="text/javascript" charset="utf-8"> + <script type="text/javascript" charset="utf-8"> function testDone() { window.scrollBy(50, 50); @@ -37,7 +36,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, '../resources/video', testDone); + setupVideo(video, '../resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/geometry/video-opacity-overlay.html b/third_party/WebKit/LayoutTests/compositing/geometry/video-opacity-overlay.html index 4a5d6fc..5259b28 100644 --- a/third_party/WebKit/LayoutTests/compositing/geometry/video-opacity-overlay.html +++ b/third_party/WebKit/LayoutTests/compositing/geometry/video-opacity-overlay.html
@@ -6,21 +6,21 @@ width: 100%; height: 100%; } - + .container { position: relative; width: 400px; height: 300px; border: 1px solid black; } - + .controls { opacity: 0.8; height: 10px; width: 10px; background-color: green; } - + #control-bar { position: absolute; left: 0; @@ -31,8 +31,7 @@ } </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> - <script type="text/javascript" charset="utf-8"> + <script type="text/javascript" charset="utf-8"> function testDone() { if (window.testRunner) @@ -42,7 +41,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, '../resources/video', testDone); + setupVideo(video, '../resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/layers-inside-overflow-scroll.html b/third_party/WebKit/LayoutTests/compositing/layers-inside-overflow-scroll.html index 0c8cbca..16191b6 100644 --- a/third_party/WebKit/LayoutTests/compositing/layers-inside-overflow-scroll.html +++ b/third_party/WebKit/LayoutTests/compositing/layers-inside-overflow-scroll.html
@@ -10,7 +10,7 @@ margin: 10px; border: 1px solid black; } - + #details { width: 300px; height: 150px; @@ -25,7 +25,7 @@ font-size: 24pt; line-height: 150%; } - + .compositing { height: 100px; width: 100px; @@ -34,7 +34,6 @@ } </style> <script src="resources/media-testing.js"></script> - <script src="../media/media-file.js"></script> <script type="text/javascript" charset="utf-8"> function testDone() @@ -47,7 +46,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, 'resources/video', testDone); + setupVideo(video, 'resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-ancestor-update.html b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-ancestor-update.html index 33128f0..8f3f1dd 100644 --- a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-ancestor-update.html +++ b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-ancestor-update.html
@@ -3,7 +3,7 @@ <html> <head> <style type="text/css" media="screen"> - + body { margin: 0; } @@ -12,7 +12,7 @@ width: 100px; height: 100px; } - + .container { position: absolute; top: 50px; @@ -20,18 +20,18 @@ height: 200px; width: 200px; } - + #scroller { overflow-y: scroll; height: 200px; width: 200px; border: 1px solid black; } - + .content { height: 500px; } - + .box { height: 100px; width: 100px; @@ -42,7 +42,7 @@ margin-top: 50px; background-color: green; } - + .indicator { position: absolute; left: 50px; @@ -52,8 +52,7 @@ </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> - <script type="text/javascript" charset="utf-8"> + <script type="text/javascript" charset="utf-8"> function testDone() { document.getElementById('scroller').scrollTop = 50; @@ -64,12 +63,12 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, '../resources/video', testDone); + setupVideo(video, '../resources/video.ogv', testDone); } </script> </head> <body onload="doTest()"> - + <div class="indicator box"></div> <div class="container"> @@ -80,7 +79,7 @@ </div> <p>The green box should obscure the red box, and move when you drag the scrollbar.</p> </div> - + <video></video> </body>
diff --git a/third_party/WebKit/LayoutTests/compositing/reflections/load-video-in-reflection.html b/third_party/WebKit/LayoutTests/compositing/reflections/load-video-in-reflection.html index 14e7293..b116503 100644 --- a/third_party/WebKit/LayoutTests/compositing/reflections/load-video-in-reflection.html +++ b/third_party/WebKit/LayoutTests/compositing/reflections/load-video-in-reflection.html
@@ -8,7 +8,7 @@ width: 300px; -webkit-animation: spin 18s infinite linear; } - + video { -webkit-box-reflect: below; background-color: red; @@ -21,8 +21,7 @@ </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> - <script type="text/javascript" charset="utf-8"> + <script type="text/javascript" charset="utf-8"> function testDone() { if (window.testRunner) @@ -32,7 +31,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, '../resources/video', testDone); + setupVideo(video, '../resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/resources/media-testing.js b/third_party/WebKit/LayoutTests/compositing/resources/media-testing.js index ace3320b..9700ddc1 100644 --- a/third_party/WebKit/LayoutTests/compositing/resources/media-testing.js +++ b/third_party/WebKit/LayoutTests/compositing/resources/media-testing.js
@@ -4,7 +4,6 @@ function setupVideo(videoElement, videoPath, canPlayThroughCallback) { - var mediaFile = findMediaFile("video", videoPath); videoElement.addEventListener("canplaythrough", canPlayThroughCallback); - videoElement.src = mediaFile; + videoElement.src = videoPath; }
diff --git a/third_party/WebKit/LayoutTests/compositing/self-painting-layers.html b/third_party/WebKit/LayoutTests/compositing/self-painting-layers.html index f4b4fd57..8d92a70c 100644 --- a/third_party/WebKit/LayoutTests/compositing/self-painting-layers.html +++ b/third_party/WebKit/LayoutTests/compositing/self-painting-layers.html
@@ -10,7 +10,7 @@ margin: 10px; border: 1px solid black; } - + #details { width: 300px; height: 150px; @@ -28,7 +28,6 @@ </style> <script src="resources/media-testing.js"></script> - <script src="../media/media-file.js"></script> <script type="text/javascript" charset="utf-8"> function testDone() @@ -41,7 +40,7 @@ function doTest() { var video = document.getElementsByTagName('video')[0]; - setupVideo(video, 'resources/video', testDone); + setupVideo(video, 'resources/video.ogv', testDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/compositing/video/video-reflection.html b/third_party/WebKit/LayoutTests/compositing/video/video-reflection.html index 3312ea4..317db2b 100644 --- a/third_party/WebKit/LayoutTests/compositing/video/video-reflection.html +++ b/third_party/WebKit/LayoutTests/compositing/video/video-reflection.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <title>Test "-webkit-box-reflect" property on a video element.</title> <script src="../../resources/run-after-layout-and-paint.js"></script> -<script src="../../media/media-file.js"></script> <style> video { -webkit-box-reflect: below 0px; @@ -19,6 +18,6 @@ runAfterLayoutAndPaint(function() {}, true); }; -video.src = findMediaFile('video', '../../media/content/test'); +video.src = '../../media/content/test.ogv'; video.currentTime = 1; </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/compositing/visibility/visibility-simple-video-layer.html b/third_party/WebKit/LayoutTests/compositing/visibility/visibility-simple-video-layer.html index 42d13f11..f7e7dbd 100644 --- a/third_party/WebKit/LayoutTests/compositing/visibility/visibility-simple-video-layer.html +++ b/third_party/WebKit/LayoutTests/compositing/visibility/visibility-simple-video-layer.html
@@ -29,8 +29,7 @@ </style> <script src="../resources/media-testing.js"></script> - <script src="../../media/media-file.js"></script> - <script type="text/javascript" charset="utf-8"> + <script type="text/javascript" charset="utf-8"> if (window.testRunner) testRunner.dumpAsTextWithPixelResults(); @@ -43,9 +42,9 @@ function doTest() { - setupVideo(document.getElementsByTagName('video')[0], '../resources/video', notifyVideoDone); - setupVideo(document.getElementsByTagName('video')[1], '../resources/video', notifyVideoDone); - setupVideo(document.getElementsByTagName('video')[2], '../resources/video', notifyVideoDone); + setupVideo(document.getElementsByTagName('video')[0], '../resources/video.ogv', notifyVideoDone); + setupVideo(document.getElementsByTagName('video')[1], '../resources/video.ogv', notifyVideoDone); + setupVideo(document.getElementsByTagName('video')[2], '../resources/video.ogv', notifyVideoDone); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt index 5096c82b..5437203 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt
@@ -1,10 +1,10 @@ This is a testharness.js-based test. -Found 59 tests; 46 PASS, 13 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 59 tests; 54 PASS, 5 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS utility code PASS application/octet-stream PASS video/x-new-fictional-format -FAIL audio/mp4 (optional) assert_equals: audio/mp4 expected "maybe" but got "" -FAIL audio/mp4; codecs="mp4a.40.2" (optional) assert_equals: audio/mp4; codecs="mp4a.40.2" expected "probably" but got "" +PASS audio/mp4 (optional) +PASS audio/mp4; codecs="mp4a.40.2" (optional) PASS audio/mp4 with bogus codec PASS audio/mp4 with and without codecs PASS audio/ogg (optional) @@ -28,12 +28,12 @@ PASS video/3gpp codecs order PASS video/3gpp with bogus codec PASS video/3gpp with and without codecs -FAIL video/mp4 (optional) assert_equals: video/mp4 expected "maybe" but got "" -FAIL video/mp4; codecs="mp4a.40.2" (optional) assert_equals: video/mp4; codecs="mp4a.40.2" expected "probably" but got "" -FAIL video/mp4; codecs="avc1.42E01E" (optional) assert_equals: video/mp4; codecs="avc1.42E01E" expected "probably" but got "" -FAIL video/mp4; codecs="avc1.4D401E" (optional) assert_equals: video/mp4; codecs="avc1.4D401E" expected "probably" but got "" -FAIL video/mp4; codecs="avc1.58A01E" (optional) assert_equals: video/mp4; codecs="avc1.58A01E" expected "probably" but got "" -FAIL video/mp4; codecs="avc1.64001E" (optional) assert_equals: video/mp4; codecs="avc1.64001E" expected "probably" but got "" +PASS video/mp4 (optional) +PASS video/mp4; codecs="mp4a.40.2" (optional) +PASS video/mp4; codecs="avc1.42E01E" (optional) +PASS video/mp4; codecs="avc1.4D401E" (optional) +PASS video/mp4; codecs="avc1.58A01E" (optional) +PASS video/mp4; codecs="avc1.64001E" (optional) FAIL video/mp4; codecs="mp4v.20.8" (optional) assert_equals: video/mp4; codecs="mp4v.20.8" expected "probably" but got "" FAIL video/mp4; codecs="mp4v.20.240" (optional) assert_equals: video/mp4; codecs="mp4v.20.240" expected "probably" but got "" PASS video/mp4 codecs subset
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-expected.txt index ecaf93e..8df4efd 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-expected.txt
@@ -7,8 +7,8 @@ PASS Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers PASS Test addSourceBuffer() video only PASS Test addSourceBuffer() audio only -FAIL Test addSourceBuffer() with AAC and H.264 assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported expected true got false -FAIL Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers assert_true: video/mp4;codecs="avc1.4D4001" is supported expected true got false +PASS Test addSourceBuffer() with AAC and H.264 +PASS Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers FAIL Test addSourceBuffer() QuotaExceededError. assert_true: Reached SourceBuffer limit. expected true got false Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-mode-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-mode-expected.txt index 8768da7..3b81c8dd 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-mode-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-addsourcebuffer-mode-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. PASS addSourceBuffer() sets SourceBuffer.mode to 'segments' when the generate timestamps flag is false -FAIL addSourceBuffer() sets SourceBuffer.mode to 'sequence' when the generate timestamps flag is true assert_unreached: Browser does not support the audio/aac and audio/mpeg MIME types used in this test Reached unreachable code +FAIL addSourceBuffer() sets SourceBuffer.mode to 'sequence' when the generate timestamps flag is true assert_equals: expected "sequence" but got "segments" Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-buffered-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-buffered-expected.txt index 28ae3356..08389f9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-buffered-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-buffered-expected.txt
@@ -1,7 +1,7 @@ This is a testharness.js-based test. -FAIL Demuxed content with different lengths assert_equals: mediaSource.activeSourceBuffers[0] expected "{ [0.000, 2.023) }" but got "{ [0.000, 2.022) }" -FAIL Muxed content with different lengths assert_equals: mediaSource.activeSourceBuffers[0] expected "{ [0.003, 2.004) }" but got "{ [0.000, 2.003) }" -FAIL Demuxed content with an empty buffered range on one SourceBuffer assert_equals: mediaSource.activeSourceBuffers[0] expected "{ [0.000, 2.023) }" but got "{ [0.000, 2.022) }" +FAIL Demuxed content with different lengths assert_equals: mediaSource.activeSourceBuffers[1] expected "{ [0.067, 2.067) }" but got "{ [0.000, 2.000) }" +FAIL Muxed content with different lengths assert_equals: mediaSource.activeSourceBuffers[0] expected "{ [0.067, 2.043) }" but got "{ [0.000, 2.000) }" +PASS Demuxed content with an empty buffered range on one SourceBuffer PASS Muxed content empty buffered ranges. PASS Get buffered range when sourcebuffer is empty. PASS Get buffered range when only init segment is appended.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt deleted file mode 100644 index fa56a24..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 audio-only bitrate changes. assert_true: audio/mp4;codecs="mp4a.40.2" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt deleted file mode 100644 index 2b7793b3..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 audio bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-framesize-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-framesize-expected.txt deleted file mode 100644 index 3e82c6e..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-framesize-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 frame size changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt deleted file mode 100644 index 8efe81a..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 video bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt deleted file mode 100644 index 8f53878c6..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 video-only bitrate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framerate-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framerate-expected.txt deleted file mode 100644 index 61e3e73..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framerate-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 video-only frame rate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framesize-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framesize-expected.txt deleted file mode 100644 index 9f613a78..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-config-change-mp4-v-framesize-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Tests mp4 video-only frame size changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream-expected.txt index f5c8646f..3e32022 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. FAIL MediaSource.endOfStream(): duration truncated to 0 when there are no buffered coded frames assert_equals: expected 0 but got 2 PASS MediaSource.endOfStream(): media element notified that it now has all of the media data -PASS MediaSource.endOfStream(): duration and buffered range end time before and after endOfStream +FAIL MediaSource.endOfStream(): duration and buffered range end time before and after endOfStream assert_equals: SegmentInfo duration should still roughly match mediaSource duration expected 6.548 but got 6.549 Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream.html b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream.html index bca80af8..5b6114fa 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream.html +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-endofstream.html
@@ -52,7 +52,8 @@ // Note that segmentInfo.duration is expected to also be the // highest track buffer range end time. Therefore, endOfStream() should // not change duration with this media. - assert_equals(threeDecimalPlaces(segmentInfo.duration), threeDecimalPlaces(mediaSource.duration)); + assert_equals(threeDecimalPlaces(segmentInfo.duration), threeDecimalPlaces(mediaSource.duration), + 'SegmentInfo duration should initially roughly match mediaSource duration'); assert_less_than_equal(highestEndTime, mediaSource.duration, 'Media duration may be slightly longer than intersected track buffered ranges'); @@ -64,7 +65,8 @@ assert_equals(sourceBuffer.buffered.length, 1, 'Media data properly buffered after endOfStream'); - assert_equals(threeDecimalPlaces(segmentInfo.duration), threeDecimalPlaces(mediaSource.duration)); + assert_equals(threeDecimalPlaces(segmentInfo.duration), threeDecimalPlaces(mediaSource.duration), + 'SegmentInfo duration should still roughly match mediaSource duration'); assert_less_than_equal(highestEndTime, mediaSource.duration, 'Media duration may be slightly longer than intersected track buffered ranges'); assert_equals(sourceBuffer.buffered.end(0), mediaSource.duration,
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-is-type-supported-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-is-type-supported-expected.txt deleted file mode 100644 index 98a290e..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-is-type-supported-expected.txt +++ /dev/null
@@ -1,43 +0,0 @@ -This is a testharness.js-based test. -PASS Test invalid MIME format "video" -PASS Test invalid MIME format "video/" -PASS Test invalid MIME format "video/webm" -PASS Test invalid MIME format "video/webm;" -PASS Test invalid MIME format "video/webm;codecs" -PASS Test invalid MIME format "video/webm;codecs=" -PASS Test invalid MIME format "video/webm;codecs="" -PASS Test invalid MIME format "video/webm;codecs=""" -PASS Test invalid MIME format "video/webm;codecs=","" -PASS Test invalid MIME format "" -PASS Test invalid MIME format "null" -PASS Test invalid MSE MIME media type "xxx" -PASS Test invalid MSE MIME media type "text/html" -PASS Test invalid MSE MIME media type "image/jpeg" -PASS Test invalid mismatch between major type and codec ID "audio/webm;codecs="vp8"" -PASS Test invalid mismatch between major type and codec ID "audio/mp4;codecs="avc1.4d001e"" -PASS Test invalid mismatch between minor type and codec ID "audio/mp4;codecs="vorbis"" -PASS Test invalid mismatch between minor type and codec ID "audio/webm;codecs="mp4a.40.2"" -PASS Test invalid mismatch between minor type and codec ID "video/mp4;codecs="vp8"" -PASS Test invalid mismatch between minor type and codec ID "video/webm;codecs="mp4a.40.2"" -PASS Test invalid mismatch between minor type and codec ID "video/mp4;codecs="vorbis"" -PASS Test invalid codec ID "audio/mp4;codecs="mp4a"" -PASS Test invalid codec ID "audio/mp4;codecs="mp4a.40"" -PASS Test invalid codec ID "audio/mp4;codecs="mp4a.40."" -PASS Test invalid codec ID "audio/mp4;codecs="mp4a.67.3"" -PASS Test valid WebM type "video/webm;codecs="vp8"" -PASS Test valid WebM type "video/webm;codecs="vorbis"" -PASS Test valid WebM type "video/webm;codecs="vp8,vorbis"" -PASS Test valid WebM type "video/webm;codecs="vorbis, vp8"" -PASS Test valid WebM type "audio/webm;codecs="vorbis"" -PASS Test valid WebM type "AUDIO/WEBM;CODECS="vorbis"" -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.42001e"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.40.5"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.67"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e "" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.5"" assert_equals: supported expected true but got false -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sequencemode-append-buffer-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sequencemode-append-buffer-expected.txt index 2a09f25..349102a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sequencemode-append-buffer-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sequencemode-append-buffer-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. -FAIL Test sequence AppendMode appendBuffer(first media segment) assert_equals: sourceBuffer.buffered range begins where expected before EOS expected 0.112 but got 0 -FAIL Test sequence AppendMode appendBuffer(second media segment) assert_equals: sourceBuffer.buffered range begins where expected before EOS expected 0.001 but got 0 -FAIL Test sequence AppendMode appendBuffer(second media segment, then first media segment) assert_equals: expectedTimestampOffset expected 0.802 but got 0.801 +FAIL Test sequence AppendMode appendBuffer(first media segment) assert_equals: sourceBuffer.buffered range begins where expected before EOS expected 0.095 but got 0 +FAIL Test sequence AppendMode appendBuffer(second media segment) assert_equals: Event types match. expected "update" but got "updateend" +FAIL Test sequence AppendMode appendBuffer(second media segment, then first media segment) assert_equals: Event types match. expected "update" but got "updateend" Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sourcebuffer-mode-timestamps-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sourcebuffer-mode-timestamps-expected.txt index 420841f2..738b6287 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sourcebuffer-mode-timestamps-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/mediasource-sourcebuffer-mode-timestamps-expected.txt
@@ -1,5 +1,9 @@ This is a testharness.js-based test. -FAIL audio/aac : If generate timestamps flag equals true and new mode equals "segments", then throw a TypeError exception and abort these steps. assert_unreached: Browser doesn't support the MIME used in this test: audio/aac Reached unreachable code -FAIL audio/mpeg : If generate timestamps flag equals true and new mode equals "segments", then throw a TypeError exception and abort these steps. assert_unreached: Browser doesn't support the MIME used in this test: audio/mpeg Reached unreachable code +FAIL audio/aac : If generate timestamps flag equals true and new mode equals "segments", then throw a TypeError exception and abort these steps. assert_throws: SourceBuffer#mode with generate timestamps flag true function "function () { + sourceBuffer.mode = "segments"; + }" did not throw +FAIL audio/mpeg : If generate timestamps flag equals true and new mode equals "segments", then throw a TypeError exception and abort these steps. assert_throws: SourceBuffer#mode with generate timestamps flag true function "function () { + sourceBuffer.mode = "segments"; + }" did not throw Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video-shadow.html index 04b3a17..b54321c 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video-shadow.html
@@ -22,8 +22,8 @@ <div><table id='outputtable'></table></div> <div>Test Video</div> <div><video id="video"> - <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.webm" type='video/webm' /> + <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.ogv" type='video/ogg' /> </video></div> <script type="application/x-javascript">
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video.html index 6f63ed1..73b6e4af 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-composite-video.html
@@ -22,8 +22,8 @@ <div><table id='outputtable'></table></div> <div>Test Video</div> <div><video id="video"> - <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.webm" type='video/webm' /> + <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.ogv" type='video/ogg' /> </video></div> <script type="application/x-javascript">
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video.html index b90614ab..480496e0 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video.html
@@ -10,8 +10,8 @@ <body> <canvas id="canvas"></canvas> <video id="video"> - <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.webm" type='video/webm' /> + <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.ogv" type='video/ogg' /> </video> <script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-video.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-video.html index 293dd460..f26f242 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-video.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-video.html
@@ -10,8 +10,8 @@ <body> <canvas id="canvas"></canvas> <video id="video"> - <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.webm" type='video/webm' /> + <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.ogv" type='video/ogg' /> </video> <script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html index 03b9993..493ad00 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html
@@ -26,8 +26,8 @@ <canvas id="hw-canvas" width=300 height=300></canvas> <canvas id="sw-canvas" width=150 height=150></canvas> <video id="video" loop> - <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.webm" type='video/webm' /> + <source src="resources/canvas_video.mp4" type='video/mp4' /> <source src="resources/canvas_video.ogv" type='video/ogg' /> </video> <script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document.html b/third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document.html index 76d1c38..40b82d0 100644 --- a/third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document.html +++ b/third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document.html
@@ -2,12 +2,11 @@ <title>This tests that media element in a standalone media document cannot be focused directly using focus() method or by mouse click.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../../media/media-file.js"></script> <iframe width="380" height="330"></iframe> <script> async_test(function(t) { var iframe = document.querySelector("iframe"); - iframe.src = "../../media/" + findMediaFile("video", "content/test"); + iframe.src = "../../media/" + "content/test.ogv"; iframe.onload = t.step_func(function() { var standaloneMediaDocument = iframe.contentDocument;
diff --git a/third_party/WebKit/LayoutTests/fast/overflow/overflow-of-video-outline.html b/third_party/WebKit/LayoutTests/fast/overflow/overflow-of-video-outline.html index 8d66d5c..c30c719a 100644 --- a/third_party/WebKit/LayoutTests/fast/overflow/overflow-of-video-outline.html +++ b/third_party/WebKit/LayoutTests/fast/overflow/overflow-of-video-outline.html
@@ -2,7 +2,6 @@ <head> </head> <script src="../../media/media-controls.js"></script> -<script src="../../media/media-file.js"></script> <video id=video controls width=400> </video>
diff --git a/third_party/WebKit/LayoutTests/fast/webgl/canvas-toDataURL-crash.html b/third_party/WebKit/LayoutTests/fast/webgl/canvas-toDataURL-crash.html new file mode 100644 index 0000000..ccd7e73 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/webgl/canvas-toDataURL-crash.html
@@ -0,0 +1,23 @@ +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> + +<canvas><canvas id="canvas_premul"></canvas> +<canvas><canvas id="canvas_unpremul"></canvas> +<script> +// Premul code path +test(function() { + gl = canvas_premul.getContext("webgl"); + gl.canvas.width += 65536; + gl.canvas.height += 65536; + gl.canvas.toDataURL(); +}, "canvas.toDataURL() should not crash on a big premul canvas."); + +// Unpremul code path +test(function() { + var attributes = {premultipliedAlpha: false}; + gl = canvas_unpremul.getContext("webgl", attributes); + gl.canvas.width += 65536; + gl.canvas.height += 65536; + gl.canvas.toDataURL(); +}, "canvas.toDataURL() should not crash on a big unpremul canvas."); +</script>
diff --git a/third_party/WebKit/LayoutTests/fullscreen/resources/video.html b/third_party/WebKit/LayoutTests/fullscreen/resources/video.html index aba93ee2..4d9febe 100644 --- a/third_party/WebKit/LayoutTests/fullscreen/resources/video.html +++ b/third_party/WebKit/LayoutTests/fullscreen/resources/video.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> -<script src="../../media/media-file.js"></script> <script> function canplaythrough() { parent.postMessage("Video loaded", "*"); @@ -11,7 +10,7 @@ onload = function() { var video = document.getElementById('video'); - var mediaFile = findMediaFile("video", "../../media/content/test"); + var mediaFile = "../../media/content/test.ogv"; video.src = mediaFile; video.addEventListener('canplaythrough', canplaythrough); video.addEventListener('webkitfullscreenchange', fullscreenChanged);
diff --git a/third_party/WebKit/LayoutTests/fullscreen/video-controls-timeline.html b/third_party/WebKit/LayoutTests/fullscreen/video-controls-timeline.html index ee23de3..16da8863 100644 --- a/third_party/WebKit/LayoutTests/fullscreen/video-controls-timeline.html +++ b/third_party/WebKit/LayoutTests/fullscreen/video-controls-timeline.html
@@ -7,8 +7,7 @@ </script> <script src="full-screen-test.js"></script> <script src="../media/media-controls.js"></script> - <script src="../media/media-file.js"></script> - <script> + <script> var video = document.getElementById('video'); var timeline; @@ -33,6 +32,6 @@ runWithKeyDown(function(){video.webkitRequestFullScreen()}); }); - video.src = findMediaFile('video', '../media/content/test'); + video.src = '../media/content/test.ogv'; </script> </body>
diff --git a/third_party/WebKit/LayoutTests/fullscreen/video-specified-size.html b/third_party/WebKit/LayoutTests/fullscreen/video-specified-size.html index 3b283a32..3a60f7f5 100644 --- a/third_party/WebKit/LayoutTests/fullscreen/video-specified-size.html +++ b/third_party/WebKit/LayoutTests/fullscreen/video-specified-size.html
@@ -7,7 +7,7 @@ <script src="full-screen-test.js"></script> <script src=../media/media-file.js></script> <script> - setSrcById("video", findMediaFile("video", "../media/content/test")); + setSrcById("video", "../media/content/test.ogv"); var video = document.getElementById('video'); waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video.clientWidth==document.body.clientWidth"); runWithKeyDown(function(){video.webkitRequestFullScreen()});
diff --git a/third_party/WebKit/LayoutTests/hdr/color-profile-video.html b/third_party/WebKit/LayoutTests/hdr/color-profile-video.html index 6058fc33..0365c6a 100644 --- a/third_party/WebKit/LayoutTests/hdr/color-profile-video.html +++ b/third_party/WebKit/LayoutTests/hdr/color-profile-video.html
@@ -35,7 +35,7 @@ }; } - setSrcByTagName('video', findMediaFile('video', '../media/content/test')); + setSrcByTagName('video', '../media/content/test.ogv'); }; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/hdr/video-canvas-alpha.html b/third_party/WebKit/LayoutTests/hdr/video-canvas-alpha.html index b6376bf..a24bc9f 100644 --- a/third_party/WebKit/LayoutTests/hdr/video-canvas-alpha.html +++ b/third_party/WebKit/LayoutTests/hdr/video-canvas-alpha.html
@@ -1,6 +1,5 @@ <html> <head> - <script src="../media/media-file.js"></script> <script> if (window.testRunner) { @@ -9,7 +8,7 @@ function onLoad() { video = document.getElementsByTagName('video')[0]; - video.src = findMediaFile("video", "../media/content/test"); + video.src = "../media/content/test.ogv"; canvas = document.getElementsByTagName('canvas')[0]; ctx = canvas.getContext('2d');
diff --git a/third_party/WebKit/LayoutTests/http/tests/appcache/video.html b/third_party/WebKit/LayoutTests/http/tests/appcache/video.html index 106b624..0ed8c09 100644 --- a/third_party/WebKit/LayoutTests/http/tests/appcache/video.html +++ b/third_party/WebKit/LayoutTests/http/tests/appcache/video.html
@@ -3,7 +3,6 @@ <title>Test that "video" can be loaded from the application cache.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -19,14 +18,14 @@ // Setting "src" to file specified in manifest. This file should load. video.ondurationchange = t.step_func(test2); video.onerror = t.unreached_func(); - video.src = "/media-resources/content/" + findMediaFile("video", "test"); + video.src = "/media-resources/content/test.ogv"; } function test2() { // Setting "src" to valid media file not in manifest. This file should fail to load. video.ondurationchange = t.unreached_func(); video.onerror = t.step_func(test3); - video.src = "/media-resources/content/" + findMediaFile("audio", "silence"); + video.src = "/media-resources/content/silence.oga"; } function test3() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/debug-inlined-scripts-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/debug-inlined-scripts-expected.txt index d665a05..9277367 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/debug-inlined-scripts-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/debug-inlined-scripts-expected.txt
@@ -2,8 +2,7 @@ Script source was shown. Script execution paused. Call stack: - 0) f1 (inlined-scripts.html:3) - 1) (inlined-scripts.html:3) + 0) (debug-inline-scripts.html:3) Call stack status: Paused on breakpoint ==Source frame contents start== <html> @@ -24,8 +23,8 @@ ==Source frame contents end== Script execution paused. Call stack: - 0) f4 (inlined-scripts.html:10) - 1) (inlined-scripts.html:12) + 0) f4 (debug-inline-scripts.html:10) + 1) (debug-inline-scripts.html:12) ==Source frame contents start== <html> <head>
diff --git a/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js b/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js deleted file mode 100644 index c80abcb..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js +++ /dev/null
@@ -1,72 +0,0 @@ -var audioCodecs = [ - ["audio/wav", "wav"], - ["audio/aac", "m4a"], - ["audio/ogg", "oga"] -]; - -var videoCodecs = [ - ["video/mp4", "mp4"], - ["video/ogg", "ogv"], - ["video/webm","webm"] -]; - -function findMediaFile(tagName, name) { - var codecs; - if (tagName == "audio") - codecs = audioCodecs; - else - codecs = videoCodecs; - - var element = document.getElementsByTagName(tagName)[0]; - if (!element) - element = document.createElement(tagName); - - for (var i = 0; i < codecs.length; ++i) { - if (element.canPlayType(codecs[i][0])) - return name + "." + codecs[i][1]; - } - - return ""; -} - -function mimeTypeForExtension(extension) { - for (var i = 0; i < videoCodecs.length; ++i) { - if (extension == videoCodecs[i][1]) - return videoCodecs[i][0]; - } - for (var i = 0; i < audioCodecs.length; ++i) { - if (extension == audioCodecs[i][1]) - return audioCodecs[i][0]; - } - - return ""; -} - -function mimeTypeForFile(filename) { - var lastPeriodIndex = filename.lastIndexOf("."); - if (lastPeriodIndex > 0) - return mimeTypeForExtension(filename.substring(lastPeriodIndex + 1)); - - return ""; -} - -function setSrcByTagName(tagName, src) { - var elements = document.getElementsByTagName(tagName); - if (elements) { - for (var i = 0; i < elements.length; ++i) - elements[i].src = src; - } -} - -function setSrcById(id, src) { - var element = document.getElementById(id); - if (element) - element.src = src; -} - -function stripExtension(filename) { - var lastPeriodIndex = filename.lastIndexOf("."); - if (lastPeriodIndex > 0) - return filename.substring(0, lastPeriodIndex); - return filename; -}
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger-expected.txt new file mode 100644 index 0000000..38ca574 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger-expected.txt
@@ -0,0 +1,4 @@ +Tests that waitForDebuggerOnStart works with out-of-process iframes. +sessionId matches: true +User-Agent = test +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger.js b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger.js new file mode 100644 index 0000000..6e2d348d --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/target/wait-for-debugger.js
@@ -0,0 +1,36 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank( + `Tests that waitForDebuggerOnStart works with out-of-process iframes.`); + + await dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: true}); + await dp.Target.setAttachToFrames({value: true}); + + await dp.Page.enable(); + session.evaluate(` + var iframe = document.createElement('iframe'); + iframe.src = 'http://devtools.oopif.test:8000/inspector-protocol/target/resources/test-page.html'; + document.body.appendChild(iframe); + `); + + var sessionId = (await dp.Target.onceAttachedToTarget()).params.sessionId; + await dp.Target.sendMessageToTarget({ + sessionId: sessionId, + message: JSON.stringify({id: 1, method: 'Network.enable'}) + }); + await dp.Target.sendMessageToTarget({ + sessionId: sessionId, + message: JSON.stringify({id: 2, method: 'Network.setUserAgentOverride', params: {userAgent: 'test'}}) + }); + dp.Target.sendMessageToTarget({ + sessionId: sessionId, + message: JSON.stringify({id: 3, method: 'Runtime.runIfWaitingForDebugger'}) + }); + dp.Target.onReceivedMessageFromTarget(event => { + var message = JSON.parse(event.params.message); + if (message.method === 'Network.requestWillBeSent') { + testRunner.log('sessionId matches: ' + (sessionId === event.params.sessionId)); + testRunner.log(`User-Agent = ${message.params.request.headers['User-Agent']}`); + testRunner.completeTest(); + } + }); +})
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/audio-seekable-contains-zero-without-ranges.html b/third_party/WebKit/LayoutTests/http/tests/media/audio-seekable-contains-zero-without-ranges.html index dc23b5d2..1fa45741 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/audio-seekable-contains-zero-without-ranges.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/audio-seekable-contains-zero-without-ranges.html
@@ -24,7 +24,7 @@ t.done(); }); - var mediaFile = findMediaFile('audio', '../../../../media/content/silence'); + var mediaFile = '../../../../media/content/silence.oga'; var type = mimeTypeForExtension(mediaFile.split('.').pop()); audio.src = 'http://127.0.0.1:8000/media/resources/load-video.php' +
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/audio-timeline-seek-outside-seekable.html b/third_party/WebKit/LayoutTests/http/tests/media/audio-timeline-seek-outside-seekable.html index ee635ff..b082ff21 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/audio-timeline-seek-outside-seekable.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/audio-timeline-seek-outside-seekable.html
@@ -27,7 +27,7 @@ t.done(); }); - var mediaFile = findMediaFile('audio', '../../../../media/content/silence'); + var mediaFile = '../../../../media/content/silence.oga'; var type = mimeTypeForExtension(mediaFile.split('.').pop()); audio.src = 'http://127.0.0.1:8000/media/resources/load-video.php' +
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html index 8e79957c..d7748920 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html
@@ -3,7 +3,6 @@ <title>Test that gestures are delegated to child frames when the attribute is used.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html index 2b70989..f7a4a3a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html
@@ -3,7 +3,6 @@ <title>Test that autoplay is disabled for cross origin by default.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <iframe src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html index 5ce9123..883400a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html
@@ -3,7 +3,6 @@ <title>Test that autoplay works on a cross origin iframe if there is a gesture in that frame.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html index 1007a20..a56351e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html
@@ -3,7 +3,6 @@ <title>Test that the header will override allow=autoplay.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe that disables autoplay with a HTTP header --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-frame-with-header.php"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html index fcc5690..fd28b401 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html
@@ -3,7 +3,6 @@ <title>Test that autoplay works on child frames, but only if allowed.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with no allow attribute --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1b.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html index 003dcbb..e68db76 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html
@@ -3,7 +3,6 @@ <title>Test that autoplay is still disabled if there is no gesture, but autoplay is switched on.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html index 42d793dc..58b1267f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html
@@ -3,7 +3,6 @@ <title>Test that gestures are delegated automatically to same origin child frames.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="resources/autoplay-test.js"></script> <!-- This is a same origin frame with a sub origin child frame with no allow attributes --> <iframe src="/media/autoplay/resources/nested-iframe-1b.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/autoplay-test.js b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/autoplay-test.js index a545ce7..19dd0294 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/autoplay-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/autoplay-test.js
@@ -40,7 +40,7 @@ function runVideoTest() { const video = document.createElement('video'); - video.src = findMediaFile('video', '/media-resources/content/test'); + video.src = '/media-resources/content/test.ogv'; video.play().then(tearDown, tearDown); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-frame-with-header.php b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-frame-with-header.php index 5b6a1aa..fbfa916 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-frame-with-header.php +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-frame-with-header.php
@@ -3,6 +3,5 @@ ?> <!DOCTYPE html> <html> -<script src="../../../media-resources/media-file.js"></script> <script src="autoplay-test.js"></script> </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1a.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1a.html index 253dda8..a9a7c842 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1a.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1a.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> <html> -<script src="../../../media-resources/media-file.js"></script> <script src="autoplay-test.js"></script> <iframe allow="autoplay" src="http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1b.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1b.html index db35333..fe16c033 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1b.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-1b.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> <html> -<script src="../../../media-resources/media-file.js"></script> <script src="autoplay-test.js"></script> <iframe src="http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-2.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-2.html index 5b8a658..0145a8d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-2.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/nested-iframe-2.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> <html> -<script src="../../../media-resources/media-file.js"></script> <script src="autoplay-test.js"></script> </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay-post-navigation.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay-post-navigation.html index cfbbeb6..67acf70a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay-post-navigation.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay-post-navigation.html
@@ -3,7 +3,6 @@ <title>Test user gesture is delegated to iframes after navigation.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="/media-resources/media-file.js"></script> <script src="autoplay-test.js"></script> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay.html index e912cf8b..e0c7dea 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay/resources/test-autoplay.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <title>Test document user gesture autoplay policy across navigation</title> <script src="/js-test-resources/js-test.js"></script> -<script src='../../../media-resources/media-file.js'></script> <script> var jsTestIsAsync = true; function tearDown(result) { @@ -12,7 +11,7 @@ function runVideoTest() { var video = document.createElement('video'); - video.src = findMediaFile("video", "/resources/test"); + video.src = "/resources/test.ogv"; video.play().then(tearDown, tearDown); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-add-hide.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-add-hide.html index ff3ec55..af8342e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-add-hide.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-add-hide.html
@@ -2,7 +2,6 @@ <title>Test adding keywords to controlsList hides buttons</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <script src="../../media-resources/media-controls.js"></script> <video controls id="enabled-controls" width="500px"></video> <script> @@ -27,6 +26,6 @@ })); })); - v.src = findMediaFile('video', '../resources/test'); + v.src = '../resources/test.ogv'; }, 'Test disabling controls on the video element with all controls.'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-remove-show.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-remove-show.html index 2244b722..60880ee8 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-remove-show.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/controls-list-remove-show.html
@@ -2,7 +2,6 @@ <title>Test removing keywords from controlsList shows buttons</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <script src="../../media-resources/media-controls.js"></script> <video controlslist="nodownload nofullscreen" id="disabled-controls" width="500px"></video> <script> @@ -28,7 +27,7 @@ })); })); - v.src = findMediaFile('video', '../resources/test'); + v.src = '../resources/test.ogv'; }, 'Test enabling controls on the video element with them enabled.'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source-buffer.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source-buffer.html index e175b8c..d9109aa 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source-buffer.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source-buffer.html
@@ -15,7 +15,7 @@ checkControlsClassName(video, "phase-ready state-buffering"); }); - const mediaFile = "../../../media/" + findMediaFile("video", "content/test"); + const mediaFile = "../../../media/" + "content/test.ogv"; const mimeType = mimeTypeForFile(mediaFile); video.src = "http://127.0.0.1:8000/resources/load-and-stall.php?name=" + mediaFile + "&mimeType=" + mimeType + "&stallAt=100000&stallFor=8";
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source.html index 947da096..2751f78 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/toggle-class-with-state-source.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../../media-resources/media-controls.js"></script> -<script src="../../../media-resources/media-file.js"></script> <video controls width=400 preload=metadata></video> <script> async_test(t => {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-correct-ordering.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-correct-ordering.html index 3aa5fa3..332cbe6f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-correct-ordering.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-correct-ordering.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../../media-resources/media-controls.js"></script> -<script src="../../../media-resources/media-file.js"></script> <script src="../../../media-resources/overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../resources/test"); + video.src = "../resources/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-updates-appropriately.html b/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-updates-appropriately.html index 8b1f18e..6f6079b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-updates-appropriately.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/controls/video-controls-overflow-menu-updates-appropriately.html
@@ -3,7 +3,6 @@ <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> <script src='../../../media-resources/media-controls.js'></script> -<script src='../../../media-resources/media-file.js'></script> <script src='../../../media-resources/overflow-menu.js'></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -15,7 +14,7 @@ // Set up video var video = document.querySelector('video'); - video.src = findMediaFile('video', '../resources/test'); + video.src = '../resources/test.ogv'; video.setAttribute('width', '60'); // Add captions var trackElement = document.createElement('track');
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/gc-while-network-loading.html b/third_party/WebKit/LayoutTests/http/tests/media/gc-while-network-loading.html index e34ad50..31f8b40 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/gc-while-network-loading.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/gc-while-network-loading.html
@@ -8,7 +8,7 @@ { var v = document.createElement("video"); v.foo = "bar"; - var mediaFile = findMediaFile("video", "../../../media/content/test"); + var mediaFile = "../../../media/content/test.ogv"; var type = mimeTypeForExtension(mediaFile.split(".").pop()); v.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + mediaFile + "&throttle=50&type=" + type; v.onloadstart = t.step_func(function()
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-document.html b/third_party/WebKit/LayoutTests/http/tests/media/media-document.html index e29eac4..4802aa12 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-document.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-document.html
@@ -6,7 +6,7 @@ <body> <script> async_test(function(t) { - var movie = findMediaFile('video', 'test'); + var movie = 'test.ogv'; var type = mimeTypeForExtension(movie.split('.').pop()); var iframe = document.createElement('iframe');
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt deleted file mode 100644 index dbcd6b5..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt +++ /dev/null
@@ -1,16 +0,0 @@ -CONSOLE WARNING: line 16: Ignore this warning. See https://crbug.com/568704#c2 -This is a testharness.js-based test. -PASS Test addSourceBuffer() in 'ended' state. -PASS Test addSourceBuffer() with empty type -PASS Test addSourceBuffer() with null -PASS Test addSourceBuffer() with unsupported type -PASS Test addSourceBuffer() with Vorbis and VP8 -PASS Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers -PASS Test addSourceBuffer() video only -PASS Test addSourceBuffer() audio only -FAIL Test addSourceBuffer() with AAC and H.264 assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported expected true got false -FAIL Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers assert_true: video/mp4;codecs="avc1.4D4001" is supported expected true got false -PASS Test addSourceBuffer() throws QuotaExceededError after MediaSource has completed init. -PASS Test addSourceBuffer() succeeds while incomplete init segment is appended, fails after MediaSource init completed. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt index fa56a24..a07603d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 audio-only bitrate changes. assert_true: audio/mp4;codecs="mp4a.40.2" is supported. expected true got false +PASS Tests mp4 audio-only bitrate changes. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt index 2b7793b3..48ad7c5 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 audio bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false +PASS Tests mp4 audio bitrate changes in multiplexed content. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt index 3e82c6e..272d3aa 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 frame size changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false +PASS Tests mp4 frame size changes in multiplexed content. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt index 8efe81a..536d6ac 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 video bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false +PASS Tests mp4 video bitrate changes in multiplexed content. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt index 8f53878c6..700eeed 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 video-only bitrate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false +PASS Tests mp4 video-only bitrate changes. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt index 61e3e73..f22b5e1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 video-only frame rate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false +PASS Tests mp4 video-only frame rate changes. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt index 9f613a78..be280a98 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt
@@ -1,4 +1,5 @@ +CONSOLE WARNING: line 106: Ignore this warning. See https://crbug.com/568704#c2 This is a testharness.js-based test. -FAIL Tests mp4 video-only frame size changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false +PASS Tests mp4 video-only frame size changes. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt index 35e804b..143b4d2a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt
@@ -30,14 +30,14 @@ PASS Test valid WebM type "video/webm;codecs="vorbis, vp8"" PASS Test valid WebM type "audio/webm;codecs="vorbis"" PASS Test valid WebM type "AUDIO/WEBM;CODECS="vorbis"" -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.42001e"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.40.5"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "audio/mp4;codecs="mp4a.67"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.2"" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e "" assert_equals: supported expected true but got false -FAIL Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.5"" assert_equals: supported expected true but got false +PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e"" +PASS Test valid MP4 type "video/mp4;codecs="avc1.42001e"" +PASS Test valid MP4 type "audio/mp4;codecs="mp4a.40.2"" +PASS Test valid MP4 type "audio/mp4;codecs="mp4a.40.5"" +PASS Test valid MP4 type "audio/mp4;codecs="mp4a.67"" +PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2"" +PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.2"" +PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e "" +PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.5"" Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html b/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html index f3a8c88..637f37c4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html
@@ -2,7 +2,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../resources/get-host-info.js"></script> -<script src="../../media-resources/media-file.js"></script> <body> <script> // This file tests the following behavior:
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html b/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html index 7623ca0..99e3a31 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html
@@ -2,7 +2,6 @@ <title>Tests that a PDF file is served as "application/pdf"</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/preload-conditions.html b/third_party/WebKit/LayoutTests/http/tests/media/preload-conditions.html index 29f9182..362959fb 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/preload-conditions.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/preload-conditions.html
@@ -2,7 +2,6 @@ <title>Test media preloading behaviour with different conditions.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <script> var tests = [ { @@ -135,7 +134,7 @@ [ '', 'none', 'metadata', 'auto' ].forEach(preload => { var media = document.createElement('video'); media.preload = preload; - media.src = findMediaFile('video', 'resources/test'); + media.src = 'resources/test.ogv'; assert_equals(media.readyState, HTMLMediaElement.HAVE_NOTHING); switch (media.preload) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/progress-events-generated-correctly.html b/third_party/WebKit/LayoutTests/http/tests/media/progress-events-generated-correctly.html index a9147c2..93299e9 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/progress-events-generated-correctly.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/progress-events-generated-correctly.html
@@ -68,7 +68,7 @@ setTimeout(t.step_func(checkProgressCount), maxProgressFiringIntervalInMS); }); - var mediaFile = findMediaFile('video', 'resources/test'); + var mediaFile = 'resources/test.ogv'; var mimeType = mimeTypeForFile(mediaFile); // Assumes minimum file size selected is > 100 kB. // At least 4*maxProgressFiringIntervalInMS is how long we want to stretch the full
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html index c6518f1..285952a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html
@@ -2,7 +2,6 @@ <title>Test that video is not reloaded on showing a dialog.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> // Make sure we don't reload a "video" element after a dialog is shown. @@ -10,7 +9,7 @@ // "loadstart" event handler is called. If the movie is reloaded when // the dialog is "dismissed", another "loadstart" event will be fired. async_test(function(t) { - var movie = findMediaFile("video", "../resources/test"); + var movie = "../resources/test.ogv"; var video = document.querySelector("video"); video.onloadstart = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/remove-while-loading.html b/third_party/WebKit/LayoutTests/http/tests/media/remove-while-loading.html index d990655..b70643c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/remove-while-loading.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/remove-while-loading.html
@@ -13,7 +13,7 @@ setTimeout(t.step_func_done(), 100); }); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; var mimeType = mimeTypeForFile(mediaFile); video.src = "http://127.0.0.1:8000/resources/load-and-stall.php?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=100000"; });
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html b/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html index 27797563..1e99cfea 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> -<script src="../../../media-resources/media-file.js"></script> <body></body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required-for-cross-origin'); @@ -8,7 +7,7 @@ { var video = document.createElement('video'); video.id = 'video'; - video.src = findMediaFile('video', 'test'); + video.src = 'test.ogv'; video.autoplay = true; video.loop = true; document.body.appendChild(video); @@ -17,7 +16,7 @@ { var video = document.createElement('video'); video.id = 'video-muted'; - video.src = findMediaFile('video', 'test'); + video.src = 'test.ogv'; video.muted = true; video.autoplay = true; video.loop = true;
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/text-served-as-text.html b/third_party/WebKit/LayoutTests/http/tests/media/text-served-as-text.html index 9631716..5263da1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/text-served-as-text.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/text-served-as-text.html
@@ -2,7 +2,6 @@ <title>Tests that a text file is served as "text/plain".</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-buffered-range-contains-currentTime.html b/third_party/WebKit/LayoutTests/http/tests/media/video-buffered-range-contains-currentTime.html index 862c90a3..8bbcd66 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-buffered-range-contains-currentTime.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-buffered-range-contains-currentTime.html
@@ -23,7 +23,7 @@ video.currentTime = video.duration - 0.5; }; -var mediaFile = findMediaFile("audio", "../../../media/content/test"); +var mediaFile = "../../../media/content/test.oga"; var type = mimeTypeForExtension(mediaFile.split(".").pop()); video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + mediaFile + "&throttle=5000&nph=1&type=" + type; </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-cancel-load.html b/third_party/WebKit/LayoutTests/http/tests/media/video-cancel-load.html index 70dd2fa..a3528ae 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-cancel-load.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-cancel-load.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Cancel loading a video file and access its properties afterwards.</title> -<script src="../../media-resources/media-file.js"></script> <video></video> <textarea style="display: none;"> @@ -35,7 +34,7 @@ doc.close(); }; -var file = findMediaFile("video", "../resources/test"); +var file = "../resources/test.ogv"; video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?throttle=40&name=" + file; // Change URL of the current page to a blank page.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-displayed.html b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-displayed.html index 20409084..38ff5737 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-displayed.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-displayed.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../../media-resources/media-controls.js"></script> -<script src="../../media-resources/media-file.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> <body style="padding-top: 200px; padding-left: 100px"> <video controls></video> @@ -11,7 +10,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "resources/test"); + video.src = "resources/test.ogv"; var controlID = "-internal-media-controls-download-button"; var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChild, controlID); video.onloadeddata = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-not-displayed-hide-download-ui.html b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-not-displayed-hide-download-ui.html index cc20b092..2c7c356abd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-not-displayed-hide-download-ui.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-not-displayed-hide-download-ui.html
@@ -3,13 +3,12 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../../media-resources/media-controls.js"></script> -<script src="../../media-resources/media-file.js"></script> <video controls></video> <script> async_test(function(t) { window.internals.settings.setHideDownloadUI(true); var video = document.querySelector("video"); - video.src = findMediaFile("video", "resources/test"); + video.src = "resources/test.ogv"; var controlID = "-internal-media-controls-download-button"; var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChild, controlID); video.onloadeddata = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media-cross-origin.html b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media-cross-origin.html index cc88f698..0b11f670 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media-cross-origin.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media-cross-origin.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../../media-resources/media-controls.js"></script> -<script src="../../media-resources/media-file.js"></script> <script src="../../media-resources/overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> <body style="padding-top: 200px; padding-left: 100px"> @@ -17,7 +16,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "http://localhost:8000/media/resources/test"); + video.src = "http://localhost:8000/media/resources/test.ogv"; var controlID = "-internal-media-controls-download-button"; var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChild, controlID);
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media.html b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media.html index 480d859..fa9bb78 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-download-button-saves-media.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../../media-resources/media-controls.js"></script> -<script src="../../media-resources/media-file.js"></script> <script src="../../media-resources/overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> <body style="padding-top: 200px; padding-left: 100px"> @@ -17,7 +16,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "resources/test"); + video.src = "resources/test.ogv"; var controlID = "-internal-media-controls-download-button"; var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChild, controlID);
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-overflow-menu-download-button.html b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-overflow-menu-download-button.html index 1fa9599..7badd4f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-controls-overflow-menu-download-button.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-controls-overflow-menu-download-button.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="../../media-resources/media-controls.js"></script> -<script src="../../media-resources/media-file.js"></script> <script src="../../media-resources/overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> <body style="padding-top: 200px; padding-left: 100px"> @@ -15,7 +14,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "resources/test"); + video.src = "resources/test.ogv"; video.setAttribute("width", "60"); var controlID = "-internal-media-controls-download-button";
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-cookie.html b/third_party/WebKit/LayoutTests/http/tests/media/video-cookie.html index 7478c13..a32ed19 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-cookie.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-cookie.html
@@ -2,12 +2,11 @@ <title>Tests that the media player will send the relevant cookies when requesting the media file.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <body> <video></video> <script> async_test(function(t) { - var movie = findMediaFile("video", "resources/test"); + var movie = "resources/test.ogv"; var frame = document.createElement("iframe"); document.body.appendChild(frame);
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html b/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html index e1284898..0117958 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html
@@ -2,7 +2,6 @@ <title>Test "abort" event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -26,7 +25,7 @@ assert_equals(video.error, null); })); - var movie = findMediaFile("video", "../resources/test"); + var movie = "../resources/test.ogv"; video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=256"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-metadata-decode-error.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-metadata-decode-error.html index cd3f0200..3d6896355 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-metadata-decode-error.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-metadata-decode-error.html
@@ -12,7 +12,7 @@ watcher.wait_for(["loadedmetadata", "error"]).then(t.step_func_done(function() { assert_equals(video.networkState, HTMLMediaElement.NETWORK_IDLE); })); - var movie = findMediaFile("video", "resources/test"); + var movie = "resources/test.ogv"; var type = mimeTypeForExtension(movie.split(".").pop()); video.src = "video-load-metadata-decode-error.cgi?name=" + movie + "&type=" + type; video.play();
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html index 71a7186..831e76a5 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html
@@ -2,12 +2,11 @@ <title>Test that the load eventually suspends and returns to NETWORK_IDLE.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "http://127.0.0.1:8000/resources/test"); + video.src = "http://127.0.0.1:8000/resources/test.ogv"; var watcher = new EventWatcher(t, video, ["loadstart", "suspend"]); watcher.wait_for(["loadstart", "suspend"]).then(t.step_func_done(function() { assert_equals(video.networkState, HTMLMediaElement.NETWORK_IDLE);
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html index f89f1bd..1425414 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html
@@ -2,11 +2,10 @@ <title>Test loading video twice.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <body> <script> async_test(function(t) { - var file = findMediaFile("video", "http://127.0.0.1:8000/resources/test"); + var file = "http://127.0.0.1:8000/resources/test.ogv"; createAndLoadVideo(false); function createAndLoadVideo(endTest) { var video = document.createElement("video");
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-with-userpass.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-with-userpass.html index 34bac02..e586a2f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-with-userpass.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-with-userpass.html
@@ -15,7 +15,7 @@ video.onerror = t.unreached_func(); video.oncanplay = t.step_func_done(); - var movie = findMediaFile('video', 'test'); + var movie = 'test.ogv'; var type = mimeTypeForExtension(movie.split('.').pop()); source = document.querySelector('source'); source.type = type;
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html b/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html index 68cedea..fea4ef3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html
@@ -2,7 +2,6 @@ <title>Test that at least one progress event is fired after starting to load the video.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -11,7 +10,7 @@ var watcher = new EventWatcher(t, video, ["loadstart", "progress"]); watcher.wait_for(["loadstart", "progress"]).then(t.step_func_done()); - var mediaFile = findMediaFile("video", "resources/test"); + var mediaFile = "resources/test.ogv"; video.src = "http://127.0.0.1:8000/" + mediaFile; video.play(); });
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html index f1363f3..879e522 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html
@@ -16,7 +16,7 @@ })); // Find a supported media file. - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; var mimeType = mimeTypeForFile(mediaFile); // Load should stall very early in the loading process.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html index d445f59..91424e4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html
@@ -126,7 +126,7 @@ // Find a supported media file. - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; var mimeType = mimeTypeForFile(mediaFile); // URL will load part of the file, pause for 8 seconds, then load the rest. // The delay of 8 seconds is chosen to reduce flakiness in waiting for the
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-preload-metadata.html b/third_party/WebKit/LayoutTests/http/tests/media/video-preload-metadata.html index d4a7cdfd..d7558405 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-preload-metadata.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-preload-metadata.html
@@ -2,7 +2,6 @@ <title>Verifies preload=metadata doesn't buffer the entire clip.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <div id="log"></div> <video controls preload=metadata></video> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html b/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html index e4255a4..c1dd2d7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html
@@ -10,7 +10,7 @@ var iframe = document.createElement('iframe'); iframe.onload = t.step_func(function() { - var movie = findMediaFile('video', 'test'); + var movie = 'test.ogv'; var type = mimeTypeForExtension(movie.split('.').pop()); var video = document.querySelector('video'); video.onerror = t.unreached_func();
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html index 2949aca..113433a29 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
@@ -9,7 +9,7 @@ </video> <script> async_test(function(t) { - var movie = findMediaFile('video', 'test'); + var movie = 'test.ogv'; var type = mimeTypeForExtension(movie.split('.').pop()); var iframe = document.createElement('iframe');
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration.html b/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration.html index ba61b9c7..fd82e9c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration.html
@@ -2,7 +2,6 @@ <title>Test event dispatches and attribute changes for seek to duration.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -48,7 +47,7 @@ assert_equals(video.currentTime, video.duration); } - video.src = findMediaFile("video", "resources/test");; + video.src = "resources/test.ogv";; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-middle.html b/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-middle.html index 759e784e..33bdae3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-middle.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-middle.html
@@ -2,7 +2,6 @@ <title>Test event dispatches and attribute changes for seek to middle.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -46,7 +45,7 @@ assert_false(video.paused); } - video.src = findMediaFile("video", "resources/test"); + video.src = "resources/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-served-as-text.html b/third_party/WebKit/LayoutTests/http/tests/media/video-served-as-text.html index 9fc3e16..85cac6db 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-served-as-text.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-served-as-text.html
@@ -2,7 +2,6 @@ <title>Tests that a media file is served as "text/plain".</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="../../media-resources/media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -12,7 +11,7 @@ watcher.wait_for(["loadstart", "loadedmetadata"]).then(t.step_func_done()); assert_equals(video.error, null); - var movie = findMediaFile("video", "resources/test"); + var movie = "resources/test.ogv"; video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=99999&type=text/plain"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html b/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html index 1197a820..293b4c25f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html
@@ -9,7 +9,7 @@ </video> <script> async_test(function(t) { - var movie = findMediaFile('video', 'test'); + var movie = 'test.ogv'; var type = mimeTypeForExtension(movie.split('.').pop()); var iframe = document.createElement('iframe');
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote-expected.txt index 91b0c1dc..2e81681 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE ERROR: Not allowed to load local resource: test.mp4 +CONSOLE ERROR: Not allowed to load local resource: test.ogv Test that a remote video element will not use a local <source>, and will use another remote <source> This test only behaves correctly in DRT
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote.html b/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote.html index ed531c3..19fcd84 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/local-video-source-from-remote.html
@@ -14,13 +14,13 @@ consoleWrite("<br>END OF TEST"); testEnded = true; if (window.testRunner) - testRunner.notifyDone(); + testRunner.notifyDone(); } function hanged() { consoleWrite("FAIL: timed out"); if (window.testRunner) - testRunner.notifyDone(); + testRunner.notifyDone(); } function logConsole() @@ -31,7 +31,7 @@ } return console; } - + function consoleWrite(text) { if (testEnded) @@ -60,24 +60,25 @@ endTest(); } - var localMovie = "file:///tmp/LayoutTests/media/content/test.mp4"; - var remoteUrl = "http://localhost:8000/resources/test"; + var localMovie = "file:///tmp/LayoutTests/media/content/test.ogv"; + var remoteUrl = "http://localhost:8000/resources/test.ogv"; - function loadedmetadata(evt) - { + function loadedmetadata(evt) + { var src = video.currentSrc; - var localFile = localMovie.substring(localMovie.lastIndexOf("/")+1, localMovie.length) - var remoteFile = remoteUrl.substring(remoteUrl.lastIndexOf("/")+1, remoteUrl.length) logEvent(evt); - if (src.indexOf(localFile) > 0) + if (src == localMovie) logResult("local movie loaded", false); - else if (src.indexOf(remoteFile) > 0) + else if (src == remoteUrl) logResult("remote movie loaded, local movie failed to load", true); + else + logResult("video failed to load any movie", false); + endTest(); } - if (window.testRunner) + if (window.testRunner) { localMovie = testRunner.pathToLocalResource(localMovie); testRunner.dumpAsText(); @@ -85,7 +86,7 @@ } setTimeout(hanged, 10000); - function test() + function test() { video = document.getElementById("vid"); @@ -97,15 +98,6 @@ var src1 = document.createElement("source"); src1.setAttribute("src", localMovie); - if (video.canPlayType("video/mp4")) - remoteUrl += ".mp4"; - else if (video.canPlayType("video/ogg")) - remoteUrl += ".ogv"; - else { - logResult("Missing test movie for this platform???", false); - endTest(); - } - var src2 = document.createElement("source"); src2.setAttribute("src", remoteUrl); @@ -113,7 +105,7 @@ video.appendChild(src2); } </script> - + </head> <body onLoad="test()">
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html index 5809bbce..e303246 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html
@@ -7,7 +7,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - var mediaFile = findMediaFile("video", "../../media/resources/test"); + var mediaFile = "../../media/resources/test.ogv"; var type = mimeTypeForExtension(mediaFile.split('.').pop()); video.onerror = t.unreached_func();
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html index 4b1cbc9e..7a692cf7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html
@@ -16,7 +16,7 @@ }); document.body.appendChild(video); - var mediaFile = findMediaFile("video", "../../media/resources/test"); + var mediaFile = "../../media/resources/test.ogv"; var type = mimeTypeForExtension(mediaFile.split('.').pop()); video.src = "http://localhost:8080/security/resources/video-cross-origin-allow.php?no-preflight&name=" + mediaFile + "&type=" + type; video.play();
diff --git a/third_party/WebKit/LayoutTests/media/W3C/audio/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt b/third_party/WebKit/LayoutTests/media/W3C/audio/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt index 045897d..c10c22c2 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/audio/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt +++ b/third_party/WebKit/LayoutTests/media/W3C/audio/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt
@@ -3,6 +3,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". +PASS "maybe" is "maybe" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3-expected.txt b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3-expected.txt index d9e6648..6dd503b 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3-expected.txt +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3-expected.txt
@@ -4,6 +4,7 @@ PASS "" is "" +PASS "probably" is "probably" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3.html b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3.html index b80b1e98..ecd3f46d 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3.html +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_codecs_order_3.html
@@ -13,8 +13,13 @@ test(function() { var v = document.getElementById("v"); assert_equals( - v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'), - v.canPlayType('video/mp4; codecs="mp4a.40.2, avc1.42E01E"'), + v.canPlayType('video/webm; codecs="vp8, BOGUS"'), + v.canPlayType('video/webm; codecs="BOGUS, vp8"'), + "order of codecs parameters should have no effect"); + + assert_equals( + v.canPlayType('video/webm; codecs="vp8, opus"'), + v.canPlayType('video/webm; codecs="opus, vp8"'), "order of codecs parameters should have no effect"); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_3-expected.txt b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_3-expected.txt index 0c1ece3e..f4c736f 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_3-expected.txt +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_3-expected.txt
@@ -3,6 +3,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". +PASS "maybe" is "maybe" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5-expected.txt b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5-expected.txt index ba70851..aea6276f 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5-expected.txt +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5-expected.txt
@@ -3,6 +3,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". +PASS "probably" is "probably" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5.html b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5.html index 85afb61f..d2cac6e5 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5.html +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_5.html
@@ -15,7 +15,7 @@ if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') == "probably") { assert_equals( v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'), - v.canPlayType('video/ogg; codecs="avc1.42E01E"'), + v.canPlayType('video/mp4; codecs="avc1.42E01E"'), "ability to play two codecs implies the ability to play one"); } });
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6-expected.txt b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6-expected.txt index ba70851..aea6276f 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6-expected.txt +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6-expected.txt
@@ -3,6 +3,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". +PASS "probably" is "probably" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6.html b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6.html index 2b615f1..3d4a59dc 100644 --- a/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6.html +++ b/third_party/WebKit/LayoutTests/media/W3C/video/canPlayType/canPlayType_two_implies_one_6.html
@@ -15,7 +15,7 @@ if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') == "probably") { assert_equals( v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'), - v.canPlayType('video/ogg; codecs="mp4a.40.2"'), + v.canPlayType('video/mp4; codecs="mp4a.40.2"'), "ability to play two codecs implies the ability to play one"); } });
diff --git a/third_party/WebKit/LayoutTests/media/adopt-node-crash.html b/third_party/WebKit/LayoutTests/media/adopt-node-crash.html index 1a02439..c9bc0ede 100644 --- a/third_party/WebKit/LayoutTests/media/adopt-node-crash.html +++ b/third_party/WebKit/LayoutTests/media/adopt-node-crash.html
@@ -50,7 +50,7 @@ { var video = document.getElementsByTagName('video')[0]; video.addEventListener("loadstart", loadstart); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/media/audio-concurrent-supported.html b/third_party/WebKit/LayoutTests/media/audio-concurrent-supported.html index ecffca8..e41b2ec 100644 --- a/third_party/WebKit/LayoutTests/media/audio-concurrent-supported.html +++ b/third_party/WebKit/LayoutTests/media/audio-concurrent-supported.html
@@ -2,7 +2,6 @@ <title>Test that multiple audio elements can play concurrently.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) { // Number of concurrent audio elements to test. @@ -46,7 +45,7 @@ } }); - audioElement.src = findMediaFile("audio", "content/silence"); + audioElement.src = "content/silence.oga"; } }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/audio-constructor-preload.html b/third_party/WebKit/LayoutTests/media/audio-constructor-preload.html index ae635c7..6dfbbb6 100644 --- a/third_party/WebKit/LayoutTests/media/audio-constructor-preload.html +++ b/third_party/WebKit/LayoutTests/media/audio-constructor-preload.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that Audio() sets "preload" attribute.</title> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script> @@ -16,7 +15,7 @@ assert_equals(audio.preload, "auto"); }); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.load(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/audio-constructor-src.html b/third_party/WebKit/LayoutTests/media/audio-constructor-src.html index 0cebeb8..c30a1036 100644 --- a/third_party/WebKit/LayoutTests/media/audio-constructor-src.html +++ b/third_party/WebKit/LayoutTests/media/audio-constructor-src.html
@@ -1,11 +1,10 @@ <!DOCTYPE html> <title>Test that Audio("url") constructor loads the specified resource.</title> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script> async_test(function(t) { - var audioFile = findMediaFile("audio", "content/test"); + var audioFile = "content/test.oga"; var audio = new Audio(audioFile); audio.onloadstart = t.step_func(function () {
diff --git a/third_party/WebKit/LayoutTests/media/audio-constructor.html b/third_party/WebKit/LayoutTests/media/audio-constructor.html index dadaf589..de7d252 100644 --- a/third_party/WebKit/LayoutTests/media/audio-constructor.html +++ b/third_party/WebKit/LayoutTests/media/audio-constructor.html
@@ -1,13 +1,12 @@ <!DOCTYPE html> <title>Test that Audio() object loads the resource after src attribute is set and load() is called.</title> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script> async_test(function(t) { var audio = new Audio(); - var audioFile = findMediaFile("audio", "content/test"); + var audioFile = "content/test.oga"; audio.src = audioFile; audio.onloadstart = t.step_func(function () { var url = audio.currentSrc;
diff --git a/third_party/WebKit/LayoutTests/media/audio-controls-captions.html b/third_party/WebKit/LayoutTests/media/audio-controls-captions.html index cdfd5e3..70b1714 100644 --- a/third_party/WebKit/LayoutTests/media/audio-controls-captions.html +++ b/third_party/WebKit/LayoutTests/media/audio-controls-captions.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that the closed captions button is not visible.</title> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> @@ -10,7 +9,7 @@ <script> async_test(function(t) { var audio = document.querySelector('audio'); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; audio.onloadedmetadata = t.step_func_done(function() { assert_false(isClosedCaptionsButtonVisible(audio)); });
diff --git a/third_party/WebKit/LayoutTests/media/audio-controls-do-not-fade-out.html b/third_party/WebKit/LayoutTests/media/audio-controls-do-not-fade-out.html index 920ae6792..b35f37c 100644 --- a/third_party/WebKit/LayoutTests/media/audio-controls-do-not-fade-out.html +++ b/third_party/WebKit/LayoutTests/media/audio-controls-do-not-fade-out.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>This tests that audio controls do not fade out when the audio is playing.</title> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> @@ -8,7 +7,7 @@ <script> async_test(function(t) { var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onplaying = t.step_func(function() { runAfterHideMediaControlsTimerFired(t.step_func_done(controlsTimerFired), audio); });
diff --git a/third_party/WebKit/LayoutTests/media/audio-controls-rendering.html b/third_party/WebKit/LayoutTests/media/audio-controls-rendering.html index 19636d3d..997a5612 100644 --- a/third_party/WebKit/LayoutTests/media/audio-controls-rendering.html +++ b/third_party/WebKit/LayoutTests/media/audio-controls-rendering.html
@@ -1,18 +1,18 @@ <html> <head> <style> - audio { background-color: blue; } + audio { background-color: blue; } </style> <script src=media-file.js></script> <script> function test() { - setSrcByTagName("audio", findMediaFile("audio", "content/test")); + setSrcByTagName("audio", "content/test.oga"); if (window.testRunner) { testRunner.waitUntilDone(); - setTimeout(function() { - document.body.appendChild(document.createTextNode('FAIL')); + setTimeout(function() { + document.body.appendChild(document.createTextNode('FAIL')); if (window.testRunner) testRunner.notifyDone(); } , 8000);
diff --git a/third_party/WebKit/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html b/third_party/WebKit/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html index 3f8a1f8..2f69e86 100644 --- a/third_party/WebKit/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html +++ b/third_party/WebKit/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing.</title> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> @@ -9,7 +8,7 @@ <script> async_test(function(t) { var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onplaying = t.step_func(function() { var seekCoords = mediaControlsButtonCoordinates(audio, "timeline"); var x = seekCoords[0];
diff --git a/third_party/WebKit/LayoutTests/media/audio-garbage-collect.html b/third_party/WebKit/LayoutTests/media/audio-garbage-collect.html index 148cbd2..59b1db4 100644 --- a/third_party/WebKit/LayoutTests/media/audio-garbage-collect.html +++ b/third_party/WebKit/LayoutTests/media/audio-garbage-collect.html
@@ -1,6 +1,5 @@ <!DOCTYPE HTML> <title>Tests that we don't garbage collect audio object while it is still playing.</title> -<script src="media-file.js"></script> <script src="../resources/gc.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> @@ -15,9 +14,9 @@ async_test(function(t) { var audioPlayers = 4; var playedCount = 0; - var audioFile = findMediaFile("audio", "content/silence"); + var audioFile = "content/silence.oga"; var audio = new Audio(audioFile); - + audio.onended = t.step_func(function() { playedCount ++; if (playedCount <= audioPlayers) {
diff --git a/third_party/WebKit/LayoutTests/media/audio-play-event.html b/third_party/WebKit/LayoutTests/media/audio-play-event.html index 906651c..f940518 100644 --- a/third_party/WebKit/LayoutTests/media/audio-play-event.html +++ b/third_party/WebKit/LayoutTests/media/audio-play-event.html
@@ -1,6 +1,5 @@ <!DOCTYPE HTML> <title>Test that a 'play' event is fired by a new audio element on playing.</title> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script> @@ -11,7 +10,7 @@ audio.oncanplay = t.step_func(function() {}); audio.onplaying = t.step_func_done(); audio.onerror = t.unreached_func("Should not fire 'error' event"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/auto-play-in-sandbox-with-allow-scripts.html b/third_party/WebKit/LayoutTests/media/auto-play-in-sandbox-with-allow-scripts.html index 49f263ef8..624eafc 100644 --- a/third_party/WebKit/LayoutTests/media/auto-play-in-sandbox-with-allow-scripts.html +++ b/third_party/WebKit/LayoutTests/media/auto-play-in-sandbox-with-allow-scripts.html
@@ -2,7 +2,6 @@ <title>Test that play event fires when "src" set with an autoplay attribute in a sandbox with allows-scripts.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <iframe sandbox="allow-scripts allow-same-origin" src="resources/auto-play-in-sandbox-with-allow-scripts-iframe.html"> @@ -15,7 +14,7 @@ var video = iframe.contentDocument.querySelector("video"); assert_true(video.paused); video.onplay = t.step_func_done(); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-clears-autoplaying-flag.html b/third_party/WebKit/LayoutTests/media/autoplay-clears-autoplaying-flag.html index a6c5ba5..f8b413ed 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-clears-autoplaying-flag.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-clears-autoplaying-flag.html
@@ -2,7 +2,6 @@ <title>autoplay clears the autoplaying flag</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) {
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-document-move.html b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html index cd55571..8047a64 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-document-move.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html
@@ -2,12 +2,11 @@ <title>Moving media element to other document to bypass autoplay</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> function createAndMoveVideo() { var v = document.implementation.createHTMLDocument().createElement('video'); - v.src = findMediaFile('video', 'content/test'); + v.src = 'content/test.ogv'; document.body.appendChild(v); return v; }
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html b/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html index 41031e0..2e653ba 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html
@@ -2,7 +2,6 @@ <title>Test for autoplay of video once the media stream is set to null</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> test(function() { assert_true(!!window.internals && !!window.internals.settings, @@ -17,7 +16,7 @@ setTimeout(t.step_func(function() { v.srcObject = null; - v.src = findMediaFile('video', 'content/test'); + v.src = 'content/test.ogv'; v.play() .then(t.unreached_func('The video must not play without user gesture.'))
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted-conditions.html b/third_party/WebKit/LayoutTests/media/autoplay-muted-conditions.html index 8a0e837..16596495 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-muted-conditions.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted-conditions.html
@@ -2,7 +2,6 @@ <title>Test autoplay muted behaviour in various system conditions.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body></body> <script> var tests = [ @@ -128,7 +127,7 @@ }); media.muted = true; - media.src = findMediaFile('video', 'content/test'); + media.src = 'content/test.ogv'; if (type == 'attribute') media.autoplay = true;
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-off.html b/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-off.html index 6a71af3..483cd09 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-off.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-off.html
@@ -4,8 +4,7 @@ <title>Test muted autoplay videos interaction with data saver on</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> -</head> + </head> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -15,7 +14,7 @@ promise_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; return video.play(); });
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html b/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html index b72990d..23be1ac 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html
@@ -4,8 +4,7 @@ <title>Test muted autoplay videos interaction with data saver on</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> -</head> + </head> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -15,7 +14,7 @@ promise_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; return promise_rejects(t, new DOMException('play() can only be initiated by a user gesture.',
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted.html b/third_party/WebKit/LayoutTests/media/autoplay-muted.html index 424de18..cc5fdaf 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-muted.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted.html
@@ -2,7 +2,6 @@ <title>Test for autoplay of muted video</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <body> <script> @@ -20,7 +19,7 @@ function createMutedMediaElement(type) { var e = document.createElement(type); - e.src = findMediaFile(type, 'content/test'); + e.src = type == 'audio' ? 'content/test.oga' : 'content/test.ogv'; e.muted = true; return e; }
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html b/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html index 0cc7239..3765e05 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html
@@ -2,7 +2,6 @@ <title>Test behaviour of autoplay muted videos with regards to visibility</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -13,7 +12,7 @@ { var video = document.createElement('video'); video.id = 'offscreen'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true;
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-non-whitelisted-scope.html b/third_party/WebKit/LayoutTests/media/autoplay-non-whitelisted-scope.html index d98b9b9d..322f344 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-non-whitelisted-scope.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-non-whitelisted-scope.html
@@ -2,7 +2,6 @@ <title>Test for autoplay of whitelisted frames</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <body> <script> @@ -21,7 +20,7 @@ function createMediaElement(type) { var e = document.createElement(type); - e.src = findMediaFile(type, 'content/test'); + e.src = type == 'audio' ? 'content/test.oga' : 'content/test.ogv'; return e; }
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html b/third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html index 56b1a74..df248c60 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html
@@ -2,7 +2,6 @@ <title>Test that unmuting offscreen video will not allow it to autoplay</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -13,7 +12,7 @@ { var video = document.createElement('video'); video.id = 'offscreen-unmute'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true; @@ -26,7 +25,7 @@ { var video = document.createElement('video'); video.id = 'offscreen-mute'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true;
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-when-visible-multiple-times.html b/third_party/WebKit/LayoutTests/media/autoplay-when-visible-multiple-times.html index 7da22941..c54d48e 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-when-visible-multiple-times.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-when-visible-multiple-times.html
@@ -2,7 +2,6 @@ <title>Test behaviour of autoplay muted videos with regards to visibility</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -39,7 +38,7 @@ // Create a video off screen. { video = document.createElement('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true;
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-when-visible.html b/third_party/WebKit/LayoutTests/media/autoplay-when-visible.html index fadc38b..116a624b 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-when-visible.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-when-visible.html
@@ -2,7 +2,6 @@ <title>Test behaviour of autoplay muted videos with regards to visibility</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); @@ -13,7 +12,7 @@ { var video = document.createElement('video'); video.id = 'offscreen'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true; @@ -26,7 +25,7 @@ { var video = document.createElement('video'); video.id = 'inscreen'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.autoplay = true; video.loop = true; @@ -36,7 +35,7 @@ // Create an audio in screen. { var audio = document.createElement('audio'); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; audio.muted = true; audio.autoplay = true; audio.loop = true; @@ -48,7 +47,7 @@ { var video = document.createElement('video'); video.id = 'offscreen-no-autoplay'; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.muted = true; video.loop = true; video.style.position = 'absolute';
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-whitelisted-scope.html b/third_party/WebKit/LayoutTests/media/autoplay-whitelisted-scope.html index e0817e9..849625e 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-whitelisted-scope.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-whitelisted-scope.html
@@ -2,7 +2,6 @@ <title>Test for autoplay of whitelisted frames</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <body> <script> @@ -22,7 +21,7 @@ function createMediaElement(type) { var e = document.createElement(type); - e.src = findMediaFile(type, 'content/test'); + e.src = type == 'audio' ? 'content/test.oga' : 'content/test.ogv'; return e; }
diff --git a/third_party/WebKit/LayoutTests/media/autoplay-with-preload-none.html b/third_party/WebKit/LayoutTests/media/autoplay-with-preload-none.html index 3ce0437..cc48eb7 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay-with-preload-none.html +++ b/third_party/WebKit/LayoutTests/media/autoplay-with-preload-none.html
@@ -2,7 +2,6 @@ <title>autoplay with preload set to none.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> function autoplay_test(tagName, src) { @@ -30,6 +29,6 @@ }, tagName + '.autoplay with preload="none"'); } -autoplay_test('audio', findMediaFile('audio', 'content/test')); -autoplay_test('video', findMediaFile('video', 'content/test')); +autoplay_test('audio', 'content/test.oga'); +autoplay_test('video', 'content/test.ogv'); </script>
diff --git a/third_party/WebKit/LayoutTests/media/autoplay.html b/third_party/WebKit/LayoutTests/media/autoplay.html index 5fc5231..3dbd455 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay.html +++ b/third_party/WebKit/LayoutTests/media/autoplay.html
@@ -3,7 +3,6 @@ <title>autoplay</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> function autoplay_test(tagName, src) { @@ -30,6 +29,6 @@ }, tagName + '.autoplay'); } -autoplay_test('audio', findMediaFile('audio', 'content/test')); -autoplay_test('video', findMediaFile('video', 'content/test')); +autoplay_test('audio', 'content/test.oga'); +autoplay_test('video', 'content/test.ogv'); </script>
diff --git a/third_party/WebKit/LayoutTests/media/autoplay/document-user-activation.html b/third_party/WebKit/LayoutTests/media/autoplay/document-user-activation.html index e6de7b4..16635b4 100644 --- a/third_party/WebKit/LayoutTests/media/autoplay/document-user-activation.html +++ b/third_party/WebKit/LayoutTests/media/autoplay/document-user-activation.html
@@ -2,7 +2,6 @@ <title>Test document user gesture autoplay policy</title> <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> -<script src='../media-file.js'></script> <body> <div id='target'>target</div> </body> @@ -15,7 +14,7 @@ window.internals.settings.setAutoplayPolicy('document-user-activation-required'); var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; return promise_rejects(t, 'NotAllowedError', video.play()); }, 'Not allowed to autoplay without some sort of user gesture'); @@ -29,7 +28,7 @@ eventSender.keyDown('a'); var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; return video.play(); }, 'Allowed to autoplay if the document received a key event'); @@ -51,7 +50,7 @@ }]); var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; return video.play(); }, 'Allowed to autoplay if the document received a click'); @@ -79,7 +78,7 @@ }]); var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; return video.play(); }, 'Allowed to autoplay if the document received a tap'); @@ -109,7 +108,7 @@ var video = document.implementation.createHTMLDocument().createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; document.body.appendChild(video); // Moved to `window.document`. document.body.removeChild(video); // To avoid polluting the DOM. return video.play(); @@ -138,7 +137,7 @@ }]); var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.play().then(resolve, reject); });
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/addtrack.html b/third_party/WebKit/LayoutTests/media/avtrack/addtrack.html index f8e8e078..1c97501 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/addtrack.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/addtrack.html
@@ -4,8 +4,7 @@ <title>AudioTrackList & VideoTrackList addtrack event</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> function addtrack_test(tagName, src, label) @@ -54,10 +53,10 @@ }, tagName + " : " + label); } - addtrack_test("audio", findMediaFile("audio", "../content/test"), "audio-only"); - addtrack_test("audio", findMediaFile("video", "../content/test"), "audio-video"); - addtrack_test("video", findMediaFile("audio", "../content/test"), "audio-only"); - addtrack_test("video", findMediaFile("video", "../content/test"), "audio-video"); + addtrack_test("audio", "../content/test.oga", "audio-only"); + addtrack_test("audio", "../content/test.ogv", "audio-video"); + addtrack_test("video", "../content/test.oga", "audio-only"); + addtrack_test("video", "../content/test.ogv", "audio-video"); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/audio-track-enabled.html b/third_party/WebKit/LayoutTests/media/avtrack/audio-track-enabled.html index 6244af4a..664bbaa 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/audio-track-enabled.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/audio-track-enabled.html
@@ -4,14 +4,13 @@ <title>AudioTrack.enabled change</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) { var audio = document.createElement("audio"); - audio.src = findMediaFile("audio", "../content/test"); + audio.src = "../content/test.oga"; audio.onloadedmetadata = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/audio-track-properties.html b/third_party/WebKit/LayoutTests/media/avtrack/audio-track-properties.html index 909849b..c9aa26a 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/audio-track-properties.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/audio-track-properties.html
@@ -4,8 +4,7 @@ <title>AudioTrack properties read from input stream metadata</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t)
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/forget-on-load.html b/third_party/WebKit/LayoutTests/media/avtrack/forget-on-load.html index 700a472c..b902566a 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/forget-on-load.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/forget-on-load.html
@@ -4,14 +4,13 @@ <title>AudioTrackList & VideoTrackList after load()</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) { var video = document.createElement("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.addEventListener("loadedmetadata", t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/gc.html b/third_party/WebKit/LayoutTests/media/avtrack/gc.html index 154773c..e31b4e57 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/gc.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/gc.html
@@ -4,14 +4,13 @@ <title>AudioTrack & VideoTrack garbage collection</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addEventListener('loadedmetadata', t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/getTrackById.html b/third_party/WebKit/LayoutTests/media/avtrack/getTrackById.html index 5b52128..6c59ccd5 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/getTrackById.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/getTrackById.html
@@ -4,8 +4,7 @@ <title>AudioTrackList & VideoTrackList.getTrackById</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) @@ -18,7 +17,7 @@ assert_equals(video.videoTracks.length, 0); assert_equals(video.videoTracks.getTrackById(''), null); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addEventListener('loadedmetadata', t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/track-switching.html b/third_party/WebKit/LayoutTests/media/avtrack/track-switching.html index 88f6f1a8..bf577fd5 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/track-switching.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/track-switching.html
@@ -4,8 +4,7 @@ <title>Media track switching during playback</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t)
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/video-track-properties.html b/third_party/WebKit/LayoutTests/media/avtrack/video-track-properties.html index 01e45c94..e965134 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/video-track-properties.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/video-track-properties.html
@@ -4,8 +4,7 @@ <title>VideoTrack properties read from input stream metadata</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t)
diff --git a/third_party/WebKit/LayoutTests/media/avtrack/video-track-selected.html b/third_party/WebKit/LayoutTests/media/avtrack/video-track-selected.html index 6e7ef4c..9ec3c5c3 100644 --- a/third_party/WebKit/LayoutTests/media/avtrack/video-track-selected.html +++ b/third_party/WebKit/LayoutTests/media/avtrack/video-track-selected.html
@@ -4,14 +4,13 @@ <title>VideoTrack.selected change</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) { var video = document.createElement("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onloadedmetadata = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/broken-video.html b/third_party/WebKit/LayoutTests/media/broken-video.html index 3c477ef..638b9b0b 100644 --- a/third_party/WebKit/LayoutTests/media/broken-video.html +++ b/third_party/WebKit/LayoutTests/media/broken-video.html
@@ -1,13 +1,12 @@ <!DOCTYPE HTML> <title>Test that an invalid video file generates a MEDIA_ERR_SRC_NOT_SUPPORTED error and sets networkState to NETWORK_NO_SOURCE.</title> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/garbage"); + video.src = "content/garbage.ogv"; video.onerror = t.step_func_done(function () { assert_true(video.error instanceof MediaError); assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
diff --git a/third_party/WebKit/LayoutTests/media/color-profile-video-seek-filter.html b/third_party/WebKit/LayoutTests/media/color-profile-video-seek-filter.html index 8267d19..806fb957 100644 --- a/third_party/WebKit/LayoutTests/media/color-profile-video-seek-filter.html +++ b/third_party/WebKit/LayoutTests/media/color-profile-video-seek-filter.html
@@ -38,7 +38,7 @@ video.pause(); }, false); - setSrcByTagName('video', findMediaFile('video', 'content/test')); + setSrcByTagName('video', 'content/test.ogv'); seek(video, 1.0); };
diff --git a/third_party/WebKit/LayoutTests/media/color-profile-video-seek-object-fit.html b/third_party/WebKit/LayoutTests/media/color-profile-video-seek-object-fit.html index c32de0c..57f98b9 100644 --- a/third_party/WebKit/LayoutTests/media/color-profile-video-seek-object-fit.html +++ b/third_party/WebKit/LayoutTests/media/color-profile-video-seek-object-fit.html
@@ -37,7 +37,7 @@ video.pause(); }, false); - setSrcByTagName('video', findMediaFile('video', 'content/test')); + setSrcByTagName('video', 'content/test.ogv'); seek(video, 3.8); };
diff --git a/third_party/WebKit/LayoutTests/media/color-profile-video-seek.html b/third_party/WebKit/LayoutTests/media/color-profile-video-seek.html index f22af0e..f97fb38 100644 --- a/third_party/WebKit/LayoutTests/media/color-profile-video-seek.html +++ b/third_party/WebKit/LayoutTests/media/color-profile-video-seek.html
@@ -32,7 +32,7 @@ video.pause(); }, false); - setSrcByTagName('video', findMediaFile('video', 'content/test')); + setSrcByTagName('video', 'content/test.ogv'); seek(video, 3.8); };
diff --git a/third_party/WebKit/LayoutTests/media/color-profile-video.html b/third_party/WebKit/LayoutTests/media/color-profile-video.html index d3d1ab2..dcc2a780 100644 --- a/third_party/WebKit/LayoutTests/media/color-profile-video.html +++ b/third_party/WebKit/LayoutTests/media/color-profile-video.html
@@ -35,7 +35,7 @@ }; } - setSrcByTagName('video', findMediaFile('video', 'content/test')); + setSrcByTagName('video', 'content/test.ogv'); }; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/content/test-par-16-9.mp4 b/third_party/WebKit/LayoutTests/media/content/test-par-16-9.mp4 deleted file mode 100644 index a0223dc00..0000000 --- a/third_party/WebKit/LayoutTests/media/content/test-par-16-9.mp4 +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/media/content/test_yuv420.mp4 b/third_party/WebKit/LayoutTests/media/content/test_yuv420.mp4 deleted file mode 100644 index 86ce14e..0000000 --- a/third_party/WebKit/LayoutTests/media/content/test_yuv420.mp4 +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/media/content/test_yuv422.mp4 b/third_party/WebKit/LayoutTests/media/content/test_yuv422.mp4 deleted file mode 100644 index f211e0a..0000000 --- a/third_party/WebKit/LayoutTests/media/content/test_yuv422.mp4 +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/media/controls-after-reload.html b/third_party/WebKit/LayoutTests/media/controls-after-reload.html index 172306f..453573ab 100644 --- a/third_party/WebKit/LayoutTests/media/controls-after-reload.html +++ b/third_party/WebKit/LayoutTests/media/controls-after-reload.html
@@ -29,7 +29,7 @@ { video.removeEventListener("canplaythrough", canplaythrough); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.addEventListener("playing", playing); video.play(); } @@ -38,8 +38,8 @@ { video = document.getElementsByTagName('video')[0]; video.addEventListener("canplaythrough", canplaythrough); - - video.src = findMediaFile("video", "content/counting"); + + video.src = "content/counting.ogv"; } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/media/controls-css-overload.html b/third_party/WebKit/LayoutTests/media/controls-css-overload.html index 2a9f63c0..557efe5 100644 --- a/third_party/WebKit/LayoutTests/media/controls-css-overload.html +++ b/third_party/WebKit/LayoutTests/media/controls-css-overload.html
@@ -2,7 +2,6 @@ <title>Testing that overloading some controls doesn't crash the browser</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <style> .nocontrols::-webkit-media-controls-panel { display:none;
diff --git a/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering-expected-mismatch.html b/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering-expected-mismatch.html index 85a48b4..e942443 100644 --- a/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering-expected-mismatch.html +++ b/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering-expected-mismatch.html
@@ -12,7 +12,7 @@ testRunner.waitUntilDone(); var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.addEventListener("loadeddata", function() { if (window.eventSender) {
diff --git a/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering.html b/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering.html index 135ff577..9c53639 100644 --- a/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering.html +++ b/third_party/WebKit/LayoutTests/media/controls-drag-timebar-rendering.html
@@ -12,7 +12,7 @@ testRunner.waitUntilDone(); var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.addEventListener("loadeddata", function() { video.play();
diff --git a/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html b/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html index 33ca8a60..91882047 100644 --- a/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html +++ b/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html
@@ -2,7 +2,6 @@ <title>Test that dragging the timebar thumb causes seeks.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -14,7 +13,7 @@ var video = document.querySelector("video"); video.onplaying = t.step_func(playing); video.onseeked = t.step_func(seeked); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); function playing() {
diff --git a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html b/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html index a4ac8c22..8116ffa 100644 --- a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html
@@ -13,7 +13,7 @@ testRunner.waitUntilDone(); function test() { - var src = findMediaFile("audio", "content/empty"); + var src = "content/empty.oga"; document.getElementById("audio1").src = src; runAfterLayoutAndPaint(function() {
diff --git a/third_party/WebKit/LayoutTests/media/controls-right-click-on-timebar.html b/third_party/WebKit/LayoutTests/media/controls-right-click-on-timebar.html index 39cd50f..2eb4bf2 100644 --- a/third_party/WebKit/LayoutTests/media/controls-right-click-on-timebar.html +++ b/third_party/WebKit/LayoutTests/media/controls-right-click-on-timebar.html
@@ -2,7 +2,6 @@ <title>Test that right clicking on the timebar does not cause a seek.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -16,7 +15,7 @@ video.onseeked = t.unreached_func(); video.autoplay = true; - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; function click() { var seekCoords = mediaControlsButtonCoordinates(video, "timeline");
diff --git a/third_party/WebKit/LayoutTests/media/controls-strict.html b/third_party/WebKit/LayoutTests/media/controls-strict.html index de5b4de..4ab66b6 100644 --- a/third_party/WebKit/LayoutTests/media/controls-strict.html +++ b/third_party/WebKit/LayoutTests/media/controls-strict.html
@@ -4,7 +4,7 @@ <script src="media-file.js"></script> <script src="video-paint-test.js"></script> </head> - <body onload="setSrcByTagName('video', findMediaFile('video', 'content/test')); init()"> + <body onload="setSrcByTagName('video', 'content/test.ogv'); init()"> <p>Drawing the controls in strict mode.</p> <video controls></video> </body>
diff --git a/third_party/WebKit/LayoutTests/media/controls-styling-strict.html b/third_party/WebKit/LayoutTests/media/controls-styling-strict.html index ecc188d..03a1bf06 100644 --- a/third_party/WebKit/LayoutTests/media/controls-styling-strict.html +++ b/third_party/WebKit/LayoutTests/media/controls-styling-strict.html
@@ -10,7 +10,7 @@ } </style> </head> - <body onload="setSrcByTagName('video', findMediaFile('video', 'content/test')); init();"> + <body onload="setSrcByTagName('video', 'content/test.ogv'); init();"> <p>The look of the controls should not change when styled under strict mode.</p> <video controls></video> <video controls></video>
diff --git a/third_party/WebKit/LayoutTests/media/controls-styling.html b/third_party/WebKit/LayoutTests/media/controls-styling.html index 453ae46..6dd98ab2 100644 --- a/third_party/WebKit/LayoutTests/media/controls-styling.html +++ b/third_party/WebKit/LayoutTests/media/controls-styling.html
@@ -15,7 +15,7 @@ } </style> </head> -<body onload="setSrcByTagName('video', findMediaFile('video', 'content/test')); init()"> +<body onload="setSrcByTagName('video', 'content/test.ogv'); init()"> <p>The look of the controls should not change.</p> <div class="override"> <video controls></video>
diff --git a/third_party/WebKit/LayoutTests/media/controls-timeline.html b/third_party/WebKit/LayoutTests/media/controls-timeline.html index 85bdc617..2556b649 100644 --- a/third_party/WebKit/LayoutTests/media/controls-timeline.html +++ b/third_party/WebKit/LayoutTests/media/controls-timeline.html
@@ -2,13 +2,12 @@ <title>Test seeking on the media controls timeline</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onloadedmetadata = t.step_func_done(function() { assert_equals(video.currentTime, 0);
diff --git a/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html b/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html index 187b9f0c..cd91b0c 100644 --- a/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html +++ b/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html
@@ -2,13 +2,12 @@ <title>Test media controls volume slider keyboard navigation</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <audio controls></audio> <script> async_test(function(t) { var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; assert_equals(audio.volume, 1); audio.onloadedmetadata = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html b/third_party/WebKit/LayoutTests/media/controls-volume-slider.html index 8b2f9408..aa88176 100644 --- a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html +++ b/third_party/WebKit/LayoutTests/media/controls-volume-slider.html
@@ -2,13 +2,12 @@ <title>media controls volume slider</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <audio controls></audio> <script> async_test(function(t) { var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; assert_equals(audio.volume, 1); audio.onloadedmetadata = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/controls-without-preload.html b/third_party/WebKit/LayoutTests/media/controls-without-preload.html index f90ffa6..d5265ae 100644 --- a/third_party/WebKit/LayoutTests/media/controls-without-preload.html +++ b/third_party/WebKit/LayoutTests/media/controls-without-preload.html
@@ -9,7 +9,7 @@ function start() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); video = document.getElementsByTagName('video')[0]; video.load(); video.play();
diff --git a/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset-expected.html b/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset-expected.html index a5925bb..cfe386e4 100644 --- a/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset-expected.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <html> -<script src="../media-file.js"></script> <video controls width=400> <track kind=subtitles src=fake-en-sub.vtt srclang=en label=English> <track kind=subtitles src=fake-fr-sub.vtt srclang=fr label=French> </video> <script> var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset.html b/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset.html index a08cd65..bc27d11 100644 --- a/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset.html +++ b/third_party/WebKit/LayoutTests/media/controls/buttons-after-reset.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that resetting the controls after load is a no-op.</title> -<script src="../media-file.js"></script> <video controls width=400> <track kind=subtitles src=fake-en-sub.vtt srclang=en label=English> <track kind=subtitles src=fake-fr-sub.vtt srclang=fr label=French> @@ -11,7 +10,7 @@ testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addEventListener('loadedmetadata', () => { video.controls = false; testRunner.layoutAndPaintAsyncThen(() => {
diff --git a/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible-expected.html b/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible-expected.html index b625f0e..be96cc9 100644 --- a/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible-expected.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Captions menu always visible - expected</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <style> video { @@ -15,7 +14,7 @@ testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addTextTrack('captions', 'foo'); video.addTextTrack('captions', 'bar');
diff --git a/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible.html b/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible.html index 69df936..24d9ab2 100644 --- a/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible.html +++ b/third_party/WebKit/LayoutTests/media/controls/captions-menu-always-visible.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Captions menu always visible</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <style> .container { @@ -18,7 +17,7 @@ testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addTextTrack('captions', 'foo'); video.addTextTrack('captions', 'bar');
diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-dynamic-update.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-dynamic-update.html index dc9d80d2..d4c10baa 100644 --- a/third_party/WebKit/LayoutTests/media/controls/closed-captions-dynamic-update.html +++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-dynamic-update.html
@@ -2,7 +2,6 @@ <title>Tests that the closed captions button enables track switching.</title> <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> -<script src='../media-file.js'></script> <script src='../media-controls.js'></script> <video controls> <track src='../track/captions-webvtt/captions-fast.vtt' kind='captions'> @@ -67,6 +66,6 @@ clickTextTrackAtIndex(video, 0); }); - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html index 8558d03..c9d72bb 100644 --- a/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html +++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html
@@ -3,7 +3,6 @@ <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> <script src='../media-controls.js'></script> -<script src='../media-file.js'></script> <video controls></video> <script> async_test(t => { @@ -45,6 +44,6 @@ })); }); - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-single-track.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-single-track.html index 554c76fb..77ee734 100644 --- a/third_party/WebKit/LayoutTests/media/controls/closed-captions-single-track.html +++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-single-track.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls></video> <script> async_test(t => { @@ -48,6 +47,6 @@ })); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html index 2915e3f3..b46f7b45 100644 --- a/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html +++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html
@@ -2,7 +2,6 @@ <title>Test that we can add multiple tracks and select between them from the track selection menu.</title> <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> -<script src='../media-file.js'></script> <script src='../media-controls.js'></script> <!-- Width should be large enough to display closed captions button. --> <video controls style='width: 500px'></video> @@ -38,6 +37,6 @@ })); }); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-low-end-device.html b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-low-end-device.html index a21dd2ba..889fc4d 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-low-end-device.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-low-end-device.html
@@ -2,7 +2,6 @@ <title>media controls cast button low end device</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../remoteplayback/util.js"></script> <video width="500"></video> @@ -23,6 +22,6 @@ assert_true(isVisible(castButton(video))); }); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-narrow.html b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-narrow.html index 34cd5310..4caab982 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-narrow.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button-narrow.html
@@ -2,13 +2,12 @@ <title>media controls cast button</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video width="100" height="200" controls></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onloadedmetadata = t.step_func(function() { // Pretend we have a cast device
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button.html b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button.html index e3c8a1c..2d74dd26 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-cast-button.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-cast-button.html
@@ -2,13 +2,12 @@ <title>media controls cast button</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls width="500"></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onloadedmetadata = t.step_func_done(function() { // Should not have a cast button by default
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-cast-do-not-fade-out.html b/third_party/WebKit/LayoutTests/media/controls/controls-cast-do-not-fade-out.html index ffdcd72..91da5e2 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-cast-do-not-fade-out.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-cast-do-not-fade-out.html
@@ -2,13 +2,12 @@ <title>This tests that controls do not fade out when the video is playing remotely.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls loop></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onplaying = t.step_func(function() { internals.mediaPlayerPlayingRemotelyChanged(video, true);
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-cast-overlay-slow-fade.html b/third_party/WebKit/LayoutTests/media/controls/controls-cast-overlay-slow-fade.html index 0b065a0..bf596d1 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-cast-overlay-slow-fade.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-cast-overlay-slow-fade.html
@@ -2,7 +2,6 @@ <title>Test that the overlay cast button fades at the right time (neither too soon nor too late).</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video loop></video> <script> @@ -12,7 +11,7 @@ var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500; var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onplaying = t.step_func(function() { setTimeout(t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button-autoplay-muted.html b/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button-autoplay-muted.html index b3be3ac..eb69dea 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button-autoplay-muted.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button-autoplay-muted.html
@@ -2,7 +2,6 @@ <title>media controls overlay cast button for autoplay muted element</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <body></body> <script> @@ -20,7 +19,7 @@ var video = document.createElement("video"); video.muted = true; video.autoplay = true; - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onloadedmetadata = t.step_func_done(function() { // Pretend we have a cast device
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button.html b/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button.html index 92b09e0..dbc8311 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-overlay-cast-button.html
@@ -2,13 +2,12 @@ <title>media controls cast button</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onloadedmetadata = t.step_func_done(function() { // Should not have a cast button by default
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-in.html b/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-in.html index d9d2031..8680352 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-in.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-in.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that media controls are painted corrected when using page zoom.</title> -<script src="../media-file.js"></script> <video controls width="400"></video> <script> var video = document.querySelector('video'); @@ -23,7 +22,7 @@ testRunner.notifyDone(); }; - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-out.html b/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-out.html index 0c81325..3adbd69 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-out.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-page-zoom-out.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that media controls are painted corrected when using page zoom.</title> -<script src="../media-file.js"></script> <video controls width="400"></video> <script> var video = document.querySelector('video'); @@ -23,7 +22,7 @@ testRunner.notifyDone(); }; - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html index fe078711..70404f1 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html
@@ -2,7 +2,6 @@ <title>Test media controls video keyboard navigation</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video></video> <script> @@ -12,7 +11,7 @@ async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; assert_equals(video.volume, 1); assert_equals(video.currentTime, 0);
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-space-vol.html b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-space-vol.html index f958d3c..17bdadf 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-space-vol.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-space-vol.html
@@ -2,7 +2,6 @@ <title>Test media controls video keyboard navigation for volume and space bar</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls></video> <script> @@ -12,7 +11,7 @@ async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; assert_equals(video.volume, 1); assert_equals(video.currentTime, 0);
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav.html b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav.html index f93eee4..6e6a9e1 100644 --- a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav.html +++ b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav.html
@@ -2,7 +2,6 @@ <title>Test media controls video keyboard navigation</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls></video> <script> @@ -12,7 +11,7 @@ async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; assert_equals(video.volume, 1); assert_equals(video.currentTime, 0);
diff --git a/third_party/WebKit/LayoutTests/media/controls/download-button-displays-with-preload-none.html b/third_party/WebKit/LayoutTests/media/controls/download-button-displays-with-preload-none.html index 89aaad2..85d9ce6a 100644 --- a/third_party/WebKit/LayoutTests/media/controls/download-button-displays-with-preload-none.html +++ b/third_party/WebKit/LayoutTests/media/controls/download-button-displays-with-preload-none.html
@@ -2,7 +2,6 @@ <title>media controls download button preload none</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls preload="none" src="https://someexample.example/example.mp4"></video> <script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/lazy-loaded-style.html b/third_party/WebKit/LayoutTests/media/controls/lazy-loaded-style.html index cde9cf71..e3839ef3 100644 --- a/third_party/WebKit/LayoutTests/media/controls/lazy-loaded-style.html +++ b/third_party/WebKit/LayoutTests/media/controls/lazy-loaded-style.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that media controls are styled correctly if lazy loaded.</title> -<script src="../media-file.js"></script> <video width="400"></video> <script> var video = document.querySelector('video'); @@ -16,7 +15,7 @@ testRunner.notifyDone(); }; - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/overflow-fully-hidden.html b/third_party/WebKit/LayoutTests/media/controls/overflow-fully-hidden.html index 454a7bd..6c3ba5b 100644 --- a/third_party/WebKit/LayoutTests/media/controls/overflow-fully-hidden.html +++ b/third_party/WebKit/LayoutTests/media/controls/overflow-fully-hidden.html
@@ -9,7 +9,6 @@ <meta name='viewport' content='width=800'> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> </head> <style> @@ -27,7 +26,7 @@ test(_ => { var videos = document.querySelectorAll('video'); for (var video, i = 0; video = videos[i]; ++i) { - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; } var forceLayout = document.body.offsetHeight;
diff --git a/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible-expected.html b/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible-expected.html index 27958cc..b06e48a 100644 --- a/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible-expected.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Overflow menu always visible - expected</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <style> video { @@ -15,7 +14,7 @@ testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addTextTrack('captions', 'foo'); video.addTextTrack('captions', 'bar');
diff --git a/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible.html b/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible.html index 317789a..2dad67e 100644 --- a/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible.html +++ b/third_party/WebKit/LayoutTests/media/controls/overflow-menu-always-visible.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Overflow menu always visible</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <style> .container { @@ -18,7 +17,7 @@ testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.addTextTrack('captions', 'foo'); video.addTextTrack('captions', 'bar');
diff --git a/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-document-move.html b/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-document-move.html index 955b89c..cacba37 100644 --- a/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-document-move.html +++ b/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-document-move.html
@@ -2,7 +2,6 @@ <title>media controls overlay play button document move</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="overlay-play-button.js"></script> <body> @@ -46,7 +45,7 @@ function createAndMoveVideo() { var doc = document.implementation.createHTMLDocument(); var v = doc.createElement('video'); - v.src = findMediaFile('video', '../content/test'); + v.src = '../content/test.ogv'; v.width = NORMAL_VIDEO_WIDTH; v.height = NORMAL_VIDEO_HEIGHT; v.controls = true;
diff --git a/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-narrow.html b/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-narrow.html index 77e37c4a..248a6a4 100644 --- a/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-narrow.html +++ b/third_party/WebKit/LayoutTests/media/controls/overlay-play-button-narrow.html
@@ -2,7 +2,6 @@ <title>media controls overlay play button narrow</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="overlay-play-button.js"></script> <body> @@ -13,7 +12,7 @@ enableOverlayPlayButtonForTest(t); var video = document.createElement('video'); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.width = NORMAL_VIDEO_WIDTH; video.height = NORMAL_VIDEO_HEIGHT; video.controls = true;
diff --git a/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none-custom-bg.html b/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none-custom-bg.html index 91fb833..470ca1b 100644 --- a/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none-custom-bg.html +++ b/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none-custom-bg.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that player controls are painted correctly with -webkit-appearance: none; and a custom background.</title> -<script src="../media-file.js"></script> <style> video::-webkit-media-controls-play-button { -webkit-appearance: none; @@ -11,6 +10,6 @@ <video controls width=400></video> <script> var video = document.querySelector('video'); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none.html b/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none.html index 6772d54b..9cfb85a 100644 --- a/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none.html +++ b/third_party/WebKit/LayoutTests/media/controls/paint-controls-webkit-appearance-none.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>Test that player controls are painted correctly with -webkit-appearance: none;</title> -<script src="../media-file.js"></script> <style> video::-webkit-media-controls-play-button { -webkit-appearance: none; @@ -10,6 +9,6 @@ <video controls width=400></video> <script> var video = document.querySelector('video'); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize-expected.html b/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize-expected.html index 4abf143574..9e802941 100644 --- a/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize-expected.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the controls repaint correctly on resize.</title> -<script src="../media-file.js"></script> <video controls width=300></video> <script> var video = document.querySelector("video"); @@ -15,5 +14,5 @@ testRunner.notifyDone(); }; -video.src = findMediaFile("video", "../content/test"); +video.src = "../content/test.ogv"; </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize.html b/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize.html index 42abd59..89ee113 100644 --- a/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize.html +++ b/third_party/WebKit/LayoutTests/media/controls/repaint-on-resize.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the controls repaint correctly on resize.</title> -<script src="../media-file.js"></script> <video controls width=200></video> <script> var video = document.querySelector("video"); @@ -16,5 +15,5 @@ testRunner.notifyDone(); }; -video.src = findMediaFile("video", "../content/test"); +video.src = "../content/test.ogv"; </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/rotated-video-has-right-panel-width.html b/third_party/WebKit/LayoutTests/media/controls/rotated-video-has-right-panel-width.html index dc67bf1..53ee59c 100644 --- a/third_party/WebKit/LayoutTests/media/controls/rotated-video-has-right-panel-width.html +++ b/third_party/WebKit/LayoutTests/media/controls/rotated-video-has-right-panel-width.html
@@ -9,7 +9,6 @@ <meta name='viewport' content='width=800'> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> </head> <style> @@ -35,7 +34,7 @@ var videos = document.querySelectorAll('video'); for (var i=0; i < videos.length; ++i) { - videos[i].src = findMediaFile('video', 'content/test'); + videos[i].src = 'content/test.ogv'; } var forceLayout = document.body.offsetHeight;
diff --git a/third_party/WebKit/LayoutTests/media/controls/settings-disable-controls.html b/third_party/WebKit/LayoutTests/media/controls/settings-disable-controls.html index 2aac53bc..d753eb1 100644 --- a/third_party/WebKit/LayoutTests/media/controls/settings-disable-controls.html +++ b/third_party/WebKit/LayoutTests/media/controls/settings-disable-controls.html
@@ -2,7 +2,6 @@ <title>Test that 'mediaControlsEnabled' properly toggles the native controls</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls></video> <script> @@ -36,6 +35,6 @@ })); })); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/time-update-after-unload.html b/third_party/WebKit/LayoutTests/media/controls/time-update-after-unload.html index f1ec7d33..5e6e5607 100644 --- a/third_party/WebKit/LayoutTests/media/controls/time-update-after-unload.html +++ b/third_party/WebKit/LayoutTests/media/controls/time-update-after-unload.html
@@ -1,14 +1,13 @@ <!DOCTYPE html> <html> <title>This tests that the controls' current time is updated after media is unloaded</title> -<script src='../media-file.js'></script> <video controls></video> <script> if (window.testRunner) testRunner.waitUntilDone(); var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; // Get the video into a playing state at currentTime > 0. video.autoplay = true;
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-frame.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-frame.html index 535d211..daa8dec 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-frame.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-frame.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400 preload=auto></video> <script> async_test(t => { @@ -16,7 +15,7 @@ checkControlsClassName(video, 'phase-ready state-stopped'); }); - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-image.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-image.html index a9cee03..a9bba34 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-image.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-poster-image.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400 preload=auto poster="../content/greenbox.png"></video> <script> async_test(t => { @@ -16,7 +15,7 @@ checkControlsClassName(video, 'phase-ready state-stopped'); }); - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-cast.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-cast.html index ee37a61..ac71d8ab 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-cast.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-cast.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -20,7 +19,7 @@ checkButtonHasClass(castButton(video), 'on'); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.play(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-fullscreen.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-fullscreen.html index ea43064..b421e6b 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-fullscreen.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-fullscreen.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -23,7 +22,7 @@ clickAtCoordinates(1, 1); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.play(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-mute.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-mute.html index 368e445..cc31a91 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-mute.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-mute.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => {
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-overlay-cast.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-overlay-cast.html index 4cebf33..14b76a4b 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-overlay-cast.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-overlay-cast.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -20,7 +19,7 @@ checkButtonHasClass(overlayCastButton(video), 'on'); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.play(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-pause.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-pause.html index 903f2ab..b288801 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-pause.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-pause.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -15,7 +14,7 @@ video.pause(); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.play().catch(t.step_func_done(_ => { checkButtonHasClass(playButton(video), 'pause'); }));
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-error.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-error.html index f92347d8..578001e 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-error.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-error.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -15,7 +14,7 @@ checkControlsClassName(video, "phase-pre-ready state-no-source use-default-poster"); }); - video.src = findMediaFile("video", "../content/missing"); + video.src = "../content/missing.ogv"; // Catch the error promise. video.play().catch(() => {}); });
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-reset.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-reset.html index 30020bd..f43fa5a 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-reset.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-with-state-source-reset.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400></video> <script> async_test(t => { @@ -25,11 +24,11 @@ video.onpause = t.step_func(() => { checkControlsClassName(video, "phase-ready state-stopped"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); }); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.play(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/toggle-class-without-poster.html b/third_party/WebKit/LayoutTests/media/controls/toggle-class-without-poster.html index 5c3e123..4367906 100644 --- a/third_party/WebKit/LayoutTests/media/controls/toggle-class-without-poster.html +++ b/third_party/WebKit/LayoutTests/media/controls/toggle-class-without-poster.html
@@ -4,7 +4,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <video controls width=400 preload=metadata></video> <script> async_test(t => { @@ -17,7 +16,7 @@ checkControlsClassName(video, 'phase-ready state-stopped use-default-poster'); }); - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-appears-when-expected.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-appears-when-expected.html index 23bae03..d377026 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-appears-when-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-appears-when-expected.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; // At this width, the mute and cast button don't fit. Since we have // two elements that don't fit, the overflow menu should be visible. video.setAttribute("width", "240");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-outside.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-outside.html index 9e4c3c5..b0639f1 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-outside.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-outside.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-panel.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-panel.html index c0f83b12..af446c1e6 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-panel.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click-panel.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.setAttribute("width", "200"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click.html index d6e5a1d..6f3086ed 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-click.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-resize.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-resize.html index f892a7e..954fc4d 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-resize.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-hide-on-resize.html
@@ -9,7 +9,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -22,7 +21,7 @@ // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-text.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-text.html index e6297088..32f3876 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-text.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-text.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; // Add captions var track = video.addTextTrack("captions"); // Pretend we have a cast device
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-visibility.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-visibility.html index 09326a9..9d8b37d35 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-visibility.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-overflow-menu-visibility.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../media-controls.js"></script> -<script src="../media-file.js"></script> <script src="../overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-controls-with-cast-rendering.html b/third_party/WebKit/LayoutTests/media/controls/video-controls-with-cast-rendering.html index 42233d4..dcc23b8 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-controls-with-cast-rendering.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-controls-with-cast-rendering.html
@@ -35,7 +35,7 @@ testRunner.notifyDone(); }); }); - setSrcByTagName('video', findMediaFile('video', '../content/test')); + setSrcByTagName('video', '../content/test.ogv'); </script> </body> </html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html b/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html index 265039f..2352914a 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html
@@ -4,7 +4,6 @@ video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls></video> @@ -80,6 +79,6 @@ }); }); - video.src = findMediaFile("video", "../content/test-25fps"); + video.src = "../content/test-25fps.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html b/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html index a00d0a28..1b89422 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html
@@ -5,7 +5,6 @@ <script src="../../fullscreen/full-screen-test.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video controls></video> @@ -65,6 +64,6 @@ }); }); - video.src = findMediaFile("video", "../content/test-25fps"); + video.src = "../content/test-25fps.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-in-scrollable-iframe-has-full-panel.html b/third_party/WebKit/LayoutTests/media/controls/video-in-scrollable-iframe-has-full-panel.html index 4536a90..79c124f 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-in-scrollable-iframe-has-full-panel.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-in-scrollable-iframe-has-full-panel.html
@@ -4,7 +4,6 @@ <title>Test that overflow-x: hidden with a small viewport doesn't clip the controls when in a scrollable iframe</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> </head> <style> @@ -56,7 +55,7 @@ let videos = iframedoc.querySelectorAll('video'); for (let i=0; i < videos.length; ++i) { - videos[i].src = findMediaFile('video', 'content/test'); + videos[i].src = 'content/test.ogv'; } }
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-dark-rendering.html b/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-dark-rendering.html index adb6744..8920852 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-dark-rendering.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-dark-rendering.html
@@ -35,7 +35,7 @@ testRunner.notifyDone(); }); }); - setSrcByTagName('video', findMediaFile('video', '../content/test')); + setSrcByTagName('video', '../content/test.ogv'); </script> </body> </html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-light-rendering.html b/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-light-rendering.html index 57d06bd..9a7a288 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-light-rendering.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-overlay-cast-light-rendering.html
@@ -35,7 +35,7 @@ testRunner.notifyDone(); }); }); - setSrcByTagName('video', findMediaFile('video', '../content/counting')); + setSrcByTagName('video', '../content/counting.ogv'); </script> </body> </html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/controls/video-overlay-play-button.html b/third_party/WebKit/LayoutTests/media/controls/video-overlay-play-button.html index 9534c57a..a67b93d 100644 --- a/third_party/WebKit/LayoutTests/media/controls/video-overlay-play-button.html +++ b/third_party/WebKit/LayoutTests/media/controls/video-overlay-play-button.html
@@ -2,7 +2,6 @@ <title>Test that the overlay play button respects the controls attribute.</title> <script src='../../resources/testharness.js'></script> <script src='../../resources/testharnessreport.js'></script> -<script src='../media-file.js'></script> <script src='../media-controls.js'></script> <body> <script> @@ -49,6 +48,6 @@ assert_equals(getComputedStyle(button).display, 'flex'); })); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute-expected.html b/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute-expected.html index bbc38a8..1dc96a5 100644 --- a/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute-expected.html
@@ -1,15 +1,14 @@ <!DOCTYPE html> <html> -<script src="../media-file.js"></script> <audio controls></audio> <video controls></video> <script> var audio = document.querySelector('audio') - audio.src = findMediaFile('audio', '../content/test'); + audio.src = '../content/test.oga'; audio.muted = true; var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.muted = true; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute.html b/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute.html index 157aad88..abc11b9 100644 --- a/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute.html +++ b/third_party/WebKit/LayoutTests/media/controls/volumechange-muted-attribute.html
@@ -1,14 +1,13 @@ <!DOCTYPE html> <html> <title>This tests that controls are properly updated when muted content attribute is changed.</title> -<script src="../media-file.js"></script> <audio controls muted></audio> <video controls muted></video> <script> var audio = document.querySelector('audio'); - audio.src = findMediaFile('audio', '../content/test'); + audio.src = '../content/test.oga'; var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation-expected.html b/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation-expected.html index 2cd2991f..53df22e 100644 --- a/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation-expected.html +++ b/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation-expected.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <html> -<script src="../media-file.js"></script> <div> <audio controls muted></audio> </div> @@ -16,10 +15,10 @@ <script> var audios = document.querySelectorAll('audio'); for (var i = 0; i < audios.length; ++i) - audios[i].src = findMediaFile('audio', '../content/test'); + audios[i].src = '../content/test.oga'; var videos = document.querySelectorAll('video'); for (var i = 0; i < videos.length; ++i) - videos[i].src = findMediaFile('video', '../content/test'); + videos[i].src = '../content/test.ogv'; </script> </html>
diff --git a/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation.html b/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation.html index 3a44866..a0d9760 100644 --- a/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation.html +++ b/third_party/WebKit/LayoutTests/media/controls/volumechange-stopimmediatepropagation.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <title>This tests that controls are properly updated when stopImmediatePropagation is used in event handler.</title> -<script src="../media-file.js"></script> <div> <audio></audio> </div> @@ -17,27 +16,27 @@ var audio = document.createElement('audio'); audio.onvolumechange = e => { e.stopImmediatePropagation() }; document.querySelector('#a').appendChild(audio); - audio.src = findMediaFile('audio', '../content/test'); + audio.src = '../content/test.oga'; audio.controls = true; audio.onloadedmetadata = () => { audio.muted = true; } var video = document.createElement('video'); video.onvolumechange = e => { e.stopImmediatePropagation() }; document.querySelector('#v').appendChild(video); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.controls = true; video.onloadedmetadata = () => { video.muted = true; } // Elements created during parsing. var audio = document.querySelector('audio'); audio.onvolumechange = e => { e.stopImmediatePropagation() }; - audio.src = findMediaFile('audio', '../content/test'); + audio.src = '../content/test.oga'; audio.controls = true; audio.muted = true; var video = document.querySelector('video'); video.onvolumechange = e => { e.stopImmediatePropagation() }; - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.controls = true; video.muted = true; </script>
diff --git a/third_party/WebKit/LayoutTests/media/csp-blocks-video.html b/third_party/WebKit/LayoutTests/media/csp-blocks-video.html index edf8396..2e0d3f2 100644 --- a/third_party/WebKit/LayoutTests/media/csp-blocks-video.html +++ b/third_party/WebKit/LayoutTests/media/csp-blocks-video.html
@@ -4,11 +4,10 @@ <video></video> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onloadedmetadata = t.unreached_func(); video.onerror = t.step_func_done();
diff --git a/third_party/WebKit/LayoutTests/media/event-attributes.html b/third_party/WebKit/LayoutTests/media/event-attributes.html index c707258..33a49f6 100644 --- a/third_party/WebKit/LayoutTests/media/event-attributes.html +++ b/third_party/WebKit/LayoutTests/media/event-attributes.html
@@ -2,7 +2,6 @@ <title>Test event attributes for media element.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video controls></video> <script> async_test(function(t) { @@ -61,7 +60,7 @@ video.onended = t.step_func(function(event) { actual_events.push(event.type); - video.src = findMediaFile("video", "content/garbage"); + video.src = "content/garbage.ogv"; progressEventCount = 0; }); @@ -89,6 +88,6 @@ video.onplay = defaultEventStepFunction; video.onseeking = defaultEventStepFunction; - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/fullscreen-controls-visible-last.html b/third_party/WebKit/LayoutTests/media/fullscreen-controls-visible-last.html index f46b8f29..085ad74 100644 --- a/third_party/WebKit/LayoutTests/media/fullscreen-controls-visible-last.html +++ b/third_party/WebKit/LayoutTests/media/fullscreen-controls-visible-last.html
@@ -2,14 +2,13 @@ <title>Tests that the fullscreen button control is the antepenultimate media controls button visible.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <script src="overflow-menu.js"></script> <video controls></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; // Since this is a video, we'll have three elements visible when the width // is 120. These three should be: play, fullscreen, overflow. video.setAttribute("width", "120");
diff --git a/third_party/WebKit/LayoutTests/media/gc-pending-event.html b/third_party/WebKit/LayoutTests/media/gc-pending-event.html index 6effe6a..f220227 100644 --- a/third_party/WebKit/LayoutTests/media/gc-pending-event.html +++ b/third_party/WebKit/LayoutTests/media/gc-pending-event.html
@@ -2,7 +2,6 @@ <title>Verify that a pending event prevents GC</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) {
diff --git a/third_party/WebKit/LayoutTests/media/gc-while-playing.html b/third_party/WebKit/LayoutTests/media/gc-while-playing.html index d34139b..08483e7 100644 --- a/third_party/WebKit/LayoutTests/media/gc-while-playing.html +++ b/third_party/WebKit/LayoutTests/media/gc-while-playing.html
@@ -2,13 +2,12 @@ <title>GC while playing</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) { var a = document.createElement("audio"); a.foo = "bar"; - a.src = findMediaFile("audio", "content/test"); + a.src = "content/test.oga"; a.onsuspend = t.step_func(function() { assert_equals(a.networkState, a.NETWORK_IDLE);
diff --git a/third_party/WebKit/LayoutTests/media/gc-while-seeking.html b/third_party/WebKit/LayoutTests/media/gc-while-seeking.html index 37add463..dcd665b 100644 --- a/third_party/WebKit/LayoutTests/media/gc-while-seeking.html +++ b/third_party/WebKit/LayoutTests/media/gc-while-seeking.html
@@ -2,13 +2,12 @@ <title>GC while seeking</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) { var a = document.createElement("audio"); a.foo = "bar"; - a.src = findMediaFile("audio", "content/test"); + a.src = "content/test.oga"; a.onsuspend = t.step_func(function() { assert_equals(a.networkState, a.NETWORK_IDLE);
diff --git a/third_party/WebKit/LayoutTests/media/media-can-load-when-hidden.html b/third_party/WebKit/LayoutTests/media/media-can-load-when-hidden.html index d3e2858..14b3a8aa 100644 --- a/third_party/WebKit/LayoutTests/media/media-can-load-when-hidden.html +++ b/third_party/WebKit/LayoutTests/media/media-can-load-when-hidden.html
@@ -4,13 +4,12 @@ video { display: none; } </style> <video></video> -<script src="media-file.js"></script> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script> async_test(function(t) { var video = document.querySelector("video"); video.ondurationchange = t.step_func_done(); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-mpeg-audio.html b/third_party/WebKit/LayoutTests/media/media-can-play-mpeg-audio.html deleted file mode 100644 index cd27f000..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-mpeg-audio.html +++ /dev/null
@@ -1,18 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method with multiple audio mpeg MIME types.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<audio></audio> -<script> -test(function() { - var audio = document.querySelector("audio"); - // Currently no platform supports the below formats. - assert_equals(audio.canPlayType("audio/x-mpeg"), ""); - assert_equals(audio.canPlayType("audio/x-mp3"), ""); - assert_equals(audio.canPlayType("audio/mp3"), ""); - assert_equals(audio.canPlayType("audio/mpeg"), ""); - - assert_equals(audio.canPlayType("audio/mp4"), ""); - assert_equals(audio.canPlayType("audio/aac"), ""); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-mpeg4-video.html b/third_party/WebKit/LayoutTests/media/media-can-play-mpeg4-video.html deleted file mode 100644 index adb4e7a..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-mpeg4-video.html +++ /dev/null
@@ -1,15 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method with multiple video mpeg4 MIME types.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<video></video> -<script> -test(function() { - var video = document.querySelector("video"); - // Currently no platform supports the below formats. - assert_equals(video.canPlayType("video/x-m4v"), ""); - assert_equals(video.canPlayType("video/mp4"), ""); - assert_equals(video.canPlayType("video/mp4; Codecs=\"avc1.4D400C\""), ""); - assert_equals(video.canPlayType("Video/MP4; CODECS=\"mp4v.20.8, mp4a.40.2\""), ""); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-octet-stream.html b/third_party/WebKit/LayoutTests/media/media-can-play-octet-stream.html deleted file mode 100644 index 8d38917..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-octet-stream.html +++ /dev/null
@@ -1,19 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method with "application/octet-stream".</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<script> -function check_media_element_canplaytype(elementName) { - test(function() { - var mediaElement = document.createElement(elementName); - // These tests should always pass as no platform - // should support "application/octet-stream". - assert_equals(mediaElement.canPlayType("APPLICATION/octet-stream"), ""); - assert_equals(mediaElement.canPlayType("application/octet-stream;codecs=theora"), ""); - assert_equals(mediaElement.canPlayType("application/octet-stream;codecs=mp4"), ""); - }, "check \"canPlayType\" method for " + elementName); -} - -check_media_element_canplaytype("audio"); -check_media_element_canplaytype("video"); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-ogg.html b/third_party/WebKit/LayoutTests/media/media-can-play-ogg.html deleted file mode 100644 index 487f189..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-ogg.html +++ /dev/null
@@ -1,18 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method for ogg media containers.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<video></video> -<script> -test(function() { - var video = document.querySelector('video'); - // These tests may be expected to fail if the platform does not support the format. - assert_equals(video.canPlayType('audio/ogg'), 'maybe'); - assert_equals(video.canPlayType('video/ogg'), 'maybe'); - - assert_equals(video.canPlayType('audio/ogg; codecs=vorbis'), 'probably'); - assert_equals(video.canPlayType('audio/ogg; codecs=opus'), 'probably'); - assert_equals(video.canPlayType('video/ogg; codecs=theora'), 'probably'); - assert_equals(video.canPlayType('video/ogg; codecs="theora,vorbis"'), 'probably'); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-type.html b/third_party/WebKit/LayoutTests/media/media-can-play-type.html deleted file mode 100644 index 237ed18..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-type.html +++ /dev/null
@@ -1,20 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method with invalid MIME types.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<video></video> -<script> -test(function() { - var video = document.querySelector("video"); - - assert_throws(new TypeError, function() { video.canPlayType(); }); - assert_equals(video.canPlayType("video/"), ""); - assert_equals(video.canPlayType("video/blahblah"), ""); - assert_equals(video.canPlayType("video/blahblah; codecs=\"blah, , blah\""), ""); - assert_equals(video.canPlayType("video/blahblah; codecs=blah"), ""); - assert_equals(video.canPlayType("video/blahblah; codecs=\"blah\""), ""); - assert_equals(video.canPlayType("video/blahblah; codecs=\"badcontent"), ""); - assert_equals(video.canPlayType("video/blahblah; codecs=badcontent\""), ""); - assert_equals(video.canPlayType("video/blahblah; codecs="badcontent""), ""); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-wav-audio.html b/third_party/WebKit/LayoutTests/media/media-can-play-wav-audio.html deleted file mode 100644 index 70f9422..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-wav-audio.html +++ /dev/null
@@ -1,17 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method with multiple .wav MIME types.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<audio></audio> -<script> -test(function() { - var audio = document.querySelector("audio"); - // These tests may be expected to fail if the platform does not support the format. - assert_equals(audio.canPlayType("audio/wav"), "maybe"); - assert_equals(audio.canPlayType("audio/x-wav"), "maybe"); - - // WAV codec 1 is basic PCM, refer to http://tools.ietf.org/html/rfc2361 - assert_equals(audio.canPlayType("audio/wav; codecs=1"), "probably"); - assert_equals(audio.canPlayType("audio/x-wav; codecs=1"), "probably"); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-webm.html b/third_party/WebKit/LayoutTests/media/media-can-play-webm.html deleted file mode 100644 index 9e8531a9..0000000 --- a/third_party/WebKit/LayoutTests/media/media-can-play-webm.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<title>Test HTMLMediaElement's "canPlayType" method for webm media containers.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<video></video> -<script> -test(function() { - var video = document.querySelector('video'); - // These tests may be expected to fail if the platform does not support the format. - assert_equals(video.canPlayType('audio/webm'), 'maybe'); - assert_equals(video.canPlayType('video/webm'), 'maybe'); - - assert_equals(video.canPlayType('audio/webm; codecs=vorbis'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp8,vorbis"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs=vp8'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs=vp8.0'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp8.0,vorbis"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs=vp8.1'), ''); - - assert_equals(video.canPlayType('video/webm; codecs=vp9'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp9,vorbis"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs=vp9.0'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp9.0,vorbis"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs=vp9.1'), ''); - - assert_equals(video.canPlayType('audio/webm; codecs=opus'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp9,opus"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp9.0,opus"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp8,opus"'), 'probably'); - assert_equals(video.canPlayType('video/webm; codecs="vp8.0,opus"'), 'probably'); -}); -</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-captions-no-controls.html b/third_party/WebKit/LayoutTests/media/media-captions-no-controls.html index 9565c03..e2a0aabb 100644 --- a/third_party/WebKit/LayoutTests/media/media-captions-no-controls.html +++ b/third_party/WebKit/LayoutTests/media/media-captions-no-controls.html
@@ -2,13 +2,12 @@ <title>Tests that adding a text track does not make controls visible.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.oncanplaythrough = t.step_func_done(function() { // Initial state: no text tracks, controls should not be visible.
diff --git a/third_party/WebKit/LayoutTests/media/media-continues-playing-after-replace-source.html b/third_party/WebKit/LayoutTests/media/media-continues-playing-after-replace-source.html index fb9aaed8..6e9eaf29 100644 --- a/third_party/WebKit/LayoutTests/media/media-continues-playing-after-replace-source.html +++ b/third_party/WebKit/LayoutTests/media/media-continues-playing-after-replace-source.html
@@ -2,17 +2,16 @@ <title>Test that media keeps playing when the source element is replaced.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <audio></audio> <script> async_test(function(t) { // TODO(srirama.m): Improve the test for better understanding var timeupdateEventCount = 0; var sourceReplaced = false; - + var audio = document.querySelector("audio"); var source = document.createElement("source"); - source.src = findMediaFile("audio", "content/silence"); + source.src = "content/silence.oga"; audio.appendChild(source); audio.onerror = t.unreached_func(); @@ -34,10 +33,10 @@ // Replacing the media's source element. sourceReplaced = true; timeupdateEventCount = 0; - + audio.removeChild(source); var newSource = document.createElement("source"); - newSource.src = findMediaFile("audio", "content/test"); + newSource.src = "content/test.oga"; audio.appendChild(newSource); } else { t.done();
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-fit-properly-while-zoomed.html b/third_party/WebKit/LayoutTests/media/media-controls-fit-properly-while-zoomed.html index 6a849f9..62d29a1 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-fit-properly-while-zoomed.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-fit-properly-while-zoomed.html
@@ -14,7 +14,7 @@ <video id="video" width="300px" controls></video> <script> var element = document.getElementById("video"); - element.src = findMediaFile("video", "content/counting"); + element.src = "content/counting.ogv"; function testTimelineVisible(test) { // Check that the timeline is shown. If zoom is not accounted for,
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-hide-menu-stoppropagation.html b/third_party/WebKit/LayoutTests/media/media-controls-hide-menu-stoppropagation.html index 72145c4..de7ab9b 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-hide-menu-stoppropagation.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-hide-menu-stoppropagation.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html b/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html index e0081c6..daae64d 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html
@@ -2,13 +2,12 @@ <title>This tests that media element controls are reset to their default state when the src is changed to an invalid url.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.oncanplaythrough = t.step_func(function() { video.oncanplaythrough = null;
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-overflow-hidden.html b/third_party/WebKit/LayoutTests/media/media-controls-overflow-hidden.html index dea8af9..8b55e97 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-overflow-hidden.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-overflow-hidden.html
@@ -9,7 +9,6 @@ <meta name='viewport' content='width=800'> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> </head> <style> @@ -34,7 +33,7 @@ var videos = document.querySelectorAll('video'); for (var i=0; i < videos.length; ++i) { - videos[i].src = findMediaFile('video', 'content/test'); + videos[i].src = 'content/test.ogv'; } var forceLayout = document.body.offsetHeight;
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-overflow-visible.html b/third_party/WebKit/LayoutTests/media/media-controls-overflow-visible.html index 89b3089..210ec351 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-overflow-visible.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-overflow-visible.html
@@ -9,7 +9,6 @@ <meta name='viewport' content='width=300'> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> </head> <body> @@ -29,7 +28,7 @@ var videos = document.querySelectorAll('video'); for (var i=0; i < videos.length; ++i) { - videos[i].src = findMediaFile('video', 'content/test'); + videos[i].src = 'content/test.ogv'; } var forceLayout = document.body.offsetHeight;
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-tap-show-controls-without-activating.html b/third_party/WebKit/LayoutTests/media/media-controls-tap-show-controls-without-activating.html index 16a0c6f..8ce4736 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls-tap-show-controls-without-activating.html +++ b/third_party/WebKit/LayoutTests/media/media-controls-tap-show-controls-without-activating.html
@@ -2,13 +2,12 @@ <title>Test that when tapping on the controls to show them it does not activate the button below.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); video.onplaying = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/media-element-play-after-eos.html b/third_party/WebKit/LayoutTests/media/media-element-play-after-eos.html index be4404e3..1a1ae925 100644 --- a/third_party/WebKit/LayoutTests/media/media-element-play-after-eos.html +++ b/third_party/WebKit/LayoutTests/media/media-element-play-after-eos.html
@@ -2,13 +2,12 @@ <title>This test ensures that media element fires the "playing" event every time it starts playing after eos. It also ensure that "pause" and "ended" events are fired when media playback ends.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <audio></audio> <script> async_test(function(t) { var loop = true; var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/silence"); + audio.src = "content/silence.oga"; var watcher = new EventWatcher(t, audio, ["loadedmetadata", "playing", "pause", "ended"]); watcher.wait_for("loadedmetadata").then(t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/media-ended.html b/third_party/WebKit/LayoutTests/media/media-ended.html index 3e15554f..10157c21 100644 --- a/third_party/WebKit/LayoutTests/media/media-ended.html +++ b/third_party/WebKit/LayoutTests/media/media-ended.html
@@ -2,7 +2,6 @@ <title>Test "ended" event fires again after changing source after "ended" event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <audio autoplay></audio> <script> async_test(function(t) { @@ -29,7 +28,7 @@ } // Change src but don't seek so that internal state isn't reset. - audio.src = findMediaFile("audio", "content/silence"); + audio.src = "content/silence.oga"; assert_false(audio.ended); break; @@ -40,6 +39,6 @@ } }); - audio.src = findMediaFile("audio", "content/silence") + audio.src = "content/silence.oga" }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/media-extension-with-fragment.html b/third_party/WebKit/LayoutTests/media/media-extension-with-fragment.html index 04df5d913f..dbd5412 100644 --- a/third_party/WebKit/LayoutTests/media/media-extension-with-fragment.html +++ b/third_party/WebKit/LayoutTests/media/media-extension-with-fragment.html
@@ -2,13 +2,12 @@ <title>Test that a media url with fragment loads properly</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); video.onloadeddata = t.step_func_done(); video.onerror = t.unreached_func(); - video.src = findMediaFile("video", "content/test") + "#01.00.xyz"; + video.src = "content/test.ogv" + "#01.00.xyz"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-file.js b/third_party/WebKit/LayoutTests/media/media-file.js index c80abcb..80eef5c 100644 --- a/third_party/WebKit/LayoutTests/media/media-file.js +++ b/third_party/WebKit/LayoutTests/media/media-file.js
@@ -10,25 +10,6 @@ ["video/webm","webm"] ]; -function findMediaFile(tagName, name) { - var codecs; - if (tagName == "audio") - codecs = audioCodecs; - else - codecs = videoCodecs; - - var element = document.getElementsByTagName(tagName)[0]; - if (!element) - element = document.createElement(tagName); - - for (var i = 0; i < codecs.length; ++i) { - if (element.canPlayType(codecs[i][0])) - return name + "." + codecs[i][1]; - } - - return ""; -} - function mimeTypeForExtension(extension) { for (var i = 0; i < videoCodecs.length; ++i) { if (extension == videoCodecs[i][1])
diff --git a/third_party/WebKit/LayoutTests/media/media-fragments/media-fragments.js b/third_party/WebKit/LayoutTests/media/media-fragments/media-fragments.js index fd6cc1e72..ed40715 100644 --- a/third_party/WebKit/LayoutTests/media/media-fragments/media-fragments.js +++ b/third_party/WebKit/LayoutTests/media/media-fragments/media-fragments.js
@@ -2,7 +2,7 @@ var consoleDiv = null; var currentTest = null; var fragmentEndTime; - var testData = + var testData = { // http://www.w3.org/2008/WebVideo/Fragments/TC/ua-test-cases @@ -231,10 +231,10 @@ function start() { video = document.createElement('video'); - video.setAttribute('id', 'vid'); - video.setAttribute('width', '320'); - video.setAttribute('height', '240'); - video.setAttribute('controls', ''); + video.setAttribute('id', 'vid'); + video.setAttribute('width', '320'); + video.setAttribute('height', '240'); + video.setAttribute('controls', ''); var paragraph = document.createElement('p'); paragraph.appendChild(video); document.body.appendChild(paragraph); @@ -249,6 +249,6 @@ consoleWrite("<br>Title: <b>" + currentTest + "</b>"); consoleWrite("Fragment: '<i>" + info.fragment + "</i>'"); consoleWrite("Comment: <i>" + info.comment + "</i>"); - url = findMediaFile("video", "../content/counting") + "#" + info.fragment; + url = "../content/counting.ogv" + "#" + info.fragment; video.src = url; } \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-load-event.html b/third_party/WebKit/LayoutTests/media/media-load-event.html index c6b2ef1..25f80ce 100644 --- a/third_party/WebKit/LayoutTests/media/media-load-event.html +++ b/third_party/WebKit/LayoutTests/media/media-load-event.html
@@ -2,7 +2,6 @@ <title>Test that media file is not reloaded when an element is inserted into the DOM.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <div id="parent"></div> <script> async_test(function(t) { @@ -20,7 +19,7 @@ audio.onplay = t.step_func(function() {}); audio.onloadeddata = t.step_func(function() {}); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.load(); }) </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise.html b/third_party/WebKit/LayoutTests/media/media-play-promise.html index e70ef77a..0c14e9e 100644 --- a/third_party/WebKit/LayoutTests/media/media-play-promise.html +++ b/third_party/WebKit/LayoutTests/media/media-play-promise.html
@@ -2,7 +2,6 @@ <title>Test the play() behaviour with regards to the returned promise for media elements.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> // This is testing the behavior of play() with regards to the returned // promise. This test file is creating a small framework in order to be able @@ -14,7 +13,7 @@ // Test that play() on an element that doesn't have enough data will // return a promise that resolves successfully. function playBeforeCanPlay(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; assert_equals(audio.readyState, HTMLMediaElement.HAVE_NOTHING); playExpectingResolvedPromise(t, audio); }, @@ -22,7 +21,7 @@ // Test that play() on an element that has enough data will return a // promise that resolves successfully. function playWhenCanPlay(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.oncanplay = t.step_func(function() { assert_greater_than_equal(audio.readyState, HTMLMediaElement.HAVE_FUTURE_DATA); @@ -35,7 +34,7 @@ // promise that resolves successfully. function playAfterPlaybackStarted(t, audio) { audio.preload = "auto"; - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onplaying = t.step_func(function() { assert_equals(audio.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA); @@ -51,7 +50,7 @@ // Test that play() on an element with an unsupported content will // return a rejected promise. function playNotSupportedContent(t, audio) { - audio.src = findMediaFile("audio", "data:,"); + audio.src = "data:,.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); @@ -65,7 +64,7 @@ // This test doesn't test a spec behaviour but tests that the Blink // implementation properly changed after the spec changed. function playDecodeError(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); @@ -84,7 +83,7 @@ // This test doesn't test a spec behaviour but tests that the Blink // implementation properly changed after the spec changed function playNetworkError(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); @@ -101,7 +100,7 @@ // Test that play() returns a rejected promise if the element is // sufferring from a not supported error. function playWithErrorAlreadySet(t, audio) { - audio.src = findMediaFile("audio", "data:,"); + audio.src = "data:,.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); @@ -113,12 +112,12 @@ // Test that play() returns a resolved promise if the element had its // source changed after suffering from an error. function playSrcChangedAfterError(t, audio) { - audio.src = findMediaFile("audio", "data:,"); + audio.src = "data:,.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); assert_equals(audio.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onloadedmetadata = t.step_func(function() { playExpectingResolvedPromise(t, audio); @@ -129,12 +128,12 @@ // Test that play() returns a rejected promise if the element had an // error and just changed its source. function playRaceWithSrcChangeError(t, audio) { - audio.src = findMediaFile("audio", "data:,"); + audio.src = "data:,.oga"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); assert_equals(audio.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; assert_equals(audio.error, null); assert_equals(audio.readyState, HTMLMediaElement.HAVE_NOTHING); playExpectingResolvedPromise(t, audio); @@ -146,7 +145,7 @@ // words, pause() doesn't cancel play() because it was resolved // immediately. function playAndPauseWhenCanplay(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.oncanplaythrough = t.step_func(function() { assert_equals(audio.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA); @@ -179,13 +178,13 @@ // Test that changing the src rejects the pending play() promises. function newSrcRejectPendingPromises(t, audio) { playExpectingRejectedPromise(t, audio, "AbortError"); // the promise will be left pending. - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; }, // Test ordering of events and promises. // This is testing a bug in Blink, see https://crbug.com/587871 function testEventAndPromiseOrdering(t, audio) { - audio.src = findMediaFile("audio", "data:,"); + audio.src = "data:,.oga"; audio.onerror = t.step_func(function() { // Until https://crbug.com/587871 is fixed, the events will be @@ -208,7 +207,7 @@ // playing returns a promise that resolves successfully. function pausePlayAfterPlaybackStarted(t, audio) { audio.preload = "auto"; - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; audio.onplaying = t.step_func(function() { assert_equals(audio.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA); @@ -225,11 +224,11 @@ // Test that running the load algorithm will not drop all the promises about // to be resolved. function loadAlgorithmDoesNotCancelTasks(t, audio) { - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; audio.addEventListener('canplaythrough', t.step_func(function() { // The play() promise will be queued to be resolved. playExpectingResolvedPromise(t, audio); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; assert_true(audio.paused); })); }, @@ -239,7 +238,7 @@ function loadAlgorithmKeepPromisesPendingWhenNotPausing(t, audio) { playExpectingResolvedPromise(t, audio); setTimeout(t.step_func(function() { - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; assert_false(audio.paused); }), 0); }, @@ -247,7 +246,7 @@ // Test that when the load algorithm is run, if it resolves multiple // promises, they are resolved in the order in which they were added. function loadAlgorithmResolveOrdering(t, audio) { - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; audio.addEventListener('canplaythrough', t.step_func(function() { var firstPromiseResolved = false; audio.play().then(t.step_func(_ => firstPromiseResolved = true), @@ -257,7 +256,7 @@ assert_true(firstPromiseResolved); }), t.unreached_func()); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; })); }, @@ -269,14 +268,14 @@ // function loadAlgorithmKeepPromisesPendingWhenNotPausingAndPreloadNone(t, audio) { // audio.preload = 'none'; // playExpectingRejectedPromise(t, audio, 'AbortError'); - // setTimeout(_ => audio.src = findMediaFile('audio', 'content/test'), 0); + // setTimeout(_ => audio.src = 'content/test.oga', 0); // }, // Test that when the load algorithm is run, if it does pause the playback, // it will reject the pending promises. function loadAlgorithmRejectPromisesWhenPausing(t, audio) { playExpectingRejectedPromise(t, audio, 'AbortError'); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; assert_true(audio.paused); }, @@ -285,7 +284,7 @@ function loadAlgorithmRejectPromisesWhenPausingAndPreloadNone(t, audio) { audio.preload = 'none'; playExpectingRejectedPromise(t, audio, 'AbortError'); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; assert_true(audio.paused); }, @@ -309,7 +308,7 @@ setTimeout(t.step_func(function() { audio.pause(); - audio.src = findMediaFile('audio', 'content/test'); + audio.src = 'content/test.oga'; }), 0); }, ]; @@ -326,14 +325,14 @@ // Test that play() on an element when media playback requires a gesture // returns a resolved promise if there is a user gesture. function playRequiresUserGestureAndHasIt(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; playWithUserGesture(t, audio); }, // Test that play() on an element when media playback requires a gesture // returns a rejected promise if there is no user gesture. function playRequiresUserGestureAndDoesNotHaveIt(t, audio) { - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; playExpectingRejectedPromise(t, audio, "NotAllowedError"); } ];
diff --git a/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html b/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html index d2cef33..f960da8d 100644 --- a/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html +++ b/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html
@@ -2,7 +2,6 @@ <title>Test that a media element doesn't reload on removing the current source element and inserting a new source element.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <audio></audio> <script> async_test(function(t) { @@ -19,9 +18,9 @@ }); var sourceA = document.createElement("source"); - sourceA.src = findMediaFile("audio", "content/test"); + sourceA.src = "content/test.oga"; var sourceB = document.createElement("source"); - sourceB.src = findMediaFile("audio", "content/silence"); + sourceB.src = "content/silence.oga"; audio.appendChild(sourceA); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html b/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html index f2eaae0..48fe3da 100644 --- a/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html +++ b/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html
@@ -2,7 +2,6 @@ <title>Test that media autoplay should not work if user gesture is required for playback.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> internals.settings.setAutoplayPolicy('user-gesture-required'); </script> @@ -10,7 +9,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; assert_true(video.paused); video.onplay = t.unreached_func();
diff --git a/third_party/WebKit/LayoutTests/media/play-promise-crash.html b/third_party/WebKit/LayoutTests/media/play-promise-crash.html index 9e23035..da5cf53e 100644 --- a/third_party/WebKit/LayoutTests/media/play-promise-crash.html +++ b/third_party/WebKit/LayoutTests/media/play-promise-crash.html
@@ -6,13 +6,12 @@ <body> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> window.internals.settings.setAutoplayPolicy('user-gesture-required'); async_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.play().then(t.step_func_done(function() { assert_unreached(); }), t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/remoteplayback/availability-callback-gc.html b/third_party/WebKit/LayoutTests/media/remoteplayback/availability-callback-gc.html index c4135ae2..1c28408 100644 --- a/third_party/WebKit/LayoutTests/media/remoteplayback/availability-callback-gc.html +++ b/third_party/WebKit/LayoutTests/media/remoteplayback/availability-callback-gc.html
@@ -5,14 +5,13 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/gc.js"></script> - <script src="../media-file.js"></script> - </head> + </head> <body> <script> async_test(function(t) { var v = document.createElement('video'); - v.src = findMediaFile('video', '../content/test'); + v.src = '../content/test.ogv'; document.body.appendChild(v); function callback(available) {}
diff --git a/third_party/WebKit/LayoutTests/media/remoteplayback/prompt-twice-throws.html b/third_party/WebKit/LayoutTests/media/remoteplayback/prompt-twice-throws.html index 1f363b9..3abd9429 100644 --- a/third_party/WebKit/LayoutTests/media/remoteplayback/prompt-twice-throws.html +++ b/third_party/WebKit/LayoutTests/media/remoteplayback/prompt-twice-throws.html
@@ -4,8 +4,7 @@ <title>Test that calling prompt() before the promise returned by the previous call is resolved throws an exception</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - <script src="util.js"></script> + <script src="util.js"></script> </head> <body> <button id="button">Click me</button> @@ -29,7 +28,7 @@ enableRemotePlaybackBackendForTest(test); var v = document.createElement('video'); - v.src = findMediaFile('video', '../content/test'); + v.src = '../content/test.ogv'; document.body.appendChild(v); var btn = document.getElementById('button');
diff --git a/third_party/WebKit/LayoutTests/media/remoteplayback/watch-availability-throws-low-end-device.html b/third_party/WebKit/LayoutTests/media/remoteplayback/watch-availability-throws-low-end-device.html index 60d46036..7c03647 100644 --- a/third_party/WebKit/LayoutTests/media/remoteplayback/watch-availability-throws-low-end-device.html +++ b/third_party/WebKit/LayoutTests/media/remoteplayback/watch-availability-throws-low-end-device.html
@@ -4,8 +4,7 @@ <title>Test that watchAvailability() throws on low-end devices.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../media-file.js"></script> - <script src="util.js"></script> + <script src="util.js"></script> </head> <body> <script> @@ -15,7 +14,7 @@ { enableRemotePlaybackBackendForTest(t); var v = document.createElement('video'); - v.src = findMediaFile('video', '../content/test'); + v.src = '../content/test.ogv'; document.body.appendChild(v); internals.setIsLowEndDevice(true); v.remote.watchAvailability(t.unreached_func()).then(
diff --git a/third_party/WebKit/LayoutTests/media/remove-from-document.html b/third_party/WebKit/LayoutTests/media/remove-from-document.html index 756b09f..a4a29d9 100644 --- a/third_party/WebKit/LayoutTests/media/remove-from-document.html +++ b/third_party/WebKit/LayoutTests/media/remove-from-document.html
@@ -2,12 +2,11 @@ <title>Test that removing a media element from the tree pauses playback but does not unload the media.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video autoplay></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.oncanplaythrough = t.step_func_done(function() { assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
diff --git a/third_party/WebKit/LayoutTests/media/resources/video-stop-propagation.html b/third_party/WebKit/LayoutTests/media/resources/video-stop-propagation.html index c8342f7..a92a8c04 100644 --- a/third_party/WebKit/LayoutTests/media/resources/video-stop-propagation.html +++ b/third_party/WebKit/LayoutTests/media/resources/video-stop-propagation.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <html> -<script src="../media-file.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> <body style="padding-top: 100px; padding-left: 100px"> <video controls width=60></video> @@ -8,7 +7,7 @@ <script> // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/seek-to-currentTime.html b/third_party/WebKit/LayoutTests/media/seek-to-currentTime.html index d329178..e657ba6 100644 --- a/third_party/WebKit/LayoutTests/media/seek-to-currentTime.html +++ b/third_party/WebKit/LayoutTests/media/seek-to-currentTime.html
@@ -3,13 +3,12 @@ <title>seek to currentTime</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <div id=log></div> <script> // TODO(srirama.m): Remove this test by importing the above web-platform-tests test async_test(function(t) { var v = document.createElement('video'); - v.src = findMediaFile('video', 'content/test'); + v.src = 'content/test.ogv'; v.onloadedmetadata = t.step_func(function() { assert_greater_than(v.readyState, v.HAVE_NOTHING, 'readyState'); assert_greater_than(v.seekable.length, 0, 'seekable ranges');
diff --git a/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable-expected.html b/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable-expected.html index 320cde41..97b8d00 100644 --- a/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable-expected.html +++ b/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable-expected.html
@@ -27,7 +27,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "../content/test")); + setSrcByTagName("video", "../content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable.html b/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable.html index c51976a..696bf68 100644 --- a/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable.html +++ b/third_party/WebKit/LayoutTests/media/stable/video-object-fit-stable.html
@@ -18,7 +18,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "../content/test")); + setSrcByTagName("video", "../content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow-2.html b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow-2.html index 3f12558..c7ba4dec24 100644 --- a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow-2.html +++ b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow-2.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the cue is styled when video and style is in the same shadow tree.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -13,7 +12,7 @@ shadowRoot.innerHTML = '<style>video::cue(.red, .red2) { color:red } video::cue(.green) { color:green }</style>' + '<video controls ><track src="captions-webvtt/styling-lifetime.vtt" kind="captions" default></video>'; var video = shadowRoot.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.id = "testvideo"; video.onseeked = t.step_func_done(function() { var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild;
diff --git a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html index 35279e2..edd6b1aa 100644 --- a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html +++ b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the cue is not styled when video is in a shadow tree and style is in a document.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -16,7 +15,7 @@ var shadowRoot = host.createShadowRoot(); shadowRoot.innerHTML = '<video controls ><track src="captions-webvtt/styling-lifetime.vtt" kind="captions" default></video>'; var video = shadowRoot.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.id = "testvideo"; video.onseeked = t.step_func_done(function() { var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild;
diff --git a/third_party/WebKit/LayoutTests/media/track/cue-style-invalidation.html b/third_party/WebKit/LayoutTests/media/track/cue-style-invalidation.html index d29b02d0..903aa070 100644 --- a/third_party/WebKit/LayoutTests/media/track/cue-style-invalidation.html +++ b/third_party/WebKit/LayoutTests/media/track/cue-style-invalidation.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Check that descendant style invalidation works with ::cue selectors.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -23,7 +22,7 @@ <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onseeked = t.step_func_done(function() { var red = "rgb(255, 0, 0)"; var green = "rgb(0, 128, 0)";
diff --git a/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html b/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html index 561f98d..1050637d 100644 --- a/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html
@@ -3,7 +3,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/gc.js"></script> -<script src="../media-file.js"></script> <video autoplay> <track src="captions-webvtt/captions-fast.vtt" default> </video> @@ -21,7 +20,7 @@ function CFcrash() { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; var document1 = document.implementation.createDocument("", null); document1.appendChild(video); delete document1;
diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html index 33b3243..48d37a0 100644 --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <title>Tests default rendering for TextTrackCues that belong to a VTTRegion.</title> <script src="../../media-controls.js"></script> -<script src="../../media-file.js"></script> <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <video controls></video> @@ -33,7 +32,7 @@ async_test(function() { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../../content/test'); + video.src = '../../content/test.ogv'; var testTrack = document.createElement('track'); testTrack.onload = this.step_func(function() { video.oncanplaythrough = this.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html index f37ecd64..3969a0f 100644 --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html
@@ -1,13 +1,12 @@ <!DOCTYPE html> <title>Tests default DOM layout structure for a VTTRegion.</title> <script src="../../media-controls.js"></script> -<script src="../../media-file.js"></script> <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script> async_test(function() { var video = document.createElement('video'); - video.src = findMediaFile('video', '../../content/test'); + video.src = '../../content/test.ogv'; var testTrack = document.createElement('track'); testTrack.onload = this.step_func(function() { video.oncanplaythrough = this.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-non-visible-crash.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-non-visible-crash.html index c5dc3e3..8428b7f 100644 --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-non-visible-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-non-visible-crash.html
@@ -2,12 +2,11 @@ <title>Box-less VTTCue attached to VTTRegion should not crash</title> <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> -<script src="../../media-file.js"></script> <video></video> <script> setup(function() { window.video = document.querySelector('video'); - video.src = findMediaFile('video', '../../content/test'); + video.src = '../../content/test.ogv'; }); async_test(function(t) { let track = video.addTextTrack('subtitles');
diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html index f27add7..be3e2f6 100644 --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests proper parsing of various regions present in WebVTT header area.</title> -<script src="../../media-file.js"></script> <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script> @@ -35,7 +34,7 @@ async_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', '../../content/test'); + video.src = '../../content/test.ogv'; var testTrack = document.createElement('track'); testTrack.onload = t.step_func_done(function() { var track = testTrack.track;
diff --git a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html index c62e8d3..63cf1d80 100644 --- a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html +++ b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html
@@ -2,7 +2,6 @@ <title>Test that we can add a track dynamically and it is displayed on the track selection menu.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <!-- Width should be large enough to display closed captions button. --> <video controls style="width: 500px"> @@ -31,6 +30,6 @@ assert_equals(textTrackDisplayElement(video).innerText, trackCueText); }); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; }) </script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-all-cues.html b/third_party/WebKit/LayoutTests/media/track/track-css-all-cues.html index 5199bab..dc12ee7 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-all-cues.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-all-cues.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that style to all cues is applied correctly.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -19,8 +18,8 @@ <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); - + video.src = '../content/test.ogv'; + var track = document.createElement('track'); track.src = 'captions-webvtt/styling.vtt'; track.kind = 'captions';
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-cue-lifetime.html b/third_party/WebKit/LayoutTests/media/track/track-css-cue-lifetime.html index e7f2b7a5..f7e503c6 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-cue-lifetime.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-cue-lifetime.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the cue is styled properly throughout its lifetime.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -15,9 +14,9 @@ var step = 0.4; var initialTime = 0.6; var endTime = 3.0 - + var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; var track = document.createElement('track'); track.src = 'captions-webvtt/styling-lifetime.vtt'; @@ -39,7 +38,7 @@ else video.currentTime = seekTime; }); - + video.currentTime = initialTime; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-matching-default.html b/third_party/WebKit/LayoutTests/media/track/track-css-matching-default.html index 7742217..d5cb191 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-matching-default.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-matching-default.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that u, b, i WebVTT objects are being styled correctly.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -8,8 +7,8 @@ <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); - + video.src = '../content/test.ogv'; + var track = document.createElement('track'); track.src = 'captions-webvtt/styling-default.vtt'; track.kind = 'captions'; @@ -24,7 +23,7 @@ cueNode = cueNode.nextElementSibling; assert_equals(getComputedStyle(cueNode).textDecoration, 'underline solid rgb(255, 255, 255)'); }); - + video.currentTime = 0.1; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-matching-lang.html b/third_party/WebKit/LayoutTests/media/track/track-css-matching-lang.html index 60629f06..0ee9681 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-matching-lang.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-matching-lang.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cues are being matched properly by the lang attribute and :lang() pseudo class.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -13,8 +12,8 @@ <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); - + video.src = '../content/test.ogv'; + var track = document.createElement('track'); track.src = 'captions-webvtt/styling-lang.vtt'; track.kind = 'captions'; @@ -29,7 +28,7 @@ cueNode = cueNode.firstElementChild.firstElementChild; assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)'); }); - + video.currentTime = 0.1; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-matching-timestamps.html b/third_party/WebKit/LayoutTests/media/track/track-css-matching-timestamps.html index c9fb1a2..8e89355 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-matching-timestamps.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-matching-timestamps.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cues are being matched properly by :past and :future pseudo classes.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -20,10 +19,10 @@ ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"], ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(128, 128, 128)", "rgb(0, 255, 0)"], ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)"]]; - + var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + var track = document.createElement("track"); track.src = "captions-webvtt/styling-timestamps.vtt"; track.kind = "captions";
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-matching.html b/third_party/WebKit/LayoutTests/media/track/track-css-matching.html index 77e8759f..d14b56f8 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-matching.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-matching.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cues are being matched properly by various CSS Selectors.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -30,8 +29,8 @@ ["rgb(255, 255, 0)", "rgb(255, 0, 0)", "rgb(0, 128, 0)"]]; var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + var track = document.createElement("track"); track.src = "captions-webvtt/styling.vtt"; track.kind = "captions"; @@ -52,7 +51,7 @@ else video.currentTime = seekTimes[seekTimeIndex]; }); - + video.currentTime = seekTimes[seekTimeIndex]; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html b/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html index b2a45b3..d3fd1057 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that ::cue pseudo-element properties are applied to WebVTT node objects only.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -19,7 +18,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onseeked = t.step_func_done(function() { var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild; @@ -27,13 +26,13 @@ assert_equals(cueStyle.color, "rgb(255, 0, 0)"); assert_equals(cueStyle.padding, "0px"); assert_equals(cueStyle.wordSpacing, "0px"); - + cueNode = cueNode.nextElementSibling; cueStyle = getComputedStyle(cueNode); assert_equals(cueStyle.color, "rgb(255, 0, 0)"); assert_equals(cueStyle.padding, "0px"); assert_equals(cueStyle.wordSpacing, "0px"); - + cueNode = cueNode.nextElementSibling; cueStyle = getComputedStyle(cueNode); assert_equals(cueStyle.color, "rgb(255, 0, 0)");
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html index 1ab12b12..52dad36 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that WebVTT objects are being styled correctly based on user settings that should override author settings.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -22,7 +21,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.oncanplaythrough = t.step_func_done(function() { var cue = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild; @@ -34,7 +33,7 @@ assert_equals(cueStyle.fontFamily, "arial"); assert_equals(cueStyle.fontStyle, "normal"); assert_equals(cueStyle.fontVariant, "normal"); - + // Apply user settings and verify they override author-specified settings internals.settings.setTextTrackTextColor("cyan"); internals.settings.setTextTrackBackgroundColor("green"); @@ -43,7 +42,7 @@ internals.settings.setTextTrackFontFamily("fantasy"); internals.settings.setTextTrackFontStyle("italic"); internals.settings.setTextTrackFontVariant("small-caps"); - + video.currentTime = 0.3; cue = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild;
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html index cde58678..5627716 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html +++ b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that WebVTT objects are being styled correctly based on user settings that should override default settings.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -10,7 +9,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.oncanplaythrough = t.step_func_done(function() { var cue = textTrackCueElementByIndex(video, 0).firstChild; @@ -20,7 +19,7 @@ assert_equals(cueStyle.color, "rgb(255, 255, 255)"); assert_equals(cueStyle.backgroundColor, "rgba(0, 0, 0, 0.8)"); assert_equals(cueStyle.fontFamily, "sans-serif"); - + // Apply user settings for color and font-size and verify that the other internal settings are retained. internals.settings.setTextTrackTextColor("purple"); internals.settings.setTextTrackTextSize("14px");
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-container-rendering-position.html b/third_party/WebKit/LayoutTests/media/track/track-cue-container-rendering-position.html index 0bde8e03..2aa5188 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-container-rendering-position.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-container-rendering-position.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>The top of the text track container should be in the bottom 25% of the video element.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -15,8 +14,8 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + video.oncanplaythrough = t.step_func_done(function() { var cueDisplayElement = textTrackDisplayElement(video); document.body.offsetTop; // Force layout.
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-gc-wrapper.html b/third_party/WebKit/LayoutTests/media/track/track-cue-gc-wrapper.html index 96ed4cf..6f4f286 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-gc-wrapper.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-gc-wrapper.html
@@ -2,14 +2,13 @@ <title>Tests that added cue object wrappers live across garbage collections.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <video></video> <script> async_test(function(t) { var cueIndex = 0; var cueLimit = 10; var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.textTracks.custom = "trackList"; assert_true(video.textTracks.hasOwnProperty("custom"));
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-fragment.html b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-fragment.html index e872421d4..cb6f355b 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-fragment.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-fragment.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cue fragment is mutable.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <style> @@ -81,6 +80,6 @@ fragment.appendChild(document.createTextNode(" amet,")); } - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html index 63363f7..6f91344 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cue text is mutable.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -68,6 +67,6 @@ t.done(); } - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html index 5574fa9..1c1c4054 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that cues are rendered and removed.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -11,8 +10,8 @@ async_test(function(t) { var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/counting"); - + video.src = "../content/counting.ogv"; + var seekTimeIndex = 0; var info = [ 0.5, "",
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-empty-cue-crash.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-empty-cue-crash.html index 2f29c82a..48e61741 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-empty-cue-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-empty-cue-crash.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <title>Tests that having empty cues does not crash the browser.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> test(function() { var video = document.createElement("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.addTextTrack("captions", "regular captions track", "en"); video.textTracks[0].addCue(new VTTCue(0, 4, "")); video.play();
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-first-line-box.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-first-line-box.html index cd865158..80e3dee 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-first-line-box.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-first-line-box.html
@@ -3,13 +3,12 @@ <style> -webkit-media-text-track-display { display: block; } </style> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> test(function() { var video = document.createElement("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.addTextTrack("captions", "regular captions track", "en"); video.textTracks[0].addCue(new VTTCue(0, 4, "")); video.play();
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-horizontal.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-horizontal.html index 258e7cd8a..c68f49a 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-horizontal.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-horizontal.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <title>Test, rendering horizontal line-positioned cues.</title> -<script src="../media-file.js"></script> <video> <track src="captions-webvtt/captions-snap-to-lines-set.vtt" kind="captions" default> </video> <script> var video = document.querySelector("video"); -video.src = findMediaFile("video", "../content/test"); +video.src = "../content/test.ogv"; testRunner.waitUntilDone(); video.onseeked = function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit-expected.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit-expected.html index 53e7d28..f8bbc33 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit-expected.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit-expected.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; </script> <style> .container {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit.html index a91f8ce..8628435 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-line-doesnt-fit.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; function addCue(track, cueData) { var cue = new VTTCue(0, 10, 'XXX');
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-mode-changed.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-mode-changed.html index e5fb2fdd..20c2804a 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-mode-changed.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-mode-changed.html
@@ -1,13 +1,12 @@ <!DOCTYPE html> <title>Test that cues are rendered when only the track mode is changed.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> async_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.oncanplaythrough = t.step_func_done(function() { addTracks();
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-on-resize.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-on-resize.html index 1e11ad51..ab656ed 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-on-resize.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-on-resize.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that line height of cue element isn't overridden by author CSS.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -13,7 +12,7 @@ <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.onseeked = t.step_func_done(function() { var multiLineCueDisplayElement = textTrackDisplayElement(video);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-overscan.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-overscan.html index 738a45f3..de9b4ad 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-overscan.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-overscan.html
@@ -1,6 +1,5 @@ <!doctype html> <title>WebVTT overscan margin test</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -21,7 +20,7 @@ video.appendChild(track); document.body.appendChild(video); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.oncanplaythrough = function() { video.currentTime = time; }; video.onseeked = t.step_func(function() { var testCueDisplayBox = textTrackDisplayElement(video);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-expected.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-expected.html index 40ba315..901df80ac 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-expected.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-expected.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; </script> <style> .container {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl-expected.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl-expected.html index 3971674..0654db4e 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl-expected.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl-expected.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; </script> <style> .container {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl.html index c688b91..10f7c4d 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto-rtl.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; function addTrackWithRtlCueData(video, cueData) { var track = video.addTextTrack('subtitles');
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto.html index 31d142f..12d1911a 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-position-auto.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <script> -var mediaFile = findMediaFile('video', '../content/test'); +var mediaFile = '../content/test.ogv'; function addTrackWithCueData(video, cueData) { var track = video.addTextTrack('subtitles');
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-rtl.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-rtl.html index b832cd1..cba774f1 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-rtl.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-rtl.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <title>Test that directionality is set correctly on cues.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -12,7 +11,7 @@ async_test(function(t) { var testTrack = document.querySelector("track"); var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; var seekedCount = 0; var info = ["تجربة",
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-snap-to-lines-not-set.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-snap-to-lines-not-set.html index 1b4e81dc..d08e1f18 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-snap-to-lines-not-set.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-snap-to-lines-not-set.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that TextTrack's cues are rendered correctly when the snap to lines flag is not set.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -11,7 +10,7 @@ async_test(function(t) { var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; // In Chromium it is the enclosure element, which provides the controls height, otherwise the panel; // both are the second child in the shadow DOM.
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video-expected.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video-expected.html index 722ccf9..5be577f 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video-expected.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video-expected.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <style> .container { transform: translate(1px, 0px); @@ -27,7 +26,7 @@ <div class="container"> <video> <script> - document.currentScript.parentNode.src = findMediaFile('video', '../content/test'); + document.currentScript.parentNode.src = '../content/test.ogv'; </script> </video> <div class=video><div class="cue"><span>XXX</span></div></div>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video.html index d359c55..bcaa0e1 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-transformed-video.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> -<script src="../media-file.js"></script> <style> video { transform: translate(1px, 0px); @@ -19,5 +18,5 @@ cue.line = 0; track.addCue(cue); track.mode = 'showing'; -video.src = findMediaFile('video', '../content/test'); +video.src = '../content/test.ogv'; </script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html index bf8e92d..52f74fd 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that the cue display tree has been removed properly and no crash happens.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -10,7 +9,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); video.oncanplaythrough = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-vertical.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-vertical.html index 8932baee..a37f060 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-vertical.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-vertical.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <title>Test, rendering vertical line-positioned cues with Japanese text.</title> -<script src="../media-file.js"></script> <video> <track src="captions-webvtt/captions-snap-to-lines-set.vtt" kind="captions" default> </video> <script> var video = document.querySelector("video"); -video.src = findMediaFile("video", "../content/test"); +video.src = "../content/test.ogv"; testRunner.waitUntilDone(); video.onseeked = function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-wider-than-controls.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-wider-than-controls.html index 4ac19e34..82c10c2 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-wider-than-controls.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-wider-than-controls.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that the cue root is not constrained by the controls/overlay.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -23,8 +22,8 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + video.onseeked = t.step_func_done(function() { // The width of the controls depends on UA style, so verify that our assumption holds. var controlsContainer = mediaControlsButton(video, "panel"); @@ -33,7 +32,7 @@ var cueRoot = textTrackContainerElement(video); assert_true(parseFloat(getComputedStyle(cueRoot).width) > 800); }); - + video.currentTime = 2; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-with-padding.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-with-padding.html index 27550f0..9ccce45 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-with-padding.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-with-padding.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests rendering text track cue line with padding set.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -15,7 +14,7 @@ <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.onseeked = t.step_func_done(function() { var cueContainerElement = textTrackContainerElement(video);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html index a0eec76e..8a20c33 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that default positioned TextTrack's cues are rendered correctly.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -12,7 +11,7 @@ async_test(function(t) { var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; var cueTextIndex = 0; var cueText = [ "Lorem", "ipsum", "dolor", "sit" ]; @@ -50,7 +49,7 @@ } })); } - + video.currentTime = 0.5; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-cuechange.html b/third_party/WebKit/LayoutTests/media/track/track-cues-cuechange.html index c0a85e3..49c0526 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-cuechange.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-cuechange.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that TextTrack's cues are indexed and updated in order during video playback. Test uses the cuechange event.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -11,7 +10,7 @@ var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.oncanplaythrough = t.step_func(attemptTests); function attemptTests() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-enter-exit.html b/third_party/WebKit/LayoutTests/media/track/track-cues-enter-exit.html index 5c491b1e..e973204 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-enter-exit.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-enter-exit.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that TextTrack's cues are indexed and updated in order during video playback. Test uses the enter and exits events on TextTrackCue.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -11,8 +10,8 @@ var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + video.oncanplaythrough = t.step_func(attemptTests); function attemptTests() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-missed.html b/third_party/WebKit/LayoutTests/media/track/track-cues-missed.html index 40f2f75..9510499f 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-missed.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-missed.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that events are triggered for missed (skipped) cues during normal playback.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -11,8 +10,8 @@ var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/test"); - + video.src = "../content/test.ogv"; + video.onended = t.step_func_done(); video.oncanplaythrough = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html b/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html index 7cea266..46f69456 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html
@@ -2,7 +2,6 @@ <title>Tests that the video is paused after cues that have pause-on-exit flag are processed.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <video controls> <track src="captions-webvtt/simple-captions.vtt" default> </video> @@ -26,7 +25,7 @@ }); } } - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.currentTime = 4.00; video.play(); assert_false(video.paused);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html b/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html index 0cc4399..cc5fa9d 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html
@@ -2,7 +2,6 @@ <title>Tests TextTrack's activeCues are indexed and updated during video playback.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <video> <track src="captions-webvtt/cues-overlapping.vtt" kind="subtitles" default> </video> @@ -12,7 +11,7 @@ var track = document.querySelector("track"); track.onload = t.step_func(function() { assert_equals(track.track.cues.length, 3); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.currentTime = 0.5; });
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html b/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html index e602ee1..10cf7af 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html
@@ -2,14 +2,13 @@ <title>Tests that all events are triggered in chronological order.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <video> <track src="captions-webvtt/sorted-dispatch.vtt" default> </video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; var track = document.querySelector("track"); track.onload = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html b/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html index 93e5763..3e558dc 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html +++ b/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html
@@ -2,7 +2,6 @@ <title>Tests track deletion during setup.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <video> <track src="captions-webvtt/metadata.vtt"> </video> @@ -24,6 +23,6 @@ assert_equals(track.track.mode, "disabled"); track.track.mode = "hidden"; - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html b/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html index 147eced..297556a 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html +++ b/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test adding cues to a disabled text track. </title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> @@ -28,7 +27,7 @@ t.done(); }); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-disabled.html b/third_party/WebKit/LayoutTests/media/track/track-disabled.html index 5b44aa8..df3423f 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-disabled.html +++ b/third_party/WebKit/LayoutTests/media/track/track-disabled.html
@@ -3,7 +3,6 @@ <video> <track kind="subtitles" src="captions-webvtt/captions.vtt"/> </video> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> @@ -23,7 +22,7 @@ t.done(); }); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-insert-after-load-crash.html b/third_party/WebKit/LayoutTests/media/track/track-insert-after-load-crash.html index 7e2e95ff..51d146c6 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-insert-after-load-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/track-insert-after-load-crash.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <title>Tests that inserting a track element immediately after a load() doesn't crash.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> async_test(function(t) { var video = document.createElement('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.load(); video.appendChild(document.createElement('track')); video.onloadedmetadata = t.step_func_done();
diff --git a/third_party/WebKit/LayoutTests/media/track/track-kind-user-preference.html b/third_party/WebKit/LayoutTests/media/track/track-kind-user-preference.html index c53f44c..62bbfa9 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-kind-user-preference.html +++ b/third_party/WebKit/LayoutTests/media/track/track-kind-user-preference.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Test that user preference for text track kind is honored.</title> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -21,7 +20,7 @@ internals.settings.setTextTrackKindUserPreference("default"); }); internals.setUserPreferredLanguages(["jp", "es", "en", "fr"]); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; var tracks; var expectedTrack;
diff --git a/third_party/WebKit/LayoutTests/media/track/track-language-preference-no-crash.html b/third_party/WebKit/LayoutTests/media/track/track-language-preference-no-crash.html index 45beef5..c361188 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-language-preference-no-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/track-language-preference-no-crash.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that setting preferences on a track-less video element does not crash.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-language-preference.html b/third_party/WebKit/LayoutTests/media/track/track-language-preference.html index 3edd1d69..67c23dca 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-language-preference.html +++ b/third_party/WebKit/LayoutTests/media/track/track-language-preference.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <title>Tests that the user's preferred languages are honored.</title> <video></video> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-large-timestamp.html b/third_party/WebKit/LayoutTests/media/track/track-large-timestamp.html index 81f8be9..4481615d 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-large-timestamp.html +++ b/third_party/WebKit/LayoutTests/media/track/track-large-timestamp.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that a very large timestamp is parsed correctly.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-mode-disabled-crash.html b/third_party/WebKit/LayoutTests/media/track/track-mode-disabled-crash.html index 4ed7a1e..ea707af6 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-mode-disabled-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/track-mode-disabled-crash.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that cues are properly removed from the active cue list when their track changes mode to disabled.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -11,7 +10,7 @@ var video = document.querySelector("video"); var testTrack = document.querySelector("track"); - video.src = findMediaFile("video", "../content/counting"); + video.src = "../content/counting.ogv"; video.oncanplaythrough = t.step_func(startTest); video.onseeked = t.step_func_done(seeked);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-mode-not-changed-by-new-track.html b/third_party/WebKit/LayoutTests/media/track/track-mode-not-changed-by-new-track.html index 5a455b1..bac70940 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-mode-not-changed-by-new-track.html +++ b/third_party/WebKit/LayoutTests/media/track/track-mode-not-changed-by-new-track.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that a track appended after the initial track configuration does not change other tracks.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -14,7 +13,7 @@ assert_equals(track1.readyState, HTMLTrackElement.NONE); assert_equals(track1.track.mode, 'disabled'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.oncanplaythrough = t.step_func(canplaythrough); track1.onload = t.step_func(metadataTrackLoaded);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html b/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html index dc10a5aa..a17358d 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html +++ b/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that a "metadata" track does not load automatically, but does load when the mode is changed.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -15,7 +14,7 @@ assert_equals(track.readyState, HTMLTrackElement.NONE); assert_equals(video.textTracks[0].mode, "disabled"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.oncanplaythrough = t.step_func(canplaythrough); track.onload = t.step_func_done(trackLoaded);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-mode.html b/third_party/WebKit/LayoutTests/media/track/track-mode.html index bb4562f..99a4ff5 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-mode.html +++ b/third_party/WebKit/LayoutTests/media/track/track-mode.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Tests that the TextTrack mode attribute is appropriately set.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -33,7 +32,7 @@ // Set to known values. setModeAndCheck("disabled"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; video.play(); // Wait for end of first cue (no events should fire while track is disabled). setTimeout(testHiddenAndShowing, 400);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html b/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html index 06e2ab2b..8890631 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html +++ b/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html
@@ -1,13 +1,12 @@ <!DOCTYPE html> <title>Tests that removing an active cue does not crash the browser.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; // Add a text track to the video element. video.addTextTrack("captions", "regular captions track", "en");
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-by-setting-innerHTML.html b/third_party/WebKit/LayoutTests/media/track/track-remove-by-setting-innerHTML.html index 040baed..5673d8b 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-remove-by-setting-innerHTML.html +++ b/third_party/WebKit/LayoutTests/media/track/track-remove-by-setting-innerHTML.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>This test makes sure that removing a track by setting video.innerHTML doesn't crash (https://bugs.webkit.org/show_bug.cgi?id=100981). If this test does not crash, it passes.</title> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <video> @@ -24,8 +23,8 @@ video.currentTime = 7.9; firstSeek = false; }); - + video.currentTime = 0.5; - video.src = findMediaFile('video', '../content/counting'); + video.src = '../content/counting.ogv'; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html b/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html index 5d602681..fe0ae77 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html +++ b/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html
@@ -3,13 +3,12 @@ <video> <track src="captions-webvtt/tc004-no-webvtt.vtt" kind="captions" default> </video> -<script src="../media-file.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; video.oncanplaythrough = t.step_func(canplaythrough); function canplaythrough() { @@ -23,7 +22,7 @@ document.body.removeChild(video); // Reset the video src attribute to re-trigger resource selection for tracks. - video.src = findMediaFile('video', '../content/test'); + video.src = '../content/test.ogv'; // Append the video element back to the body. document.body.appendChild(video);
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-quickly.html b/third_party/WebKit/LayoutTests/media/track/track-remove-quickly.html index 8649029..3266eea 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-remove-quickly.html +++ b/third_party/WebKit/LayoutTests/media/track/track-remove-quickly.html
@@ -2,10 +2,9 @@ <title>This test that removing a track element before it has been processed doesn't crash (https://bugs.webkit.org/show_bug.cgi?id=85095).</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <div id="video_container"></div> <script> -var mediaFile = findMediaFile("video", "../content/test"); +var mediaFile = "../content/test.ogv"; document.getElementById("video_container").innerHTML = "<video src='" + mediaFile + "' controls ><track kind='captions' src='captions-webvtt/simple-captions.vtt' default ></video>"; test(function() { // Test passes if it doesn't crash.
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-track.html b/third_party/WebKit/LayoutTests/media/track/track-remove-track.html index a432428..73d0349b 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-remove-track.html +++ b/third_party/WebKit/LayoutTests/media/track/track-remove-track.html
@@ -3,8 +3,7 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <script src="../media-file.js"></script> - <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> </head> <body>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines-expected.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines-expected.html index 877333d7..3dd6fca5 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines-expected.html +++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines-expected.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Reference test for track-webvtt-non-snap-to-lines.html.</title> -<script src="../media-file.js"></script> <style> .container { position: relative; @@ -19,7 +18,7 @@ <div class="container"> <video> <script> - document.currentScript.parentNode.src = findMediaFile('video', '../content/test'); + document.currentScript.parentNode.src = '../content/test.ogv'; </script> </video> <span class="cue">Bear is Coming!!!!!</div>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines.html index 3e45b33..0bc4e12 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines.html +++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-non-snap-to-lines.html
@@ -5,7 +5,6 @@ background: green; } </style> -<script src="../media-file.js"></script> <video></video> <script> var video = document.querySelector("video"); @@ -16,5 +15,5 @@ cue.align = "left"; track.addCue(cue); track.mode = "showing"; -video.src = findMediaFile("video", "../content/test"); +video.src = "../content/test.ogv"; </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html b/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html index b1a606cb..24d151e 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html +++ b/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html
@@ -2,7 +2,6 @@ <title>Test that line breaks are forced in captions.</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../media-file.js"></script> <script src="../media-controls.js"></script> <video> <track src="captions-webvtt/long-word.vtt" kind="captions" default> @@ -22,7 +21,7 @@ assert_greater_than(multiLineCaptionHeight / singleLineCaptionHeight, 2); }); - video.src = findMediaFile("video", "../content/test"); + video.src = "../content/test.ogv"; function getCaptionLineHeight() { var captionElement = textTrackContainerElement(video).firstChild.firstChild;
diff --git a/third_party/WebKit/LayoutTests/media/unsupported-tracks.html b/third_party/WebKit/LayoutTests/media/unsupported-tracks.html index f1fd3bc..09e5077 100644 --- a/third_party/WebKit/LayoutTests/media/unsupported-tracks.html +++ b/third_party/WebKit/LayoutTests/media/unsupported-tracks.html
@@ -2,12 +2,11 @@ <title>Test that QuickTime file with unsupported track types only, generates an error.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/unsupported_track"); + video.src = "content/unsupported_track.ogv"; video.onerror = t.step_func_done(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-append-source.html b/third_party/WebKit/LayoutTests/media/video-append-source.html index 4a97b68..3152888 100644 --- a/third_party/WebKit/LayoutTests/media/video-append-source.html +++ b/third_party/WebKit/LayoutTests/media/video-append-source.html
@@ -2,13 +2,12 @@ <title>Verify that a media element's currentSrc is correctly set to source element's src</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); assert_equals(video.currentSrc, ""); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; var source = document.createElement("source"); source.src = mediaFile; video.appendChild(source);
diff --git a/third_party/WebKit/LayoutTests/media/video-aspect-ratio.html b/third_party/WebKit/LayoutTests/media/video-aspect-ratio.html index ffd95a9..657b4fb 100644 --- a/third_party/WebKit/LayoutTests/media/video-aspect-ratio.html +++ b/third_party/WebKit/LayoutTests/media/video-aspect-ratio.html
@@ -1,6 +1,6 @@ <script src="media-file.js"></script> <script src="video-paint-test.js"></script> -<body onload="setSrcByTagName('video', findMediaFile('video', 'content/test')); init()"> +<body onload="setSrcByTagName('video', 'content/test.ogv'); init()"> <p>Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size. </p> <video></video><br> <video style="width: 160px; height:120px">
diff --git a/third_party/WebKit/LayoutTests/media/video-autoplay.html b/third_party/WebKit/LayoutTests/media/video-autoplay.html index 5d3d8ff..3f1bf06 100644 --- a/third_party/WebKit/LayoutTests/media/video-autoplay.html +++ b/third_party/WebKit/LayoutTests/media/video-autoplay.html
@@ -2,7 +2,6 @@ <title>Verify that "autoplay" attribute on a media element starts playback automatically.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video autoplay></video> <script> async_test(function(t) { @@ -14,6 +13,6 @@ assert_false(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-black-bg-in-media-document.html b/third_party/WebKit/LayoutTests/media/video-black-bg-in-media-document.html index 2ae28aa..a6db6f38 100644 --- a/third_party/WebKit/LayoutTests/media/video-black-bg-in-media-document.html +++ b/third_party/WebKit/LayoutTests/media/video-black-bg-in-media-document.html
@@ -2,7 +2,6 @@ <title>Test that video media documents have a black background.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <iframe></iframe> <script> async_test(function(t) { @@ -15,6 +14,6 @@ assert_equals(iframeBodyStyle.backgroundColor, "rgb(0, 0, 0)"); }); - iframe.src = findMediaFile("video", "content/counting"); + iframe.src = "content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-buffered-unknown-duration.html b/third_party/WebKit/LayoutTests/media/video-buffered-unknown-duration.html index 8271244..3cbce76 100644 --- a/third_party/WebKit/LayoutTests/media/video-buffered-unknown-duration.html +++ b/third_party/WebKit/LayoutTests/media/video-buffered-unknown-duration.html
@@ -2,7 +2,6 @@ <title>Load a video with an infinite duration. Start playback and ensure video.currentTime is less than video.buffered.end(0) upon first timeupdate.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) {
diff --git a/third_party/WebKit/LayoutTests/media/video-buffered.html b/third_party/WebKit/LayoutTests/media/video-buffered.html index b7b6070..645dab5 100644 --- a/third_party/WebKit/LayoutTests/media/video-buffered.html +++ b/third_party/WebKit/LayoutTests/media/video-buffered.html
@@ -2,7 +2,6 @@ <title>Test video buffering properties.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -24,6 +23,6 @@ assert_throws("IndexSizeError", function() { video.buffered.end(1); }); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas-alpha.html b/third_party/WebKit/LayoutTests/media/video-canvas-alpha.html index 9ee14545..82c438b 100644 --- a/third_party/WebKit/LayoutTests/media/video-canvas-alpha.html +++ b/third_party/WebKit/LayoutTests/media/video-canvas-alpha.html
@@ -1,6 +1,5 @@ <html> <head> - <script src="media-file.js"></script> <script> if (window.testRunner) { @@ -9,8 +8,8 @@ function onLoad() { video = document.getElementsByTagName('video')[0]; - video.src = findMediaFile("video", "content/test"); - + video.src = "content/test.ogv"; + canvas = document.getElementsByTagName('canvas')[0]; ctx = canvas.getContext('2d'); @@ -22,7 +21,7 @@ if (window.testRunner) { testRunner.notifyDone(); } - }); + }); } </script> </head>
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas-draw-expected.html b/third_party/WebKit/LayoutTests/media/video-canvas-draw-expected.html index 0f9f145..4f0d5da6 100644 --- a/third_party/WebKit/LayoutTests/media/video-canvas-draw-expected.html +++ b/third_party/WebKit/LayoutTests/media/video-canvas-draw-expected.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <head> -<script src="media-file.js"></script> <script> if (window.testRunner) { @@ -21,16 +20,16 @@ var video1 = document.getElementById('video1'); var video2 = document.getElementById('video2'); var video3 = document.getElementById('video3'); - video1.src = findMediaFile("video", "content/test"); + video1.src = "content/test.ogv"; video2.src = video1.src; video3.src = video1.src; video1.load(); video2.load(); video3.load(); - video1.addEventListener("canplay", onVideoLoaded); - video2.addEventListener("canplay", onVideoLoaded); - video3.addEventListener("canplay", onVideoLoaded); + video1.addEventListener("canplay", onVideoLoaded); + video2.addEventListener("canplay", onVideoLoaded); + video3.addEventListener("canplay", onVideoLoaded); } </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas-draw.html b/third_party/WebKit/LayoutTests/media/video-canvas-draw.html index 1bf7227d..8dc445b 100644 --- a/third_party/WebKit/LayoutTests/media/video-canvas-draw.html +++ b/third_party/WebKit/LayoutTests/media/video-canvas-draw.html
@@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <head> -<script src="media-file.js"></script> <script> if (window.testRunner) { @@ -10,7 +9,7 @@ function onLoad() { var video = document.getElementsByTagName('video')[0]; - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; var canvas1 = document.getElementById('canvas1'); var canvas2 = document.getElementById('canvas2'); @@ -27,7 +26,7 @@ if (window.testRunner) { testRunner.notifyDone(); } - }); + }); } </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas-source.html b/third_party/WebKit/LayoutTests/media/video-canvas-source.html index 0832004..c8bc4c8f 100644 --- a/third_party/WebKit/LayoutTests/media/video-canvas-source.html +++ b/third_party/WebKit/LayoutTests/media/video-canvas-source.html
@@ -2,7 +2,6 @@ <title>Verify that drawing to canvas using video with source element does not taint canvas</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <canvas></canvas> <script> @@ -20,7 +19,7 @@ }); var source = document.createElement("source"); - source.src = findMediaFile("video", "content/counting"); + source.src = "content/counting.ogv"; video.appendChild(source); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas.html b/third_party/WebKit/LayoutTests/media/video-canvas.html index 3a0c2981..f3b1c88 100644 --- a/third_party/WebKit/LayoutTests/media/video-canvas.html +++ b/third_party/WebKit/LayoutTests/media/video-canvas.html
@@ -2,7 +2,6 @@ <title>Test "video" as a source for "canvas".</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <canvas width="160" height="120"></canvas> <script> @@ -58,6 +57,6 @@ video.currentTime = results.values[results.current].time; } - video.src = findMediaFile("video", "content/counting"); + video.src = "content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-colorspace-yuv420.html b/third_party/WebKit/LayoutTests/media/video-colorspace-yuv420.html index c19951a..740f5dc 100644 --- a/third_party/WebKit/LayoutTests/media/video-colorspace-yuv420.html +++ b/third_party/WebKit/LayoutTests/media/video-colorspace-yuv420.html
@@ -7,7 +7,7 @@ <p>Test correct colorspace for yuv420, i.e. YU12 video </p> <video/> <script> - setSrcByTagName('video', findMediaFile('video', 'content/test_yuv420')); + setSrcByTagName('video', 'content/test_yuv420.ogv'); init(); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/media/video-colorspace-yuv422.html b/third_party/WebKit/LayoutTests/media/video-colorspace-yuv422.html index 1b5bb23..3e42c048 100644 --- a/third_party/WebKit/LayoutTests/media/video-colorspace-yuv422.html +++ b/third_party/WebKit/LayoutTests/media/video-colorspace-yuv422.html
@@ -7,7 +7,7 @@ <p>Test correct colorspace for yuv422, i.e. YU16 video </p> <video/> <script> - setSrcByTagName('video', findMediaFile('video', 'content/test_yuv422')); + setSrcByTagName('video', 'content/test_yuv422.ogv'); init(); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html b/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html index 5bc07fb..71ea685 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html
@@ -2,7 +2,6 @@ <title>Verify that media controls are always visible when hovered.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -26,6 +25,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-attribute-fullscreen.html b/third_party/WebKit/LayoutTests/media/video-controls-attribute-fullscreen.html index 0e9fe94..fffbfca 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-attribute-fullscreen.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-attribute-fullscreen.html
@@ -2,12 +2,11 @@ <title>Test that the controls attribute is not affected by fullscreen</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onloadeddata = t.step_func(function() { assert_false(video.controls); video.onwebkitfullscreenchange = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html b/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html index 3c2c2799..8f87fe0 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html
@@ -2,7 +2,6 @@ <title>Test video control element visibility when play by touch.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -33,6 +32,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-dont-show-on-focus-when-disabled.html b/third_party/WebKit/LayoutTests/media/video-controls-dont-show-on-focus-when-disabled.html index 0b204f0..41b0b9bf 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-dont-show-on-focus-when-disabled.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-dont-show-on-focus-when-disabled.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <!-- "tabindex" makes the video focusable despite it not having controls --> <video tabindex="0"></video> <script> @@ -18,7 +17,7 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-download-button-not-displayed-local.html b/third_party/WebKit/LayoutTests/media/video-controls-download-button-not-displayed-local.html index 751ccfb..a356bec0 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-download-button-not-displayed-local.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-download-button-not-displayed-local.html
@@ -3,12 +3,11 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <video controls></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; var controlID = "-internal-media-controls-download-button"; var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChild, controlID); video.onloadeddata = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html b/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html index ef9b581..5d858c18 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <video controls></video> <script> async_test(function(t) { @@ -25,6 +24,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-allowed.html b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-allowed.html index f394b3c..65f641b9 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-allowed.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-allowed.html
@@ -4,8 +4,7 @@ <title>video controls fullscreen button in iframe with allowfullscreen attribute</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> - <script src="media-controls.js"></script> + <script src="media-controls.js"></script> <script src="video-controls-fullscreen.js"></script> </head> <body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-not-allowed.html b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-not-allowed.html index b270d8f6..049d9f9 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-not-allowed.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-iframe-not-allowed.html
@@ -4,8 +4,7 @@ <title>video controls fullscreen button in iframe without allowfullscreen attribute</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> - <script src="media-controls.js"></script> + <script src="media-controls.js"></script> <script src="video-controls-fullscreen.js"></script> </head> <body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-not-supported.html b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-not-supported.html index 028f7ae..4931e3b 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-not-supported.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen-not-supported.html
@@ -4,8 +4,7 @@ <title>video controls fullscreen button with fullscreenSupported setting disabled</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> - <script src="media-controls.js"></script> + <script src="media-controls.js"></script> <script src="video-controls-fullscreen.js"></script> </head> <body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.html b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.html index 38fddf1..514894a 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.html
@@ -4,8 +4,7 @@ <title>video controls fullscreen button</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> - <script src="media-file.js"></script> - <script src="media-controls.js"></script> + <script src="media-controls.js"></script> <script src="video-controls-fullscreen.js"></script> </head> <body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.js b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.js index 5c953fe..6cbceaea 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.js +++ b/third_party/WebKit/LayoutTests/media/video-controls-fullscreen.js
@@ -7,8 +7,8 @@ var v1 = document.createElement("video"); var v2 = document.createElement("video"); v1.controls = v2.controls = true; - v1.src = findMediaFile("video", "content/test"); - v2.src = findMediaFile("audio", "content/test"); + v1.src = "content/test.ogv"; + v2.src = "content/test.oga"; document.body.appendChild(v1); document.body.appendChild(v2); @@ -41,7 +41,7 @@ var doc = iframe.contentDocument; var v = doc.createElement("video"); v.controls = true; - v.src = findMediaFile("video", "content/test"); + v.src = "content/test.ogv"; doc.body.appendChild(v); v.addEventListener("loadeddata", t.step_func_done(function() @@ -58,7 +58,7 @@ { var v = document.createElement("video"); v.controls = true; - v.src = findMediaFile("video", "content/test"); + v.src = "content/test.ogv"; document.body.appendChild(v); v.addEventListener("loadeddata", t.step_func_done(function()
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html b/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html index 5d023ca2..e4cc123 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <video controls></video> <script> async_test(function(t) { @@ -47,6 +46,6 @@ video.muted = true; }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }) </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-hide-after-touch-on-control.html b/third_party/WebKit/LayoutTests/media/video-controls-hide-after-touch-on-control.html index 37c5aeaa..bb4767d 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-hide-after-touch-on-control.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-hide-after-touch-on-control.html
@@ -2,7 +2,6 @@ <title>Test video controls visibility on touch. After a delay the controls must be hidden.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -25,6 +24,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html b/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html index aa6c602..386dfa42 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html
@@ -2,7 +2,6 @@ <title>Test video controls visibility when mouse is not over controls.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -28,6 +27,6 @@ eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-in-media-document.html b/third_party/WebKit/LayoutTests/media/video-controls-in-media-document.html index 05b878d..1386a2e5 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-in-media-document.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-in-media-document.html
@@ -2,7 +2,6 @@ <title>Test that controls don't increase the size of the container (i.e. are rendered overlapping with the video canvas).</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <iframe style="width: 400px; height: 300px; border: 0px;"></iframe> <script> async_test(function(t) { @@ -17,6 +16,6 @@ }); }); - iframe.src = findMediaFile("video", "content/test"); + iframe.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-labels.html b/third_party/WebKit/LayoutTests/media/video-controls-labels.html index 697eae15..7ef52c8 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-labels.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-labels.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <video controls> <track kind="subtitles" src="captions.vtt" srclang="is" label="Icelandic"> <track kind="subtitles" src="captions-fast.vtt" srclang="fr" label=""> @@ -26,6 +25,6 @@ assert_equals(captionsList.children[3].innerText, "Track 3"); }); - video.src = findMediaFile("video", "content/counting"); + video.src = "content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-mouse-events-captured.html b/third_party/WebKit/LayoutTests/media/video-controls-mouse-events-captured.html index 052b9883..bd8a817 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-mouse-events-captured.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-mouse-events-captured.html
@@ -2,7 +2,6 @@ <title>This tests that a mouse/keyboard event on the controls will not be seen by the video element.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -62,6 +61,6 @@ eventSender.keyDown('A'); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-muted-video-can-unmute.html b/third_party/WebKit/LayoutTests/media/video-controls-muted-video-can-unmute.html index c12fe6e3..db29c9ac 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-muted-video-can-unmute.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-muted-video-can-unmute.html
@@ -2,7 +2,6 @@ <title>Test that muted video has an unmute button.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -17,6 +16,6 @@ assert_not_equals(getComputedStyle(muteButton).display, "none"); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-button.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-button.html index fff2b17..f1c3212 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-button.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-button.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video. var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); // Add two captions. video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-list-hide-on-click-outside.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-list-hide-on-click-outside.html index 34f0b45..06f75c2 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-list-hide-on-click-outside.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-closed-captions-list-hide-on-click-outside.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); // Add captions var track = video.addTextTrack("captions");
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-fullscreen-button.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-fullscreen-button.html index 30fccc1..9969bcf 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-fullscreen-button.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-fullscreen-button.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); window.addEventListener("load", t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-last-button-visible.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-last-button-visible.html index 4446dc1..114a784c 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-last-button-visible.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-last-button-visible.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -14,10 +13,10 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; var audio = document.querySelector("audio"); - audio.src = findMediaFile("audio", "content/test"); + audio.src = "content/test.oga"; video.onloadeddata = t.step_func_done(function() { var overflowVideo = getOverflowMenuButton(video);
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-mute-button.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-mute-button.html index 9ce5a68..e0e2e41 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-mute-button.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-mute-button.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); video.onloadeddata = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-play-button.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-play-button.html index 07a0562..874d194 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-play-button.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-play-button.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script src="overflow-menu.js"></script> <!--Padding ensures the overflow menu is visible for the tests. --> @@ -13,7 +12,7 @@ async_test(function(t) { // Set up video var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.setAttribute("width", "60"); video.onloadeddata = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-rendering.html b/third_party/WebKit/LayoutTests/media/video-controls-rendering.html index d9b7aee0..9f0273a 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-rendering.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-rendering.html
@@ -15,6 +15,6 @@ if (window.internals) window.internals.settings.setMockScrollbarsEnabled(true); init(); -setSrcByTagName('video', findMediaFile('video', 'content/test')); +setSrcByTagName('video', 'content/test.ogv'); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-show-on-focus.html b/third_party/WebKit/LayoutTests/media/video-controls-show-on-focus.html index 2e7f025..39efcff 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-show-on-focus.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-show-on-focus.html
@@ -2,7 +2,6 @@ <title>Test visibiblity of controls when focusing video.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls autoplay></video> <script> @@ -22,6 +21,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-toggling.html b/third_party/WebKit/LayoutTests/media/video-controls-toggling.html index 98beb5e7..c80f576 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-toggling.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-toggling.html
@@ -2,7 +2,6 @@ <title>Test rendering of volume slider of video tag.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -14,7 +13,7 @@ video.onplay = t.step_func(function() { panel = mediaControlsButton(video, "panel"); muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button"); - + // Move mouse somewhere over the panel. eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1]); @@ -43,7 +42,7 @@ t.done(); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-touch-events-captured.html b/third_party/WebKit/LayoutTests/media/video-controls-touch-events-captured.html index cd1b40b..2f7f0f7 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-touch-events-captured.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-touch-events-captured.html
@@ -2,7 +2,6 @@ <title>Test that touch events on the controls will not be seen by the video element.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls></video> <script> @@ -43,6 +42,6 @@ eventSender.cancelTouchPoint(0); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html b/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html index 989249c..3139ff1 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="track/track-helpers.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <!-- Width should be large enough to display closed captions button. --> <video controls style="width: 500px"> @@ -45,7 +44,7 @@ assert_equals(textTrackDisplayElement(video).innerText, "first caption"); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; } }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-transformed.html b/third_party/WebKit/LayoutTests/media/video-controls-transformed.html index b579419..b70ac0a 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-transformed.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-transformed.html
@@ -2,7 +2,6 @@ <title>Test "controls" on transformed video.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <style> video { @@ -25,6 +24,6 @@ assert_false(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-mouse-after-touch.html b/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-mouse-after-touch.html index a762090..e2abfcd 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-mouse-after-touch.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-mouse-after-touch.html
@@ -2,7 +2,6 @@ <title>Test video controls visibility with multimodal input. The controls should remain visible if the last input event was a mouse move over them.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -24,7 +23,7 @@ // And then hover the control with the mouse. eventSender.mouseMoveTo(0, 0); eventSender.mouseMoveTo(coords[0], coords[1]); - + // And the controls should remain visible. runAfterHideMediaControlsTimerFired(t.step_func_done(function() { assert_true(isControlsPanelVisible(video)); @@ -32,6 +31,6 @@ }), video); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-touch-after-mouse.html b/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-touch-after-mouse.html index c578b4e..7ccc2e47 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-touch-after-mouse.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-visibility-multimodal-touch-after-mouse.html
@@ -2,7 +2,6 @@ <title>Test video controls visibility with multimodal input. The controls should hide after a timeout if the last input event was a tap.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <video controls loop></video> <script> @@ -36,6 +35,6 @@ }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-visible-audio-only.html b/third_party/WebKit/LayoutTests/media/video-controls-visible-audio-only.html index a267a38..2bb7834ff 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-visible-audio-only.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-visible-audio-only.html
@@ -2,7 +2,7 @@ <html> <head> <style> - #no-video-media { background-color: yellow; width: 320px; height: 100px;} + #no-video-media { background-color: yellow; width: 320px; height: 100px;} #mouse-parking:hover { padding:8; background-color: blue; } </style> <script src=media-file.js></script> @@ -20,15 +20,15 @@ var console = document.getElementById("console"); console.innerHTML += text + "<br>"; } - + function testcondition(testFuncString, endit) { if (eval(testFuncString)) consoleWrite("TEST(" + testFuncString + ") <span style='color:green'>OK</span>"); else - consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>"); + consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>"); } - + function start() { video = document.getElementById("no-video-media"); @@ -62,8 +62,8 @@ } if (window.testRunner) { - setTimeout(function() { - document.body.appendChild(document.createTextNode('FAIL')); + setTimeout(function() { + document.body.appendChild(document.createTextNode('FAIL')); if (window.testRunner) testRunner.notifyDone(); } , 8000); @@ -81,7 +81,7 @@ <video id="no-video-media" controls loop oncanplaythrough="start()"></video> <br><br><div id="console"></div> <script> - setSrcById("no-video-media", findMediaFile("audio", "content/test")); + setSrcById("no-video-media", "content/test.oga"); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html b/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html index b831b91..d76b9ce 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html +++ b/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html
@@ -2,7 +2,6 @@ <title>Test controls with zooming.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="media-controls.js"></script> <style> video { @@ -35,6 +34,6 @@ }, 50); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-controls.html b/third_party/WebKit/LayoutTests/media/video-controls.html index c2c26a73..75dd19e 100644 --- a/third_party/WebKit/LayoutTests/media/video-controls.html +++ b/third_party/WebKit/LayoutTests/media/video-controls.html
@@ -2,7 +2,6 @@ <title>Test "controls" attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video controls></video> <script> async_test(function(t) { @@ -21,6 +20,6 @@ assert_true(video.controls); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html index 453517d..5574eaa 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html
@@ -2,12 +2,11 @@ <title>Test currentTime values when setting while readystate is HAVE_NOTHING for media fragment URI.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test") + "#t=2"; + video.src = "content/test.ogv" + "#t=2"; assert_equals(video.currentTime, 0); video.currentTime = 1;
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html index 4bea570..5c9978b 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html
@@ -2,12 +2,11 @@ <title>Test currentTime values when setting while readystate is HAVE_NOTHING.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; assert_equals(video.currentTime, 0); video.currentTime = 1; assert_equals(video.currentTime, 1);
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html b/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html index be0fff4..4ae1630 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html
@@ -2,7 +2,6 @@ <title>Test, a delay in playing the movie still results in an "ended" event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -21,6 +20,6 @@ }); video.onended = t.step_func_done(); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set.html b/third_party/WebKit/LayoutTests/media/video-currentTime-set.html index 614144b..9ec6ad3 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-set.html
@@ -2,7 +2,6 @@ <title>Test that setting currentTime changes the time, and that "ended" event is fired in a reasonable amount of time.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -20,6 +19,6 @@ video.play(); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html b/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html index 350c058..53b46cc4 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html
@@ -2,7 +2,6 @@ <title>Test that setting currentTime changes the time, and setting invalid values throw exceptions.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -19,6 +18,6 @@ assert_equals(video.currentTime, 3.1); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime.html b/third_party/WebKit/LayoutTests/media/video-currentTime.html index b8b190c9..dbd5abc0 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime.html
@@ -2,7 +2,6 @@ <title>Test media current time values.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -18,6 +17,6 @@ }), 500); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-defaultmuted.html b/third_party/WebKit/LayoutTests/media/video-defaultmuted.html index db62a01..d8b47c0 100644 --- a/third_party/WebKit/LayoutTests/media/video-defaultmuted.html +++ b/third_party/WebKit/LayoutTests/media/video-defaultmuted.html
@@ -2,7 +2,6 @@ <title>Test "defaultMuted" IDL, "muted" IDL and content attributes.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> test(function() { var video = document.createElement("video"); @@ -32,6 +31,6 @@ assert_false(video.muted); }); - video.src = findMediaFile("audio", "content/test"); + video.src = "content/test.oga"; }, "Test 'muted' content and IDL attributes on video load"); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-delay-load-event.html b/third_party/WebKit/LayoutTests/media/video-delay-load-event.html index 3592227..5064289 100644 --- a/third_party/WebKit/LayoutTests/media/video-delay-load-event.html +++ b/third_party/WebKit/LayoutTests/media/video-delay-load-event.html
@@ -2,7 +2,6 @@ <title>Test that the document's load event is delayed until a video's meta data is available.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video id="video1"></video> <video id="video2"></video> <video id="video3"><source></source></video> @@ -11,11 +10,11 @@ assertVideoNoSrcNoLoad(document.getElementById("video1")); var video = document.getElementById("video2"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; assertVideoSrcNoLoad(video); var source = document.querySelector("source"); - source.src = findMediaFile("video", "content/test"); + source.src = "content/test.ogv"; assertVideoSrcNoLoad(document.getElementById("video3")); window.onload = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-display-aspect-ratio.html b/third_party/WebKit/LayoutTests/media/video-display-aspect-ratio.html index 96d91ef..3fe516e 100644 --- a/third_party/WebKit/LayoutTests/media/video-display-aspect-ratio.html +++ b/third_party/WebKit/LayoutTests/media/video-display-aspect-ratio.html
@@ -2,7 +2,6 @@ <title>Test video dimension aspect ratio.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -15,6 +14,6 @@ assert_equals(video.videoHeight, 240); }); - video.src = findMediaFile("video", "content/test-par-16-9"); + video.src = "content/test-par-16-9.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-display-none-crash.html b/third_party/WebKit/LayoutTests/media/video-display-none-crash.html index 67812acc..eee208f 100644 --- a/third_party/WebKit/LayoutTests/media/video-display-none-crash.html +++ b/third_party/WebKit/LayoutTests/media/video-display-none-crash.html
@@ -2,12 +2,11 @@ <title>Test that pause() after changing display to "none" doesn't cause a crash.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> test(function() { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); video.style.display = "none"; video.pause();
diff --git a/third_party/WebKit/LayoutTests/media/video-display-toggle.html b/third_party/WebKit/LayoutTests/media/video-display-toggle.html index 83aae36..56c577aa 100644 --- a/third_party/WebKit/LayoutTests/media/video-display-toggle.html +++ b/third_party/WebKit/LayoutTests/media/video-display-toggle.html
@@ -16,7 +16,7 @@ { if (window.testRunner) testRunner.waitUntilDone(); - setSrcById('vid', findMediaFile('video', 'content/test')); + setSrcById('vid', 'content/test.ogv'); var video = document.getElementById('vid'); video.addEventListener("canplaythrough", test2); video.load();
diff --git a/third_party/WebKit/LayoutTests/media/video-dom-autoplay.html b/third_party/WebKit/LayoutTests/media/video-dom-autoplay.html index 8aaf56e2..991eaaa 100644 --- a/third_party/WebKit/LayoutTests/media/video-dom-autoplay.html +++ b/third_party/WebKit/LayoutTests/media/video-dom-autoplay.html
@@ -2,7 +2,6 @@ <title>Test media "autoplay" attribute set via DOM.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -16,6 +15,6 @@ assert_false(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-dom-src.html b/third_party/WebKit/LayoutTests/media/video-dom-src.html index e214ce6..47c6877 100644 --- a/third_party/WebKit/LayoutTests/media/video-dom-src.html +++ b/third_party/WebKit/LayoutTests/media/video-dom-src.html
@@ -2,13 +2,12 @@ <title>Test media "src" attribute set via DOM.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); assert_equals(video.currentSrc, ""); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; video.src = mediaFile; assert_equals(video.currentSrc, "");
diff --git a/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html b/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html index fe5e533..612d148 100644 --- a/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html +++ b/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html
@@ -2,7 +2,6 @@ <title>Test double seek currentTime.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> // Seek to same time twice and make sure "seeking" is fired twice and that @@ -27,6 +26,6 @@ assert_equals(video.currentTime, timeToTest); })); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html b/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html index a1c3fac..296a1b2 100644 --- a/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html +++ b/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html
@@ -2,7 +2,6 @@ <title>Tests that duration is known after playback ended.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -17,7 +16,7 @@ video.currentTime = video.duration - 0.2; }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-enter-fullscreen-without-user-gesture.html b/third_party/WebKit/LayoutTests/media/video-enter-fullscreen-without-user-gesture.html index b6cd9a4f..4e255a4a 100644 --- a/third_party/WebKit/LayoutTests/media/video-enter-fullscreen-without-user-gesture.html +++ b/third_party/WebKit/LayoutTests/media/video-enter-fullscreen-without-user-gesture.html
@@ -2,7 +2,6 @@ <title>Test webkitRequestFullscreen() without any user gesture.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -15,6 +14,6 @@ video.onwebkitfullscreenerror = t.step_func_done(); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-error-networkState.html b/third_party/WebKit/LayoutTests/media/video-error-networkState.html index 535e2eff..be5a43d 100644 --- a/third_party/WebKit/LayoutTests/media/video-error-networkState.html +++ b/third_party/WebKit/LayoutTests/media/video-error-networkState.html
@@ -2,7 +2,6 @@ <title>Test media element networkState value in an error corner case.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -28,7 +27,7 @@ }), 0); }); - video.src = findMediaFile("video", "content/corrupt"); + video.src = "content/corrupt.ogv"; video.play(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-load.html b/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-load.html index c7b1a376..2b5392b 100644 --- a/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-load.html +++ b/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-load.html
@@ -2,12 +2,11 @@ <title>Test that loading a video element with preload "none" changes its effective preload to "metadata"</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video preload="none"></video> <script> test(function() { var video = document.querySelector('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; assert_equals(internals.effectivePreload(video), "none"); video.load(); assert_equals(internals.effectivePreload(video), "metadata");
diff --git a/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-play.html b/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-play.html index 1b494fe..e35facd 100644 --- a/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-play.html +++ b/third_party/WebKit/LayoutTests/media/video-force-preload-none-to-metadata-on-play.html
@@ -2,12 +2,11 @@ <title>Test that playing a video element with preload "none" changes its effective preload to "metadata"</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video preload="none"></video> <script> test(function() { var video = document.querySelector('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; assert_equals(internals.effectivePreload(video), "none"); video.play(); assert_equals(internals.effectivePreload(video), "metadata");
diff --git a/third_party/WebKit/LayoutTests/media/video-frame-accurate-seek.html b/third_party/WebKit/LayoutTests/media/video-frame-accurate-seek.html index a92a866..25ecf93 100644 --- a/third_party/WebKit/LayoutTests/media/video-frame-accurate-seek.html +++ b/third_party/WebKit/LayoutTests/media/video-frame-accurate-seek.html
@@ -4,7 +4,7 @@ <script src="media-file.js"></script> <script src="video-paint-test.js"></script> </head> - <body onload="setSrcByTagName('video', findMediaFile('video', 'content/test-25fps')); initAndSeeked()"> + <body onload="setSrcByTagName('video', 'content/test-25fps.ogv'); initAndSeeked()"> <p>Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.</p> <video oncanplaythrough='event.target.currentTime=(12/25)'></video> <video oncanplaythrough='event.target.currentTime=(13/25)'></video>
diff --git a/third_party/WebKit/LayoutTests/media/video-layer-crash.html b/third_party/WebKit/LayoutTests/media/video-layer-crash.html index 1c2cc22..96373a9 100644 --- a/third_party/WebKit/LayoutTests/media/video-layer-crash.html +++ b/third_party/WebKit/LayoutTests/media/video-layer-crash.html
@@ -12,7 +12,7 @@ <video style="transform:scale(0.5)"></video><br> <video style="transform:skew(20deg)"></video><br> <script> - setSrcByTagName('video', findMediaFile('video', 'content/test')); + setSrcByTagName('video', 'content/test.ogv'); document.body.removeChild(document.getElementById('one')); document.body.offsetLeft; init(); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-load-networkState.html b/third_party/WebKit/LayoutTests/media/video-load-networkState.html index e4175ed..b26125dc 100644 --- a/third_party/WebKit/LayoutTests/media/video-load-networkState.html +++ b/third_party/WebKit/LayoutTests/media/video-load-networkState.html
@@ -2,7 +2,6 @@ <title>Test that setting src to an invalid url triggers load(), which sets networkState to NETWORK_NO_SOURCE. Setting src to a valid url should then trigger the loading events and end up with networkState >= NETWORK_LOADING.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -17,7 +16,7 @@ video.onerror = t.step_func(function() { assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); // now set a valid url - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); video.oncanplaythrough = t.step_func_done(function () {
diff --git a/third_party/WebKit/LayoutTests/media/video-load-preload-none.html b/third_party/WebKit/LayoutTests/media/video-load-preload-none.html index bc789b3..e7ed897 100644 --- a/third_party/WebKit/LayoutTests/media/video-load-preload-none.html +++ b/third_party/WebKit/LayoutTests/media/video-load-preload-none.html
@@ -2,7 +2,6 @@ <title>Test that an explicit load() to a media element whose preload is set to "none" still loads the video.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video preload="none"></video> <script> async_test(function(t) { @@ -20,6 +19,6 @@ video.load(); }, 300); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-load-readyState.html b/third_party/WebKit/LayoutTests/media/video-load-readyState.html index 56b6b11..4e6cc93e 100644 --- a/third_party/WebKit/LayoutTests/media/video-load-readyState.html +++ b/third_party/WebKit/LayoutTests/media/video-load-readyState.html
@@ -2,7 +2,6 @@ <title>Test media element readystate value on load.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -19,6 +18,6 @@ assert_equals(video.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-loop-from-ended.html b/third_party/WebKit/LayoutTests/media/video-loop-from-ended.html index a441d48..b225846d 100644 --- a/third_party/WebKit/LayoutTests/media/video-loop-from-ended.html +++ b/third_party/WebKit/LayoutTests/media/video-loop-from-ended.html
@@ -2,7 +2,6 @@ <title>Test looping edge case to verify http://crbug.com/364442.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> // Seek towards end of video (for faster testing). @@ -50,6 +49,6 @@ video.play(); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-loop.html b/third_party/WebKit/LayoutTests/media/video-loop.html index 4aee3df..09ba701 100644 --- a/third_party/WebKit/LayoutTests/media/video-loop.html +++ b/third_party/WebKit/LayoutTests/media/video-loop.html
@@ -2,7 +2,6 @@ <title>Test video looping.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video autoplay></video> <script> // Test looping by: @@ -68,6 +67,6 @@ // Set "loop" to true and begin playing. video.loop = true; - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html b/third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html index cba59dc1..6476448 100644 --- a/third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html +++ b/third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html
@@ -2,11 +2,10 @@ <title>Test that moving video element to a new document and performing an operation on it doesn't crash.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> async_test(function(t) { var v = document.createElement('video'); - v.src = findMediaFile('video', 'content/test'); + v.src = 'content/test.ogv'; v.oncanplaythrough = t.step_func(function() { var newDoc = document.implementation.createDocument( "", null); newDoc.adoptNode(v);
diff --git a/third_party/WebKit/LayoutTests/media/video-move-to-new-document-srcobject.html b/third_party/WebKit/LayoutTests/media/video-move-to-new-document-srcobject.html index 9bb762f..361e0458 100644 --- a/third_party/WebKit/LayoutTests/media/video-move-to-new-document-srcobject.html +++ b/third_party/WebKit/LayoutTests/media/video-move-to-new-document-srcobject.html
@@ -2,7 +2,6 @@ <title>Verify that moving a video element to a new document, still loads it normally</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <iframe></iframe> <script>
diff --git a/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html b/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html index 139f701..18bbd24 100644 --- a/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html +++ b/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html
@@ -2,13 +2,12 @@ <title>Verify that moving a video element to a new document, still loads it normally</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <iframe></iframe> <script> async_test(function(t) { var video = document.querySelector('video'); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onloadeddata = this.step_func(function() { video.onloadeddata = null; assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
diff --git a/third_party/WebKit/LayoutTests/media/video-muted.html b/third_party/WebKit/LayoutTests/media/video-muted.html index 07d4247..965a8ae2 100644 --- a/third_party/WebKit/LayoutTests/media/video-muted.html +++ b/third_party/WebKit/LayoutTests/media/video-muted.html
@@ -2,7 +2,6 @@ <title>Test "muted" attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -17,6 +16,6 @@ assert_false(video.muted); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-no-audio.html b/third_party/WebKit/LayoutTests/media/video-no-audio.html index 22586257..209746e 100644 --- a/third_party/WebKit/LayoutTests/media/video-no-audio.html +++ b/third_party/WebKit/LayoutTests/media/video-no-audio.html
@@ -4,10 +4,10 @@ <script> if (window.testRunner) testRunner.waitUntilDone(); - + function start() { - setSrcByTagName("video", findMediaFile("video", "content/counting")); + setSrcByTagName("video", "content/counting.ogv"); } function finish()
diff --git a/third_party/WebKit/LayoutTests/media/video-no-autoplay.html b/third_party/WebKit/LayoutTests/media/video-no-autoplay.html index d10b5cc..867fdd2 100644 --- a/third_party/WebKit/LayoutTests/media/video-no-autoplay.html +++ b/third_party/WebKit/LayoutTests/media/video-no-autoplay.html
@@ -2,7 +2,6 @@ <title>Test that play event does not fire when "src" set with no autoplay attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -17,6 +16,6 @@ }), 500); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html b/third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html index 13bdfc8d..2219bb3 100644 --- a/third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html +++ b/third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html
@@ -2,7 +2,6 @@ <title>Video elements without controls should not absborb click events</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> test(_ => { @@ -22,6 +21,6 @@ t.done(); })); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-no-timeupdate-before-playback.html b/third_party/WebKit/LayoutTests/media/video-no-timeupdate-before-playback.html index 3f0b2c5..4974a9d8 100644 --- a/third_party/WebKit/LayoutTests/media/video-no-timeupdate-before-playback.html +++ b/third_party/WebKit/LayoutTests/media/video-no-timeupdate-before-playback.html
@@ -2,7 +2,6 @@ <title>Test that no timeupdate event fires during loading.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -18,6 +17,6 @@ }); video.ontimeupdate = t.unreached_func(); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-object-fit-change-expected.html b/third_party/WebKit/LayoutTests/media/video-object-fit-change-expected.html index 0fedd32..c016b30 100644 --- a/third_party/WebKit/LayoutTests/media/video-object-fit-change-expected.html +++ b/third_party/WebKit/LayoutTests/media/video-object-fit-change-expected.html
@@ -18,7 +18,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/video-object-fit-change.html b/third_party/WebKit/LayoutTests/media/video-object-fit-change.html index 428e11f60..0306d91 100644 --- a/third_party/WebKit/LayoutTests/media/video-object-fit-change.html +++ b/third_party/WebKit/LayoutTests/media/video-object-fit-change.html
@@ -18,7 +18,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/video-object-fit-expected.html b/third_party/WebKit/LayoutTests/media/video-object-fit-expected.html index 8337ef4b..b7fc684 100644 --- a/third_party/WebKit/LayoutTests/media/video-object-fit-expected.html +++ b/third_party/WebKit/LayoutTests/media/video-object-fit-expected.html
@@ -27,7 +27,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/video-object-fit.html b/third_party/WebKit/LayoutTests/media/video-object-fit.html index 67ad4d0f..1b2cd49 100644 --- a/third_party/WebKit/LayoutTests/media/video-object-fit.html +++ b/third_party/WebKit/LayoutTests/media/video-object-fit.html
@@ -18,7 +18,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount;
diff --git a/third_party/WebKit/LayoutTests/media/video-pause-empty-events.html b/third_party/WebKit/LayoutTests/media/video-pause-empty-events.html index 43bec2e..b95abc6 100644 --- a/third_party/WebKit/LayoutTests/media/video-pause-empty-events.html +++ b/third_party/WebKit/LayoutTests/media/video-pause-empty-events.html
@@ -2,12 +2,11 @@ <title>Test that pause() from EMPTY network state triggers load().</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); video.onloadstart = t.step_func(function() {});
diff --git a/third_party/WebKit/LayoutTests/media/video-pause-immediately.html b/third_party/WebKit/LayoutTests/media/video-pause-immediately.html index ca82c4c..9734c8b 100644 --- a/third_party/WebKit/LayoutTests/media/video-pause-immediately.html +++ b/third_party/WebKit/LayoutTests/media/video-pause-immediately.html
@@ -2,13 +2,12 @@ <title>Test that pausing the media element has an immediate effect on the clock.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var timeAfterPause; var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.oncanplay = t.step_func(function() { video.play(); });
diff --git a/third_party/WebKit/LayoutTests/media/video-persistence-expected.html b/third_party/WebKit/LayoutTests/media/video-persistence-expected.html index a6b60ca9..6d52a37 100644 --- a/third_party/WebKit/LayoutTests/media/video-persistence-expected.html +++ b/third_party/WebKit/LayoutTests/media/video-persistence-expected.html
@@ -29,7 +29,6 @@ } </style> -<script src='media-file.js'></script> <div id='player'> <div id='container'> <video></video> @@ -38,7 +37,7 @@ <div id='fs'>fullscreen</div> <script> var video = document.querySelector('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; document.querySelector('#fs').addEventListener('click', e => { document.querySelector('#player').webkitRequestFullscreen();
diff --git a/third_party/WebKit/LayoutTests/media/video-persistence.html b/third_party/WebKit/LayoutTests/media/video-persistence.html index 2b13a5a2..a9112eb 100644 --- a/third_party/WebKit/LayoutTests/media/video-persistence.html +++ b/third_party/WebKit/LayoutTests/media/video-persistence.html
@@ -20,7 +20,6 @@ } </style> -<script src='media-file.js'></script> <div id='player'> <div id='container'> <video></video> @@ -32,7 +31,7 @@ <div id='fs'>fullscreen</div> <script> var video = document.querySelector('video'); - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; document.querySelector('#fs').addEventListener('click', e => { document.querySelector('#player').webkitRequestFullscreen();
diff --git a/third_party/WebKit/LayoutTests/media/video-play-empty-events.html b/third_party/WebKit/LayoutTests/media/video-play-empty-events.html index f761aa7..109e3eb 100644 --- a/third_party/WebKit/LayoutTests/media/video-play-empty-events.html +++ b/third_party/WebKit/LayoutTests/media/video-play-empty-events.html
@@ -2,7 +2,6 @@ <title>Test that play() from EMPTY network state triggers load() and async playing event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -22,7 +21,7 @@ assert_false(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-play-pause-events.html b/third_party/WebKit/LayoutTests/media/video-play-pause-events.html index 1bc3c2e..8e586461 100644 --- a/third_party/WebKit/LayoutTests/media/video-play-pause-events.html +++ b/third_party/WebKit/LayoutTests/media/video-play-pause-events.html
@@ -2,7 +2,6 @@ <title>Test that calling play() and pause() triggers async play, timeupdate and pause events.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -31,7 +30,7 @@ assert_true(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); video.pause(); });
diff --git a/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture-expected.txt b/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture-expected.txt index 2ae6bba..e96aad1 100644 --- a/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture-expected.txt +++ b/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE ERROR: line 18: Uncaught (in promise) NotAllowedError: play() can only be initiated by a user gesture. +CONSOLE ERROR: line 17: Uncaught (in promise) NotAllowedError: play() can only be initiated by a user gesture. This is a testharness.js-based test. Harness Error. harness_status.status = 1 , harness_status.message = play() can only be initiated by a user gesture. PASS Test that video play does not work unless a user gesture is involved in playing a video.
diff --git a/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture.html b/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture.html index a2a4b7d..5f91bff6 100644 --- a/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture.html +++ b/third_party/WebKit/LayoutTests/media/video-play-require-user-gesture.html
@@ -3,7 +3,6 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> <script src="media-controls.js"></script> -<script src="media-file.js"></script> <script> internals.settings.setAutoplayPolicy('user-gesture-required'); </script> @@ -35,6 +34,6 @@ assert_true(video.paused); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-playbackrate.html b/third_party/WebKit/LayoutTests/media/video-playbackrate.html index 8a29a4d..922a1a6 100644 --- a/third_party/WebKit/LayoutTests/media/video-playbackrate.html +++ b/third_party/WebKit/LayoutTests/media/video-playbackrate.html
@@ -2,7 +2,6 @@ <title>Test playbackRate and defaultPlaybackRate.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> // "playbackRate" should not change when play() is called. @@ -27,7 +26,7 @@ assert_equals(video.defaultPlaybackRate, 2); // Test extreme playback rates. - + video.defaultPlaybackRate = Number.MIN_VALUE; assert_equals(video.defaultPlaybackRate, Number.MIN_VALUE); @@ -78,6 +77,6 @@ } }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-played-collapse.html b/third_party/WebKit/LayoutTests/media/video-played-collapse.html index 426fcb7..763c955 100644 --- a/third_party/WebKit/LayoutTests/media/video-played-collapse.html +++ b/third_party/WebKit/LayoutTests/media/video-played-collapse.html
@@ -2,7 +2,6 @@ <title>Test media element's "played" attribute and range collapse.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="video-played.js"></script> <video></video> <script> @@ -63,6 +62,6 @@ waitForPauseAndContinue(t, null, true, expectedStartTimes, expectedEndTimes); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-played-ranges-1.html b/third_party/WebKit/LayoutTests/media/video-played-ranges-1.html index 0d300309..6146bbb5 100644 --- a/third_party/WebKit/LayoutTests/media/video-played-ranges-1.html +++ b/third_party/WebKit/LayoutTests/media/video-played-ranges-1.html
@@ -2,7 +2,6 @@ <title>Test media element's "played" attribute and ranges.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="video-played.js"></script> <video></video> <script> @@ -53,6 +52,6 @@ waitForPauseAndContinue(t, null, true, expectedStartTimes, expectedEndTimes); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-played-reset.html b/third_party/WebKit/LayoutTests/media/video-played-reset.html index fb426c95f..ce8bf88 100644 --- a/third_party/WebKit/LayoutTests/media/video-played-reset.html +++ b/third_party/WebKit/LayoutTests/media/video-played-reset.html
@@ -2,7 +2,6 @@ <title>Test media element's "played" attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script src="video-played.js"></script> <video></video> <script> @@ -26,7 +25,7 @@ timeRangeCount = currentTimeRange = 0; expectedStartTimes = []; expectedEndTimes = []; - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.oncanplay = t.step_func(jumpAndPlayFwd); } @@ -49,6 +48,6 @@ video.onloadstart = t.step_func_done(testRanges(expectedStartTimes, expectedEndTimes)); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-plays-past-end-of-test.html b/third_party/WebKit/LayoutTests/media/video-plays-past-end-of-test.html index a8d2b5a..8297ca0 100644 --- a/third_party/WebKit/LayoutTests/media/video-plays-past-end-of-test.html +++ b/third_party/WebKit/LayoutTests/media/video-plays-past-end-of-test.html
@@ -2,12 +2,11 @@ <p>This test intentionally lets the video keep playing past end of test to ensure that shutdown is clean, since DumpRenderTree used to crash in this case.</p> <video autoplay></video> -<script src="media-file.js"></script> <script> testRunner.dumpAsText(); var video = document.querySelector("video"); video.onplaying = function() { testRunner.notifyDone(); }; -video.src = findMediaFile("video", "content/test"); +video.src = "content/test.ogv"; </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-poster-delayed.html b/third_party/WebKit/LayoutTests/media/video-poster-delayed.html index 9f378b3..723418f 100644 --- a/third_party/WebKit/LayoutTests/media/video-poster-delayed.html +++ b/third_party/WebKit/LayoutTests/media/video-poster-delayed.html
@@ -2,7 +2,6 @@ <title>Delayed load of poster should not overwrite intrinsic size of video.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -23,6 +22,6 @@ assert_equals(video.videoHeight, 240); } - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-prefixed-fullscreen.html b/third_party/WebKit/LayoutTests/media/video-prefixed-fullscreen.html index 8a72eb9..f139b58 100644 --- a/third_party/WebKit/LayoutTests/media/video-prefixed-fullscreen.html +++ b/third_party/WebKit/LayoutTests/media/video-prefixed-fullscreen.html
@@ -2,14 +2,13 @@ <title>Test HTMLVideoElement's prefixed fullscreen API.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); assert_true(video.webkitSupportsFullscreen); assert_false(video.webkitDisplayingFullscreen); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onloadeddata = t.step_func(function() { assert_true(video.webkitSupportsFullscreen);
diff --git a/third_party/WebKit/LayoutTests/media/video-preload-none-no-stalled-event.html b/third_party/WebKit/LayoutTests/media/video-preload-none-no-stalled-event.html index 5b7bde9..be8fef5 100644 --- a/third_party/WebKit/LayoutTests/media/video-preload-none-no-stalled-event.html +++ b/third_party/WebKit/LayoutTests/media/video-preload-none-no-stalled-event.html
@@ -2,13 +2,12 @@ <title>Test that a media element with "preload=none" doesn't fire a "stalled" event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video preload="none"></video> <script> async_test(function(t) { var video = document.querySelector("video"); video.onsuspend = t.step_func_done(); video.onstalled = t.unreached_func(); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-preload-none-to-metadata-after-load-crash.html b/third_party/WebKit/LayoutTests/media/video-preload-none-to-metadata-after-load-crash.html index 22fdd44b8..caa38f4 100644 --- a/third_party/WebKit/LayoutTests/media/video-preload-none-to-metadata-after-load-crash.html +++ b/third_party/WebKit/LayoutTests/media/video-preload-none-to-metadata-after-load-crash.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>Setting preload=metadata after calling load() w/ preload=none</title> -<script src="media-file.js"></script> <p>PASS if no crash in Debug.</p> <script> if (window.testRunner) @@ -8,7 +7,7 @@ var video = document.createElement('video'); video.preload = "none"; -video.src = findMediaFile('video', 'content/test'); +video.src = 'content/test.ogv'; video.load(); video.preload = "metadata"; </script>
diff --git a/third_party/WebKit/LayoutTests/media/video-preload.html b/third_party/WebKit/LayoutTests/media/video-preload.html index 8492549..df884904d 100644 --- a/third_party/WebKit/LayoutTests/media/video-preload.html +++ b/third_party/WebKit/LayoutTests/media/video-preload.html
@@ -2,7 +2,6 @@ <title>Test media loading behaviour with different "preload" values.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <script> var movies = [ // should not buffer, "preload" is "none". @@ -32,7 +31,7 @@ setupAttribute("preload", movie.preload); setupAttribute("autoplay", movie.autoPlay); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; if (movie.hasOwnProperty("play")) video.play();
diff --git a/third_party/WebKit/LayoutTests/media/video-remove-insert-repaints.html b/third_party/WebKit/LayoutTests/media/video-remove-insert-repaints.html index 9fdae11..9b2c0db 100644 --- a/third_party/WebKit/LayoutTests/media/video-remove-insert-repaints.html +++ b/third_party/WebKit/LayoutTests/media/video-remove-insert-repaints.html
@@ -31,7 +31,7 @@ function start() { video = document.getElementsByTagName('video')[0]; - video.src = findMediaFile('video', 'content/test'); + video.src = 'content/test.ogv'; video.addEventListener('canplaythrough', canplaythrough); video.addEventListener('playing', playing); video.addEventListener('seeked', seeked);
diff --git a/third_party/WebKit/LayoutTests/media/video-replaces-poster.html b/third_party/WebKit/LayoutTests/media/video-replaces-poster.html index 069724d..bf64056 100644 --- a/third_party/WebKit/LayoutTests/media/video-replaces-poster.html +++ b/third_party/WebKit/LayoutTests/media/video-replaces-poster.html
@@ -1,11 +1,10 @@ <!DOCTYPE html> <title>Test that video frame replaces poster on seeking.</title> -<script src="media-file.js"></script> <script> function doSetup() { // TODO(srirama.m): convert this test to reference test. var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.addEventListener("canplaythrough", function () { video.currentTime = 1; // so the snapshot always has the same frame. });
diff --git a/third_party/WebKit/LayoutTests/media/video-scales-in-media-document.html b/third_party/WebKit/LayoutTests/media/video-scales-in-media-document.html index 5f0c12e..1f9da0d 100644 --- a/third_party/WebKit/LayoutTests/media/video-scales-in-media-document.html +++ b/third_party/WebKit/LayoutTests/media/video-scales-in-media-document.html
@@ -2,7 +2,6 @@ <title>Test that video(media) documents scale to fit undersized containers.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <iframe style="width: 200px; height: 200px;"></iframe> <script> async_test(function(t) { @@ -18,6 +17,6 @@ video.load(); }); - iframe.src = findMediaFile("video", "content/counting"); + iframe.src = "content/counting.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html b/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html index ecd3e79..c569798 100644 --- a/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html +++ b/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html
@@ -2,7 +2,6 @@ <title>Test seeking by very small increments.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -34,6 +33,6 @@ video.onplay = t.step_func(function() {}); video.onpause = t.step_func(function() {}); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html b/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html index 50fac62..06a6faf 100644 --- a/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html +++ b/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html
@@ -2,7 +2,6 @@ <title>Test that seeking a paused video past its end sets currentTime to duration and leaves the video paused.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -36,7 +35,7 @@ video.pause(); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.play(); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html b/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html index 29bd0737..3c0c975 100644 --- a/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html +++ b/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html
@@ -2,7 +2,6 @@ <title>Test that seeking video with "loop" past it's end rewinds to the beginning and continues playback.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video loop></video> <script> async_test(function(t) { @@ -35,6 +34,6 @@ } }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html b/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html index 8593285..454ebb81 100644 --- a/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html +++ b/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html
@@ -2,13 +2,12 @@ <title>Test behavior when seeking to the duration and the playback rate equals 0.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.load(); video.onseeking = t.step_func(function() {});
diff --git a/third_party/WebKit/LayoutTests/media/video-seekable.html b/third_party/WebKit/LayoutTests/media/video-seekable.html index 0625483..0018dab 100644 --- a/third_party/WebKit/LayoutTests/media/video-seekable.html +++ b/third_party/WebKit/LayoutTests/media/video-seekable.html
@@ -2,7 +2,6 @@ <title>Test video "seekable" properties.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -24,6 +23,6 @@ assert_throws("IndexSizeError", function() { video.seekable.end(1); }); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-seeking.html b/third_party/WebKit/LayoutTests/media/video-seeking.html index 1976f7c1..3218a96 100644 --- a/third_party/WebKit/LayoutTests/media/video-seeking.html +++ b/third_party/WebKit/LayoutTests/media/video-seeking.html
@@ -2,7 +2,6 @@ <title>Test that seeking attribute is true immediately after a seek, goes back to false when seeking completes, and that a "seeked" event is fired for each seek.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -24,7 +23,7 @@ assert_true(video.seeking); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.currentTime = 0.5; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-set-rate-from-pause.html b/third_party/WebKit/LayoutTests/media/video-set-rate-from-pause.html index c3f2a93e..6a272c5 100644 --- a/third_party/WebKit/LayoutTests/media/video-set-rate-from-pause.html +++ b/third_party/WebKit/LayoutTests/media/video-set-rate-from-pause.html
@@ -2,7 +2,6 @@ <title>Test that setting a non-zero rate causes an async timeupdate event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -13,7 +12,7 @@ video.playbackRate = 1; }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.playbackRate = 0; video.play(); });
diff --git a/third_party/WebKit/LayoutTests/media/video-single-valid-source.html b/third_party/WebKit/LayoutTests/media/video-single-valid-source.html index 40ee975..941c8f9 100644 --- a/third_party/WebKit/LayoutTests/media/video-single-valid-source.html +++ b/third_party/WebKit/LayoutTests/media/video-single-valid-source.html
@@ -2,7 +2,6 @@ <title>Test that a single valid "source" element loads correctly.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -10,7 +9,7 @@ // The first source should load. var source = document.createElement("source"); - source.src = findMediaFile("video", "content/test");; + source.src = "content/test.ogv";; video.appendChild(source); // The second source is bogus and won't load, but it should never be processed.
diff --git a/third_party/WebKit/LayoutTests/media/video-size.html b/third_party/WebKit/LayoutTests/media/video-size.html index 462bddd..d7ff8f1fc 100644 --- a/third_party/WebKit/LayoutTests/media/video-size.html +++ b/third_party/WebKit/LayoutTests/media/video-size.html
@@ -2,7 +2,6 @@ <title>Test "video" element size with and without "src" and "poster" attributes.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <body> <script> var movieInfo = [ @@ -35,7 +34,7 @@ videoHeight: 0 }, { - src: "content/test", + src: "content/test.ogv", poster: "content/abe.png", description: "'poster' and 'src', should be 'video' size", width: 320, @@ -44,7 +43,7 @@ videoHeight: 240 }, { - src: "content/bogus", + src: "content/bogus.ogv", poster: "content/greenbox.png", description: "'poster' and invalid 'src', should be 'poster' size", width: 25, @@ -74,7 +73,7 @@ } if (movie.src) - video.src = findMediaFile("video", movie.src); + video.src = movie.src; if (movie.poster) video.poster = movie.poster;
diff --git a/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html b/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html index eb42abf5..3b004722 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html +++ b/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html
@@ -2,7 +2,6 @@ <title>Test adding "source" after removing failed candidate loads media normally.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source></source> </video> @@ -14,7 +13,7 @@ source.onerror = t.step_func(function() { video.removeChild(video.firstChild); var newSource = document.createElement("source"); - newSource.src = findMediaFile("video", "content/test"); + newSource.src = "content/test.ogv"; video.appendChild(newSource); video.onloadedmetadata = t.step_func_done(); });
diff --git a/third_party/WebKit/LayoutTests/media/video-source-error.html b/third_party/WebKit/LayoutTests/media/video-source-error.html index 46a5a549..973d24b 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-error.html +++ b/third_party/WebKit/LayoutTests/media/video-source-error.html
@@ -2,13 +2,11 @@ <title>Test "error" event are fired on "source" elements and not on "video" while processing invalid "source" elements.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source id="missing-src" type="video/blahblah"></source> <source id="bogus-type" src="content/test.mp4" type="video/blahblah"></source> <source id="missing-file" src="content/error2.mpeg" type="video/mpeg"></source> <source id="format-error" src="content/unsupported_track.mov"></source> - <source id="supported-format-mp4" src="content/test.mp4" type="video/mp4; codecs="avc1.4D400C""></source> <source id="supported-format-ogv" src="content/test.ogv" type="video/ogg"></source> </video> <script> @@ -34,7 +32,7 @@ video.onloadeddata = t.step_func_done(function() { var url = video.currentSrc; - assert_equals(url.substr(url.lastIndexOf("/media/") + 7), findMediaFile("video", "content/test")); + assert_equals(url.substr(url.lastIndexOf("/media/") + 7), "content/test.ogv"); }); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-source-load.html b/third_party/WebKit/LayoutTests/media/video-source-load.html index fb866a8..a402de7 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-load.html +++ b/third_party/WebKit/LayoutTests/media/video-source-load.html
@@ -33,16 +33,16 @@ // Add an invalid url to the first source so we test getting // an error event each time resource selection runs. - addSource("video", "content/bogus"); - addSource("video", "content/test"); - addSource("audio", "content/test"); + addSource("content/bogus.ogv"); + addSource("content/test.ogv"); + addSource("content/test.oga"); // test networkState. assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); - function addSource(type, name) { + function addSource(filePath) { var source = document.createElement("source"); - source.src = findMediaFile(type, name); + source.src = filePath; sourceUrls.push(source.src); source.type = mimeTypeForExtension(source.src.split(".").pop()); video.appendChild(source);
diff --git a/third_party/WebKit/LayoutTests/media/video-source-moved.html b/third_party/WebKit/LayoutTests/media/video-source-moved.html index 2dadf69..d8ed856 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-moved.html +++ b/third_party/WebKit/LayoutTests/media/video-source-moved.html
@@ -56,7 +56,7 @@ function addSource(index) { var source = document.createElement("source"); - source.src = findMediaFile("video", index + "-" + Date.now()); + source.src = index + "-" + Date.now() + ".ogv"; source.type = mimeTypeForExtension(source.src.split(".").pop()); video.appendChild(source);
diff --git a/third_party/WebKit/LayoutTests/media/video-source-removed.html b/third_party/WebKit/LayoutTests/media/video-source-removed.html index 9b5350a6..1c91335f 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-removed.html +++ b/third_party/WebKit/LayoutTests/media/video-source-removed.html
@@ -23,7 +23,7 @@ function addSource(index) { source = document.createElement("source"); - source.src = findMediaFile("video", index + "-" + Date.now()); + source.src = index + "-" + Date.now() + ".ogv"; source.type = mimeTypeForExtension(source.src.split(".").pop()); video.appendChild(source); }
diff --git a/third_party/WebKit/LayoutTests/media/video-source-type-params.html b/third_party/WebKit/LayoutTests/media/video-source-type-params.html index 02c5b7d..d40e502 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-type-params.html +++ b/third_party/WebKit/LayoutTests/media/video-source-type-params.html
@@ -2,7 +2,6 @@ <title>Test "source" element "type" attribute with "params".</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source src=content/bogus.mpeg type="video/blahblah"> <source src=content/test.mp4 type="video/mpeg; codecs="avc1.4D400C""> @@ -15,7 +14,7 @@ video.onloadstart = t.step_func_done(function() { var url = video.currentSrc; - assert_equals(url.substr(url.lastIndexOf("/media/") + 7), findMediaFile("video", "content/test")); + assert_equals(url.substr(url.lastIndexOf("/media/") + 7), "content/test.ogv"); }); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-source-type.html b/third_party/WebKit/LayoutTests/media/video-source-type.html index 7e156f7e..06bc0ea9 100644 --- a/third_party/WebKit/LayoutTests/media/video-source-type.html +++ b/third_party/WebKit/LayoutTests/media/video-source-type.html
@@ -2,12 +2,10 @@ <title>Test "source" element "type" attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source src=content/error.mpeg type=video/blahblah> <source src=test.mp4 type=video/x-chicken-face> <source src=test.ogv type=audio/x-higglety-pigglety> - <source src=content/test.mp4 type=video/mp4> <source src=content/test.ogv type=video/ogg> <source src=content/error2.mpeg type=video/mpeg> </video> @@ -17,7 +15,7 @@ video.onloadstart = t.step_func_done(function() { var url = video.currentSrc; - assert_equals(url.substr(url.lastIndexOf("/media/") + 7), findMediaFile("video", "content/test")); + assert_equals(url.substr(url.lastIndexOf("/media/") + 7), "content/test.ogv"); }); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-source.html b/third_party/WebKit/LayoutTests/media/video-source.html index 1f4b6b5c..d3529a6 100644 --- a/third_party/WebKit/LayoutTests/media/video-source.html +++ b/third_party/WebKit/LayoutTests/media/video-source.html
@@ -2,7 +2,6 @@ <title>Test "source" element.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source></source> </video> @@ -10,7 +9,7 @@ async_test(function(t) { var video = document.querySelector("video"); var source = document.querySelector("source"); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; source.src = mediaFile; video.onloadstart = t.step_func_done(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-src-blob.html b/third_party/WebKit/LayoutTests/media/video-src-blob.html index e5d76d12e..b6f1d9d 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-blob.html +++ b/third_party/WebKit/LayoutTests/media/video-src-blob.html
@@ -2,7 +2,6 @@ <title>This tests the ability of the "video" element to load blob URLs. In the browser, select a video file.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <input type="file"> <video></video> <script> @@ -16,7 +15,7 @@ video.src = URL.createObjectURL(event.target.files[0]); }); - eventSender.beginDragWithFiles([findMediaFile("video", "content/test")]); + eventSender.beginDragWithFiles(["content/test.ogv"]); var centerX = inputFile.offsetLeft + inputFile.offsetWidth / 2; var centerY = inputFile.offsetTop + inputFile.offsetHeight / 2; eventSender.mouseMoveTo(centerX, centerY);
diff --git a/third_party/WebKit/LayoutTests/media/video-src-change.html b/third_party/WebKit/LayoutTests/media/video-src-change.html index 5cd6604b..efaa768 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-change.html +++ b/third_party/WebKit/LayoutTests/media/video-src-change.html
@@ -2,7 +2,6 @@ <title>Test that an invalid "src" fires an error event and changing "src" to a valid one triggers media load.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> // 1. Test that an invalid src attribute fires an error when the file fails to load. @@ -23,7 +22,7 @@ return; } - mediaFile = findMediaFile("video", "content/counting"); + mediaFile = "content/counting.ogv"; video.src = mediaFile; }); @@ -33,7 +32,7 @@ assert_equals(url.substr(url.lastIndexOf("/media/")+7), "bogus"); assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); - mediaFile = findMediaFile("video", "content/test"); + mediaFile = "content/test.ogv"; video.src = mediaFile; });
diff --git a/third_party/WebKit/LayoutTests/media/video-src-empty.html b/third_party/WebKit/LayoutTests/media/video-src-empty.html index f75a6639b..b22dccd 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-empty.html +++ b/third_party/WebKit/LayoutTests/media/video-src-empty.html
@@ -2,7 +2,6 @@ <title>Video element with src="" should invoke media element's load algorithm and should fire "error" event. Network state should be NETWORK_NO_SOURCE and the error code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -26,6 +25,6 @@ }); // video with valid non-empty "src" attribute. - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html b/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html index 5b4b715..451f14e 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html +++ b/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
@@ -2,7 +2,6 @@ <title>Test that removing "src" attribute does not trigger load of "source" elements.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -18,7 +17,7 @@ video.src = "bogus.mov"; var source = document.createElement("source"); - source.src = findMediaFile("video", "content/test"); + source.src = "content/test.ogv"; video.appendChild(source); }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-src-plus-source.html b/third_party/WebKit/LayoutTests/media/video-src-plus-source.html index 5b75d85..646e914e 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-plus-source.html +++ b/third_party/WebKit/LayoutTests/media/video-src-plus-source.html
@@ -2,7 +2,6 @@ <title>Test that a "source" element is not used when a bogus "src" attribute is present.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source></source> </video> @@ -23,7 +22,7 @@ setTimeout(t.step_func_done(), 200) ; }); - document.querySelector("source").src = findMediaFile("video", "content/test"); + document.querySelector("source").src = "content/test.ogv"; var mediaFile = "content/bogus.mpeg"; video.src = mediaFile; });
diff --git a/third_party/WebKit/LayoutTests/media/video-src-remove.html b/third_party/WebKit/LayoutTests/media/video-src-remove.html index 0abcdaa1..4b7e35f 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-remove.html +++ b/third_party/WebKit/LayoutTests/media/video-src-remove.html
@@ -2,7 +2,6 @@ <title>Test that removing valid "src" attribute doesn't trigger load of "source" elements.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source></source> </video> @@ -26,8 +25,8 @@ assert_false(isNaN(video.duration)); } - document.querySelector("source").src = findMediaFile("video", "content/counting"); - var mediaFile = findMediaFile("video", "content/test"); + document.querySelector("source").src = "content/counting.ogv"; + var mediaFile = "content/test.ogv"; video.src = mediaFile; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-src-set.html b/third_party/WebKit/LayoutTests/media/video-src-set.html index 5bf8e00..6c454d3 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-set.html +++ b/third_party/WebKit/LayoutTests/media/video-src-set.html
@@ -2,12 +2,11 @@ <title>Test that setting "src" attribute triggers load.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; video.onloadstart = t.step_func_done(function() { var url = video.currentSrc;
diff --git a/third_party/WebKit/LayoutTests/media/video-src-source.html b/third_party/WebKit/LayoutTests/media/video-src-source.html index be84df7c..36dede9 100644 --- a/third_party/WebKit/LayoutTests/media/video-src-source.html +++ b/third_party/WebKit/LayoutTests/media/video-src-source.html
@@ -2,14 +2,13 @@ <title>Test that a "source" element is not used when "src" attribute is set.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video> <source></source> </video> <script> async_test(function(t) { var video = document.querySelector("video"); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; video.onloadstart = t.step_func_done(function() { var url = video.currentSrc;
diff --git a/third_party/WebKit/LayoutTests/media/video-src.html b/third_party/WebKit/LayoutTests/media/video-src.html index 35c6b5a..b86a37f6 100644 --- a/third_party/WebKit/LayoutTests/media/video-src.html +++ b/third_party/WebKit/LayoutTests/media/video-src.html
@@ -2,12 +2,11 @@ <title>Verify media element's "src" attribute on "loadstart" event.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - var mediaFile = findMediaFile("video", "content/test"); + var mediaFile = "content/test.ogv"; video.onloadstart = t.step_func_done(function () { var url = video.currentSrc;
diff --git a/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html b/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html index b5a3e4cf..70f2f0e 100644 --- a/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html +++ b/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html
@@ -2,12 +2,11 @@ <title>Test "timeupdate" events are posted while playing but not while paused.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { var video = document.querySelector("video"); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; video.onplaying = t.step_func(function() { video.ontimeupdate = t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/media/video-transformed.html b/third_party/WebKit/LayoutTests/media/video-transformed.html index 1e64bf9..247e6b81 100644 --- a/third_party/WebKit/LayoutTests/media/video-transformed.html +++ b/third_party/WebKit/LayoutTests/media/video-transformed.html
@@ -10,6 +10,6 @@ <video style="transform:skew(20deg)"></video><br> <script> init(); -setSrcByTagName('video', findMediaFile('video', 'content/test')); +setSrcByTagName('video', 'content/test.ogv'); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/media/video-volume.html b/third_party/WebKit/LayoutTests/media/video-volume.html index a447831a..4575c1a 100644 --- a/third_party/WebKit/LayoutTests/media/video-volume.html +++ b/third_party/WebKit/LayoutTests/media/video-volume.html
@@ -2,7 +2,6 @@ <title>Test "volume" attribute.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <video></video> <script> async_test(function(t) { @@ -28,6 +27,6 @@ assert_throws("IndexSizeError", function() { video.volume = -0.5; }); }); - video.src = findMediaFile("video", "content/test"); + video.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-webkit-appearance-expected.html b/third_party/WebKit/LayoutTests/media/video-webkit-appearance-expected.html index 75d747ed..bc4fe520 100644 --- a/third_party/WebKit/LayoutTests/media/video-webkit-appearance-expected.html +++ b/third_party/WebKit/LayoutTests/media/video-webkit-appearance-expected.html
@@ -1,10 +1,9 @@ <!DOCTYPE html> <title>video with -webkit-appearance media-play-button</title> -<script src="media-file.js"></script> <video></video> <script> var video = document.querySelector('video'); -video.src = findMediaFile('video', 'content/test'); +video.src = 'content/test.ogv'; if (window.testRunner) { testRunner.waitUntilDone();
diff --git a/third_party/WebKit/LayoutTests/media/video-webkit-appearance.html b/third_party/WebKit/LayoutTests/media/video-webkit-appearance.html index 1633274e..b79cd12 100644 --- a/third_party/WebKit/LayoutTests/media/video-webkit-appearance.html +++ b/third_party/WebKit/LayoutTests/media/video-webkit-appearance.html
@@ -1,6 +1,5 @@ <!DOCTYPE html> <title>video with -webkit-appearance media-play-button</title> -<script src="media-file.js"></script> <style> video { -webkit-appearance: media-play-button; @@ -9,7 +8,7 @@ <video></video> <script> var video = document.querySelector('video'); -video.src = findMediaFile('video', 'content/test'); +video.src = 'content/test.ogv'; if (window.testRunner) { testRunner.waitUntilDone();
diff --git a/third_party/WebKit/LayoutTests/media/video-zoom-controls.html b/third_party/WebKit/LayoutTests/media/video-zoom-controls.html index bd05f35..290ebcb 100644 --- a/third_party/WebKit/LayoutTests/media/video-zoom-controls.html +++ b/third_party/WebKit/LayoutTests/media/video-zoom-controls.html
@@ -13,7 +13,7 @@ <script src="media-file.js"></script> <script src="video-paint-test.js"></script> </head> -<body onload="setSrcByTagName('video', findMediaFile('video', 'content/test')); init()"> +<body onload="setSrcByTagName('video', 'content/test.ogv'); init()"> <p>Zoomed video with controls.</p> <video width="160" height="120" controls></video> <video class="rotated" width="160" height="120" controls></video>
diff --git a/third_party/WebKit/LayoutTests/media/video-zoom.html b/third_party/WebKit/LayoutTests/media/video-zoom.html index 2fe261d..77841ebb2 100644 --- a/third_party/WebKit/LayoutTests/media/video-zoom.html +++ b/third_party/WebKit/LayoutTests/media/video-zoom.html
@@ -8,7 +8,7 @@ function init() { - setSrcByTagName("video", findMediaFile("video", "content/test")); + setSrcByTagName("video", "content/test.ogv"); var totalCount = document.getElementsByTagName('video').length; var count = totalCount; @@ -21,8 +21,8 @@ if (window.testRunner) { testRunner.waitUntilDone(); - setTimeout(function() { - document.body.appendChild(document.createTextNode('FAIL')); + setTimeout(function() { + document.body.appendChild(document.createTextNode('FAIL')); if (window.testRunner) testRunner.notifyDone(); }, 1500);
diff --git a/third_party/WebKit/LayoutTests/media/viewport-in-standalone-media-document.html b/third_party/WebKit/LayoutTests/media/viewport-in-standalone-media-document.html index 1f70d53..7296600 100644 --- a/third_party/WebKit/LayoutTests/media/viewport-in-standalone-media-document.html +++ b/third_party/WebKit/LayoutTests/media/viewport-in-standalone-media-document.html
@@ -2,7 +2,6 @@ <title>This tests that a standalone media document has viewport settings.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> -<script src="media-file.js"></script> <iframe></iframe> <script> async_test(function(t) { @@ -14,6 +13,6 @@ assert_equals(metaElement.content, "width=device-width"); }); - iframe.src = findMediaFile("video", "content/test"); + iframe.src = "content/test.ogv"; }); </script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background-expected.html index 819db39..10e71be1 100644 --- a/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background-expected.html +++ b/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background-expected.html
@@ -8,7 +8,7 @@ <script src="../../../fullscreen/full-screen-test.js"></script> <script src="../../../media/media-file.js"></script> <script> - setSrcById("video", findMediaFile("video", "../../../media/content/test")); + setSrcById("video", "../../../media/content/test.ogv"); var video = document.getElementById('video'); // Bail out early if the full screen API is not enabled or is missing: if (Element.prototype.webkitRequestFullScreen == undefined) {
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background.html b/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background.html index 77b31f0..02e7efa 100644 --- a/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background.html +++ b/third_party/WebKit/LayoutTests/virtual/android/fullscreen/video-fixed-background.html
@@ -8,7 +8,7 @@ <script src="../../../fullscreen/full-screen-test.js"></script> <script src="../../../media/media-file.js"></script> <script> - setSrcById("video", findMediaFile("video", "../../../media/content/test")); + setSrcById("video", "../../../media/content/test.ogv"); var video = document.getElementById('video'); // Bail out early if the full screen API is not enabled or is missing: if (Element.prototype.webkitRequestFullScreen == undefined) {
diff --git a/third_party/WebKit/ManualTests/media-controls.html b/third_party/WebKit/ManualTests/media-controls.html index 8b0fe0c8b..4ab7ba7b 100644 --- a/third_party/WebKit/ManualTests/media-controls.html +++ b/third_party/WebKit/ManualTests/media-controls.html
@@ -68,7 +68,6 @@ </style> <!-- LayoutTests location is hard-coded to avoid duplication of code. --> -<script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/media-file.js"></script> <script> var MEDIA_FILES_LOCATION = 'http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content'; @@ -195,8 +194,8 @@ function configureMediaFiles() { MEDIA_FILES = { - 'audio': absoluteUrl(findMediaFile('audio', MEDIA_FILES_LOCATION + '/test')), - 'video': absoluteUrl(findMediaFile('video', MEDIA_FILES_LOCATION + '/test')), + 'audio': absoluteUrl(MEDIA_FILES_LOCATION + '/test.wav'), + 'video': absoluteUrl(MEDIA_FILES_LOCATION + '/test.ogv'), 'video-captioned': absoluteUrl(MEDIA_FILES_LOCATION + '/counting-captioned.mov') }
diff --git a/third_party/WebKit/ManualTests/media-default-playback-rate.html b/third_party/WebKit/ManualTests/media-default-playback-rate.html index b980edc..dfc18885 100644 --- a/third_party/WebKit/ManualTests/media-default-playback-rate.html +++ b/third_party/WebKit/ManualTests/media-default-playback-rate.html
@@ -2,7 +2,6 @@ <html> <head> <!-- LayoutTests location is hard-coded to avoid duplication of code. --> - <script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/media-file.js"></script> <script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/video-test.js"></script> <script> @@ -47,7 +46,7 @@ video.addEventListener('playing', playing); // Use the video file from the svn repository to avoid duplicating the file. - video.src = absoluteUrl(findMediaFile('video', 'http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content/test')); + video.src = absoluteUrl('http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content/test.ogv'); testRates(); } @@ -68,7 +67,7 @@ </head> <body onload="start()"> - + <video controls > </video> <ul> <li>The current 'playbackRate' and 'defaultPlaybackRate' should be logged every time either changes.</li>
diff --git a/third_party/WebKit/ManualTests/media-muted.html b/third_party/WebKit/ManualTests/media-muted.html index 40e4e418..30a36ab 100644 --- a/third_party/WebKit/ManualTests/media-muted.html +++ b/third_party/WebKit/ManualTests/media-muted.html
@@ -16,8 +16,7 @@ // Mute first vid.muted = true; - - vid.src = "http://src.chromium.org/svn/trunk/src/chrome/test/data/media/" + findMediaFile("video", "bear"); + vid.src = "https://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content/audio-describes-video.mp4" } </script>
diff --git a/third_party/WebKit/PRESUBMIT.py b/third_party/WebKit/PRESUBMIT.py index 8afc249..42dbdf4 100644 --- a/third_party/WebKit/PRESUBMIT.py +++ b/third_party/WebKit/PRESUBMIT.py
@@ -235,9 +235,11 @@ results.extend(output_api.EnsureCQIncludeTrybotsAreAdded( cl, ['master.tryserver.chromium.linux:' - 'linux_layout_tests_slimming_paint_v2'], - 'Automatically added slimming-paint-v2 tests to run on CQ due to ' - 'changes in paint or compositing directories.')) + 'linux_layout_tests_slimming_paint_v2', + 'master.tryserver.blink:linux_trusty_blink_rel'], + 'Automatically added linux_layout_tests_slimming_paint_v2 and ' + 'linux_trusty_blink_rel to run on CQ due to changes in paint or ' + 'compositing directories.')) if _AreLayoutNGDirectoriesModified(change): results.extend(output_api.EnsureCQIncludeTrybotsAreAdded( cl,
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 8ba3e47..d63d5f8 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -250,7 +250,7 @@ if (event->IsIncrementalInsertion()) return false; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); @@ -310,25 +310,25 @@ // copy/paste (like divs, or a document body). bool Editor::CanDHTMLCut() { - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); return !IsInPasswordField(GetFrame() .Selection() .ComputeVisibleSelectionInDOMTree() .Start()) && - !DispatchCPPEvent(EventTypeNames::beforecut, kDataTransferNumb); + !DispatchClipboardEvent(EventTypeNames::beforecut, kDataTransferNumb); } bool Editor::CanDHTMLCopy() { - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); return !IsInPasswordField(GetFrame() .Selection() .ComputeVisibleSelectionInDOMTree() .Start()) && - !DispatchCPPEvent(EventTypeNames::beforecopy, kDataTransferNumb); + !DispatchClipboardEvent(EventTypeNames::beforecopy, kDataTransferNumb); } bool Editor::CanCut() const { @@ -484,31 +484,31 @@ GetFrame().DomWindow(), pasting_fragment, smart_replace, match_style)); } -bool Editor::TryDHTMLCopy() { - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets +bool Editor::DispatchCopyEvent() { + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (IsInPasswordField( GetFrameSelection().ComputeVisibleSelectionInDOMTree().Start())) - return false; + return true; - return !DispatchCPPEvent(EventTypeNames::copy, kDataTransferWritable); + return DispatchClipboardEvent(EventTypeNames::copy, kDataTransferWritable); } -bool Editor::TryDHTMLCut() { - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets +bool Editor::DispatchCutEvent() { + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (IsInPasswordField( GetFrameSelection().ComputeVisibleSelectionInDOMTree().Start())) - return false; + return true; - return !DispatchCPPEvent(EventTypeNames::cut, kDataTransferWritable); + return DispatchClipboardEvent(EventTypeNames::cut, kDataTransferWritable); } -bool Editor::TryDHTMLPaste(PasteMode paste_mode) { - return !DispatchCPPEvent(EventTypeNames::paste, kDataTransferReadable, - paste_mode); +bool Editor::DispatchPasteEvent(PasteMode paste_mode) { + return DispatchClipboardEvent(EventTypeNames::paste, kDataTransferReadable, + paste_mode); } void Editor::PasteAsPlainTextWithPasteboard(Pasteboard* pasteboard) { @@ -538,9 +538,9 @@ if (!text.IsEmpty()) { chose_plain_text = true; - // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): Use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |selectedRange| requires clean layout for visible selection + // |SelectedRange| requires clean layout for visible selection // normalization. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); @@ -618,11 +618,9 @@ pasteboard->WriteImage(image.get(), url, title); } -// Returns whether caller should continue with "the default processing", which -// is the same as the event handler NOT setting the return value to false -bool Editor::DispatchCPPEvent(const AtomicString& event_type, - DataTransferAccessPolicy policy, - PasteMode paste_mode) { +bool Editor::DispatchClipboardEvent(const AtomicString& event_type, + DataTransferAccessPolicy policy, + PasteMode paste_mode) { Element* target = FindEventTargetFromSelection(); if (!target) return true; @@ -640,7 +638,7 @@ Pasteboard::GeneralPasteboard()->WriteDataObject( data_transfer->GetDataObject()); - // invalidate clipboard here for security + // Invalidate clipboard here for security. data_transfer->SetAccessPolicy(kDataTransferNumb); return !no_default_processing; @@ -1126,15 +1124,15 @@ } void Editor::Cut(EditorCommandSource source) { - if (TryDHTMLCut()) - return; // DHTML did the whole operation + if (!DispatchCutEvent()) + return; if (!CanCut()) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |tryDHTMLCut| dispatches cut event, which may make layout dirty, but we - // need clean layout to obtain the selected content. + // A 'cut' event handler might have dirtied the layout so we need to update + // before we obtain the selection. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && @@ -1172,15 +1170,15 @@ } void Editor::Copy(EditorCommandSource) { - if (TryDHTMLCopy()) - return; // DHTML did the whole operation + if (!DispatchCopyEvent()) + return; if (!CanCopy()) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |tryDHTMLCopy| dispatches copy event, which may make layout dirty, but - // we need clean layout to obtain the selected content. + // A 'copy' event handler might have dirtied the layout so we need to update + // before we obtain the selection. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (EnclosingTextControl( @@ -1202,15 +1200,15 @@ void Editor::Paste(EditorCommandSource source) { DCHECK(GetFrame().GetDocument()); - if (TryDHTMLPaste(kAllMimeTypes)) - return; // DHTML did the whole operation + if (!DispatchPasteEvent(kAllMimeTypes)) + return; if (!CanPaste()) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |tryDHTMLPaste| dispatches copy event, which may make layout dirty, but - // we need clean layout to obtain the selected content. + // A 'paste' event handler might have dirtied the layout so we need to update + // before we obtain the selection. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && @@ -1244,15 +1242,15 @@ } void Editor::PasteAsPlainText(EditorCommandSource source) { - if (TryDHTMLPaste(kPlainTextOnly)) + if (!DispatchPasteEvent(kPlainTextOnly)) return; if (!CanPaste()) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |tryDHTMLPaste| dispatches copy event, which may make layout dirty, but - // we need clean layout to obtain the selected content. + // A 'paste' event handler might have dirtied the layout so we need to update + // before we obtain the selection. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && @@ -1266,9 +1264,9 @@ if (!CanDelete()) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. - // |selectedRange| requires clean layout for visible selection normalization. + // |SelectedRange| requires clean layout for visible selection normalization. GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); AddToKillRing(SelectedRange()); @@ -1416,8 +1414,8 @@ Document* const document = frame.GetDocument(); - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets - // needs to be audited. see http://crbug.com/590369 for more details. + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets + // needs to be audited. See http://crbug.com/590369 for more details. document->UpdateStyleAndLayoutIgnorePendingStylesheets(); const EphemeralRange& range = ComputeRangeForTranspose(frame); @@ -1441,8 +1439,8 @@ if (frame.GetDocument() != document) return; - // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets - // needs to be audited. see http://crbug.com/590369 for more details. + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets + // needs to be audited. See http://crbug.com/590369 for more details. document->UpdateStyleAndLayoutIgnorePendingStylesheets(); // 'beforeinput' event handler may change selection, we need to re-calculate
diff --git a/third_party/WebKit/Source/core/editing/Editor.h b/third_party/WebKit/Source/core/editing/Editor.h index c404a72..542b71b 100644 --- a/third_party/WebKit/Source/core/editing/Editor.h +++ b/third_party/WebKit/Source/core/editing/Editor.h
@@ -339,17 +339,18 @@ bool CanDeleteRange(const EphemeralRange&) const; - bool TryDHTMLCopy(); - bool TryDHTMLCut(); - bool TryDHTMLPaste(PasteMode); + // Returns true if Editor should continue with default processing. + bool DispatchCopyEvent(); + bool DispatchCutEvent(); + bool DispatchPasteEvent(PasteMode); + bool DispatchClipboardEvent(const AtomicString&, + DataTransferAccessPolicy, + PasteMode = kAllMimeTypes); bool CanSmartReplaceWithPasteboard(Pasteboard*); void PasteAsPlainTextWithPasteboard(Pasteboard*); void PasteWithPasteboard(Pasteboard*); void WriteSelectionToPasteboard(); - bool DispatchCPPEvent(const AtomicString&, - DataTransferAccessPolicy, - PasteMode = kAllMimeTypes); void RevealSelectionAfterEditingOperation( const ScrollAlignment& = ScrollAlignment::kAlignCenterIfNeeded);
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index cf4045d..fb188918 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -760,9 +760,24 @@ return nullptr; scoped_refptr<StaticBitmapImage> image_bitmap = nullptr; if (Is3d()) { - context_->PaintRenderingResultsToCanvas(source_buffer); - if (GetImageBuffer()) - image_bitmap = GetImageBuffer()->NewImageSnapshot(hint, reason); + if (context_->CreationAttributes().premultipliedAlpha()) { + context_->PaintRenderingResultsToCanvas(source_buffer); + if (GetImageBuffer()) + image_bitmap = GetImageBuffer()->NewImageSnapshot(hint, reason); + } else { + scoped_refptr<Uint8Array> data_array = + context_->PaintRenderingResultsToDataArray(source_buffer); + if (data_array) { + // If the accelerated canvas is too big, there is a logic in WebGL code + // path that scales down the drawing buffer to the maximum supported + // size. Hence, we need to query the adjusted size of DrawingBuffer. + IntSize adjusted_size = context_->DrawingBufferSize(); + SkImageInfo info = + SkImageInfo::Make(adjusted_size.Width(), adjusted_size.Height(), + kRGBA_8888_SkColorType, kUnpremul_SkAlphaType); + image_bitmap = StaticBitmapImage::Create(std::move(data_array), info); + } + } } else if (context_ || PlaceholderFrame()) { DCHECK(Is2d() || PlaceholderFrame()); if (GetImageBuffer()) { @@ -777,24 +792,6 @@ return image_bitmap; } -ImageData* HTMLCanvasElement::ToImageData(SourceDrawingBuffer source_buffer, - SnapshotReason reason) const { - // Using ImageData requires pixel read back and converting the color - // components from half float to float32 if the context is using a wide color - // gamut. Therefore, we do this only if the context is texture backed and - // premultipledAlpha is set to false by the user. - DCHECK(Is3d() && !context_->CreationAttributes().premultipliedAlpha()); - if (Size().IsEmpty()) - return nullptr; - ImageData* image_data; - // Get non-premultiplied data because of inaccurate premultiplied alpha - // conversion of buffer()->toDataURL(). - image_data = context_->PaintRenderingResultsToImageData(source_buffer); - if (image_data) - return image_data; - return ImageData::Create(size_); -} - String HTMLCanvasElement::ToDataURLInternal( const String& mime_type, const double& quality, @@ -826,20 +823,10 @@ NOTREACHED(); } - if (Is3d() && !context_->CreationAttributes().premultipliedAlpha()) { - ImageData* image_data = ToImageData(source_buffer, kSnapshotReasonToBlob); - if (image_data) { - return ImageDataBuffer(image_data->Size(), image_data->data()->Data()) - .ToDataURL(encoding_mime_type, quality); - } - } else { - scoped_refptr<StaticBitmapImage> image_bitmap = ToStaticBitmapImage( - source_buffer, kPreferNoAcceleration, kSnapshotReasonToBlob); - if (image_bitmap) { - return ImageDataBuffer(image_bitmap) - .ToDataURL(encoding_mime_type, quality); - } - } + scoped_refptr<StaticBitmapImage> image_bitmap = ToStaticBitmapImage( + source_buffer, kPreferNoAcceleration, kSnapshotReasonToBlob); + if (image_bitmap) + return ImageDataBuffer(image_bitmap).ToDataURL(encoding_mime_type, quality); return String("data:,"); } @@ -894,14 +881,6 @@ mime_type, ImageEncoderUtils::kEncodeReasonToBlobCallback); CanvasAsyncBlobCreator* async_creator = nullptr; - if (Is3d() && !context_->CreationAttributes().premultipliedAlpha()) { - ImageData* image_data = ToImageData(kBackBuffer, kSnapshotReasonToBlob); - if (image_data) { - async_creator = CanvasAsyncBlobCreator::Create( - image_data->data(), encoding_mime_type, image_data->Size(), callback, - start_time, &GetDocument()); - } - } else { scoped_refptr<StaticBitmapImage> image_bitmap = ToStaticBitmapImage( kBackBuffer, kPreferNoAcceleration, kSnapshotReasonToBlob); if (image_bitmap) { @@ -909,7 +888,6 @@ CanvasAsyncBlobCreator::Create(image_bitmap, encoding_mime_type, callback, start_time, &GetDocument()); } - } if (async_creator) { async_creator->ScheduleAsyncBlobCreation(quality);
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h index 55970cb..0c8e790a 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
@@ -68,7 +68,6 @@ class ImageBitmapOptions; class ImageBuffer; class ImageBufferSurface; -class ImageData; class IntSize; class @@ -326,7 +325,6 @@ scoped_refptr<StaticBitmapImage> ToStaticBitmapImage(SourceDrawingBuffer, AccelerationHint, SnapshotReason) const; - ImageData* ToImageData(SourceDrawingBuffer, SnapshotReason) const; String ToDataURLInternal(const String& mime_type, const double& quality,
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index eb52749..9da17848 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -151,40 +151,14 @@ } // anonymous namespace CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::Create( - DOMUint8ClampedArray* unpremultiplied_rgba_image_data, - const String& mime_type, - const IntSize& size, - V8BlobCallback* callback, - double start_time, - ExecutionContext* context) { - return new CanvasAsyncBlobCreator(unpremultiplied_rgba_image_data, nullptr, - ConvertMimeTypeStringToEnum(mime_type), - size, callback, start_time, context, - nullptr); -} - -CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::Create( - DOMUint8ClampedArray* unpremultiplied_rgba_image_data, - const String& mime_type, - const IntSize& size, - double start_time, - ExecutionContext* context, - ScriptPromiseResolver* resolver) { - return new CanvasAsyncBlobCreator(unpremultiplied_rgba_image_data, nullptr, - ConvertMimeTypeStringToEnum(mime_type), - size, nullptr, start_time, context, - resolver); -} - -CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::Create( scoped_refptr<StaticBitmapImage> image, const String& mime_type, V8BlobCallback* callback, double start_time, ExecutionContext* context) { - return new CanvasAsyncBlobCreator( - nullptr, image, ConvertMimeTypeStringToEnum(mime_type), IntSize(0, 0), - callback, start_time, context, nullptr); + return new CanvasAsyncBlobCreator(image, + ConvertMimeTypeStringToEnum(mime_type), + callback, start_time, context, nullptr); } CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::Create( @@ -193,21 +167,19 @@ double start_time, ExecutionContext* context, ScriptPromiseResolver* resolver) { - return new CanvasAsyncBlobCreator( - nullptr, image, ConvertMimeTypeStringToEnum(mime_type), IntSize(0, 0), - nullptr, start_time, context, resolver); + return new CanvasAsyncBlobCreator(image, + ConvertMimeTypeStringToEnum(mime_type), + nullptr, start_time, context, resolver); } CanvasAsyncBlobCreator::CanvasAsyncBlobCreator( - DOMUint8ClampedArray* data, scoped_refptr<StaticBitmapImage> image, MimeType mime_type, - const IntSize& size, V8BlobCallback* callback, double start_time, ExecutionContext* context, ScriptPromiseResolver* resolver) - : data_(data), + : fail_encoder_initialization_for_test_(false), image_(image), context_(context), mime_type_(mime_type), @@ -215,23 +187,13 @@ static_bitmap_image_loaded_(false), callback_(callback), script_promise_resolver_(resolver) { - if (data_) { - size_t rowBytes = size.Width() * 4; - DCHECK(data_->length() == (unsigned)(size.Height() * rowBytes)); - SkImageInfo info = - SkImageInfo::Make(size.Width(), size.Height(), kRGBA_8888_SkColorType, - kUnpremul_SkAlphaType, nullptr); - src_data_.reset(info, data_->Data(), rowBytes); - } else { - DCHECK(image); - sk_sp<SkImage> skia_image = - image_->PaintImageForCurrentFrame().GetSkImage(); - DCHECK(skia_image); - if (skia_image->peekPixels(&src_data_)) - static_bitmap_image_loaded_ = true; - else - LoadStaticBitmapImage(); - } + DCHECK(image); + sk_sp<SkImage> skia_image = image_->PaintImageForCurrentFrame().GetSkImage(); + DCHECK(skia_image); + if (skia_image->peekPixels(&src_data_)) + static_bitmap_image_loaded_ = true; + else + LoadStaticBitmapImage(); idle_task_status_ = kIdleTaskNotSupported; num_rows_completed_ = 0; @@ -251,7 +213,6 @@ void CanvasAsyncBlobCreator::Dispose() { // Eagerly let go of references to prevent retention of these // resources while any remaining posted tasks are queued. - data_.Clear(); context_.Clear(); parent_frame_task_runner_.Clear(); callback_.Clear(); @@ -259,18 +220,12 @@ } bool CanvasAsyncBlobCreator::EncodeImage(const double& quality) { - if (image_) { return ImageDataBuffer(src_data_).EncodeImage("image/webp", quality, &encoded_image_); - } - DCHECK(data_); - IntSize size(src_data_.width(), src_data_.height()); - return ImageDataBuffer(size, data_->Data()) - .EncodeImage("image/webp", quality, &encoded_image_); } void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) { - if (image_ && !static_bitmap_image_loaded_) { + if (!static_bitmap_image_loaded_) { context_->GetTaskRunner(TaskType::kCanvasBlobSerialization) ->PostTask(BLINK_FROM_HERE, WTF::Bind(&CanvasAsyncBlobCreator::CreateNullAndReturnResult, @@ -502,6 +457,9 @@ } bool CanvasAsyncBlobCreator::InitializeEncoder(double quality) { + // This is solely used for unit tests. + if (fail_encoder_initialization_for_test_) + return false; if (mime_type_ == kMimeTypeJpeg) { SkJpegEncoder::Options options; options.fQuality = ImageEncoder::ComputeJpegQuality(quality); @@ -593,7 +551,6 @@ void CanvasAsyncBlobCreator::Trace(blink::Visitor* visitor) { visitor->Trace(context_); - visitor->Trace(data_); visitor->Trace(parent_frame_task_runner_); visitor->Trace(script_promise_resolver_); }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h index eac9ac5..64156cd 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -27,20 +27,6 @@ class CORE_EXPORT CanvasAsyncBlobCreator : public GarbageCollectedFinalized<CanvasAsyncBlobCreator> { public: - static CanvasAsyncBlobCreator* Create( - DOMUint8ClampedArray* unpremultiplied_rgba_image_data, - const String& mime_type, - const IntSize&, - V8BlobCallback*, - double start_time, - ExecutionContext*); - static CanvasAsyncBlobCreator* Create( - DOMUint8ClampedArray* unpremultiplied_rgba_image_data, - const String& mime_type, - const IntSize&, - double start_time, - ExecutionContext*, - ScriptPromiseResolver*); static CanvasAsyncBlobCreator* Create(scoped_refptr<StaticBitmapImage>, const String& mime_type, V8BlobCallback*, @@ -86,10 +72,8 @@ virtual void Trace(blink::Visitor*); protected: - CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, - scoped_refptr<StaticBitmapImage>, + CanvasAsyncBlobCreator(scoped_refptr<StaticBitmapImage>, MimeType, - const IntSize&, V8BlobCallback*, double, ExecutionContext*, @@ -105,14 +89,16 @@ virtual void CreateNullAndReturnResult(); void InitiateEncoding(double quality, double deadline_seconds); + + protected: IdleTaskStatus idle_task_status_; + bool fail_encoder_initialization_for_test_; private: friend class CanvasAsyncBlobCreatorTest; void Dispose(); - Member<DOMUint8ClampedArray> data_; scoped_refptr<StaticBitmapImage> image_; std::unique_ptr<ImageEncoder> encoder_; Vector<unsigned char> encoded_image_;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp index 28bb802..6fc63ac4 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
@@ -11,6 +11,7 @@ #include "public/platform/Platform.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkSurface.h" namespace blink { @@ -18,18 +19,19 @@ class MockCanvasAsyncBlobCreator : public CanvasAsyncBlobCreator { public: - MockCanvasAsyncBlobCreator(DOMUint8ClampedArray* data, - const IntSize& size, + MockCanvasAsyncBlobCreator(scoped_refptr<StaticBitmapImage> image, MimeType mime_type, - Document* document) - : CanvasAsyncBlobCreator(data, - nullptr, + Document* document, + bool fail_encoder_initialization = false) + : CanvasAsyncBlobCreator(image, mime_type, - size, nullptr, 0, document, - nullptr) {} + nullptr) { + if (fail_encoder_initialization) + fail_encoder_initialization_for_test_ = true; + } CanvasAsyncBlobCreator::IdleTaskStatus GetIdleTaskStatus() { return idle_task_status_; @@ -61,16 +63,13 @@ } //============================================================================== -//=================================PNG========================================== -//============================================================================== -class MockCanvasAsyncBlobCreatorWithoutStartPng +class MockCanvasAsyncBlobCreatorWithoutStart : public MockCanvasAsyncBlobCreator { public: - MockCanvasAsyncBlobCreatorWithoutStartPng(DOMUint8ClampedArray* data, - const IntSize& size, - Document* document) - : MockCanvasAsyncBlobCreator(data, size, kMimeTypePng, document) {} + MockCanvasAsyncBlobCreatorWithoutStart(scoped_refptr<StaticBitmapImage> image, + Document* document) + : MockCanvasAsyncBlobCreator(image, kMimeTypePng, document) {} protected: void ScheduleInitiateEncoding(double) override { @@ -81,65 +80,25 @@ //============================================================================== -class MockCanvasAsyncBlobCreatorWithoutCompletePng +class MockCanvasAsyncBlobCreatorWithoutComplete : public MockCanvasAsyncBlobCreator { public: - MockCanvasAsyncBlobCreatorWithoutCompletePng(DOMUint8ClampedArray* data, - const IntSize& size, - Document* document) - : MockCanvasAsyncBlobCreator(data, size, kMimeTypePng, document) {} + MockCanvasAsyncBlobCreatorWithoutComplete( + scoped_refptr<StaticBitmapImage> image, + Document* document, + bool fail_encoder_initialization = false) + : MockCanvasAsyncBlobCreator(image, + kMimeTypePng, + document, + fail_encoder_initialization) {} protected: void ScheduleInitiateEncoding(double quality) override { Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( BLINK_FROM_HERE, - WTF::Bind( - &MockCanvasAsyncBlobCreatorWithoutCompletePng::InitiateEncoding, - WrapPersistent(this), quality, std::numeric_limits<double>::max())); - } - - void IdleEncodeRows(double deadline_seconds) override { - // Deliberately make idleEncodeRows do nothing so that idle task never - // completes - } -}; - -//============================================================================== -//=================================JPEG========================================= -//============================================================================== - -class MockCanvasAsyncBlobCreatorWithoutStartJpeg - : public MockCanvasAsyncBlobCreator { - public: - MockCanvasAsyncBlobCreatorWithoutStartJpeg(DOMUint8ClampedArray* data, - const IntSize& size, - Document* document) - : MockCanvasAsyncBlobCreator(data, size, kMimeTypeJpeg, document) {} - - protected: - void ScheduleInitiateEncoding(double) override { - // Deliberately make scheduleInitiateEncoding do nothing so that idle - // task never starts - } -}; - -//============================================================================== - -class MockCanvasAsyncBlobCreatorWithoutCompleteJpeg - : public MockCanvasAsyncBlobCreator { - public: - MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(DOMUint8ClampedArray* data, - const IntSize& size, - Document* document) - : MockCanvasAsyncBlobCreator(data, size, kMimeTypeJpeg, document) {} - - protected: - void ScheduleInitiateEncoding(double quality) override { - Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( - BLINK_FROM_HERE, - WTF::Bind( - &MockCanvasAsyncBlobCreatorWithoutCompleteJpeg::InitiateEncoding, - WrapPersistent(this), quality, std::numeric_limits<double>::max())); + WTF::Bind(&MockCanvasAsyncBlobCreatorWithoutComplete::InitiateEncoding, + WrapPersistent(this), quality, + std::numeric_limits<double>::max())); } void IdleEncodeRows(double deadline_seconds) override { @@ -152,15 +111,9 @@ class CanvasAsyncBlobCreatorTest : public PageTestBase { public: - // Png unit tests - void PrepareMockCanvasAsyncBlobCreatorWithoutStartPng(); - void PrepareMockCanvasAsyncBlobCreatorWithoutCompletePng(); - void PrepareMockCanvasAsyncBlobCreatorFailPng(); - - // Jpeg unit tests - void PrepareMockCanvasAsyncBlobCreatorWithoutStartJpeg(); - void PrepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg(); - void PrepareMockCanvasAsyncBlobCreatorFailJpeg(); + void PrepareMockCanvasAsyncBlobCreatorWithoutStart(); + void PrepareMockCanvasAsyncBlobCreatorWithoutComplete(); + void PrepareMockCanvasAsyncBlobCreatorFail(); protected: CanvasAsyncBlobCreatorTest(); @@ -177,62 +130,31 @@ CanvasAsyncBlobCreatorTest::CanvasAsyncBlobCreatorTest() { } -void CanvasAsyncBlobCreatorTest:: - PrepareMockCanvasAsyncBlobCreatorWithoutStartPng() { - IntSize test_size(20, 20); - ImageData* image_data = ImageData::Create(test_size); - - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutStartPng( - image_data->data(), test_size, &GetDocument()); +scoped_refptr<StaticBitmapImage> CreateTransparentImage(int width, int height) { + sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(width, height); + if (!surface) + return nullptr; + return StaticBitmapImage::Create(surface->makeImageSnapshot()); } void CanvasAsyncBlobCreatorTest:: - PrepareMockCanvasAsyncBlobCreatorWithoutCompletePng() { - IntSize test_size(20, 20); - ImageData* image_data = ImageData::Create(test_size); - - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutCompletePng( - image_data->data(), test_size, &GetDocument()); + PrepareMockCanvasAsyncBlobCreatorWithoutStart() { + async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutStart( + CreateTransparentImage(20, 20), &GetDocument()); } -void CanvasAsyncBlobCreatorTest::PrepareMockCanvasAsyncBlobCreatorFailPng() { - IntSize test_size(0, 0); - ImageData* image_data = ImageData::CreateForTest(test_size); +void CanvasAsyncBlobCreatorTest:: + PrepareMockCanvasAsyncBlobCreatorWithoutComplete() { + async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutComplete( + CreateTransparentImage(20, 20), &GetDocument()); +} - // We reuse the class MockCanvasAsyncBlobCreatorWithoutCompletePng because +void CanvasAsyncBlobCreatorTest::PrepareMockCanvasAsyncBlobCreatorFail() { + // We reuse the class MockCanvasAsyncBlobCreatorWithoutComplete because // this test case is expected to fail at initialization step before // completion. - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutCompletePng( - image_data->data(), test_size, &GetDocument()); -} - -void CanvasAsyncBlobCreatorTest:: - PrepareMockCanvasAsyncBlobCreatorWithoutStartJpeg() { - IntSize test_size(20, 20); - ImageData* image_data = ImageData::Create(test_size); - - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutStartJpeg( - image_data->data(), test_size, &GetDocument()); -} - -void CanvasAsyncBlobCreatorTest:: - PrepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg() { - IntSize test_size(20, 20); - ImageData* image_data = ImageData::Create(test_size); - - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg( - image_data->data(), test_size, &GetDocument()); -} - -void CanvasAsyncBlobCreatorTest::PrepareMockCanvasAsyncBlobCreatorFailJpeg() { - IntSize test_size(0, 0); - ImageData* image_data = ImageData::CreateForTest(test_size); - - // We reuse the class MockCanvasAsyncBlobCreatorWithoutCompleteJpeg because - // this test case is expected to fail at initialization step before - // completion. - async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg( - image_data->data(), test_size, &GetDocument()); + async_blob_creator_ = new MockCanvasAsyncBlobCreatorWithoutComplete( + CreateTransparentImage(20, 20), &GetDocument(), true); } void CanvasAsyncBlobCreatorTest::TearDown() { @@ -242,12 +164,12 @@ //============================================================================== TEST_F(CanvasAsyncBlobCreatorTest, - PngIdleTaskNotStartedWhenStartTimeoutEventHappens) { + IdleTaskNotStartedWhenStartTimeoutEventHappens) { // This test mocks the scenario when idle task is not started when the // StartTimeoutEvent is inspecting the idle task status. // The whole image encoding process (including initialization) will then // become carried out in the alternative code path instead. - PrepareMockCanvasAsyncBlobCreatorWithoutStartPng(); + PrepareMockCanvasAsyncBlobCreatorWithoutStart(); EXPECT_CALL(*(AsyncBlobCreator()), SignalTaskSwitchInStartTimeoutEventForTesting()); @@ -260,12 +182,12 @@ } TEST_F(CanvasAsyncBlobCreatorTest, - PngIdleTaskNotCompletedWhenCompleteTimeoutEventHappens) { + IdleTaskNotCompletedWhenCompleteTimeoutEventHappens) { // This test mocks the scenario when idle task is not completed when the // CompleteTimeoutEvent is inspecting the idle task status. // The remaining image encoding process (excluding initialization) will // then become carried out in the alternative code path instead. - PrepareMockCanvasAsyncBlobCreatorWithoutCompletePng(); + PrepareMockCanvasAsyncBlobCreatorWithoutComplete(); EXPECT_CALL(*(AsyncBlobCreator()), SignalTaskSwitchInCompleteTimeoutEventForTesting()); @@ -277,12 +199,11 @@ AsyncBlobCreator()->GetIdleTaskStatus()); } -TEST_F(CanvasAsyncBlobCreatorTest, - PngIdleTaskFailedWhenStartTimeoutEventHappens) { +TEST_F(CanvasAsyncBlobCreatorTest, IdleTaskFailedWhenStartTimeoutEventHappens) { // This test mocks the scenario when idle task is not failed during when // either the StartTimeoutEvent or the CompleteTimeoutEvent is inspecting // the idle task status. - PrepareMockCanvasAsyncBlobCreatorFailPng(); + PrepareMockCanvasAsyncBlobCreatorFail(); AsyncBlobCreator()->ScheduleAsyncBlobCreation(true); testing::EnterRunLoop(); @@ -291,44 +212,4 @@ AsyncBlobCreator()->GetIdleTaskStatus()); } -// The below 3 unit tests have exactly same workflow as the above 3 unit tests -// except that they are encoding on JPEG image formats instead of PNG. -TEST_F(CanvasAsyncBlobCreatorTest, - JpegIdleTaskNotStartedWhenStartTimeoutEventHappens) { - PrepareMockCanvasAsyncBlobCreatorWithoutStartJpeg(); - EXPECT_CALL(*(AsyncBlobCreator()), - SignalTaskSwitchInStartTimeoutEventForTesting()); - - AsyncBlobCreator()->ScheduleAsyncBlobCreation(1.0); - testing::EnterRunLoop(); - - ::testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); - EXPECT_EQ(IdleTaskStatus::kIdleTaskSwitchedToImmediateTask, - AsyncBlobCreator()->GetIdleTaskStatus()); -} - -TEST_F(CanvasAsyncBlobCreatorTest, - JpegIdleTaskNotCompletedWhenCompleteTimeoutEventHappens) { - PrepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg(); - EXPECT_CALL(*(AsyncBlobCreator()), - SignalTaskSwitchInCompleteTimeoutEventForTesting()); - - AsyncBlobCreator()->ScheduleAsyncBlobCreation(1.0); - testing::EnterRunLoop(); - - ::testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); - EXPECT_EQ(IdleTaskStatus::kIdleTaskSwitchedToImmediateTask, - AsyncBlobCreator()->GetIdleTaskStatus()); -} - -TEST_F(CanvasAsyncBlobCreatorTest, - JpegIdleTaskFailedWhenStartTimeoutEventHappens) { - PrepareMockCanvasAsyncBlobCreatorFailJpeg(); - - AsyncBlobCreator()->ScheduleAsyncBlobCreation(1.0); - testing::EnterRunLoop(); - - EXPECT_EQ(IdleTaskStatus::kIdleTaskFailed, - AsyncBlobCreator()->GetIdleTaskStatus()); -} }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h index 9c4f70f..de687106 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
@@ -44,7 +44,6 @@ class CanvasImageSource; class HTMLCanvasElement; -class ImageData; class ImageBitmap; class WebLayer; @@ -92,7 +91,6 @@ virtual scoped_refptr<StaticBitmapImage> GetImage(AccelerationHint, SnapshotReason) const = 0; - virtual ImageData* ToImageData(SnapshotReason reason) { return nullptr; } virtual ContextType GetContextType() const = 0; virtual bool IsComposited() const = 0; virtual bool IsAccelerated() const = 0; @@ -164,7 +162,8 @@ virtual void SetFilterQuality(SkFilterQuality) { NOTREACHED(); } virtual void Reshape(int width, int height) { NOTREACHED(); } virtual void MarkLayerComposited() { NOTREACHED(); } - virtual ImageData* PaintRenderingResultsToImageData(SourceDrawingBuffer) { + virtual scoped_refptr<Uint8Array> PaintRenderingResultsToDataArray( + SourceDrawingBuffer) { NOTREACHED(); return nullptr; } @@ -172,6 +171,10 @@ NOTREACHED(); return 0; } + virtual IntSize DrawingBufferSize() const { + NOTREACHED(); + return IntSize(0, 0); + } // ImageBitmap-specific interface virtual bool Paint(GraphicsContext&, const IntRect&) { return false; }
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp index 577e999c..623e3f2 100644 --- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp
@@ -206,25 +206,6 @@ return CopyImageData(std::move(input), info); } -void freePixels(const void*, void* pixels) { - static_cast<Uint8Array*>(pixels)->Release(); -} - -scoped_refptr<StaticBitmapImage> NewImageFromRaster( - const SkImageInfo& info, - scoped_refptr<Uint8Array>&& image_pixels) { - SkPixmap pixmap(info, image_pixels->Data(), info.minRowBytes()); - - Uint8Array* pixels = image_pixels.get(); - if (pixels) { - pixels->AddRef(); - image_pixels = nullptr; - } - - return StaticBitmapImage::Create( - SkImage::MakeFromRaster(pixmap, freePixels, pixels)); -} - static inline bool ShouldAvoidPremul( const ImageBitmap::ParsedOptions& options) { return options.source_is_unpremul && !options.premultiply_alpha; @@ -252,7 +233,7 @@ image_pixels->Data() + top_last_element, image_pixels->Data() + bottom_first_element); } - return NewImageFromRaster(info, std::move(image_pixels)); + return StaticBitmapImage::Create(std::move(image_pixels), info); } // Since we are allowed to premul the input image if needed, we can use Skia @@ -297,7 +278,7 @@ CopyImageData(image, info.makeColorSpace(nullptr)); if (!dst_pixels) return nullptr; - return NewImageFromRaster(info, std::move(dst_pixels)); + return StaticBitmapImage::Create(std::move(dst_pixels), info); } // Draw on a surface. Avoid sRGB gamma transfer curve. @@ -313,6 +294,10 @@ image->ContextProviderWrapper()); } +void freePixels(const void*, void* pixels) { + static_cast<Uint8Array*>(pixels)->Release(); +} + // Resizes an SkImage using scalePixels(). This code path should not be used if // source image is not premul and premul is not allowed and the requested filter // quality is high. @@ -777,7 +762,7 @@ parsed_options.premultiply_alpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType, parsed_options.color_params.GetSkColorSpaceForSkSurfaces()); - image_ = NewImageFromRaster(info, std::move(image_pixels)); + image_ = StaticBitmapImage::Create(std::move(image_pixels), info); if (!image_) return;
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index e49a2717..0fd473b 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -394,19 +394,11 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); CanvasAsyncBlobCreator* async_creator = nullptr; - if (context_->Is3d() && - !context_->CreationAttributes().premultipliedAlpha()) { - ImageData* image_data = context_->ToImageData(kSnapshotReasonUnknown); - async_creator = CanvasAsyncBlobCreator::Create( - image_data->data(), encoding_mime_type, image_data->Size(), start_time, - ExecutionContext::From(script_state), resolver); - } else { - scoped_refptr<StaticBitmapImage> snapshot = - context_->GetImage(kPreferNoAcceleration, kSnapshotReasonUnknown); - async_creator = CanvasAsyncBlobCreator::Create( - snapshot, encoding_mime_type, start_time, - ExecutionContext::From(script_state), resolver); - } + scoped_refptr<StaticBitmapImage> snapshot = + context_->GetImage(kPreferNoAcceleration, kSnapshotReasonUnknown); + async_creator = CanvasAsyncBlobCreator::Create( + snapshot, encoding_mime_type, start_time, + ExecutionContext::From(script_state), resolver); async_creator->ScheduleAsyncBlobCreation(options.quality()); return resolver->Promise(); }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp index 80ed181..2d44b08 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -868,9 +868,10 @@ IntSize scroll_offset_accumulation_for_children = painting_info.scroll_offset_accumulation; - if (paint_layer_.GetLayoutObject().HasOverflowClip()) + if (paint_layer_.GetLayoutObject().HasOverflowClip()) { scroll_offset_accumulation_for_children += paint_layer_.GetLayoutBox()->ScrolledContentOffset(); + } for (; child; child = iterator.Next()) { // If this Layer should paint into its own backing or a grouped backing,
diff --git a/third_party/WebKit/Source/devtools/front_end/network_log/NetworkLog.js b/third_party/WebKit/Source/devtools/front_end/network_log/NetworkLog.js index 2d636c0..372e9d4 100644 --- a/third_party/WebKit/Source/devtools/front_end/network_log/NetworkLog.js +++ b/third_party/WebKit/Source/devtools/front_end/network_log/NetworkLog.js
@@ -276,7 +276,7 @@ _onMainFrameNavigated(event) { var mainFrame = /** @type {!SDK.ResourceTreeFrame} */ (event.data); var manager = mainFrame.resourceTreeModel().target().model(SDK.NetworkManager); - if (!manager) + if (!manager || mainFrame.resourceTreeModel().target().parentTarget()) return; var oldManagerRequests = this._requests.filter(request => SDK.NetworkManager.forRequest(request) === manager);
diff --git a/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp index a0861fa..e68d37f9 100644 --- a/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
@@ -143,33 +143,6 @@ return image; } -// TODO(xlai): Handle error cases when, by any reason, -// OffscreenCanvasRenderingContext2D fails to get ImageData. -ImageData* OffscreenCanvasRenderingContext2D::ToImageData( - SnapshotReason reason) { - if (!GetImageBuffer()) - return nullptr; - if (Host()->Size().IsEmpty()) - return nullptr; - scoped_refptr<StaticBitmapImage> snapshot = - GetImageBuffer()->NewImageSnapshot(kPreferNoAcceleration, reason); - ImageData* image_data = nullptr; - if (snapshot) { - image_data = ImageData::Create(Host()->Size()); - SkImageInfo image_info = - SkImageInfo::Make(this->Width(), this->Height(), kRGBA_8888_SkColorType, - kUnpremul_SkAlphaType); - sk_sp<SkImage> sk_image = - snapshot->PaintImageForCurrentFrame().GetSkImage(); - bool read_pixels_successful = sk_image->readPixels( - image_info, image_data->data()->Data(), image_info.minRowBytes(), 0, 0); - DCHECK(read_pixels_successful); - if (!read_pixels_successful) - return nullptr; - } - return image_data; -} - void OffscreenCanvasRenderingContext2D::SetOffscreenCanvasGetContextResult( OffscreenRenderingContext& result) { result.SetOffscreenCanvasRenderingContext2D(this);
diff --git a/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h b/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h index c00b22d..8327ee61 100644 --- a/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h +++ b/third_party/WebKit/Source/modules/canvas/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h
@@ -62,7 +62,6 @@ } scoped_refptr<StaticBitmapImage> GetImage(AccelerationHint, SnapshotReason) const final; - ImageData* ToImageData(SnapshotReason) override; void Reset() override; void RestoreCanvasMatrixClipStack(PaintCanvas* c) const override { RestoreMatrixClipStack(c);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index c9bd9731..e5de510 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -824,34 +824,6 @@ surface->makeImageSnapshot(), std::move(shared_context_wrapper)); } -ImageData* WebGLRenderingContextBase::ToImageData(SnapshotReason reason) { - ImageData* image_data = nullptr; - // TODO(ccameron): WebGL should produce sRGB images. - // https://crbug.com/672299 - if (GetDrawingBuffer()) { - // For un-premultiplied data - image_data = PaintRenderingResultsToImageData(kBackBuffer); - if (image_data) { - return image_data; - } - - int width = GetDrawingBuffer()->Size().Width(); - int height = GetDrawingBuffer()->Size().Height(); - SkImageInfo image_info = - SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, - CreationAttributes().alpha() ? kPremul_SkAlphaType - : kOpaque_SkAlphaType); - scoped_refptr<StaticBitmapImage> snapshot = MakeImageSnapshot(image_info); - if (snapshot) { - image_data = ImageData::Create(GetDrawingBuffer()->Size()); - snapshot->PaintImageForCurrentFrame().GetSkImage()->readPixels( - image_info, image_data->data()->Data(), image_info.minRowBytes(), 0, - 0); - } - } - return image_data; -} - namespace { // Exposed by GL_ANGLE_depth_texture @@ -1513,27 +1485,21 @@ return true; } -ImageData* WebGLRenderingContextBase::PaintRenderingResultsToImageData( +IntSize WebGLRenderingContextBase::DrawingBufferSize() const { + if (isContextLost()) + return IntSize(0, 0); + return GetDrawingBuffer()->Size(); +} + +scoped_refptr<Uint8Array> +WebGLRenderingContextBase::PaintRenderingResultsToDataArray( SourceDrawingBuffer source_buffer) { if (isContextLost()) return nullptr; - if (CreationAttributes().premultipliedAlpha()) - return nullptr; - ClearIfComposited(); GetDrawingBuffer()->ResolveAndBindForReadAndDraw(); ScopedFramebufferRestorer restorer(this); - int width, height; - WTF::ArrayBufferContents contents; - if (!GetDrawingBuffer()->PaintRenderingResultsToImageData( - width, height, source_buffer, contents)) - return nullptr; - DOMArrayBuffer* image_data_pixels = DOMArrayBuffer::Create(contents); - - return ImageData::Create( - IntSize(width, height), - NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::Create( - image_data_pixels, 0, image_data_pixels->ByteLength()))); + return GetDrawingBuffer()->PaintRenderingResultsToDataArray(source_buffer); } void WebGLRenderingContextBase::Reshape(int width, int height) {
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h index 1b257c12..ac82de5 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -560,7 +560,9 @@ void Reshape(int width, int height) override; void MarkLayerComposited() override; - ImageData* PaintRenderingResultsToImageData(SourceDrawingBuffer) override; + + scoped_refptr<Uint8Array> PaintRenderingResultsToDataArray( + SourceDrawingBuffer) override; unsigned MaxVertexAttribs() const { return max_vertex_attribs_; } @@ -571,6 +573,10 @@ // Returns approximate gpu memory allocated per pixel. int ExternallyAllocatedBufferCountPerPixel() override; + // Returns the drawing buffer size after it is, probably, has scaled down + // to the maximum supported canvas size. + IntSize DrawingBufferSize() const override; + class TextureUnitState { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); @@ -587,7 +593,6 @@ scoped_refptr<StaticBitmapImage> GetImage(AccelerationHint, SnapshotReason) const override; - ImageData* ToImageData(SnapshotReason) override; void SetFilterQuality(SkFilterQuality) override; bool IsWebGL2OrHigher() { return Version() >= 2; }
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp index 7a11758..a985eb5 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -34,6 +34,30 @@ return UnacceleratedStaticBitmapImage::Create(std::move(image)); } +scoped_refptr<StaticBitmapImage> StaticBitmapImage::Create( + scoped_refptr<Uint8Array>&& image_pixels, + const SkImageInfo& info) { + SkPixmap pixmap(info, image_pixels->Data(), info.minRowBytes()); + + Uint8Array* pixels = image_pixels.get(); + if (pixels) { + pixels->AddRef(); + image_pixels = nullptr; + } + + return Create(SkImage::MakeFromRaster( + pixmap, + [](const void*, void* p) { static_cast<Uint8Array*>(p)->Release(); }, + pixels)); +} + +scoped_refptr<StaticBitmapImage> StaticBitmapImage::Create( + WTF::ArrayBufferContents& contents, + const SkImageInfo& info) { + SkPixmap pixmap(info, contents.Data(), info.minRowBytes()); + return Create(SkImage::MakeFromRaster(pixmap, nullptr, nullptr)); +} + void StaticBitmapImage::DrawHelper(PaintCanvas* canvas, const PaintFlags& flags, const FloatRect& dst_rect,
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h index f1a508b..61486e5 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
@@ -11,6 +11,7 @@ #include "platform/graphics/CanvasColorParams.h" #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/Image.h" +#include "platform/wtf/typed_arrays/Uint8Array.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkRefCnt.h" @@ -35,6 +36,10 @@ sk_sp<SkImage>, base::WeakPtr<WebGraphicsContext3DProviderWrapper> = nullptr); static scoped_refptr<StaticBitmapImage> Create(PaintImage); + static scoped_refptr<StaticBitmapImage> Create(scoped_refptr<Uint8Array>&&, + const SkImageInfo&); + static scoped_refptr<StaticBitmapImage> Create(WTF::ArrayBufferContents&, + const SkImageInfo&); bool IsStaticBitmapImage() const override { return true; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index d63086b68..8167474 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -1106,26 +1106,28 @@ gl_->BindFramebuffer(target, WantExplicitResolve() ? multisample_fbo_ : fbo_); } -bool DrawingBuffer::PaintRenderingResultsToImageData( - int& width, - int& height, - SourceDrawingBuffer source_buffer, - WTF::ArrayBufferContents& contents) { +scoped_refptr<Uint8Array> DrawingBuffer::PaintRenderingResultsToDataArray( + SourceDrawingBuffer source_buffer) { ScopedStateRestorer scoped_state_restorer(this); - DCHECK(!premultiplied_alpha_); - width = Size().Width(); - height = Size().Height(); + int width = Size().Width(); + int height = Size().Height(); CheckedNumeric<int> data_size = 4; data_size *= width; data_size *= height; if (!data_size.IsValid()) - return false; + return nullptr; - WTF::ArrayBufferContents pixels(width * height, 4, - WTF::ArrayBufferContents::kNotShared, - WTF::ArrayBufferContents::kDontInitialize); + unsigned byte_length = width * height * 4; + scoped_refptr<ArrayBuffer> dst_buffer = + ArrayBuffer::CreateOrNull(byte_length, 1); + if (!dst_buffer) + return nullptr; + scoped_refptr<Uint8Array> data_array = + Uint8Array::Create(std::move(dst_buffer), 0, byte_length); + if (!data_array) + return nullptr; GLuint fbo = 0; state_restorer_->SetFramebufferBindingDirty(); @@ -1139,9 +1141,10 @@ gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); } - ReadBackFramebuffer(static_cast<unsigned char*>(pixels.Data()), width, height, - kReadbackRGBA, WebGLImageConversion::kAlphaDoNothing); - FlipVertically(static_cast<uint8_t*>(pixels.Data()), width, height); + ReadBackFramebuffer(static_cast<unsigned char*>(data_array->Data()), width, + height, kReadbackRGBA, + WebGLImageConversion::kAlphaDoNothing); + FlipVertically(static_cast<uint8_t*>(data_array->Data()), width, height); if (fbo) { gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, @@ -1149,8 +1152,7 @@ gl_->DeleteFramebuffers(1, &fbo); } - pixels.Transfer(contents); - return true; + return data_array; } void DrawingBuffer::ReadBackFramebuffer(unsigned char* pixels,
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index c5f8504..ff92729 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -61,10 +61,6 @@ class SharedBitmap; } -namespace WTF { -class ArrayBufferContents; -} - namespace blink { class CanvasColorParams; class Extensions3DUtil; @@ -215,10 +211,8 @@ const IntRect& src_sub_rectangle, SourceDrawingBuffer); - bool PaintRenderingResultsToImageData(int&, - int&, - SourceDrawingBuffer, - WTF::ArrayBufferContents&); + scoped_refptr<Uint8Array> PaintRenderingResultsToDataArray( + SourceDrawingBuffer); int SampleCount() const { return sample_count_; } bool ExplicitResolveOfMultisampleData() const {
diff --git a/third_party/WebKit/Source/platform/heap/IncrementalMarkingTest.cpp b/third_party/WebKit/Source/platform/heap/IncrementalMarkingTest.cpp index 724d309b..0be9cf2 100644 --- a/third_party/WebKit/Source/platform/heap/IncrementalMarkingTest.cpp +++ b/third_party/WebKit/Source/platform/heap/IncrementalMarkingTest.cpp
@@ -10,6 +10,9 @@ #include "platform/heap/TraceTraits.h" #include "testing/gtest/include/gtest/gtest.h" +// TODO(mlippautz): Replace with proper build flag. +#if 0 + namespace blink { namespace incremental_marking_test { @@ -210,3 +213,5 @@ } // namespace incremental_marking_test } // namespace blink + +#endif
diff --git a/third_party/WebKit/Source/platform/heap/Member.h b/third_party/WebKit/Source/platform/heap/Member.h index d1f1e588..fedefb2 100644 --- a/third_party/WebKit/Source/platform/heap/Member.h +++ b/third_party/WebKit/Source/platform/heap/Member.h
@@ -249,6 +249,8 @@ protected: ALWAYS_INLINE void WriteBarrier(const T* value) const { +// TODO(mlippautz): Replace with proper build flag. +#if 0 if (value) { // The following method for retrieving a page works as allocation of // mixins on large object pages is prohibited. @@ -258,6 +260,7 @@ ThreadState::Current()->Heap().WriteBarrierInternal(page, value); } } +#endif } };
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 2a7c0ac3..2ae99da6 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -364,10 +364,15 @@ } bool ThreadState::ShouldScheduleIncrementalMarking() const { - // TODO(mluppautz): For now immediately schedule incremental marking if +// TODO(mlippautz): Replace with proper build flag. +#if 0 + // TODO(mlippautz): For now immediately schedule incremental marking if // the runtime flag is provided, basically exercising a stress test. return (GcState() == kNoGCScheduled || GcState() == kSweeping) && RuntimeEnabledFeatures::HeapIncrementalMarkingEnabled(); +#else + return false; +#endif } bool ThreadState::ShouldScheduleIdleGC() {
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 04716509..625138d 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -30663,6 +30663,9 @@ <histogram name="interstitial.ssl.expiration_and_decision.nonoverridable" enum="SSLIsExpiredAndDecision"> + <obsolete> + Deprecated Dec 2017 (M65). + </obsolete> <owner>jww@chromium.org</owner> <summary> Records when a user has made a decision to proceed on a nonoverridable SSL @@ -30673,6 +30676,9 @@ <histogram name="interstitial.ssl.expiration_and_decision.overridable" enum="SSLIsExpiredAndDecision"> + <obsolete> + Deprecated Dec 2017 (M65). + </obsolete> <owner>jww@chromium.org</owner> <summary> Records when a user has made a decision to proceed on an overridable SSL @@ -64349,6 +64355,10 @@ </histogram> <histogram name="Plugin.Flash.Engagement"> + <obsolete> + Deprecated 12/2017 in Issue 781644 as we no longer use Site Engagement Index + as a signal for Flash display. + </obsolete> <owner>dominickn@chromium.org</owner> <summary> The engagement score of origins which have passed through a site engagement @@ -107475,6 +107485,9 @@ </histogram_suffixes> <histogram_suffixes name="PluginFlashEngagement" separator="."> + <obsolete> + Deprecated 12/2017 in Issue 781644. + </obsolete> <suffix name="ContentSettingAllowed" label="Engagement when Flash allowed."/> <suffix name="ContentSettingBlocked" label="Engagement when Flash blocked."/> <suffix name="NoSetting" label="Engagement when no content setting set."/>
diff --git a/ui/aura/local/layer_tree_frame_sink_local.h b/ui/aura/local/layer_tree_frame_sink_local.h index 98ba1ae..25dc6cf 100644 --- a/ui/aura/local/layer_tree_frame_sink_local.h +++ b/ui/aura/local/layer_tree_frame_sink_local.h
@@ -44,6 +44,10 @@ base::WeakPtr<LayerTreeFrameSinkLocal> GetWeakPtr(); + const viz::LocalSurfaceId& local_surface_id() const { + return local_surface_id_; + } + // cc::LayerTreeFrameSink: bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; void DetachFromClient() override;
diff --git a/ui/aura/mus/DEPS b/ui/aura/mus/DEPS index f572556f..8e72cf0 100644 --- a/ui/aura/mus/DEPS +++ b/ui/aura/mus/DEPS
@@ -7,6 +7,7 @@ "+components/discardable_memory/client/client_discardable_shared_memory_manager.h", "+components/viz/client", "+components/viz/common", + "+components/viz/service/frame_sinks/frame_sink_manager_impl.h", "+gpu/command_buffer/client/gpu_memory_buffer_manager.h", "+gpu/ipc/client/gpu_channel_host.h", "+mojo/public/cpp/system/buffer.h",
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc index 1e499673..aedc2838 100644 --- a/ui/aura/mus/window_port_mus.cc +++ b/ui/aura/mus/window_port_mus.cc
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "components/viz/client/local_surface_id_provider.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/transient_window_client.h" #include "ui/aura/env.h" @@ -36,7 +37,9 @@ WindowPortMus::WindowPortMus(WindowTreeClient* client, WindowMusType window_mus_type) - : WindowMus(window_mus_type), window_tree_client_(client) {} + : WindowMus(window_mus_type), + window_tree_client_(client), + weak_ptr_factory_(this) {} WindowPortMus::~WindowPortMus() { client_surface_embedder_.reset(); @@ -550,25 +553,64 @@ WindowPortMus::CreateLayerTreeFrameSink() { DCHECK_EQ(window_mus_type(), WindowMusType::LOCAL); DCHECK(!local_layer_tree_frame_sink_); - auto frame_sink = RequestLayerTreeFrameSink( - nullptr, - aura::Env::GetInstance()->context_factory()->GetGpuMemoryBufferManager()); - local_layer_tree_frame_sink_ = frame_sink->GetWeakPtr(); - auto size_in_pixel = + + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink; + if (switches::IsMusHostingViz()) { + auto client_layer_tree_frame_sink = + RequestLayerTreeFrameSink(nullptr, aura::Env::GetInstance() + ->context_factory() + ->GetGpuMemoryBufferManager()); + local_layer_tree_frame_sink_ = client_layer_tree_frame_sink->GetWeakPtr(); + frame_sink = std::move(client_layer_tree_frame_sink); + } else { + auto* context_factory_private = + aura::Env::GetInstance()->context_factory_private(); + auto frame_sink_id = GetFrameSinkId(); + DCHECK(frame_sink_id.is_valid()); + auto layer_tree_frame_sink_local = + std::make_unique<LayerTreeFrameSinkLocal>( + frame_sink_id, context_factory_private->GetHostFrameSinkManager(), + window_->GetName()); + layer_tree_frame_sink_local->SetSurfaceChangedCallback(base::BindRepeating( + &WindowPortMus::OnSurfaceChanged, weak_ptr_factory_.GetWeakPtr())); + if (window_->layer()->GetCompositor()) { + window_->layer()->GetCompositor()->AddFrameSink(GetFrameSinkId()); + is_frame_sink_id_added_to_compositor_ = true; + } + local_layer_tree_frame_sink_ = layer_tree_frame_sink_local->GetWeakPtr(); + frame_sink = std::move(layer_tree_frame_sink_local); + } + + gfx::Size size_in_pixel = gfx::ConvertSizeToPixel(GetDeviceScaleFactor(), window_->bounds().size()); // Make sure |local_surface_id_| and |last_surface_size_in_pixels_| are - // correct for the new created |frame_sink|. + // correct for the new created |local_layer_tree_frame_sink_|. GetOrAllocateLocalSurfaceId(size_in_pixel); - return std::move(frame_sink); + return frame_sink; } viz::SurfaceId WindowPortMus::GetSurfaceId() const { return viz::SurfaceId(window_->embed_frame_sink_id(), local_surface_id_); } -void WindowPortMus::OnWindowAddedToRootWindow() {} +void WindowPortMus::OnWindowAddedToRootWindow() { + if (switches::IsMusHostingViz()) + return; + if (local_layer_tree_frame_sink_) { + DCHECK(!is_frame_sink_id_added_to_compositor_); + window_->layer()->GetCompositor()->AddFrameSink(GetFrameSinkId()); + is_frame_sink_id_added_to_compositor_ = true; + } +} -void WindowPortMus::OnWillRemoveWindowFromRootWindow() {} +void WindowPortMus::OnWillRemoveWindowFromRootWindow() { + if (switches::IsMusHostingViz()) + return; + if (is_frame_sink_id_added_to_compositor_) { + window_->layer()->GetCompositor()->RemoveFrameSink(GetFrameSinkId()); + is_frame_sink_id_added_to_compositor_ = false; + } +} void WindowPortMus::OnEventTargetingPolicyChanged() { SetEventTargetingPolicy(window_->event_targeting_policy()); @@ -614,4 +656,19 @@ client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); } +void WindowPortMus::OnSurfaceChanged(const viz::SurfaceInfo& surface_info) { + DCHECK(!switches::IsMusHostingViz()); + DCHECK_EQ(surface_info.id().frame_sink_id(), GetFrameSinkId()); + DCHECK_EQ(surface_info.id().local_surface_id(), local_surface_id_); + scoped_refptr<viz::SurfaceReferenceFactory> reference_factory = + aura::Env::GetInstance() + ->context_factory_private() + ->GetFrameSinkManager() + ->surface_manager() + ->reference_factory(); + window_->layer()->SetShowPrimarySurface( + surface_info.id(), window_->bounds().size(), reference_factory); + window_->layer()->SetFallbackSurfaceId(surface_info.id()); +} + } // namespace aura
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h index 449979e..732ca7b 100644 --- a/ui/aura/mus/window_port_mus.h +++ b/ui/aura/mus/window_port_mus.h
@@ -12,12 +12,14 @@ #include "base/logging.h" #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "components/viz/client/client_layer_tree_frame_sink.h" #include "components/viz/common/surfaces/surface_info.h" #include "services/ui/public/interfaces/cursor/cursor.mojom.h" #include "services/ui/public/interfaces/window_tree.mojom.h" #include "services/ui/public/interfaces/window_tree_constants.mojom.h" #include "ui/aura/aura_export.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" #include "ui/aura/mus/mus_types.h" #include "ui/aura/mus/window_mus.h" #include "ui/aura/window_port.h" @@ -280,6 +282,8 @@ void UpdatePrimarySurfaceId(); void UpdateClientSurfaceEmbedder(); + void OnSurfaceChanged(const viz::SurfaceInfo& surface_info); + WindowTreeClient* window_tree_client_; Window* window_ = nullptr; @@ -305,7 +309,10 @@ // When a frame sink is created // for a local aura::Window, we need keep a weak ptr of it, so we can update // the local surface id when necessary. - base::WeakPtr<viz::ClientLayerTreeFrameSink> local_layer_tree_frame_sink_; + base::WeakPtr<cc::LayerTreeFrameSink> local_layer_tree_frame_sink_; + bool is_frame_sink_id_added_to_compositor_ = false; + + base::WeakPtrFactory<WindowPortMus> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(WindowPortMus); };
diff --git a/ui/aura/mus/window_port_mus_unittest.cc b/ui/aura/mus/window_port_mus_unittest.cc index bd40c6d..107d663e 100644 --- a/ui/aura/mus/window_port_mus_unittest.cc +++ b/ui/aura/mus/window_port_mus_unittest.cc
@@ -6,8 +6,10 @@ #include "components/viz/client/client_layer_tree_frame_sink.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/window.h" +#include "ui/base/ui_base_switches_util.h" namespace aura { @@ -17,7 +19,7 @@ ~WindowPortMusTest() override = default; - base::WeakPtr<viz::ClientLayerTreeFrameSink> GetFrameSinkFor(Window* window) { + base::WeakPtr<cc::LayerTreeFrameSink> GetFrameSinkFor(Window* window) { auto* window_mus = WindowPortMus::Get(window); return window_mus->local_layer_tree_frame_sink_; } @@ -43,8 +45,14 @@ auto mus_frame_sink = GetFrameSinkFor(&window); ASSERT_TRUE(mus_frame_sink); - EXPECT_TRUE(mus_frame_sink->local_surface_id().is_valid()); - EXPECT_EQ(mus_frame_sink->local_surface_id(), local_surface_id); + auto frame_sink_local_surface_id = + switches::IsMusHostingViz() + ? static_cast<viz::ClientLayerTreeFrameSink*>(mus_frame_sink.get()) + ->local_surface_id() + : static_cast<LayerTreeFrameSinkLocal*>(mus_frame_sink.get()) + ->local_surface_id(); + EXPECT_TRUE(frame_sink_local_surface_id.is_valid()); + EXPECT_EQ(frame_sink_local_surface_id, local_surface_id); } } // namespace aura
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index 37e176f..4e67c9d 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -4,6 +4,7 @@ #include "ui/compositor/test/in_process_context_factory.h" +#include <limits> #include <utility> #include "base/bind.h" @@ -45,8 +46,8 @@ namespace ui { namespace { // The client_id used here should not conflict with the client_id generated -// from RenderWidgetHostImpl. -constexpr uint32_t kDefaultClientId = 0u; +// from RenderWidgetHostImpl and client_id(0) used by aura::WindowPortMus. +constexpr uint32_t kDefaultClientId = std::numeric_limits<uint32_t>::max(); class FakeReflector : public Reflector { public:
diff --git a/ui/events/android/motion_event_android.cc b/ui/events/android/motion_event_android.cc index 09f030db..433ff446 100644 --- a/ui/events/android/motion_event_android.cc +++ b/ui/events/android/motion_event_android.cc
@@ -16,35 +16,27 @@ using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef; -using namespace JNI_MotionEvent; namespace ui { namespace { +#define EVENT_CASE(x) \ + case JNI_MotionEvent::x: \ + return MotionEventAndroid::x + MotionEventAndroid::Action FromAndroidAction(int android_action) { switch (android_action) { - case ACTION_DOWN: - return MotionEventAndroid::ACTION_DOWN; - case ACTION_UP: - return MotionEventAndroid::ACTION_UP; - case ACTION_MOVE: - return MotionEventAndroid::ACTION_MOVE; - case ACTION_CANCEL: - return MotionEventAndroid::ACTION_CANCEL; - case ACTION_POINTER_DOWN: - return MotionEventAndroid::ACTION_POINTER_DOWN; - case ACTION_POINTER_UP: - return MotionEventAndroid::ACTION_POINTER_UP; - case ACTION_HOVER_ENTER: - return MotionEventAndroid::ACTION_HOVER_ENTER; - case ACTION_HOVER_EXIT: - return MotionEventAndroid::ACTION_HOVER_EXIT; - case ACTION_HOVER_MOVE: - return MotionEventAndroid::ACTION_HOVER_MOVE; - case ACTION_BUTTON_PRESS: - return MotionEventAndroid::ACTION_BUTTON_PRESS; - case ACTION_BUTTON_RELEASE: - return MotionEventAndroid::ACTION_BUTTON_RELEASE; + EVENT_CASE(ACTION_DOWN); + EVENT_CASE(ACTION_UP); + EVENT_CASE(ACTION_MOVE); + EVENT_CASE(ACTION_CANCEL); + EVENT_CASE(ACTION_POINTER_DOWN); + EVENT_CASE(ACTION_POINTER_UP); + EVENT_CASE(ACTION_HOVER_ENTER); + EVENT_CASE(ACTION_HOVER_EXIT); + EVENT_CASE(ACTION_HOVER_MOVE); + EVENT_CASE(ACTION_BUTTON_PRESS); + EVENT_CASE(ACTION_BUTTON_RELEASE); default: NOTREACHED() << "Invalid Android MotionEvent action: " << android_action; }; @@ -53,38 +45,34 @@ MotionEventAndroid::ToolType FromAndroidToolType(int android_tool_type) { switch (android_tool_type) { - case TOOL_TYPE_UNKNOWN: - return MotionEventAndroid::TOOL_TYPE_UNKNOWN; - case TOOL_TYPE_FINGER: - return MotionEventAndroid::TOOL_TYPE_FINGER; - case TOOL_TYPE_STYLUS: - return MotionEventAndroid::TOOL_TYPE_STYLUS; - case TOOL_TYPE_MOUSE: - return MotionEventAndroid::TOOL_TYPE_MOUSE; - case TOOL_TYPE_ERASER: - return MotionEventAndroid::TOOL_TYPE_ERASER; + EVENT_CASE(TOOL_TYPE_UNKNOWN); + EVENT_CASE(TOOL_TYPE_FINGER); + EVENT_CASE(TOOL_TYPE_STYLUS); + EVENT_CASE(TOOL_TYPE_MOUSE); + EVENT_CASE(TOOL_TYPE_ERASER); default: NOTREACHED() << "Invalid Android MotionEvent tool type: " << android_tool_type; }; return MotionEventAndroid::TOOL_TYPE_UNKNOWN; } +#undef EVENT_CASE int FromAndroidButtonState(int button_state) { int result = 0; - if ((button_state & BUTTON_BACK) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_BACK) != 0) result |= MotionEventAndroid::BUTTON_BACK; - if ((button_state & BUTTON_FORWARD) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_FORWARD) != 0) result |= MotionEventAndroid::BUTTON_FORWARD; - if ((button_state & BUTTON_PRIMARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_PRIMARY) != 0) result |= MotionEventAndroid::BUTTON_PRIMARY; - if ((button_state & BUTTON_SECONDARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_SECONDARY) != 0) result |= MotionEventAndroid::BUTTON_SECONDARY; - if ((button_state & BUTTON_TERTIARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_TERTIARY) != 0) result |= MotionEventAndroid::BUTTON_TERTIARY; - if ((button_state & BUTTON_STYLUS_PRIMARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_STYLUS_PRIMARY) != 0) result |= MotionEventAndroid::BUTTON_STYLUS_PRIMARY; - if ((button_state & BUTTON_STYLUS_SECONDARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_STYLUS_SECONDARY) != 0) result |= MotionEventAndroid::BUTTON_STYLUS_SECONDARY; return result; } @@ -103,19 +91,19 @@ if ((meta_state & AMETA_CAPS_LOCK_ON) != 0) flags |= ui::EF_CAPS_LOCK_ON; - if ((button_state & BUTTON_BACK) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_BACK) != 0) flags |= ui::EF_BACK_MOUSE_BUTTON; - if ((button_state & BUTTON_FORWARD) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_FORWARD) != 0) flags |= ui::EF_FORWARD_MOUSE_BUTTON; - if ((button_state & BUTTON_PRIMARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_PRIMARY) != 0) flags |= ui::EF_LEFT_MOUSE_BUTTON; - if ((button_state & BUTTON_SECONDARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_SECONDARY) != 0) flags |= ui::EF_RIGHT_MOUSE_BUTTON; - if ((button_state & BUTTON_TERTIARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_TERTIARY) != 0) flags |= ui::EF_MIDDLE_MOUSE_BUTTON; - if ((button_state & BUTTON_STYLUS_PRIMARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_STYLUS_PRIMARY) != 0) flags |= ui::EF_LEFT_MOUSE_BUTTON; - if ((button_state & BUTTON_STYLUS_SECONDARY) != 0) + if ((button_state & JNI_MotionEvent::BUTTON_STYLUS_SECONDARY) != 0) flags |= ui::EF_RIGHT_MOUSE_BUTTON; return flags; @@ -333,24 +321,24 @@ DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].id; - return Java_MotionEvent_getPointerId(AttachCurrentThread(), event_, - pointer_index); + return JNI_MotionEvent::Java_MotionEvent_getPointerId(AttachCurrentThread(), + event_, pointer_index); } float MotionEventAndroid::GetX(size_t pointer_index) const { DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].position.x(); - return ToDips( - Java_MotionEvent_getXF_I(AttachCurrentThread(), event_, pointer_index)); + return ToDips(JNI_MotionEvent::Java_MotionEvent_getXF_I( + AttachCurrentThread(), event_, pointer_index)); } float MotionEventAndroid::GetY(size_t pointer_index) const { DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].position.y(); - return ToDips( - Java_MotionEvent_getYF_I(AttachCurrentThread(), event_, pointer_index)); + return ToDips(JNI_MotionEvent::Java_MotionEvent_getYF_I( + AttachCurrentThread(), event_, pointer_index)); } float MotionEventAndroid::GetRawX(size_t pointer_index) const { @@ -365,23 +353,23 @@ DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].touch_major; - return ToDips(Java_MotionEvent_getTouchMajorF_I(AttachCurrentThread(), event_, - pointer_index)); + return ToDips(JNI_MotionEvent::Java_MotionEvent_getTouchMajorF_I( + AttachCurrentThread(), event_, pointer_index)); } float MotionEventAndroid::GetTouchMinor(size_t pointer_index) const { DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].touch_minor; - return ToDips(Java_MotionEvent_getTouchMinorF_I(AttachCurrentThread(), event_, - pointer_index)); + return ToDips(JNI_MotionEvent::Java_MotionEvent_getTouchMinorF_I( + AttachCurrentThread(), event_, pointer_index)); } float MotionEventAndroid::GetOrientation(size_t pointer_index) const { DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].orientation; - return ToValidFloat(Java_MotionEvent_getOrientationF_I( + return ToValidFloat(JNI_MotionEvent::Java_MotionEvent_getOrientationF_I( AttachCurrentThread(), event_, pointer_index)); } @@ -394,8 +382,8 @@ return 0.f; if (cached_action_ == MotionEvent::ACTION_UP) return 0.f; - return Java_MotionEvent_getPressureF_I(AttachCurrentThread(), event_, - pointer_index); + return JNI_MotionEvent::Java_MotionEvent_getPressureF_I( + AttachCurrentThread(), event_, pointer_index); } float MotionEventAndroid::GetTiltX(size_t pointer_index) const { @@ -406,9 +394,11 @@ return 0.f; float tilt_x, tilt_y; float tilt_rad = ToValidFloat(Java_MotionEvent_getAxisValueF_I_I( - AttachCurrentThread(), event_, AXIS_TILT, pointer_index)); - float orientation_rad = ToValidFloat(Java_MotionEvent_getOrientationF_I( - AttachCurrentThread(), event_, pointer_index)); + AttachCurrentThread(), event_, JNI_MotionEvent::AXIS_TILT, + pointer_index)); + float orientation_rad = + ToValidFloat(JNI_MotionEvent::Java_MotionEvent_getOrientationF_I( + AttachCurrentThread(), event_, pointer_index)); ConvertTiltOrientationToTiltXY(tilt_rad, orientation_rad, &tilt_x, &tilt_y); return tilt_x; } @@ -420,10 +410,13 @@ if (!event_.obj()) return 0.f; float tilt_x, tilt_y; - float tilt_rad = ToValidFloat(Java_MotionEvent_getAxisValueF_I_I( - AttachCurrentThread(), event_, AXIS_TILT, pointer_index)); - float orientation_rad = ToValidFloat(Java_MotionEvent_getOrientationF_I( - AttachCurrentThread(), event_, pointer_index)); + float tilt_rad = + ToValidFloat(JNI_MotionEvent::Java_MotionEvent_getAxisValueF_I_I( + AttachCurrentThread(), event_, JNI_MotionEvent::AXIS_TILT, + pointer_index)); + float orientation_rad = + ToValidFloat(JNI_MotionEvent::Java_MotionEvent_getOrientationF_I( + AttachCurrentThread(), event_, pointer_index)); ConvertTiltOrientationToTiltXY(tilt_rad, orientation_rad, &tilt_x, &tilt_y); return tilt_y; } @@ -438,26 +431,27 @@ base::TimeTicks MotionEventAndroid::GetHistoricalEventTime( size_t historical_index) const { - return FromAndroidTime(Java_MotionEvent_getHistoricalEventTime( - AttachCurrentThread(), event_, historical_index)); + return FromAndroidTime( + JNI_MotionEvent::Java_MotionEvent_getHistoricalEventTime( + AttachCurrentThread(), event_, historical_index)); } float MotionEventAndroid::GetHistoricalTouchMajor( size_t pointer_index, size_t historical_index) const { - return ToDips(Java_MotionEvent_getHistoricalTouchMajorF_I_I( + return ToDips(JNI_MotionEvent::Java_MotionEvent_getHistoricalTouchMajorF_I_I( AttachCurrentThread(), event_, pointer_index, historical_index)); } float MotionEventAndroid::GetHistoricalX(size_t pointer_index, size_t historical_index) const { - return ToDips(Java_MotionEvent_getHistoricalXF_I_I( + return ToDips(JNI_MotionEvent::Java_MotionEvent_getHistoricalXF_I_I( AttachCurrentThread(), event_, pointer_index, historical_index)); } float MotionEventAndroid::GetHistoricalY(size_t pointer_index, size_t historical_index) const { - return ToDips(Java_MotionEvent_getHistoricalYF_I_I( + return ToDips(JNI_MotionEvent::Java_MotionEvent_getHistoricalYF_I_I( AttachCurrentThread(), event_, pointer_index, historical_index)); } @@ -466,7 +460,7 @@ DCHECK_LT(pointer_index, cached_pointer_count_); if (pointer_index < MAX_POINTERS_TO_CACHE) return cached_pointers_[pointer_index].tool_type; - return FromAndroidToolType(Java_MotionEvent_getToolType( + return FromAndroidToolType(JNI_MotionEvent::Java_MotionEvent_getToolType( AttachCurrentThread(), event_, pointer_index)); }