diff --git a/DEPS b/DEPS index 78da55b4..0b1e93a 100644 --- a/DEPS +++ b/DEPS
@@ -45,11 +45,11 @@ # 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': 'dd7ffa5a557bcaa1daebd0f056a8f1bafb992d4d', + 'skia_revision': '63272cfc19c73a19840bad9d66af5dbda737a859', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '11f53821f3d1d81d4ea6e884bbe1eacf0e96e698', + 'v8_revision': 'e6758ab15731c4ae66f00726f79717beea9dc213', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -57,7 +57,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'db3422764a9bdebb924552169b3df8d42c4b463f', + 'angle_revision': 'a60d35672ed9dba63e5141859fcb25d903de65b5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -69,7 +69,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'c2ae41abd16aef062fee878160aa18457d2118a7', + 'pdfium_revision': '97538d86576da009ea3f40546cd5e8a49d6126a3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -101,7 +101,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '117560741b21ecaefedf407c216ea24e65e6bc83', + 'catapult_revision': '6c4c84e978fc0b5fa8176b57baea822f4827c2c3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/ash/new_window_controller.cc b/ash/new_window_controller.cc index b791c82a..2c8f7af 100644 --- a/ash/new_window_controller.cc +++ b/ash/new_window_controller.cc
@@ -17,6 +17,17 @@ bindings_.AddBinding(this, std::move(request)); } +void NewWindowController::SetClient( + mojom::NewWindowClientAssociatedPtrInfo client) { + client_.Bind(std::move(client)); +} + +void NewWindowController::ShowKeyboardOverlay() { + // TODO(estade): implement this here rather than passing off to |client_|. + if (client_) + client_->ShowKeyboardOverlay(); +} + void NewWindowController::NewTab() { if (client_) client_->NewTab(); @@ -47,11 +58,6 @@ client_->RestoreTab(); } -void NewWindowController::ShowKeyboardOverlay() { - if (client_) - client_->ShowKeyboardOverlay(); -} - void NewWindowController::ShowTaskManager() { if (client_) client_->ShowTaskManager(); @@ -62,9 +68,4 @@ client_->OpenFeedbackPage(); } -void NewWindowController::SetClient( - mojom::NewWindowClientAssociatedPtrInfo client) { - client_.Bind(std::move(client)); -} - } // namespace ash
diff --git a/ash/new_window_controller.h b/ash/new_window_controller.h index 80097f32..3efc9e1 100644 --- a/ash/new_window_controller.h +++ b/ash/new_window_controller.h
@@ -5,6 +5,7 @@ #ifndef ASH_NEW_WINDOW_CONTROLLER_H_ #define ASH_NEW_WINDOW_CONTROLLER_H_ +#include "ash/ash_export.h" #include "ash/public/interfaces/new_window.mojom.h" #include "base/macros.h" #include "mojo/public/cpp/bindings/associated_binding.h" @@ -15,29 +16,28 @@ // Provides the NewWindowController interface to the outside world. This lets a // consumer of ash provide a NewWindowClient, which we will dispatch to if one // has been provided to us. -class NewWindowController : public mojom::NewWindowController, - public mojom::NewWindowClient { +class ASH_EXPORT NewWindowController : public mojom::NewWindowController { public: NewWindowController(); ~NewWindowController() override; void BindRequest(mojom::NewWindowControllerRequest request); - // NewWindowClient: - void NewTab() override; - void NewWindow(bool incognito) override; - void OpenFileManager() override; - void OpenCrosh() override; - void OpenGetHelp() override; - void RestoreTab() override; - void ShowKeyboardOverlay() override; - void ShowTaskManager() override; - void OpenFeedbackPage() override; - - private: // NewWindowController: void SetClient(mojom::NewWindowClientAssociatedPtrInfo client) override; + void ShowKeyboardOverlay() override; + // Pass throughs for methods of the same name on |client_|. + void NewTab(); + void NewWindow(bool incognito); + void OpenFileManager(); + void OpenCrosh(); + void OpenGetHelp(); + void RestoreTab(); + void ShowTaskManager(); + void OpenFeedbackPage(); + + private: mojo::BindingSet<mojom::NewWindowController> bindings_; mojom::NewWindowClientAssociatedPtr client_;
diff --git a/ash/public/interfaces/new_window.mojom b/ash/public/interfaces/new_window.mojom index 7009400..8867fa1 100644 --- a/ash/public/interfaces/new_window.mojom +++ b/ash/public/interfaces/new_window.mojom
@@ -7,6 +7,10 @@ // An exported object in ash which lets an ash consumer set a client interface. interface NewWindowController { SetClient(associated NewWindowClient client); + + // Shows the keyboard shortcut overlay. TODO(mash): this calls the client + // function of the same name below, but it should be implemented inside ash. + ShowKeyboardOverlay(); }; // A delegate interface that an ash user sends to ash to handle certain window
diff --git a/ash/shelf/voice_interaction_overlay.cc b/ash/shelf/voice_interaction_overlay.cc index 07d0021..e943723 100644 --- a/ash/shelf/voice_interaction_overlay.cc +++ b/ash/shelf/voice_interaction_overlay.cc
@@ -188,9 +188,9 @@ */ void InitMoleculeShape() { for (int i = 0; i < DOT_COUNT; ++i) { - dot_layer_delegates_[i] = base::MakeUnique<views::CircleLayerDelegate>( + dot_layer_delegates_[i] = std::make_unique<views::CircleLayerDelegate>( kMoleculeColors[i], kMoleculeRadiusDip[i]); - dot_layers_[i] = base::MakeUnique<ui::Layer>(); + dot_layers_[i] = std::make_unique<ui::Layer>(); dot_layers_[i]->SetBounds(gfx::Rect( kIconInitSizeDip / 2 + kMoleculeOffsetXDip[i] - kMoleculeRadiusDip[i], @@ -225,10 +225,10 @@ small_size_(gfx::Size(kBackgroundSizeDip, kBackgroundSizeDip)), center_point_( gfx::PointF(kBackgroundSizeDip / 2, kBackgroundSizeDip / 2)), - circle_layer_delegate_(base::MakeUnique<views::CircleLayerDelegate>( + circle_layer_delegate_(std::make_unique<views::CircleLayerDelegate>( SK_ColorWHITE, kBackgroundSizeDip / 2)), - rect_layer_delegate_(base::MakeUnique<views::RectangleLayerDelegate>( + rect_layer_delegate_(std::make_unique<views::RectangleLayerDelegate>( SK_ColorWHITE, gfx::SizeF(small_size_))) { set_name("VoiceInteractionOverlay:BACKGROUND_LAYER"); @@ -236,15 +236,26 @@ SetFillsBoundsOpaquely(false); SetMasksToBounds(false); - for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i) - AddPaintLayer(static_cast<PaintedShape>(i)); - shadow_values_ = gfx::ShadowValue::MakeMdShadowValues(kBackgroundShadowElevationDip); const gfx::Insets shadow_margin = gfx::ShadowValue::GetMargin(shadow_values_); - shadow_layer_.reset(new ui::Layer()); + border_shadow_delegate_ = + std::make_unique<views::BorderShadowLayerDelegate>( + shadow_values_, gfx::Rect(large_size_), SK_ColorWHITE, + kBackgroundCornerRadiusDip); + + large_shadow_layer_ = std::make_unique<ui::Layer>(); + large_shadow_layer_->set_delegate(border_shadow_delegate_.get()); + large_shadow_layer_->SetFillsBoundsOpaquely(false); + large_shadow_layer_->SetBounds( + gfx::Rect(shadow_margin.left(), shadow_margin.top(), + kBackgroundLargeWidthDip - shadow_margin.width(), + kBackgroundLargeHeightDip - shadow_margin.height())); + Add(large_shadow_layer_.get()); + + shadow_layer_ = std::make_unique<ui::Layer>(); shadow_layer_->set_delegate(this); shadow_layer_->SetFillsBoundsOpaquely(false); shadow_layer_->SetBounds( @@ -252,9 +263,19 @@ kBackgroundInitSizeDip - shadow_margin.width(), kBackgroundInitSizeDip - shadow_margin.height())); Add(shadow_layer_.get()); + + for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i) + AddPaintLayer(static_cast<PaintedShape>(i)); } ~VoiceInteractionIconBackground() override{}; + void MoveLargeShadow(const gfx::PointF& new_center) { + gfx::Transform transform; + transform.Translate(new_center.x() - kBackgroundLargeWidthDip / 2, + new_center.y() - kBackgroundLargeHeightDip / 2); + large_shadow_layer_->SetTransform(transform); + } + void AnimateToLarge(const gfx::PointF& new_center, ui::LayerAnimationObserver* animation_observer) { PaintedShapeTransforms transforms; @@ -265,6 +286,10 @@ // Hide the shadow layer shadow_layer_->SetVisible(false); + // Also hide the large shadow layer, it will be shown when animation ends. + large_shadow_layer_->SetVisible(false); + // Move the shadow to the right place. + MoveLargeShadow(new_center); center_point_ = new_center; // Animate the painted layers to the large rectangle size @@ -283,6 +308,10 @@ SetPaintedLayersVisible(true); // Hide the shadow layer shadow_layer_->SetVisible(false); + // Show the large shadow behind + large_shadow_layer_->SetVisible(true); + // Move the shadow to the right place. + MoveLargeShadow(new_center); center_point_ = new_center; // Set the painted layers to the large rectangle size @@ -294,6 +323,7 @@ void ResetShape() { // This reverts to the original small round shape. shadow_layer_->SetVisible(true); + large_shadow_layer_->SetVisible(false); SetPaintedLayersVisible(false); center_point_.SetPoint(small_size_.width() / 2.f, small_size_.height() / 2.f); @@ -467,6 +497,15 @@ animator->StartAnimation(sequence); } + + { + ui::ScopedLayerAnimationSettings animation( + large_shadow_layer_->GetAnimator()); + animation.SetTweenType(tween); + animation.SetTransitionDuration(duration); + + large_shadow_layer_->SetVisible(true); + } } std::string ToLayerName(PaintedShape painted_shape) { @@ -531,17 +570,24 @@ // ui::LayerDelegate to paint rectangles for all the rectangle layers. std::unique_ptr<views::RectangleLayerDelegate> rect_layer_delegate_; + // ui::LayerDelegate to paint rounded rectangle with shadow. + std::unique_ptr<views::BorderShadowLayerDelegate> border_shadow_delegate_; + gfx::ShadowValues shadow_values_; + // This layer shows the small circle with shadow. std::unique_ptr<ui::Layer> shadow_layer_; + // This layer shows the large rounded rectangle with shadow. + std::unique_ptr<ui::Layer> large_shadow_layer_; + DISALLOW_COPY_AND_ASSIGN(VoiceInteractionIconBackground); }; VoiceInteractionOverlay::VoiceInteractionOverlay(AppListButton* host_view) - : ripple_layer_(base::MakeUnique<ui::Layer>()), - icon_layer_(base::MakeUnique<VoiceInteractionIcon>()), - background_layer_(base::MakeUnique<VoiceInteractionIconBackground>()), + : ripple_layer_(std::make_unique<ui::Layer>()), + icon_layer_(std::make_unique<VoiceInteractionIcon>()), + background_layer_(std::make_unique<VoiceInteractionIconBackground>()), host_view_(host_view), circle_layer_delegate_(kRippleColor, kRippleCircleInitRadiusDip) { SetPaintToLayer(ui::LAYER_NOT_DRAWN);
diff --git a/ash/system/audio/tray_audio.cc b/ash/system/audio/tray_audio.cc index ea3cd95..5d96858 100644 --- a/ash/system/audio/tray_audio.cc +++ b/ash/system/audio/tray_audio.cc
@@ -105,7 +105,7 @@ return; } pop_up_volume_view_ = true; - ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); + ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds); } void TrayAudio::OnOutputMuteChanged(bool /* mute_on */, bool system_adjust) { @@ -117,7 +117,7 @@ SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); } else if (!system_adjust) { pop_up_volume_view_ = true; - ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); + ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds); } }
diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc index aefc3a3..0cb2768 100644 --- a/ash/system/brightness/tray_brightness.cc +++ b/ash/system/brightness/tray_brightness.cc
@@ -265,7 +265,7 @@ if (brightness_view_ && brightness_view_->visible()) SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); else - ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); + ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds); } } // namespace ash
diff --git a/ash/system/keyboard_brightness/tray_keyboard_brightness.cc b/ash/system/keyboard_brightness/tray_keyboard_brightness.cc index b765ad8..c0d5f79 100644 --- a/ash/system/keyboard_brightness/tray_keyboard_brightness.cc +++ b/ash/system/keyboard_brightness/tray_keyboard_brightness.cc
@@ -158,7 +158,7 @@ if (brightness_view_ && brightness_view_->visible()) SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); else - ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); + ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds); } } // namespace ash
diff --git a/ash/system/network/tray_network_unittest.cc b/ash/system/network/tray_network_unittest.cc index 4361eda..60c39bd4 100644 --- a/ash/system/network/tray_network_unittest.cc +++ b/ash/system/network/tray_network_unittest.cc
@@ -70,8 +70,7 @@ // Show network details. TrayNetwork* tray_network = SystemTrayTestApi(system_tray).tray_network(); const int close_delay_in_seconds = 0; - bool activate = true; - system_tray->ShowDetailedView(tray_network, close_delay_in_seconds, activate, + system_tray->ShowDetailedView(tray_network, close_delay_in_seconds, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop();
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index aff23d5..48c4e39 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc
@@ -357,25 +357,23 @@ if (creation_type != BUBBLE_USE_EXISTING) Shell::Get()->metrics()->RecordUserMetricsAction( UMA_STATUS_AREA_MENU_OPENED); - ShowItems(GetTrayItems(), false, true, creation_type, false, show_by_click); + ShowItems(GetTrayItems(), false, creation_type, false, show_by_click); } void SystemTray::ShowPersistentDefaultView() { - ShowItems(GetTrayItems(), false, false, BUBBLE_CREATE_NEW, true, false); + ShowItems(GetTrayItems(), false, BUBBLE_CREATE_NEW, true, false); } void SystemTray::ShowDetailedView(SystemTrayItem* item, int close_delay, - bool activate, BubbleCreationType creation_type) { std::vector<SystemTrayItem*> items; // The detailed view with timeout means a UI to show the current system state, // like the audio level or brightness. Such UI should behave as persistent and // keep its own logic for the appearance. - bool persistent = - (!activate && close_delay > 0 && creation_type == BUBBLE_CREATE_NEW); + bool persistent = (close_delay > 0 && creation_type == BUBBLE_CREATE_NEW); items.push_back(item); - ShowItems(items, true, activate, creation_type, persistent, false); + ShowItems(items, true, creation_type, persistent, false); if (system_bubble_) system_bubble_->bubble()->StartAutoCloseTimer(close_delay); } @@ -481,7 +479,6 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items, bool detailed, - bool can_activate, BubbleCreationType creation_type, bool persistent, bool show_by_click) {
diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h index cf1d0e4b..dbe7092b 100644 --- a/ash/system/tray/system_tray.h +++ b/ash/system/tray/system_tray.h
@@ -78,7 +78,6 @@ // non-zero, then the view is automatically closed after the specified time. void ShowDetailedView(SystemTrayItem* item, int close_delay_in_seconds, - bool activate, BubbleCreationType creation_type); // Continue showing the existing detailed view, if any, for |close_delay| @@ -168,15 +167,12 @@ // Constructs or re-constructs |system_bubble_| and populates it with |items|. // Specify |change_tray_status| to true if want to change the tray background - // status. The bubble will be opened in inactive state. If |can_activate| is - // true, the bubble will be activated by one of following means. Specify + // status. The bubble will be opened in inactive state. Specify // |show_by_click| to true if |items| are shown by mouse or gesture click. - // * When alt/alt-tab acclerator is used to start navigation. // * When the bubble is opened by accelerator. // * When the tray item is set to be focused. void ShowItems(const std::vector<SystemTrayItem*>& items, bool details, - bool can_activate, BubbleCreationType creation_type, bool persistent, bool show_by_click);
diff --git a/ash/system/tray/system_tray_item.cc b/ash/system/tray/system_tray_item.cc index a380e79..e5120dc 100644 --- a/ash/system/tray/system_tray_item.cc +++ b/ash/system/tray/system_tray_item.cc
@@ -39,16 +39,15 @@ FROM_HERE, base::TimeDelta::FromMilliseconds(kTrayDetailedViewTransitionDelayMs), base::Bind(&SystemTray::ShowDetailedView, base::Unretained(system_tray()), - this, 0, true, BUBBLE_USE_EXISTING)); + this, 0, BUBBLE_USE_EXISTING)); } void SystemTrayItem::UpdateAfterLoginStatusChange(LoginStatus status) {} void SystemTrayItem::UpdateAfterShelfAlignmentChange() {} -void SystemTrayItem::ShowDetailedView(int for_seconds, bool activate) { - system_tray()->ShowDetailedView(this, for_seconds, activate, - BUBBLE_CREATE_NEW); +void SystemTrayItem::ShowDetailedView(int for_seconds) { + system_tray()->ShowDetailedView(this, for_seconds, BUBBLE_CREATE_NEW); } void SystemTrayItem::SetDetailedViewCloseDelay(int for_seconds) {
diff --git a/ash/system/tray/system_tray_item.h b/ash/system/tray/system_tray_item.h index fb2ef32f..4ddbc55 100644 --- a/ash/system/tray/system_tray_item.h +++ b/ash/system/tray/system_tray_item.h
@@ -118,7 +118,7 @@ // something, e.g. volume, network availability etc. changes). If // |for_seconds| is non-zero, then the popup is closed after the specified // time. - void ShowDetailedView(int for_seconds, bool activate); + void ShowDetailedView(int for_seconds); // Continue showing the currently-shown detailed view, if any, for // |for_seconds| seconds. The caller is responsible for checking that the
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index b2e511b..0441fec37 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc
@@ -505,7 +505,7 @@ base::HistogramTester histogram_tester; - tray->ShowDetailedView(test_item, 0, false, BUBBLE_CREATE_NEW); + tray->ShowDetailedView(test_item, 0, BUBBLE_CREATE_NEW); RunAllPendingInMessageLoop(); histogram_tester.ExpectTotalCount(kVisibleRowsHistogramName, 0); @@ -531,7 +531,7 @@ histogram_tester.ExpectBucketCount(kVisibleRowsHistogramName, SystemTrayItem::UMA_TEST, 1); - tray->ShowDetailedView(test_item, 0, false, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item, 0, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); histogram_tester.ExpectBucketCount(kVisibleRowsHistogramName, SystemTrayItem::UMA_TEST, 1); @@ -693,7 +693,7 @@ ASSERT_TRUE(detailed_item->default_view() != NULL); // Show the detailed view, ensure it's created and the default view destroyed. - tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW); + tray->ShowDetailedView(detailed_item, 0, BUBBLE_CREATE_NEW); RunAllPendingInMessageLoop(); ASSERT_TRUE(test_item->default_view() == NULL); ASSERT_TRUE(detailed_item->detailed_view() != NULL); @@ -714,7 +714,7 @@ no_view_item->set_has_views(false); tray->AddTrayItem(base::WrapUnique(no_view_item)); tray->ShowDefaultView(BUBBLE_CREATE_NEW, false /* show_by_click */); - tray->ShowDetailedView(no_view_item, 0, false, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(no_view_item, 0, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); } @@ -765,7 +765,7 @@ views::Widget* widget = test_item->default_view()->GetWidget(); gfx::Rect bubble_bounds = widget->GetWindowBoundsInScreen(); - tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item, 0, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); EXPECT_FALSE(test_item->default_view());
diff --git a/ash/system/tray/tray_details_view_unittest.cc b/ash/system/tray/tray_details_view_unittest.cc index 38fabba..092e234 100644 --- a/ash/system/tray/tray_details_view_unittest.cc +++ b/ash/system/tray/tray_details_view_unittest.cc
@@ -103,7 +103,7 @@ tray->AddTrayItem(base::WrapUnique(test_item)); tray->ShowDefaultView(BUBBLE_CREATE_NEW, false /* show_by_click */); RunAllPendingInMessageLoop(); - tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item, 0, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); return test_item->detailed_view()->tray_popup_header_button(); @@ -157,7 +157,7 @@ RunAllPendingInMessageLoop(); // Show the detailed view of item 2. - tray->ShowDetailedView(test_item_2, 0, true, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item_2, 0, BUBBLE_USE_EXISTING); EXPECT_TRUE(test_item_2->detailed_view()); RunAllPendingInMessageLoop(); EXPECT_FALSE(test_item_2->default_view()); @@ -174,7 +174,7 @@ EXPECT_TRUE(test_item_2->default_view()->HasFocus()); // Show the detailed view of item 2 again. - tray->ShowDetailedView(test_item_2, 0, true, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item_2, 0, BUBBLE_USE_EXISTING); EXPECT_TRUE(test_item_2->detailed_view()); RunAllPendingInMessageLoop(); EXPECT_FALSE(test_item_2->default_view()); @@ -195,7 +195,7 @@ tray->AddTrayItem(base::WrapUnique(test_item)); tray->ShowDefaultView(BUBBLE_CREATE_NEW, false /* show_by_click */); RunAllPendingInMessageLoop(); - tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); + tray->ShowDetailedView(test_item, 0, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); test_item->detailed_view()->CreateScrollerViews();
diff --git a/base/numerics/clamped_math_impl.h b/base/numerics/clamped_math_impl.h index e18f9390..3c5a6be3 100644 --- a/base/numerics/clamped_math_impl.h +++ b/base/numerics/clamped_math_impl.h
@@ -82,31 +82,30 @@ if (ClampedAddFastOp<T, U>::is_supported) return ClampedAddFastOp<T, U>::template Do<V>(x, y); + // This is structured as a nested ternary to trigger the necessary + // optimization heuristics in MSVC and Clang. + const V saturated = + IsTypeInRangeForNumericType<V, T>::value + ? (IsTypeInRangeForNumericType<V, U>::value + // Optimize for a compile-time constant in the common case. + ? CommonMaxOrMin<V>( + (IsCompileTimeConstant(x) && IsValueNegative(x)) || + IsValueNegative(y)) + // Otherwise the out-of-range-type determines the saturation. + : CommonMaxOrMin<V>(IsValueNegative(y))) + : CommonMaxOrMin<V>(IsValueNegative(x)); + // Pick a destination type wide enough to compute the saturation direction. - // The saturation check in the final return statement covers the case where - // one type is out-of-bounds. It's structured this way to avoid unnecessary - // run-time conversions when we have a compile-time-constant. + // We already computed the saturation value, so it's structured this way to + // avoid run-time conversions when we have a compile-time-constant. using Promotion = typename std::conditional_t< IsTypeInRangeForNumericType<V, T>::value || IsTypeInRangeForNumericType<V, U>::value, V, typename BigEnoughPromotion<T, U>::type>; Promotion result; - if (BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result)))) - return saturated_cast<V>(result); - - // This is the normal saturation case, which includes a compile-time - // constant optimization. - if (IsTypeInRangeForNumericType<V, T>::value && - IsTypeInRangeForNumericType<V, U>::value) { - return CommonMaxOrMin<V>( - (IsCompileTimeConstant(x) && IsValueNegative(x)) || - IsValueNegative(y)); - } - - // Otherwise the out-of-range-type determines the saturation direction. - return IsTypeInRangeForNumericType<V, T>::value - ? CommonMaxOrMin<V>(IsValueNegative(y)) - : CommonMaxOrMin<V>(IsValueNegative(x)); + return BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result))) + ? saturated_cast<V>(result) + : saturated; } }; @@ -125,31 +124,30 @@ if (ClampedSubFastOp<T, U>::is_supported) return ClampedSubFastOp<T, U>::template Do<V>(x, y); + // This is structured as a nested ternary to trigger the necessary + // optimization heuristics in MSVC and Clang. + const V saturated = + IsTypeInRangeForNumericType<V, T>::value + ? (IsTypeInRangeForNumericType<V, U>::value + // Optimize for a compile-time constant in the common case. + ? CommonMaxOrMin<V>( + (IsCompileTimeConstant(x) && IsValueNegative(x)) || + !IsValueNegative(y)) + // Otherwise the out-of-range-type determines the saturation. + : CommonMaxOrMin<V>(!IsValueNegative(y))) + : CommonMaxOrMin<V>(IsValueNegative(x)); + // Pick a destination type wide enough to compute the saturation direction. - // The saturation check in the final return statement covers the case where - // one type is out-of-bounds. It's structured this way to avoid unnecessary - // run-time conversions when we have a compile-time-constant. + // We already computed the saturation value, so it's structured this way to + // avoid run-time conversions when we have a compile-time-constant. using Promotion = typename std::conditional_t< IsTypeInRangeForNumericType<V, T>::value || IsTypeInRangeForNumericType<V, U>::value, V, typename BigEnoughPromotion<T, U>::type>; Promotion result; - if (BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result)))) - return saturated_cast<V>(result); - - // This is the normal saturation case, which includes a compile-time - // constant optimization. - if (IsTypeInRangeForNumericType<V, T>::value && - IsTypeInRangeForNumericType<V, U>::value) { - return CommonMaxOrMin<V>( - (IsCompileTimeConstant(x) && IsValueNegative(x)) || - !IsValueNegative(y)); - } - - // Otherwise the out-of-range-type determines the saturation direction. - return IsTypeInRangeForNumericType<V, T>::value - ? CommonMaxOrMin<V>(!IsValueNegative(y)) - : CommonMaxOrMin<V>(IsValueNegative(x)); + return BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result))) + ? saturated_cast<V>(result) + : saturated; } };
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index 1c9d3e6..81dc4b7 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc
@@ -1649,6 +1649,12 @@ } #endif // defined(OS_WIN) +void TraceLog::SetTraceBufferForTesting( + std::unique_ptr<TraceBuffer> trace_buffer) { + AutoLock lock(lock_); + logged_events_ = std::move(trace_buffer); +} + void ConvertableToTraceFormat::EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) { overhead->Add(TraceEventMemoryOverhead::kConvertableToTraceFormat,
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h index 10fbcf42..abb4721 100644 --- a/base/trace_event/trace_log.h +++ b/base/trace_event/trace_log.h
@@ -338,6 +338,9 @@ void UpdateETWCategoryGroupEnabledFlags(); #endif + // Replaces |logged_events_| with a new TraceBuffer for testing. + void SetTraceBufferForTesting(std::unique_ptr<TraceBuffer> trace_buffer); + private: typedef unsigned int InternalTraceOptions;
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index 1343924..c7fef4a2 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py
@@ -81,7 +81,7 @@ def _LaunchUrl(devices, input_args, device_args_file, url, apk, - wait_for_java_debugger): + wait_for_debugger): if input_args and device_args_file is None: raise Exception('This apk does not support any flags.') if url: @@ -92,10 +92,8 @@ def launch(device): # Set debug app in order to enable reading command line flags on user # builds. - cmd = ['am', 'set-debug-app', apk.GetPackageName()] - if wait_for_java_debugger: - # To wait for debugging on a non-primary process: - # am set-debug-app org.chromium.chrome:privileged_process0 + cmd = ['am', 'set-debug-app', '--persistent', apk.GetPackageName()] + if wait_for_debugger: cmd[-1:-1] = ['-w'] # Ignore error since it will fail if apk is not debuggable. device.RunShellCommand(cmd, check_return=False) @@ -846,15 +844,13 @@ all_devices_by_default = True def _RegisterExtraArgs(self, group): - group.add_argument('-w', '--wait-for-java-debugger', action='store_true', - help='Pause execution until debugger attaches. Applies ' - 'only to the main process. To have renderers wait, ' - 'use --args="--renderer-wait-for-java-debugger"') + group.add_argument('-w', '--wait-for-debugger', action='store_true', + help='Pause execution until debugger attaches.') group.add_argument('url', nargs='?', help='A URL to launch with.') def Run(self): _LaunchUrl(self.devices, self.args.args, self.args.command_line_flags_file, - self.args.url, self.apk_helper, self.args.wait_for_java_debugger) + self.args.url, self.apk_helper, self.args.wait_for_debugger) class _StopCommand(_Command):
diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py index 4de7c81..26fedbf 100644 --- a/build/android/pylib/gtest/gtest_test_instance.py +++ b/build/android/pylib/gtest/gtest_test_instance.py
@@ -293,7 +293,6 @@ self._suite = args.suite_name[0] self._symbolizer = stack_symbolizer.Symbolizer(None, False) self._gs_test_artifacts_bucket = args.gs_test_artifacts_bucket - self._wait_for_java_debugger = args.wait_for_java_debugger # GYP: if args.executable_dist_dir: @@ -328,8 +327,6 @@ self._extras[_EXTRA_SHARD_SIZE_LIMIT] = 1 self._extras[EXTRA_SHARD_NANO_TIMEOUT] = int(1e9 * self._shard_timeout) self._shard_timeout = 10 * self._shard_timeout - if args.wait_for_java_debugger: - self._extras[EXTRA_SHARD_NANO_TIMEOUT] = int(1e15) # Forever if not self._apk_helper and not self._exe_dist_dir: error_func('Could not find apk or executable for %s' % self._suite) @@ -472,10 +469,6 @@ def total_external_shards(self): return self._total_external_shards - @property - def wait_for_java_debugger(self): - return self._wait_for_java_debugger - #override def TestType(self): return 'gtest'
diff --git a/build/android/pylib/local/device/local_device_environment.py b/build/android/pylib/local/device/local_device_environment.py index 6f1d0389..1bae4a0 100644 --- a/build/android/pylib/local/device/local_device_environment.py +++ b/build/android/pylib/local/device/local_device_environment.py
@@ -145,10 +145,6 @@ self._trace_all = None if hasattr(args, 'trace_all'): self._trace_all = args.trace_all - self._wait_for_java_debugger = args.wait_for_java_debugger - - if self._wait_for_java_debugger: - self._max_tries = 1 devil_chromium.Initialize( output_directory=constants.GetOutDirectory(), @@ -254,10 +250,6 @@ def trace_output(self): return self._trace_output - @property - def wait_for_java_debugger(self): - return self._wait_for_java_debugger - #override def TearDown(self): if self.trace_output:
diff --git a/build/android/pylib/local/device/local_device_gtest_run.py b/build/android/pylib/local/device/local_device_gtest_run.py index 6d9ae3a..22794a43 100644 --- a/build/android/pylib/local/device/local_device_gtest_run.py +++ b/build/android/pylib/local/device/local_device_gtest_run.py
@@ -118,7 +118,6 @@ self._suite = test_instance.suite self._component = '%s/%s' % (self._package, self._runner) self._extras = test_instance.extras - self._wait_for_java_debugger = test_instance.wait_for_java_debugger def GetTestDataRoot(self, device): # pylint: disable=no-self-use @@ -170,10 +169,6 @@ device.adb, dir=device.GetExternalStoragePath(), suffix='.gtest_out') extras[_EXTRA_STDOUT_FILE] = stdout_file.name - if self._wait_for_java_debugger: - cmd = ['am', 'set-debug-app', '-w', self._package] - device.RunShellCommand(cmd, check_return=True) - with command_line_file, test_list_file, stdout_file: try: device.StartInstrumentation( @@ -375,12 +370,9 @@ @local_device_environment.handle_shard_failures_with( on_failure=self._env.BlacklistDevice) def list_tests(dev): - timeout = 30 - if self._test_instance.wait_for_java_debugger: - timeout = None raw_test_list = crash_handler.RetryOnSystemCrash( lambda d: self._delegate.Run( - None, d, flags='--gtest_list_tests', timeout=timeout), + None, d, flags='--gtest_list_tests', timeout=30), device=dev) tests = gtest_test_instance.ParseGTestListTests(raw_test_list) if not tests: @@ -428,8 +420,6 @@ # Run the test. timeout = (self._test_instance.shard_timeout * self.GetTool(device).GetTimeoutScale()) - if self._test_instance.wait_for_java_debugger: - timeout = None if self._test_instance.store_tombstones: tombstones.ClearAllTombstones(device) with device_temp_file.DeviceTempFile(
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py index 94ff92b..2c781791f 100644 --- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py +++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -202,16 +202,15 @@ def set_debug_app(dev): # Set debug app in order to enable reading command line flags on user # builds - if not self._test_instance.package_info: - logging.error("Couldn't set debug app: no package info") - elif not self._test_instance.package_info.package: - logging.error("Couldn't set debug app: no package defined") - else: - cmd = ['am', 'set-debug-app', '--persistent'] - if self._env.wait_for_java_debugger: - cmd.append('-w') - cmd.append(self._test_instance.package_info.package) - dev.RunShellCommand(cmd, check_return=True) + if self._test_instance.flags: + if not self._test_instance.package_info: + logging.error("Couldn't set debug app: no package info") + elif not self._test_instance.package_info.package: + logging.error("Couldn't set debug app: no package defined") + else: + dev.RunShellCommand(['am', 'set-debug-app', '--persistent', + self._test_instance.package_info.package], + check_return=True) @trace_event.traced def edit_shared_prefs(dev): @@ -422,8 +421,6 @@ valgrind_tools.SetChromeTimeoutScale( device, test_timeout_scale * self._test_instance.timeout_scale) - if self._env.wait_for_java_debugger: - timeout = None logging.info('preparing to run %s: %s', test_display_name, test) render_tests_device_output_dir = None @@ -614,11 +611,8 @@ extras['log'] = 'true' extras[_EXTRA_TEST_LIST] = dev_test_list_json.name target = '%s/%s' % (test_package, junit4_runner_class) - kwargs = {} - if self._env.wait_for_java_debugger: - kwargs['timeout'] = None test_list_run_output = dev.StartInstrumentation( - target, extras=extras, retries=0, **kwargs) + target, extras=extras) if any(test_list_run_output): logging.error('Unexpected output while listing tests:') for line in test_list_run_output:
diff --git a/build/android/pylib/local/device/local_device_perf_test_run.py b/build/android/pylib/local/device/local_device_perf_test_run.py index 2ac8b0f..ba9e2b6a 100644 --- a/build/android/pylib/local/device/local_device_perf_test_run.py +++ b/build/android/pylib/local/device/local_device_perf_test_run.py
@@ -81,7 +81,6 @@ def _TestSetUp(self, test): if (self._test_instance.collect_chartjson_data - or self._test_instance.collect_json_data or self._tests[test].get('archive_output_dir')): self._output_dir = tempfile.mkdtemp() @@ -108,9 +107,6 @@ end_time = time.time() chart_json_output = self._test_instance.ReadChartjsonOutput( self._output_dir) - json_output = '' - if self._test_instance.collect_json_data: - json_output = self._test_instance.ReadJsonOutput(self._output_dir) if exit_code == 0: result_type = base_test_result.ResultType.PASS else: @@ -120,11 +116,9 @@ exit_code = -1 output = e.output chart_json_output = '' - json_output = '' result_type = base_test_result.ResultType.TIMEOUT return self._ProcessTestResult(test, cmd, start_time, end_time, exit_code, - output, chart_json_output, json_output, - result_type) + output, chart_json_output, result_type) def _CreateCmd(self, test): cmd = [] @@ -133,8 +127,6 @@ cmd.append(self._tests[test]['cmd']) if self._output_dir: cmd.append('--output-dir=%s' % self._output_dir) - if self._test_instance.collect_json_data: - cmd.append('--output-format=json') return ' '.join(self._ExtendCmd(cmd)) def _ExtendCmd(self, cmd): # pylint: disable=no-self-use @@ -151,7 +143,7 @@ raise NotImplementedError def _ProcessTestResult(self, test, cmd, start_time, end_time, exit_code, - output, chart_json_output, json_output, result_type): + output, chart_json_output, result_type): if exit_code is None: exit_code = -1 @@ -168,7 +160,6 @@ 'name': test, 'output': [output], 'chartjson': chart_json_output, - 'json': json_output, 'archive_bytes': archive_bytes, 'exit_code': exit_code, 'actual_exit_code': actual_exit_code,
diff --git a/build/android/pylib/perf/perf_test_instance.py b/build/android/pylib/perf/perf_test_instance.py index 69ecf4c..e7141088 100644 --- a/build/android/pylib/perf/perf_test_instance.py +++ b/build/android/pylib/perf/perf_test_instance.py
@@ -61,7 +61,6 @@ super(PerfTestInstance, self).__init__() self._collect_chartjson_data = args.collect_chartjson_data - self._collect_json_data = args.collect_json_data self._dry_run = args.dry_run self._flaky_steps = args.flaky_steps self._output_dir_archive_path = args.output_dir_archive_path @@ -74,7 +73,6 @@ self._min_battery_level = args.min_battery_level self._no_timeout = args.no_timeout self._output_chartjson_data = args.output_chartjson_data - self._output_json_data = args.output_json_data self._output_json_list = args.output_json_list self._print_step = args.print_step self._single_step = ( @@ -138,10 +136,6 @@ i, persisted_outputs[i]) print output_formatted - if self.output_json_data: - with file(self.output_json_data, 'w') as f: - f.write(persisted_result['json']) - if self.output_chartjson_data: with file(self.output_chartjson_data, 'w') as f: f.write(persisted_result['chartjson']) @@ -175,21 +169,6 @@ ' the test.') return '' - @staticmethod - def ReadJsonOutput(output_dir): - if not output_dir: - return '' - json_output_path = os.path.join(output_dir, 'results.json') - try: - with open(json_output_path) as f: - return f.read() - except IOError: - logging.exception('Exception when reading results.json.') - logging.error('This usually means that telemetry did not run, so it could' - ' not generate the file. Please check the device running' - ' the test.') - return '' - def WriteBuildBotJson(self, output_dir): """Write metadata about the buildbot environment to the output dir.""" if not output_dir or not self._write_buildbot_json: @@ -206,10 +185,6 @@ return self._collect_chartjson_data @property - def collect_json_data(self): - return self._collect_json_data - - @property def dry_run(self): return self._dry_run @@ -242,10 +217,6 @@ return self._output_dir_archive_path @property - def output_json_data(self): - return self._output_json_data - - @property def output_json_list(self): return self._output_json_list
diff --git a/build/android/test_runner.py b/build/android/test_runner.py index edfa8c5c..ecb088f 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py
@@ -334,10 +334,6 @@ '--test-apk-incremental-install-json', type=os.path.realpath, help='Path to install json for the test apk.') - parser.add_argument( - '-w', '--wait-for-java-debugger', action='store_true', - help='Wait for java debugger to attach before running any application ' - 'code. Also disables test timeouts and sets retries=0.') filter_group = parser.add_mutually_exclusive_group() filter_group.add_argument( @@ -485,10 +481,6 @@ '--ui-screenshot-directory', dest='ui_screenshot_dir', type=os.path.realpath, help='Destination for screenshots captured by the tests') - parser.add_argument( - '-w', '--wait-for-java-debugger', action='store_true', - help='Wait for java debugger to attach before running any application ' - 'code. Also disables test timeouts and sets retries=0.') # These arguments are suppressed from the help text because they should # only ever be specified by an intermediate script. @@ -621,10 +613,6 @@ action='store_true', help='Cache the telemetry chartjson output from each step for later use.') parser.add_argument( - '--collect-json-data', - action='store_true', - help='Cache the telemetry JSON output from each step for later use.') - parser.add_argument( '--dry-run', action='store_true', help='Just print the steps without executing.') @@ -669,10 +657,6 @@ help='Write the cached output directory archived by a step into the' ' given ZIP file.') parser.add_argument( - '--output-json-data', - type=os.path.realpath, - help='Writes telemetry JSON formatted output into the given file.') - parser.add_argument( '--output-json-list', type=os.path.realpath, help='Writes a JSON list of information for each --steps into the given '
diff --git a/build/toolchain/concurrent_links.gni b/build/toolchain/concurrent_links.gni index 32b78e0f..c6badbf68 100644 --- a/build/toolchain/concurrent_links.gni +++ b/build/toolchain/concurrent_links.gni
@@ -28,7 +28,7 @@ } else if (use_sanitizer_coverage) { # Sanitizer coverage instrumentation increases linker memory consumption # significantly. - _args = [ "--mem_per_link_gb=12" ] + _args = [ "--mem_per_link_gb=16" ] } else if (is_win) { _args = [ "--mem_per_link_gb=5" ] } else if (is_mac) {
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc index 3360f65..3d5f5dd 100644 --- a/cc/layers/heads_up_display_layer_impl.cc +++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -110,8 +110,9 @@ }); } -bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { +bool HeadsUpDisplayLayerImpl::WillDraw( + DrawMode draw_mode, + LayerTreeResourceProvider* resource_provider) { if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) return false;
diff --git a/cc/layers/heads_up_display_layer_impl.h b/cc/layers/heads_up_display_layer_impl.h index 4cfeded..f32753c 100644 --- a/cc/layers/heads_up_display_layer_impl.h +++ b/cc/layers/heads_up_display_layer_impl.h
@@ -40,7 +40,7 @@ std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override; void UpdateHudTexture(DrawMode draw_mode,
diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc index 310aee5b..85aa4b6 100644 --- a/cc/layers/heads_up_display_layer_impl_unittest.cc +++ b/cc/layers/heads_up_display_layer_impl_unittest.cc
@@ -17,7 +17,7 @@ namespace { void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer, - ResourceProvider* resource_provider, + LayerTreeResourceProvider* resource_provider, viz::ContextProvider* context_provider, DrawMode draw_mode) { std::unique_ptr<viz::RenderPass> render_pass = viz::RenderPass::Create();
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 8b95e3d..46aec42 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -24,6 +24,7 @@ #include "cc/input/main_thread_scrolling_reason.h" #include "cc/input/scroll_state.h" #include "cc/layers/layer.h" +#include "cc/resources/layer_tree_resource_provider.h" #include "cc/trees/clip_node.h" #include "cc/trees/draw_property_utils.h" #include "cc/trees/effect_node.h" @@ -175,7 +176,7 @@ } bool LayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { + LayerTreeResourceProvider* resource_provider) { // WillDraw/DidDraw must be matched. DCHECK_NE(DRAW_MODE_NONE, draw_mode); DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); @@ -183,7 +184,7 @@ return true; } -void LayerImpl::DidDraw(ResourceProvider* resource_provider) { +void LayerImpl::DidDraw(LayerTreeResourceProvider* resource_provider) { DCHECK_NE(DRAW_MODE_NONE, current_draw_mode_); current_draw_mode_ = DRAW_MODE_NONE; }
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 9c90521..62f3ae33 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h
@@ -31,7 +31,6 @@ #include "cc/layers/performance_properties.h" #include "cc/layers/render_surface_impl.h" #include "cc/layers/touch_action_region.h" -#include "cc/resources/resource_provider.h" #include "cc/tiles/tile_priority.h" #include "cc/trees/element_id.h" #include "cc/trees/mutator_host_client.h" @@ -60,6 +59,7 @@ class AppendQuadsData; class LayerTreeImpl; +class LayerTreeResourceProvider; class MicroBenchmarkImpl; class MutatorHost; class PrioritizedTile; @@ -140,10 +140,10 @@ // WillDraw/DidDraw must call the base class version only if WillDraw // returns true. virtual bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider); + LayerTreeResourceProvider* resource_provider); virtual void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) {} - virtual void DidDraw(ResourceProvider* resource_provider); + virtual void DidDraw(LayerTreeResourceProvider* resource_provider); // Verify that the resource ids in the quad are valid. void ValidateQuadResources(viz::DrawQuad* quad) const {
diff --git a/cc/layers/painted_overlay_scrollbar_layer_impl.cc b/cc/layers/painted_overlay_scrollbar_layer_impl.cc index f445def..fbbd8fa 100644 --- a/cc/layers/painted_overlay_scrollbar_layer_impl.cc +++ b/cc/layers/painted_overlay_scrollbar_layer_impl.cc
@@ -59,7 +59,7 @@ bool PaintedOverlayScrollbarLayerImpl::WillDraw( DrawMode draw_mode, - ResourceProvider* resource_provider) { + LayerTreeResourceProvider* resource_provider) { DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE); return LayerImpl::WillDraw(draw_mode, resource_provider); }
diff --git a/cc/layers/painted_overlay_scrollbar_layer_impl.h b/cc/layers/painted_overlay_scrollbar_layer_impl.h index b890e49..104287b 100644 --- a/cc/layers/painted_overlay_scrollbar_layer_impl.h +++ b/cc/layers/painted_overlay_scrollbar_layer_impl.h
@@ -31,7 +31,7 @@ void PushPropertiesTo(LayerImpl* layer) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override;
diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index edcd3332..dc29d3c 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc
@@ -77,8 +77,9 @@ scrollbar_layer->set_thumb_opacity(thumb_opacity_); } -bool PaintedScrollbarLayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { +bool PaintedScrollbarLayerImpl::WillDraw( + DrawMode draw_mode, + LayerTreeResourceProvider* resource_provider) { DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE); return LayerImpl::WillDraw(draw_mode, resource_provider); }
diff --git a/cc/layers/painted_scrollbar_layer_impl.h b/cc/layers/painted_scrollbar_layer_impl.h index 8511ab7..a08bfb3 100644 --- a/cc/layers/painted_scrollbar_layer_impl.h +++ b/cc/layers/painted_scrollbar_layer_impl.h
@@ -30,7 +30,7 @@ void PushPropertiesTo(LayerImpl* layer) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override; gfx::Rect GetEnclosingRectInTargetSpace() const override;
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index c5aa818..1ddbf9f 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc
@@ -78,7 +78,7 @@ } bool TextureLayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { + LayerTreeResourceProvider* resource_provider) { if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) return false;
diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h index 0f942c5..f7ae1fc 100644 --- a/cc/layers/texture_layer_impl.h +++ b/cc/layers/texture_layer_impl.h
@@ -12,6 +12,7 @@ #include "base/memory/ptr_util.h" #include "cc/cc_export.h" #include "cc/layers/layer_impl.h" +#include "components/viz/common/quads/texture_mailbox.h" namespace viz { class SingleReleaseCallback; @@ -34,7 +35,7 @@ void PushPropertiesTo(LayerImpl* layer) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override; SimpleEnclosedRegion VisibleOpaqueRegion() const override;
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc index 79d5556..16bee3da 100644 --- a/cc/layers/ui_resource_layer_impl.cc +++ b/cc/layers/ui_resource_layer_impl.cc
@@ -84,8 +84,9 @@ NoteLayerPropertyChanged(); } -bool UIResourceLayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { +bool UIResourceLayerImpl::WillDraw( + DrawMode draw_mode, + LayerTreeResourceProvider* resource_provider) { if (!ui_resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) return false; return LayerImpl::WillDraw(draw_mode, resource_provider);
diff --git a/cc/layers/ui_resource_layer_impl.h b/cc/layers/ui_resource_layer_impl.h index 4e23517a..0c756184 100644 --- a/cc/layers/ui_resource_layer_impl.h +++ b/cc/layers/ui_resource_layer_impl.h
@@ -45,7 +45,7 @@ void PushPropertiesTo(LayerImpl* layer) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override;
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 09c2d861..d1ee805 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc
@@ -76,7 +76,7 @@ } bool VideoLayerImpl::WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) { + LayerTreeResourceProvider* resource_provider) { if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) return false; @@ -330,7 +330,7 @@ } } -void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) { +void VideoLayerImpl::DidDraw(LayerTreeResourceProvider* resource_provider) { LayerImpl::DidDraw(resource_provider); DCHECK(frame_.get());
diff --git a/cc/layers/video_layer_impl.h b/cc/layers/video_layer_impl.h index 7e93cce..5510189 100644 --- a/cc/layers/video_layer_impl.h +++ b/cc/layers/video_layer_impl.h
@@ -36,10 +36,10 @@ // LayerImpl implementation. std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; bool WillDraw(DrawMode draw_mode, - ResourceProvider* resource_provider) override; + LayerTreeResourceProvider* resource_provider) override; void AppendQuads(viz::RenderPass* render_pass, AppendQuadsData* append_quads_data) override; - void DidDraw(ResourceProvider* resource_provider) override; + void DidDraw(LayerTreeResourceProvider* resource_provider) override; SimpleEnclosedRegion VisibleOpaqueRegion() const override; void DidBecomeActive() override; void ReleaseResources() override;
diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 0613d65..daa44207 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h
@@ -42,7 +42,6 @@ class LayerImpl; class LayerTreeFrameSink; class RenderSurfaceImpl; -class ResourceProvider; // Returns the RenderSurfaceImpl into which the given layer draws. RenderSurfaceImpl* GetRenderSurface(LayerImpl* layer_impl); @@ -182,7 +181,7 @@ LayerTreeFrameSink* layer_tree_frame_sink() const { return host_->host_impl()->layer_tree_frame_sink(); } - ResourceProvider* resource_provider() const { + LayerTreeResourceProvider* resource_provider() const { return host_->host_impl()->resource_provider(); } LayerImpl* root_layer_for_testing() const {
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc index 80762ad..14b674b 100644 --- a/cc/tiles/gpu_image_decode_cache.cc +++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -1301,8 +1301,8 @@ mode = DecodedDataMode::GPU; } - return base::WrapRefCounted( - new ImageData(mode, data_size, draw_image.target_color_space(), params)); + return base::MakeRefCounted<ImageData>( + mode, data_size, draw_image.target_color_space(), params); } void GpuImageDecodeCache::DeletePendingImages() {
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index b54c3949..d16e31f 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -4098,7 +4098,8 @@ return base::WrapUnique(new DidDrawCheckLayer(tree_impl, id)); } - bool WillDraw(DrawMode draw_mode, ResourceProvider* provider) override { + bool WillDraw(DrawMode draw_mode, + LayerTreeResourceProvider* provider) override { will_draw_called_ = true; if (will_draw_returns_false_) return false; @@ -4111,7 +4112,7 @@ LayerImpl::AppendQuads(render_pass, append_quads_data); } - void DidDraw(ResourceProvider* provider) override { + void DidDraw(LayerTreeResourceProvider* provider) override { did_draw_called_ = true; LayerImpl::DidDraw(provider); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimationHandler.java index b328318..379317f4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimationHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimationHandler.java
@@ -36,6 +36,9 @@ */ private boolean mWasUpdateRequestedForAnimationStart; + /** Whether or not testing mode is enabled. In this mode, animations end immediately. */ + private boolean mIsInTestingMode; + /** * Default constructor. * @param host A {@link LayoutUpdateHost} responsible for requesting frames when an animation @@ -64,6 +67,9 @@ mUpdateHost.requestUpdate(); mWasUpdateRequestedForAnimationStart = true; } + + // If in testing mode, immediately push an update and end the animation. + if (mIsInTestingMode) pushUpdate(animator.getDuration()); } /** @@ -107,4 +113,12 @@ public int getActiveAnimationCount() { return mAnimators.size(); } + + /** + * Enable testing mode. This causes any animations to end immediately. + */ + @VisibleForTesting + public void enableTestingMode() { + mIsInTestingMode = true; + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchBarControl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchBarControl.java index 2cebd43..f731f3dc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchBarControl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchBarControl.java
@@ -4,33 +4,25 @@ package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.view.ViewGroup; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; +import org.chromium.chrome.browser.compositor.animation.CompositorAnimator; +import org.chromium.chrome.browser.compositor.animation.CompositorAnimator.AnimatorUpdateListener; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation; -import org.chromium.chrome.browser.compositor.layouts.ChromeAnimation; import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; /** * Controls the Search Bar in the Contextual Search Panel. */ -public class ContextualSearchBarControl - implements ChromeAnimation.Animatable<ContextualSearchBarControl.AnimationType> { - - /** - * Animation properties. - */ - protected enum AnimationType { - TEXT_OPACITY, - DIVIDER_LINE_VISIBILITY, - TOUCH_HIGHLIGHT_VISIBILITY - } - +public class ContextualSearchBarControl { /** * The panel used to get information about the panel layout. */ @@ -117,11 +109,19 @@ */ private final boolean mCanPromoteToNewTab; + /** The animator that controls the text opacity. */ + private CompositorAnimator mTextOpacityAnimation; + + /** The animator that controls the divider line visibility. */ + private CompositorAnimator mDividerLineVisibilityAnimation; + + /** The animator that controls touch highlighting. */ + private CompositorAnimator mTouchHighlightAnimation; + /** * Constructs a new bottom bar control container by inflating views from XML. * * @param panel The panel. - * @param context The context used to build this view. * @param container The parent view for the bottom bar views. * @param loader The resource loader that will handle the snapshot capturing. */ @@ -131,7 +131,7 @@ DynamicResourceLoader loader) { mOverlayPanel = panel; mCanPromoteToNewTab = panel.canPromoteToNewTab(); - mImageControl = new ContextualSearchImageControl(panel, context); + mImageControl = new ContextualSearchImageControl(panel); mContextControl = new ContextualSearchContextControl(panel, context, container, loader); mSearchTermControl = new ContextualSearchTermControl(panel, context, container, loader); mCaptionControl = new ContextualSearchCaptionControl(panel, context, container, loader, @@ -419,9 +419,17 @@ private void animateDividerLine(boolean visible) { float endValue = visible ? 1.f : 0.f; if (mDividerLineVisibilityPercentage == endValue) return; - mOverlayPanel.addToAnimation(this, AnimationType.DIVIDER_LINE_VISIBILITY, - mDividerLineVisibilityPercentage, endValue, - OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0); + if (mDividerLineVisibilityAnimation != null) mDividerLineVisibilityAnimation.cancel(); + AnimatorUpdateListener listener = new AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(CompositorAnimator animator) { + mDividerLineVisibilityPercentage = animator.getAnimatedValue(); + } + }; + mDividerLineVisibilityAnimation = CompositorAnimator.ofFloat( + mOverlayPanel.getAnimationHandler(), mDividerLineVisibilityPercentage, endValue, + OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, listener); + mDividerLineVisibilityAnimation.start(); } // ============================================================================================ @@ -522,8 +530,18 @@ // The touch highlight animation is used to ensure the touch highlight is visible for at // least OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS. // TODO(twellington): Add a material ripple to this animation. - mOverlayPanel.addToAnimation(this, AnimationType.TOUCH_HIGHLIGHT_VISIBILITY, 0.f, 1.f, - OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0); + if (mTouchHighlightAnimation == null) { + mTouchHighlightAnimation = new CompositorAnimator(mOverlayPanel.getAnimationHandler()); + mTouchHighlightAnimation.setDuration(OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS); + mTouchHighlightAnimation.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mTouchHighlightVisible = false; + } + }); + } + mTouchHighlightAnimation.cancel(); + mTouchHighlightAnimation.start(); } /** @@ -546,17 +564,25 @@ * Animates the search term resolution. */ public void animateSearchTermResolution() { - mOverlayPanel.addToAnimation(this, AnimationType.TEXT_OPACITY, 0.f, 1.f, - OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0); + if (mTextOpacityAnimation == null) { + mTextOpacityAnimation = CompositorAnimator.ofFloat(mOverlayPanel.getAnimationHandler(), + 0.f, 1.f, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, null); + mTextOpacityAnimation.addUpdateListener(new AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(CompositorAnimator animator) { + updateSearchBarTextOpacity(animator.getAnimatedValue()); + } + }); + } + mTextOpacityAnimation.cancel(); + mTextOpacityAnimation.start(); } /** * Cancels the search term resolution animation if it is in progress. */ public void cancelSearchTermResolutionAnimation() { - if (mOverlayPanel.animationIsRunning()) { - mOverlayPanel.cancelAnimation(this, AnimationType.TEXT_OPACITY); - } + if (mTextOpacityAnimation != null) mTextOpacityAnimation.cancel(); } /** @@ -576,24 +602,4 @@ mSearchBarContextOpacity = fadingOutPercentage; mSearchBarTermOpacity = fadingInPercentage; } - - // ============================================================================================ - // ChromeAnimation.Animatable Implementation - // ============================================================================================ - - @Override - public void setProperty(AnimationType type, float value) { - if (type == AnimationType.TEXT_OPACITY) { - updateSearchBarTextOpacity(value); - } else if (type == AnimationType.DIVIDER_LINE_VISIBILITY) { - mDividerLineVisibilityPercentage = value; - } - } - - @Override - public void onPropertyAnimationFinished(AnimationType prop) { - if (prop == AnimationType.TOUCH_HIGHLIGHT_VISIBILITY) { - mTouchHighlightVisible = false; - } - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchCaptionControl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchCaptionControl.java index f4c9c11..9251a41 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchCaptionControl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchCaptionControl.java
@@ -13,19 +13,18 @@ import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; +import org.chromium.chrome.browser.compositor.animation.CompositorAnimator; +import org.chromium.chrome.browser.compositor.animation.CompositorAnimator.AnimatorUpdateListener; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelTextViewInflater; -import org.chromium.chrome.browser.compositor.layouts.ChromeAnimation; -import org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; /** * Controls the Caption View that is shown at the bottom of the control and used * as a dynamic resource. */ -public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater - implements ChromeAnimation.Animatable<ContextualSearchCaptionControl.AnimationType> { +public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater { private static final float ANIMATION_PERCENTAGE_ZERO = 0.f; private static final float ANIMATION_PERCENTAGE_COMPLETE = 1.f; private static final float EXPANDED_CAPTION_THRESHOLD = 0.5f; @@ -38,13 +37,6 @@ public static final int EXPANED_CAPTION_ID = R.string.contextmenu_open_in_new_tab; /** - * Animation properties. - */ - protected enum AnimationType { - APPEARANCE - } - - /** * The caption View. */ private TextView mCaption; @@ -81,6 +73,9 @@ */ private float mAnimationPercentage = ANIMATION_PERCENTAGE_ZERO; + /** The animator responsible for transitioning the caption. */ + private CompositorAnimator mTransitionAnimator; + /** * Whether a new snapshot has been captured by the system yet - this is false when we have * something to show, but cannot yet show it. @@ -133,7 +128,7 @@ public void onUpdateFromPeekToExpand(float percentage) { if (!mShouldShowExpandedCaption) { if (mHasPeekingCaption) { - mOverlayPanel.cancelAnimation(this, AnimationType.APPEARANCE); + if (mTransitionAnimator != null) mTransitionAnimator.cancel(); mAnimationPercentage = 1.f - percentage; } return; @@ -259,18 +254,16 @@ // ============================================================================================ private void animateTransitionIn() { - mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, ANIMATION_PERCENTAGE_ZERO, - ANIMATION_PERCENTAGE_COMPLETE, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, - 0, false, ANIMATION_INTERPOLATOR); + AnimatorUpdateListener listener = new AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(CompositorAnimator animator) { + mAnimationPercentage = animator.getAnimatedValue(); + } + }; + mTransitionAnimator = CompositorAnimator.ofFloat(mOverlayPanel.getAnimationHandler(), + ANIMATION_PERCENTAGE_ZERO, ANIMATION_PERCENTAGE_COMPLETE, + OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, listener); + mTransitionAnimator.setInterpolator(ANIMATION_INTERPOLATOR); + mTransitionAnimator.start(); } - - @Override - public void setProperty(AnimationType type, float value) { - if (type == AnimationType.APPEARANCE) { - mAnimationPercentage = value; - } - } - - @Override - public void onPropertyAnimationFinished(AnimationType prop) {} }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchImageControl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchImageControl.java index 4976b59..59144b5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchImageControl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchImageControl.java
@@ -3,39 +3,30 @@ // found in the LICENSE file. package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; -import android.content.Context; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.support.v4.view.animation.PathInterpolatorCompat; import android.text.TextUtils; import android.view.animation.Interpolator; import org.chromium.chrome.R; +import org.chromium.chrome.browser.compositor.animation.CompositorAnimator; +import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation; -import org.chromium.chrome.browser.compositor.layouts.ChromeAnimation; /** * Controls the image shown in the Bar. Owns animating between the search provider icon and * custom image (either a thumbnail or quick action icon) for the current query. */ -public class ContextualSearchImageControl - implements ChromeAnimation.Animatable<ContextualSearchImageControl.AnimationType> { - /** - * Animation properties. - */ - protected enum AnimationType { CUSTOM_IMAGE_VISIBILITY } - - /** The current context. */ - private final Context mContext; - - /** The OverlayPanelAnimation used to add animations. */ - private final OverlayPanelAnimation mOverlayPanelAnimation; +public class ContextualSearchImageControl { + /** The {@link OverlayPanel} that this class belongs to. */ + private final OverlayPanel mPanel; /** The percentage the panel is expanded. 1.f is fully expanded and 0.f is peeked. */ private float mExpandedPercentage; - public ContextualSearchImageControl(OverlayPanelAnimation overlayPanelAnimation, - Context context) { - mContext = context; - mOverlayPanelAnimation = overlayPanelAnimation; + public ContextualSearchImageControl(OverlayPanel panel) { + mPanel = panel; } /** @@ -161,7 +152,7 @@ if ((mThumbnailVisible || mQuickActionIconVisible) && animate) { animateCustomImageVisibility(false); } else { - mOverlayPanelAnimation.cancelAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY); + if (mImageVisibilityAnimator != null) mImageVisibilityAnimator.cancel(); onCustomImageHidden(); } } @@ -171,7 +162,7 @@ */ public int getBarImageSize() { if (mBarImageSize == 0) { - mBarImageSize = mContext.getResources().getDimensionPixelSize( + mBarImageSize = mPanel.getContext().getResources().getDimensionPixelSize( R.dimen.contextual_search_bar_image_size); } return mBarImageSize; @@ -202,6 +193,8 @@ // Thumbnail Animation // ============================================================================================ + private CompositorAnimator mImageVisibilityAnimator; + private Interpolator mCustomImageVisibilityInterpolator; private void animateCustomImageVisibility(boolean visible) { @@ -214,30 +207,27 @@ PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f); } - mOverlayPanelAnimation.cancelAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY); + if (mImageVisibilityAnimator != null) mImageVisibilityAnimator.cancel(); - float endValue = visible ? 1.f : 0.f; - mOverlayPanelAnimation.addToAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY, - mCustomImageVisibilityPercentage, endValue, - OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false, - mCustomImageVisibilityInterpolator); - } - - @Override - public void setProperty(AnimationType prop, float val) { - if (prop == AnimationType.CUSTOM_IMAGE_VISIBILITY) { - // If the panel is expanded, #onUpdateFromPeekedToExpanded() is responsible for setting - // mCustomImageVisiblityPercentage. - if (mExpandedPercentage == 0.f) mCustomImageVisibilityPercentage = val; - } - } - - @Override - public void onPropertyAnimationFinished(AnimationType prop) { - if (prop == AnimationType.CUSTOM_IMAGE_VISIBILITY) { - if (mCustomImageVisibilityPercentage == 0.f) { - onCustomImageHidden(); + mImageVisibilityAnimator = new CompositorAnimator(mPanel.getAnimationHandler()); + mImageVisibilityAnimator.setDuration(OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS); + mImageVisibilityAnimator.setInterpolator(mCustomImageVisibilityInterpolator); + mImageVisibilityAnimator.setValues(mCustomImageVisibilityPercentage, visible ? 1.f : 0.f); + mImageVisibilityAnimator.addUpdateListener(new CompositorAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(CompositorAnimator animator) { + if (mExpandedPercentage > 0.f) return; + mCustomImageVisibilityPercentage = animator.getAnimatedValue(); } - } + }); + mImageVisibilityAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mCustomImageVisibilityPercentage == 0.f) onCustomImageHidden(); + mImageVisibilityAnimator.removeAllListeners(); + mImageVisibilityAnimator = null; + } + }); + mImageVisibilityAnimator.start(); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index 887618c..b37153e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -469,8 +469,10 @@ mSuggestionDefinitionHeight = context.getResources().getDimensionPixelOffset( R.dimen.omnibox_suggestion_definition_height); - int paddingTop = context.getResources().getDimensionPixelOffset( - R.dimen.omnibox_suggestion_list_padding_top); + int paddingTop = mBottomSheet != null + ? 0 + : context.getResources().getDimensionPixelOffset( + R.dimen.omnibox_suggestion_list_padding_top); int paddingBottom = context.getResources().getDimensionPixelOffset( R.dimen.omnibox_suggestion_list_padding_bottom); ApiCompatibilityUtils.setPaddingRelative(this, 0, paddingTop, 0, paddingBottom);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index 78267c3..5ecfc9bb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -2937,6 +2937,8 @@ @SmallTest @Feature({"ContextualSearch"}) public void testQuickActionCaptionAndImage() throws InterruptedException, TimeoutException { + mPanel.getAnimationHandler().enableTestingMode(); + // Simulate a tap to show the Bar, then set the quick action data. simulateTapSearch("search"); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @@ -2944,8 +2946,6 @@ public void run() { mPanel.onSearchTermResolved("search", null, "tel:555-555-5555", QuickActionCategory.PHONE); - // Finish all running animations. - mPanel.onUpdateAnimation(System.currentTimeMillis(), true); } });
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index f492472..6992589 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -869,17 +869,17 @@ int pak_fd = global_descriptors->Get(kAndroidLocalePakDescriptor); base::MemoryMappedFile::Region pak_region = global_descriptors->GetRegion(kAndroidLocalePakDescriptor); - ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), - pak_region); + ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), + pak_region); // Load secondary locale .pak file if it exists. pak_fd = global_descriptors->MaybeGet(kAndroidSecondaryLocalePakDescriptor); if (pak_fd != -1) { pak_region = global_descriptors->GetRegion( kAndroidSecondaryLocalePakDescriptor); - ResourceBundle::GetSharedInstance(). - LoadSecondaryLocaleDataWithPakFileRegion( - base::File(pak_fd), pak_region); + ui::ResourceBundle::GetSharedInstance() + .LoadSecondaryLocaleDataWithPakFileRegion(base::File(pak_fd), + pak_region); } int extra_pak_keys[] = { @@ -889,7 +889,7 @@ for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { pak_fd = global_descriptors->Get(extra_pak_keys[i]); pak_region = global_descriptors->GetRegion(extra_pak_keys[i]); - ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( base::File(pak_fd), pak_region, ui::SCALE_FACTOR_100P); } @@ -903,7 +903,7 @@ base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); #endif CHECK(!loaded_locale.empty()) << "Locale could not be found for " << @@ -1006,7 +1006,7 @@ void ChromeMainDelegate::ProcessExiting(const std::string& process_type) { if (SubprocessNeedsResourceBundle(process_type)) - ResourceBundle::CleanupSharedInstance(); + ui::ResourceBundle::CleanupSharedInstance(); #if !defined(OS_ANDROID) logging::CleanupChromeLogging(); #else
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index a18c800..c72bba5 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -276,12 +276,6 @@ <message name="IDS_MD_HISTORY_ITEMS_SELECTED" desc="Label displayed in history toolbar telling the user how many items they have selected."> <ph name="NUMBER_OF_ITEMS_SELECTED">$1</ph> selected </message> - <message name="IDS_MD_HISTORY_HAS_SYNCED_RESULTS" desc="The notification at the top of the history page indicating that it is showing visits synced from other devices."> - Showing history from your signed-in devices. <ph name="BEGIN_LINK"><a href="https://support.google.com/chrome/?p=sync_history&hl=[GRITLANGCODE]"></ph>Learn more<ph name="END_LINK"></a><ex></a></ex></ph> - </message> - <message name="IDS_MD_HISTORY_HAS_SYNCED_RESULTS_DESCRIPTION" desc="Description for the notification at the top of the history page indicating that it is showing visits synced from other devices. This is spoken by the screen reader when the notification button is focused."> - Showing history from your signed-in devices. - </message> <message name="IDS_MD_HISTORY_HISTORY_MENU_DESCRIPTION" desc="Tooltip for the history sidebar menu button."> Main menu </message> @@ -9386,6 +9380,12 @@ <message name="IDS_EMAIL_PAGE_LOCATION_MAC" desc="The Mac menu item to email the page location in the file menu."> Email Page Location </message> + <message name="IDS_SHARING_MORE_MAC" desc="The Mac menu item to see more macOS share extensions in the share menu."> + More... + </message> + <message name="IDS_SHARE_MAC" desc="The Mac menu item for sharing to external services."> + Share + </message> <message name="IDS_PRINT_USING_SYSTEM_DIALOG_MAC" desc="The Mac menu item to print using system dialog in the file menu"> Print Using System Dialog... </message>
diff --git a/chrome/app/resources/resources_unittest.cc b/chrome/app/resources/resources_unittest.cc index eff82b2..01a9d66 100644 --- a/chrome/app/resources/resources_unittest.cc +++ b/chrome/app/resources/resources_unittest.cc
@@ -22,11 +22,11 @@ ResourcesTest() { ui::RegisterPathProvider(); ui::MaterialDesignController::Initialize(); - ResourceBundle::InitSharedInstanceWithLocale( - "en-US", nullptr, ResourceBundle::LOAD_COMMON_RESOURCES); + ui::ResourceBundle::InitSharedInstanceWithLocale( + "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); } - ~ResourcesTest() override { ResourceBundle::CleanupSharedInstance(); } + ~ResourcesTest() override { ui::ResourceBundle::CleanupSharedInstance(); } }; // Trailing whitespace has been the cause of a bug in the past. Make sure this @@ -45,9 +45,9 @@ for (base::FilePath locale_file_path = file_enumerator.Next(); !locale_file_path.empty(); locale_file_path = file_enumerator.Next()) { // Load the current locale file. - ResourceBundle::GetSharedInstance().OverrideLocalePakForTest( + ui::ResourceBundle::GetSharedInstance().OverrideLocalePakForTest( locale_file_path); - ResourceBundle::GetSharedInstance().ReloadLocaleResources(""); + ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(""); for (int message : messages_to_check) { base::string16 message_str = l10n_util::GetStringUTF16(message);
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index e000a855..1e22786 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1727,6 +1727,7 @@ "//services/preferences/public/cpp/tracked", "//services/preferences/public/interfaces", "//services/preferences/tracked", + "//services/proxy_resolver/public/interfaces", "//services/resource_coordinator/public/cpp:resource_coordinator_cpp", "//services/service_manager/public/cpp", "//services/shape_detection/public/interfaces",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 6342e06f..54425d5 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1922,12 +1922,6 @@ flag_descriptions::kNotificationsNativeFlagDescription, kOsMac | kOsLinux, FEATURE_VALUE_TYPE(features::kNativeNotifications)}, #endif // ENABLE_NATIVE_NOTIFICATIONS -#if BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS) - {"enable-native-window-nav-buttons", - flag_descriptions::kWindowNavNativeFlagName, - flag_descriptions::kWindowNavNativeFlagDescription, kOsLinux, - FEATURE_VALUE_TYPE(features::kNativeWindowNavButtons)}, -#endif // ENABLE_NATIVE_WINDOW_NAV_BUTTONS #if defined(OS_ANDROID) {"reader-mode-heuristics", flag_descriptions::kReaderModeHeuristicsName, flag_descriptions::kReaderModeHeuristicsDescription, kOsAndroid, @@ -3523,6 +3517,11 @@ flag_descriptions::kHtmlBasedUsernameDetectorDescription, kOsAll, FEATURE_VALUE_TYPE( password_manager::features::kEnableHtmlBasedUsernameDetector)}, +#if defined(OS_MACOSX) + {"mac-system-share-menu", flag_descriptions::kMacSystemShareMenuName, + flag_descriptions::kMacSystemShareMenuDescription, kOsMac, + FEATURE_VALUE_TYPE(features::kMacSystemShareMenu)}, +#endif // defined(OS_MACOSX) {"enable-new-preconnect", flag_descriptions::kSpeculativePreconnectName, flag_descriptions::kSpeculativePreconnectDescription, kOsAll,
diff --git a/chrome/browser/android/devtools_manager_delegate_android.cc b/chrome/browser/android/devtools_manager_delegate_android.cc index c7306a5..c4f5852 100644 --- a/chrome/browser/android/devtools_manager_delegate_android.cc +++ b/chrome/browser/android/devtools_manager_delegate_android.cc
@@ -254,8 +254,9 @@ } std::string DevToolsManagerDelegateAndroid::GetDiscoveryPageHTML() { - return ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); + return ui::ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_DEVTOOLS_DISCOVERY_PAGE_HTML) + .as_string(); } bool DevToolsManagerDelegateAndroid::IsBrowserTargetDiscoverable() {
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc index 22dc4cd..c6736e44 100644 --- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc +++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -11,6 +11,8 @@ #include "base/memory/ptr_util.h" #include "chrome/browser/android/vr_shell/vr_metrics_util.h" #include "chrome/browser/android/vr_shell/vr_shell.h" +#include "chrome/browser/vr/service/vr_device_manager.h" +#include "chrome/browser/vr/service/vr_service_impl.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host_view.h" @@ -21,9 +23,7 @@ #include "device/vr/android/gvr/gvr_delegate.h" #include "device/vr/android/gvr/gvr_delegate_provider_factory.h" #include "device/vr/vr_device.h" -#include "device/vr/vr_device_manager.h" #include "device/vr/vr_display_impl.h" -#include "device/vr/vr_service_impl.h" #include "jni/VrShellDelegate_jni.h" #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h" @@ -373,7 +373,7 @@ } device::VRDevice* VrShellDelegate::GetDevice() { - return device::VRDeviceManager::GetInstance()->GetDevice(device_id_); + return vr::VRDeviceManager::GetInstance()->GetDevice(device_id_); } // ---------------------------------------------------------------------------- @@ -388,7 +388,7 @@ device::GvrDelegateProviderFactory::Install( new VrShellDelegateProviderFactory); content::WebvrServiceProvider::SetWebvrServiceCallback( - base::Bind(&device::VRServiceImpl::Create)); + base::Bind(&vr::VRServiceImpl::Create)); } } // namespace vr_shell
diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h index ff1eb55..08160cef 100644 --- a/chrome/browser/app_controller_mac.h +++ b/chrome/browser/app_controller_mac.h
@@ -31,6 +31,7 @@ @class ProfileMenuController; class QuitWithAppsController; class ScopedKeepAlive; +@class ShareMenuController; namespace ui { class WorkAreaWatcherObserver; @@ -73,6 +74,9 @@ // available when multiple profiles is enabled. base::scoped_nsobject<ProfileMenuController> profileMenuController_; + // Controller for the macOS system share menu. + base::scoped_nsobject<ShareMenuController> shareMenuController_; + // If we're told to open URLs (in particular, via |-application:openFiles:| by // Launch Services) before we've launched the browser, we queue them up in // |startupUrls_| so that they can go in the first browser window/tab.
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 1f136e5..88b13aa 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -72,6 +72,7 @@ #import "chrome/browser/ui/cocoa/history_menu_bridge.h" #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" +#import "chrome/browser/ui/cocoa/share_menu_controller.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" @@ -412,6 +413,13 @@ if (customizeItem) [viewMenu removeItem:customizeItem]; } + + // In |applicationWillFinishLaunching| because FeatureList isn't + // available at init time. + if (base::FeatureList::IsEnabled(features::kMacSystemShareMenu)) { + // Initialize the share menu. + [self initShareMenu]; + } } - (void)applicationWillHide:(NSNotification*)notification { @@ -1261,6 +1269,28 @@ [[ProfileMenuController alloc] initWithMainMenuItem:profileMenu]); } +- (void)initShareMenu { + shareMenuController_.reset([[ShareMenuController alloc] init]); + NSMenu* mainMenu = [NSApp mainMenu]; + NSMenu* fileMenu = [[mainMenu itemWithTag:IDC_FILE_MENU] submenu]; + NSString* shareMenuTitle = l10n_util::GetNSString(IDS_SHARE_MAC); + base::scoped_nsobject<NSMenuItem> shareMenuItem([[NSMenuItem alloc] + initWithTitle:shareMenuTitle + action:NULL + keyEquivalent:@""]); + base::scoped_nsobject<NSMenu> shareSubmenu( + [[NSMenu alloc] initWithTitle:shareMenuTitle]); + [shareSubmenu setDelegate:shareMenuController_]; + [shareMenuItem setSubmenu:shareSubmenu]; + // Replace "Email Page Location" with Share. + // TODO(crbug.com/770804): Remove this code and update the XIB when + // the share menu launches. + NSInteger index = [fileMenu indexOfItemWithTag:IDC_EMAIL_PAGE_LOCATION]; + DCHECK(index != -1); + [fileMenu removeItemAtIndex:index]; + [fileMenu insertItem:shareMenuItem atIndex:index]; +} + // The Confirm to Quit preference is atypical in that the preference lives in // the app menu right above the Quit menu item. This method will refresh the // display of that item depending on the preference state.
diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc index b321cde..d538a32 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.cc +++ b/chrome/browser/browsing_data/cookies_tree_model.cc
@@ -1057,12 +1057,15 @@ // Returns the set of icons for the nodes in the tree. You only need override // this if you don't want to use the default folder icons. void CookiesTreeModel::GetIcons(std::vector<gfx::ImageSkia>* icons) { - icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_DEFAULT_FAVICON).ToImageSkia()); - icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_COOKIE_ICON).ToImageSkia()); - icons->push_back(*ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_COOKIE_STORAGE_ICON).ToImageSkia()); + icons->push_back(*ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_DEFAULT_FAVICON) + .ToImageSkia()); + icons->push_back(*ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_COOKIE_ICON) + .ToImageSkia()); + icons->push_back(*ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_COOKIE_STORAGE_ICON) + .ToImageSkia()); } // Returns the index of the icon to use for |node|. Return -1 to use the
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 2386c526..9858573c 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -972,10 +972,10 @@ #if !defined(OS_CHROMEOS) // Convert active labs into switches. This needs to be done before - // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are - // affected by experiment flags (--touch-optimized-ui in particular). - // On ChromeOS system level flags are applied from the device settings from - // the session manager. + // ui::ResourceBundle::InitSharedInstanceWithLocale as some loaded resources + // are affected by experiment flags (--touch-optimized-ui in particular). On + // ChromeOS system level flags are applied from the device settings from the + // session manager. { TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags"); @@ -1049,7 +1049,7 @@ #if defined(OS_ANDROID) ui::LoadMainAndroidPackFile("assets/resources.pak", resources_pack_path); #else - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); #endif // defined(OS_ANDROID) } @@ -1155,7 +1155,8 @@ // tasks. SetupFieldTrials(); - // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. + // ChromeOS needs ui::ResourceBundle::InitSharedInstance to be called before + // this. browser_process_->PreCreateThreads(); // This must occur in PreCreateThreads() because it initializes global state
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index e5bbc5c4..5107623 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -123,7 +123,7 @@ base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); // This is a no-op if the KeystoneRegistration framework is not present.
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 8e7f8d8..ca20355 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1877,7 +1877,7 @@ } const gfx::ImageSkia* ChromeContentBrowserClient::GetDefaultFavicon() { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToImageSkia(); } @@ -3087,7 +3087,7 @@ std::unique_ptr<base::Value> ChromeContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); int id = -1; if (name == content::mojom::kBrowserServiceName) id = IDR_CHROME_CONTENT_BROWSER_MANIFEST_OVERLAY;
diff --git a/chrome/browser/chrome_content_utility_manifest_overlay.json b/chrome/browser/chrome_content_utility_manifest_overlay.json index 07008f85..32cc63d 100644 --- a/chrome/browser/chrome_content_utility_manifest_overlay.json +++ b/chrome/browser/chrome_content_utility_manifest_overlay.json
@@ -16,9 +16,9 @@ "extensions::mojom::MediaParser", "extensions::mojom::RemovableStorageWriter", "extensions::mojom::WiFiCredentialsGetter", - "net::interfaces::ProxyResolverFactory", "payments::mojom::PaymentManifestParser", "profiling::mojom::MemlogClient", + "proxy_resolver::mojom::ProxyResolverFactory", "safe_json::mojom::SafeJsonParser" ] }
diff --git a/chrome/browser/chrome_device_client.cc b/chrome/browser/chrome_device_client.cc index 6d671bb0..28441ad 100644 --- a/chrome/browser/chrome_device_client.cc +++ b/chrome/browser/chrome_device_client.cc
@@ -24,13 +24,11 @@ return usb_service_.get(); } +#if !defined(OS_ANDROID) device::HidService* ChromeDeviceClient::GetHidService() { DCHECK_CURRENTLY_ON(BrowserThread::UI); -#if defined(OS_ANDROID) - return nullptr; -#else if (!hid_service_) hid_service_ = device::HidService::Create(); return hid_service_.get(); -#endif // defined(OS_ANDROID) } +#endif // defined(OS_ANDROID)
diff --git a/chrome/browser/chrome_device_client.h b/chrome/browser/chrome_device_client.h index 8921616..0174b97 100644 --- a/chrome/browser/chrome_device_client.h +++ b/chrome/browser/chrome_device_client.h
@@ -21,7 +21,9 @@ // device::DeviceClient implementation device::UsbService* GetUsbService() override; +#if !defined(OS_ANDROID) device::HidService* GetHidService() override; +#endif // !defined(OS_ANDROID) private: #if !defined(OS_ANDROID)
diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc index 4e40cb6..4076244 100644 --- a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc +++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc
@@ -48,7 +48,6 @@ user_manager::UserManager::Get()->GetPrimaryUser()->GetAccountId(); notifier_id.profile_id = account_id.GetUserEmail(); message_center::RichNotificationData optional_fields; - optional_fields.clickable = false; optional_fields.never_timeout = true; message_center::MessageCenter::Get()->AddNotification(
diff --git a/chrome/browser/chromeos/base/locale_util.cc b/chrome/browser/chromeos/base/locale_util.cc index 4723210..566ac20 100644 --- a/chrome/browser/chromeos/base/locale_util.cc +++ b/chrome/browser/chromeos/base/locale_util.cc
@@ -47,7 +47,7 @@ DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); data->result.loaded_locale = - ResourceBundle::GetSharedInstance().ReloadLocaleResources( + ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources( data->result.requested_locale); data->result.success = !data->result.loaded_locale.empty(); @@ -94,7 +94,7 @@ // The font clean up of ResourceBundle should be done on UI thread, since the // cached fonts are thread unsafe. - ResourceBundle::GetSharedInstance().ReloadFonts(); + ui::ResourceBundle::GetSharedInstance().ReloadFonts(); gfx::PlatformFontLinux::ReloadDefaultFont(); if (!data->callback.is_null()) data->callback.Run(data->result);
diff --git a/chrome/browser/chromeos/extensions/gfx_utils.cc b/chrome/browser/chromeos/extensions/gfx_utils.cc index 15a9d93..911a006 100644 --- a/chrome/browser/chromeos/extensions/gfx_utils.cc +++ b/chrome/browser/chromeos/extensions/gfx_utils.cc
@@ -211,7 +211,7 @@ return; const gfx::ImageSkia* badge_image = - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_ARC_DUAL_ICON_BADGE); DCHECK(badge_image);
diff --git a/chrome/browser/chromeos/hats/hats_dialog.cc b/chrome/browser/chromeos/hats/hats_dialog.cc index fa054c1d..d29dbbc26 100644 --- a/chrome/browser/chromeos/hats/hats_dialog.cc +++ b/chrome/browser/chromeos/hats/hats_dialog.cc
@@ -55,7 +55,7 @@ std::string LoadLocalHtmlAsString(std::string site_id, std::string site_context) { std::string html_data; - ResourceBundle::GetSharedInstance() + ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_HATS_HTML) .CopyToString(&html_data);
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index b9a3e4d..f642ccf7 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -309,7 +309,7 @@ DCHECK(out_imes); for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) { ComponentExtensionIME component_ime; - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); component_ime.manifest = rb.GetRawDataResource( whitelisted_component_extension[i].manifest_resource_id)
diff --git a/chrome/browser/chromeos/login/resource_loader_browsertest.cc b/chrome/browser/chromeos/login/resource_loader_browsertest.cc index b806a154..8aaf03c 100644 --- a/chrome/browser/chromeos/login/resource_loader_browsertest.cc +++ b/chrome/browser/chromeos/login/resource_loader_browsertest.cc
@@ -45,10 +45,10 @@ ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &resources_pack_path)); resources_pack_path = resources_pack_path.AppendASCII("gen/ui/login/login_resources.pak"); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); const base::StringPiece resource_loader_js = - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_OOBE_RESOURCE_LOADER_JS); EXPECT_FALSE(resource_loader_js.empty());
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.cc b/chrome/browser/chromeos/login/screens/user_selection_screen.cc index 4c369218..bbec3ff3 100644 --- a/chrome/browser/chromeos/login/screens/user_selection_screen.cc +++ b/chrome/browser/chromeos/login/screens/user_selection_screen.cc
@@ -456,7 +456,7 @@ user_info->basic_user_info->avatar = user->GetImage(); if (user_info->basic_user_info->avatar.isNull()) { user_info->basic_user_info->avatar = - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER); } user_info->auth_type = auth_type;
diff --git a/chrome/browser/chromeos/login/signin/merge_session_load_page.cc b/chrome/browser/chromeos/login/signin/merge_session_load_page.cc index fa678f4..287c73f 100644 --- a/chrome/browser/chromeos/login/signin/merge_session_load_page.cc +++ b/chrome/browser/chromeos/login/signin/merge_session_load_page.cc
@@ -88,7 +88,7 @@ webui::SetLoadTimeDataDefaults(app_locale, &strings); base::StringPiece html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_MERGE_SESSION_LOAD_HTML)); return webui::GetI18nTemplateHtml(html, &strings); }
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc b/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc index 67848ee5..5e2be2fd 100644 --- a/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc
@@ -442,7 +442,7 @@ } else { user->SetStubImage( base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER)), image_index_, false); } @@ -617,10 +617,11 @@ image_properties->GetString(kImagePathNodeName, &image_path); user->SetImageURL(image_url); - user->SetStubImage(base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_LOGIN_DEFAULT_USER)), - image_index, true); + user->SetStubImage( + base::MakeUnique<user_manager::UserImage>( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_LOGIN_DEFAULT_USER)), + image_index, true); DCHECK(!image_path.empty() || image_index == user_manager::User::USER_IMAGE_PROFILE); if (image_path.empty()) {
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc index a8cda98..709f9f8c 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -758,7 +758,7 @@ // http://crosbug.com/230859 active_user_->SetStubImage( base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER)), user_manager::User::USER_IMAGE_INVALID, false); @@ -865,7 +865,7 @@ active_user_ = user; active_user_->SetStubImage( base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER)), user_manager::User::USER_IMAGE_INVALID, false); @@ -919,7 +919,7 @@ active_user_ = user; active_user_->SetStubImage( base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER)), user_manager::User::USER_IMAGE_INVALID, false); @@ -938,7 +938,7 @@ user_manager::User::CreateKioskAppUser(user_manager::DemoAccountId()); active_user_->SetStubImage( base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER)), user_manager::User::USER_IMAGE_INVALID, false); WallpaperManager::Get()->SetUserWallpaperNow(user_manager::DemoAccountId()); @@ -1354,7 +1354,7 @@ const gfx::ImageSkia& ChromeUserManagerImpl::GetResourceImagekiaNamed( int id) const { - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); } base::string16 ChromeUserManagerImpl::GetResourceStringUTF16(
diff --git a/chrome/browser/chromeos/login/users/default_user_image/default_user_images.cc b/chrome/browser/chromeos/login/users/default_user_image/default_user_images.cc index e2c4c9b..4d8a23ff 100644 --- a/chrome/browser/chromeos/login/users/default_user_image/default_user_images.cc +++ b/chrome/browser/chromeos/login/users/default_user_image/default_user_images.cc
@@ -322,7 +322,7 @@ const gfx::ImageSkia& GetDefaultImage(int index) { DCHECK(index >= 0 && index < kDefaultImagesCount); - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( kDefaultImageResourceIDs[index]); }
diff --git a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc index 53157bf..e7e05c8 100644 --- a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc +++ b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc
@@ -78,10 +78,11 @@ user->SetAffiliation(is_affiliated); user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( account_id.GetUserEmail())); - user->SetStubImage(base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_LOGIN_DEFAULT_USER)), - user_manager::User::USER_IMAGE_PROFILE, false); + user->SetStubImage( + base::MakeUnique<user_manager::UserImage>( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_LOGIN_DEFAULT_USER)), + user_manager::User::USER_IMAGE_PROFILE, false); users_.push_back(user); chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); return user; @@ -122,10 +123,11 @@ user_manager::User::CreatePublicAccountUser(account_id); user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( account_id.GetUserEmail())); - user->SetStubImage(base::MakeUnique<user_manager::UserImage>( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_LOGIN_DEFAULT_USER)), - user_manager::User::USER_IMAGE_PROFILE, false); + user->SetStubImage( + base::MakeUnique<user_manager::UserImage>( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_LOGIN_DEFAULT_USER)), + user_manager::User::USER_IMAGE_PROFILE, false); users_.push_back(user); chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); return user; @@ -341,7 +343,7 @@ const gfx::ImageSkia& FakeChromeUserManager::GetResourceImagekiaNamed( int id) const { - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); } base::string16 FakeChromeUserManager::GetResourceStringUTF16(
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index 2b36fc7..700f545b 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -1203,19 +1203,19 @@ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); passphrase_visible_button_->SetImage( views::ImageButton::STATE_NORMAL, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD)); passphrase_visible_button_->SetImage( views::ImageButton::STATE_HOVERED, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD_HOVER)); passphrase_visible_button_->SetToggledImage( views::ImageButton::STATE_NORMAL, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_HIDE_PASSWORD)); passphrase_visible_button_->SetToggledImage( views::ImageButton::STATE_HOVERED, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_HIDE_PASSWORD_HOVER)); passphrase_visible_button_->SetImageAlignment( views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE);
diff --git a/chrome/browser/chromeos/options/wimax_config_view.cc b/chrome/browser/chromeos/options/wimax_config_view.cc index a115390f..dd22de0 100644 --- a/chrome/browser/chromeos/options/wimax_config_view.cc +++ b/chrome/browser/chromeos/options/wimax_config_view.cc
@@ -288,19 +288,19 @@ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); passphrase_visible_button_->SetImage( views::ImageButton::STATE_NORMAL, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD)); passphrase_visible_button_->SetImage( views::ImageButton::STATE_HOVERED, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD_HOVER)); passphrase_visible_button_->SetToggledImage( views::ImageButton::STATE_NORMAL, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_HIDE_PASSWORD)); passphrase_visible_button_->SetToggledImage( views::ImageButton::STATE_HOVERED, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_HIDE_PASSWORD_HOVER)); passphrase_visible_button_->SetImageAlignment( views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE);
diff --git a/chrome/browser/chromeos/printing/cups_print_job_notification.cc b/chrome/browser/chromeos/printing/cups_print_job_notification.cc index df27b81f..dc0fa98 100644 --- a/chrome/browser/chromeos/printing/cups_print_job_notification.cc +++ b/chrome/browser/chromeos/printing/cups_print_job_notification.cc
@@ -239,7 +239,7 @@ message_center::kSmallImageSizeMD, notification_->accent_color()))); } } else { - ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); switch (print_job_->state()) { case CupsPrintJob::State::STATE_WAITING: case CupsPrintJob::State::STATE_STARTED: @@ -354,7 +354,7 @@ } gfx::Image CupsPrintJobNotification::GetButtonIcon(ButtonCommand button) const { - ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); gfx::Image icon; switch (button) { case ButtonCommand::CANCEL_PRINTING:
diff --git a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc index 6579413..496fd0d 100644 --- a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc +++ b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
@@ -115,7 +115,7 @@ } void TearDownOnMainThread() override { - AccessibilityManager::SetBrailleControllerForTest(NULL); + AccessibilityManager::SetBrailleControllerForTest(nullptr); } void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { @@ -156,7 +156,7 @@ bool CanCreateMenuItem() { views::View* menu_item_view = CreateMenuItem(); DestroyMenuItem(); - return menu_item_view != NULL; + return menu_item_view != nullptr; } void SetLoginStatus(ash::LoginStatus status) { @@ -166,8 +166,8 @@ ash::LoginStatus GetLoginStatus() { return tray()->login_; } bool CreateDetailedMenu() { - tray()->ShowDetailedView(0, false); - return tray()->detailed_menu_ != NULL; + tray()->ShowDetailedView(0); + return tray()->detailed_menu_ != nullptr; } void CloseDetailMenu() {
diff --git a/chrome/browser/devtools/chrome_devtools_manager_delegate.cc b/chrome/browser/devtools/chrome_devtools_manager_delegate.cc index 23c12309..3eac8b2 100644 --- a/chrome/browser/devtools/chrome_devtools_manager_delegate.cc +++ b/chrome/browser/devtools/chrome_devtools_manager_delegate.cc
@@ -179,8 +179,9 @@ } std::string ChromeDevToolsManagerDelegate::GetDiscoveryPageHTML() { - return ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); + return ui::ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_DEVTOOLS_DISCOVERY_PAGE_HTML) + .as_string(); } std::string ChromeDevToolsManagerDelegate::GetFrontendResource(
diff --git a/chrome/browser/download/download_commands.cc b/chrome/browser/download/download_commands.cc index 8bfdcda3..192ab0c 100644 --- a/chrome/browser/download/download_commands.cc +++ b/chrome/browser/download/download_commands.cc
@@ -195,7 +195,7 @@ } gfx::Image DownloadCommands::GetCommandIcon(Command command) { - ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); return bundle.GetImageNamed(GetCommandIconId(command)); }
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc index a6aa4c7..f2ece9614 100644 --- a/chrome/browser/download/notification/download_item_notification.cc +++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -19,8 +19,9 @@ #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/notification/download_notification_manager.h" #include "chrome/browser/notifications/notification.h" -#include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/notifications/profile_notification.h" +#include "chrome/browser/notifications/notification_common.h" +#include "chrome/browser/notifications/notification_display_service.h" +#include "chrome/browser/notifications/notification_display_service_factory.h" #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" #include "chrome/common/url_constants.h" #include "chrome/grit/chromium_strings.h" @@ -173,47 +174,18 @@ } // namespace -// This class implements a simple pass-through for the NotificationDelegate -// interface. It exists because NotificationDelegate supports ref counting and -// DownloadItemNotification does not. -class DownloadItemNotification::DownloadItemNotificationDelegate - : public message_center::NotificationDelegate { - public: - explicit DownloadItemNotificationDelegate(DownloadItemNotification* item) - : item_(item) {} - - // NotificationDelegate overrides: - void Close(bool by_user) override { item_->OnNotificationClose(); } - - void Click() override { item_->OnNotificationClick(); } - - bool HasClickedListener() override { - return item_->HasNotificationClickedListener(); - } - - void ButtonClick(int button_index) override { - item_->OnNotificationButtonClick(button_index); - } - - private: - ~DownloadItemNotificationDelegate() override {} - - DownloadItemNotification* item_; - - DISALLOW_COPY_AND_ASSIGN(DownloadItemNotificationDelegate); -}; - DownloadItemNotification::DownloadItemNotification( content::DownloadItem* item, DownloadNotificationManagerForProfile* manager) : item_(item), - message_center_(manager->message_center()), weak_factory_(this) { // Creates the notification instance. |title|, |body| and |icon| will be // overridden by UpdateNotificationData() below. message_center::RichNotificationData rich_notification_data; rich_notification_data.should_make_spoken_feedback_for_popup_updates = false; - notification_.reset(new Notification( + // Dangerous notifications don't have a click handler. + rich_notification_data.clickable = !item_->IsDangerous(); + notification_ = std::make_unique<Notification>( message_center::NOTIFICATION_TYPE_PROGRESS, GetNotificationId(), base::string16(), // title base::string16(), // body @@ -223,8 +195,8 @@ l10n_util::GetStringUTF16( IDS_DOWNLOAD_NOTIFICATION_DISPLAY_SOURCE), // display_source GURL(kDownloadNotificationOrigin), // origin_url - base::UintToString(item_->GetId()), // tag - rich_notification_data, new DownloadItemNotificationDelegate(this))); + GetNotificationId(), // tag + rich_notification_data, nullptr); notification_->set_progress(0); notification_->set_never_timeout(false); @@ -248,10 +220,8 @@ DCHECK_EQ(item, item_); // Removing the notification causes calling |NotificationDelegate::Close()|. - if (g_browser_process->notification_ui_manager()) { - g_browser_process->notification_ui_manager()->CancelById( - GetNotificationId(), NotificationUIManager::GetProfileID(profile())); - } + NotificationDisplayServiceFactory::GetForProfile(profile())->Close( + NotificationCommon::DOWNLOAD, GetNotificationId()); item_ = nullptr; } @@ -262,22 +232,19 @@ // Hides a notification from popup notifications if it's a pop-up, by // decreasing its priority and reshowing itself. Low-priority notifications // doesn't pop-up itself so this logic works as disabling pop-up. - CloseNotificationByNonUser(); + CloseNotification(); notification_->set_priority(message_center::LOW_PRIORITY); closed_ = false; - g_browser_process->notification_ui_manager()->Add(*notification_, profile()); -} - -bool DownloadItemNotification::HasNotificationClickedListener() const { - // Dangerous notifications don't have a click handler. - return !item_->IsDangerous(); + NotificationDisplayServiceFactory::GetForProfile(profile())->Display( + NotificationCommon::DOWNLOAD, GetNotificationId(), *notification_); } void DownloadItemNotification::OnNotificationClose() { + closed_ = true; + if (item_ && item_->IsDangerous() && !item_->IsDone()) { base::RecordAction( UserMetricsAction("DownloadNotification.Close_Dangerous")); - closed_ = true; // Should be set before cancelling the download. item_->Cancel(true /* by_user */); return; } @@ -310,13 +277,13 @@ GURL(chrome::kChromeUIDownloadsURL), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false /* is_renderer_initiated */)); - CloseNotificationByUser(); + CloseNotification(); break; case content::DownloadItem::COMPLETE: base::RecordAction( UserMetricsAction("DownloadNotification.Click_Completed")); item_->OpenDownload(); - CloseNotificationByUser(); + CloseNotification(); break; case content::DownloadItem::MAX_DOWNLOAD_STATE: NOTREACHED(); @@ -336,9 +303,10 @@ DownloadCommands(item_).ExecuteCommand(command); - if (command != DownloadCommands::PAUSE && + // ExecuteCommand() might cause |item_| to be destroyed. + if (item_ && command != DownloadCommands::PAUSE && command != DownloadCommands::RESUME) { - CloseNotificationByUser(); + CloseNotification(); } // Shows the notification again after clicking "Keep" on dangerous download. @@ -349,68 +317,35 @@ } std::string DownloadItemNotification::GetNotificationId() const { - return base::UintToString(item_->GetId()); + return item_->GetGuid(); } -void DownloadItemNotification::CloseNotificationByNonUser() { - const ProfileID profile_id = NotificationUIManager::GetProfileID(profile()); - - g_browser_process->notification_ui_manager()->CancelById(GetNotificationId(), - profile_id); -} - -void DownloadItemNotification::CloseNotificationByUser() { - // Item may be already removed. - if (!item_) - return; - - std::string notification_id = GetNotificationId(); - const ProfileID profile_id = NotificationUIManager::GetProfileID(profile()); - const std::string notification_id_in_message_center = - ProfileNotification::GetProfileNotificationId(notification_id, - profile_id); - - g_browser_process->notification_ui_manager()-> - CancelById(notification_id, profile_id); - - // When the message center is visible, |NotificationUIManager::CancelByID()| - // delays the close hence the notification is not closed at this time. But - // from the viewpoint of UX of MessageCenter, we should close it immediately - // because it's by user action. So, we request closing of it directlly to - // MessageCenter instance. - // Note that: this calling has no side-effect even when the message center - // is not opened. - message_center_->RemoveNotification( - notification_id_in_message_center, true /* by_user */); +void DownloadItemNotification::CloseNotification() { + NotificationDisplayServiceFactory::GetForProfile(profile())->Close( + NotificationCommon::DOWNLOAD, GetNotificationId()); } void DownloadItemNotification::Update() { auto download_state = item_->GetState(); // When the download is just completed, interrupted or transitions to - // dangerous, close the notification once and re-show it immediately so - // it'll pop up. + // dangerous, increase the priority over its previous value to make sure it + // pops up again. bool popup = ((item_->IsDangerous() && !previous_dangerous_state_) || (download_state == content::DownloadItem::COMPLETE && previous_download_state_ != content::DownloadItem::COMPLETE) || (download_state == content::DownloadItem::INTERRUPTED && previous_download_state_ != content::DownloadItem::INTERRUPTED)); - - if (IsNotificationVisible() && !closed_) { - UpdateNotificationData(popup ? UPDATE_AND_POPUP : UPDATE); - } else { - if (show_next_ || popup) - UpdateNotificationData(ADD); - } + UpdateNotificationData(!closed_ || show_next_ || popup, popup); show_next_ = false; previous_download_state_ = item_->GetState(); previous_dangerous_state_ = item_->IsDangerous(); } -void DownloadItemNotification::UpdateNotificationData( - NotificationUpdateType type) { +void DownloadItemNotification::UpdateNotificationData(bool display, + bool bump_priority) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DownloadItemModel model(item_); @@ -452,13 +387,13 @@ notification_->set_progress(100); break; case content::DownloadItem::CANCELLED: - // Confgirms that a download is cancelled by user action. + // Confirms that a download is cancelled by user action. DCHECK(item_->GetLastReason() == content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED || item_->GetLastReason() == content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN); - CloseNotificationByUser(); + CloseNotification(); return; // Skips the remaining since the notification has closed. case content::DownloadItem::INTERRUPTED: // Shows a notifiation as progress type once so the visible content will @@ -487,23 +422,14 @@ } notification_->set_buttons(notification_actions); - if (type == ADD) { + if (display) { closed_ = false; - g_browser_process->notification_ui_manager()-> - Add(*notification_, profile()); - } else if (type == UPDATE || - // If the notification is already visible as popup or in the - // notification center, doesn't pop it up. - (type == UPDATE_AND_POPUP && IsNotificationVisible())) { - g_browser_process->notification_ui_manager()-> - Update(*notification_, profile()); - } else if (type == UPDATE_AND_POPUP) { - CloseNotificationByNonUser(); - closed_ = false; - g_browser_process->notification_ui_manager()-> - Add(*notification_, profile()); - } else { - NOTREACHED(); + if (bump_priority && + notification_->priority() < message_center::HIGH_PRIORITY) { + notification_->set_priority(notification_->priority() + 1); + } + NotificationDisplayServiceFactory::GetForProfile(profile())->Display( + NotificationCommon::DOWNLOAD, GetNotificationId(), *notification_); } if (item_->IsDone() && image_decode_status_ == NOT_STARTED) { @@ -620,7 +546,7 @@ gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap); notification_->set_image(image); image_decode_status_ = DONE; - UpdateNotificationData(UPDATE); + UpdateNotificationData(!closed_, false); } void DownloadItemNotification::OnDecodeImageFailed() { @@ -628,7 +554,7 @@ DCHECK(notification_->image().IsEmpty()); image_decode_status_ = FAILED; - UpdateNotificationData(UPDATE); + UpdateNotificationData(!closed_, false); } std::unique_ptr<std::vector<DownloadCommands::Command>> @@ -963,16 +889,3 @@ Profile* DownloadItemNotification::profile() const { return Profile::FromBrowserContext(item_->GetBrowserContext()); } - -bool DownloadItemNotification::IsNotificationVisible() const { - const ProfileID profile_id = NotificationUIManager::GetProfileID(profile()); - if (!g_browser_process->notification_ui_manager()) - return false; - const Notification* notification = - g_browser_process->notification_ui_manager()->FindById( - GetNotificationId(), profile_id); - if (!notification) - return false; - - return !!message_center_->FindVisibleNotificationById(notification->id()); -}
diff --git a/chrome/browser/download/notification/download_item_notification.h b/chrome/browser/download/notification/download_item_notification.h index c27fc14..6f07b94 100644 --- a/chrome/browser/download/notification/download_item_notification.h +++ b/chrome/browser/download/notification/download_item_notification.h
@@ -13,8 +13,6 @@ #include "chrome/browser/notifications/notification_test_util.h" #include "content/public/browser/download_item.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/message_center_observer.h" #include "ui/message_center/notification_delegate.h" #include "ui/native_theme/native_theme.h" @@ -43,6 +41,11 @@ // Disables popup by setting low priority. void DisablePopup(); + // Called back from the NotificationHandler. + void OnNotificationClose(); + void OnNotificationClick(); + void OnNotificationButtonClick(int button_index); + private: class DownloadItemNotificationDelegate; friend class test::DownloadItemNotificationTest; @@ -55,18 +58,11 @@ UPDATE_AND_POPUP }; - // This block of functions implements NotificationDelegate. They're called - // from DownloadItemNotificationDelegate. - bool HasNotificationClickedListener() const; - void OnNotificationClose(); - void OnNotificationClick(); - void OnNotificationButtonClick(int button_index); std::string GetNotificationId() const; - void CloseNotificationByUser(); - void CloseNotificationByNonUser(); + void CloseNotification(); void Update(); - void UpdateNotificationData(NotificationUpdateType type); + void UpdateNotificationData(bool display, bool bump_priority); void UpdateNotificationIcon(); // Set icon of the notification. @@ -128,12 +124,6 @@ // Status of the preview image decode. ImageDecodeStatus image_decode_status_ = NOT_STARTED; - // Pointer to the message center instance. - message_center::MessageCenter* message_center_; - - void SetMessageCenterForTest( - message_center::MessageCenter* message_center); - base::WeakPtrFactory<DownloadItemNotification> weak_factory_; DISALLOW_COPY_AND_ASSIGN(DownloadItemNotification);
diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc index 125de0b..27b02a9 100644 --- a/chrome/browser/download/notification/download_item_notification_unittest.cc +++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
@@ -7,11 +7,15 @@ #include <stddef.h> #include <utility> +#include "base/guid.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/download/notification/download_notification_manager.h" +#include "chrome/browser/notifications/notification_display_service.h" +#include "chrome/browser/notifications/notification_display_service_factory.h" +#include "chrome/browser/notifications/notification_display_service_tester.h" #include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/notifications/platform_notification_service_impl.h" #include "chrome/test/base/testing_browser_process.h" @@ -22,7 +26,6 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/message_center/fake_message_center.h" using testing::NiceMock; using testing::Return; @@ -38,54 +41,29 @@ namespace test { -class MockMessageCenter : public message_center::FakeMessageCenter { - public: - MockMessageCenter() {} - ~MockMessageCenter() override {} - - void AddVisibleNotification(message_center::Notification* notification) { - visible_notifications_.insert(notification); - } - - const message_center::NotificationList::Notifications& - GetVisibleNotifications() override { - return visible_notifications_; - } - - private: - message_center::NotificationList::Notifications visible_notifications_; - - DISALLOW_COPY_AND_ASSIGN(MockMessageCenter); -}; - class DownloadItemNotificationTest : public testing::Test { public: DownloadItemNotificationTest() : profile_(nullptr) {} void SetUp() override { testing::Test::SetUp(); - message_center::MessageCenter::Initialize(); profile_manager_.reset( new TestingProfileManager(TestingBrowserProcess::GetGlobal())); ASSERT_TRUE(profile_manager_->SetUp()); profile_ = profile_manager_->CreateTestingProfile("test-user"); - std::unique_ptr<NotificationUIManager> ui_manager( - new StubNotificationUIManager); - TestingBrowserProcess::GetGlobal()->SetNotificationUIManager( - std::move(ui_manager)); + service_tester_ = + std::make_unique<NotificationDisplayServiceTester>(profile_); download_notification_manager_.reset( new DownloadNotificationManagerForProfile(profile_, nullptr)); - message_center_.reset(new MockMessageCenter()); - download_notification_manager_->OverrideMessageCenterForTest( - message_center_.get()); - base::FilePath download_item_target_path(kDownloadItemTargetPathString); download_item_.reset(new NiceMock<content::MockDownloadItem>()); ON_CALL(*download_item_, GetId()).WillByDefault(Return(12345)); + ON_CALL(*download_item_, GetGuid()) + .WillByDefault(ReturnRefOfCopy(base::GenerateGUID())); ON_CALL(*download_item_, GetState()) .WillByDefault(Return(content::DownloadItem::IN_PROGRESS)); ON_CALL(*download_item_, IsDangerous()).WillByDefault(Return(false)); @@ -106,43 +84,35 @@ download_item_notification_ = nullptr; // will be free'd in the manager. download_notification_manager_.reset(); profile_manager_.reset(); - message_center::MessageCenter::Shutdown(); testing::Test::TearDown(); } protected: - message_center::MessageCenter* message_center() const { - return message_center::MessageCenter::Get(); - } - - NotificationUIManager* ui_manager() const { - return TestingBrowserProcess::GetGlobal()->notification_ui_manager(); - } - std::string notification_id() const { return download_item_notification_->notification_->id(); } - const Notification* notification() const { - return ui_manager()->FindById( - download_item_notification_->GetNotificationId(), - NotificationUIManager::GetProfileID(profile_)); + std::unique_ptr<Notification> LookUpNotification() const { + std::vector<Notification> notifications = + service_tester_->GetDisplayedNotificationsForType( + NotificationCommon::DOWNLOAD); + for (const auto& notification : notifications) { + if (notification.id() == download_item_notification_->GetNotificationId()) + return std::make_unique<Notification>(notification); + } + return nullptr; } size_t NotificationCount() const { - return ui_manager() - ->GetAllIdsByProfileAndSourceOrigin( - NotificationUIManager::GetProfileID(profile_), - GURL("chrome://downloads")) + return service_tester_ + ->GetDisplayedNotificationsForType(NotificationCommon::DOWNLOAD) .size(); } void RemoveNotification() { - ui_manager()->CancelById(download_item_notification_->GetNotificationId(), - NotificationUIManager::GetProfileID(profile_)); - - // Waits, since removing a notification may cause an async job. - base::RunLoop().RunUntilIdle(); + service_tester_->RemoveNotification( + NotificationCommon::DOWNLOAD, + download_item_notification_->GetNotificationId(), false); } // Trampoline methods to access a private method in DownloadItemNotification. @@ -153,16 +123,16 @@ return download_item_notification_->OnNotificationButtonClick(index); } - bool ShownAsPopUp() { - return !notification()->shown_as_popup(); - } + bool ShownAsPopUp() { return !LookUpNotification()->shown_as_popup(); } void CreateDownloadItemNotification() { download_notification_manager_->OnNewDownloadReady(download_item_.get()); download_item_notification_ = download_notification_manager_->items_[download_item_.get()].get(); - message_center_->AddVisibleNotification( - download_item_notification_->notification_.get()); + NotificationDisplayServiceFactory::GetForProfile(profile_)->Display( + NotificationCommon::DOWNLOAD, + download_item_notification_->notification_->id(), + *download_item_notification_->notification_); } content::TestBrowserThreadBundle test_browser_thread_bundle_; @@ -173,8 +143,8 @@ std::unique_ptr<NiceMock<content::MockDownloadItem>> download_item_; std::unique_ptr<DownloadNotificationManagerForProfile> download_notification_manager_; - std::unique_ptr<MockMessageCenter> message_center_; DownloadItemNotification* download_item_notification_; + std::unique_ptr<NotificationDisplayServiceTester> service_tester_; }; TEST_F(DownloadItemNotificationTest, ShowAndCloseNotification) { @@ -282,11 +252,11 @@ CreateDownloadItemNotification(); download_item_->NotifyObserversDownloadOpened(); - EXPECT_EQ(message_center::DEFAULT_PRIORITY, notification()->priority()); + EXPECT_EQ(message_center::DEFAULT_PRIORITY, LookUpNotification()->priority()); download_item_notification_->DisablePopup(); // Priority is low. - EXPECT_EQ(message_center::LOW_PRIORITY, notification()->priority()); + EXPECT_EQ(message_center::LOW_PRIORITY, LookUpNotification()->priority()); // Downloading is completed. EXPECT_CALL(*download_item_, GetState()) @@ -294,8 +264,8 @@ EXPECT_CALL(*download_item_, IsDone()).WillRepeatedly(Return(true)); download_item_->NotifyObserversDownloadUpdated(); - // Priority is updated back to normal. - EXPECT_EQ(message_center::DEFAULT_PRIORITY, notification()->priority()); + // Priority is increased by the download's completion. + EXPECT_GT(LookUpNotification()->priority(), message_center::LOW_PRIORITY); } } // namespace test
diff --git a/chrome/browser/download/notification/download_notification_browsertest.cc b/chrome/browser/download/notification/download_notification_browsertest.cc index c9e29b2..2ec993a 100644 --- a/chrome/browser/download/notification/download_notification_browsertest.cc +++ b/chrome/browser/download/notification/download_notification_browsertest.cc
@@ -841,10 +841,12 @@ EXPECT_TRUE(IsInNotifications(popup_notifications, notification_id2)); // Confirms that the old one is low priority, and the new one is default. - EXPECT_EQ(message_center::LOW_PRIORITY, - GetNotification(notification_id1)->priority()); - EXPECT_EQ(message_center::DEFAULT_PRIORITY, - GetNotification(notification_id2)->priority()); + const int in_progress_priority1 = + GetNotification(notification_id1)->priority(); + const int in_progress_priority2 = + GetNotification(notification_id2)->priority(); + EXPECT_EQ(message_center::LOW_PRIORITY, in_progress_priority1); + EXPECT_EQ(message_center::DEFAULT_PRIORITY, in_progress_priority2); // Confirms that the updates of both download are delivered to the // notifications. @@ -882,11 +884,11 @@ EXPECT_TRUE(IsInNotifications(popup_notifications, notification_id1)); EXPECT_TRUE(IsInNotifications(popup_notifications, notification_id2)); - // Confirms that the both are default priority after downloads finish. - EXPECT_EQ(message_center::DEFAULT_PRIORITY, - GetNotification(notification_id1)->priority()); - EXPECT_EQ(message_center::DEFAULT_PRIORITY, - GetNotification(notification_id2)->priority()); + // Confirms that both increase in priority when finished. + EXPECT_GT(GetNotification(notification_id1)->priority(), + in_progress_priority1); + EXPECT_GT(GetNotification(notification_id2)->priority(), + in_progress_priority2); // Confirms the types of download notifications are correct. EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
diff --git a/chrome/browser/download/notification/download_notification_manager.cc b/chrome/browser/download/notification/download_notification_manager.cc index ac37862..431bdda6 100644 --- a/chrome/browser/download/notification/download_notification_manager.cc +++ b/chrome/browser/download/notification/download_notification_manager.cc
@@ -13,13 +13,56 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/notification/download_item_notification.h" +#include "chrome/browser/notifications/notification_common.h" +#include "chrome/browser/notifications/notification_display_service.h" +#include "chrome/browser/notifications/notification_display_service_factory.h" +#include "chrome/browser/notifications/notification_handler.h" #include "chrome/common/chrome_switches.h" #include "content/public/browser/download_item.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/message_center/message_center.h" #include "ui/message_center/notification.h" #include "ui/message_center/notification_delegate.h" +namespace { + +class DownloadNotificationHandler : public NotificationHandler { + public: + explicit DownloadNotificationHandler( + DownloadNotificationManagerForProfile* manager) + : manager_(manager) {} + ~DownloadNotificationHandler() override {} + + void OnClose(Profile* profile, + const std::string& origin, + const std::string& notification_id, + bool by_user) override { + if (by_user) { + manager_->GetNotificationItemByGuid(notification_id) + ->OnNotificationClose(); + } + } + + void OnClick(Profile* profile, + const std::string& origin, + const std::string& notification_id, + const base::Optional<int>& action_index, + const base::Optional<base::string16>& reply) override { + DownloadItemNotification* item = + manager_->GetNotificationItemByGuid(notification_id); + if (!action_index) + item->OnNotificationClick(); + else + item->OnNotificationButtonClick(*action_index); + } + + private: + DownloadNotificationManagerForProfile* manager_; + + DISALLOW_COPY_AND_ASSIGN(DownloadNotificationHandler); +}; + +} // namespace + /////////////////////////////////////////////////////////////////////////////// // DownloadNotificationManager implementation: /////////////////////////////////////////////////////////////////////////////// @@ -27,16 +70,10 @@ DownloadNotificationManager::DownloadNotificationManager(Profile* profile) : main_profile_(profile) {} -DownloadNotificationManager::~DownloadNotificationManager() { -} +DownloadNotificationManager::~DownloadNotificationManager() = default; void DownloadNotificationManager::OnAllDownloadsRemoving(Profile* profile) { - std::unique_ptr<DownloadNotificationManagerForProfile> manager_for_profile = - std::move(manager_for_profile_[profile]); manager_for_profile_.erase(profile); - - base::ThreadTaskRunnerHandle::Get()->DeleteSoon( - FROM_HERE, manager_for_profile.release()); } void DownloadNotificationManager::OnNewDownloadReady( @@ -63,12 +100,19 @@ DownloadNotificationManagerForProfile::DownloadNotificationManagerForProfile( Profile* profile, DownloadNotificationManager* parent_manager) - : profile_(profile), - parent_manager_(parent_manager), - message_center_(g_browser_process->message_center()) {} + : profile_(profile), parent_manager_(parent_manager) { + NotificationDisplayService* service = + NotificationDisplayServiceFactory::GetForProfile(profile); + DCHECK(!service->GetNotificationHandler(NotificationCommon::DOWNLOAD)); + service->AddNotificationHandler( + NotificationCommon::DOWNLOAD, + std::make_unique<DownloadNotificationHandler>(this)); +} DownloadNotificationManagerForProfile:: ~DownloadNotificationManagerForProfile() { + NotificationDisplayServiceFactory::GetForProfile(profile_) + ->RemoveNotificationHandler(NotificationCommon::DOWNLOAD); for (const auto& download : items_) { download.first->RemoveObserver(this); } @@ -104,6 +148,8 @@ if (items_.size() == 0 && parent_manager_) parent_manager_->OnAllDownloadsRemoving(profile_); + + // |this| is deleted. } void DownloadNotificationManagerForProfile::OnDownloadDestroyed( @@ -120,6 +166,8 @@ if (items_.size() == 0 && parent_manager_) parent_manager_->OnAllDownloadsRemoving(profile_); + + // |this| is deleted. } void DownloadNotificationManagerForProfile::OnNewDownloadReady( @@ -136,11 +184,17 @@ download_notification->DisablePopup(); } - items_[download] = base::MakeUnique<DownloadItemNotification>(download, this); + items_[download] = std::make_unique<DownloadItemNotification>(download, this); } -void DownloadNotificationManagerForProfile::OverrideMessageCenterForTest( - message_center::MessageCenter* message_center) { - DCHECK(message_center); - message_center_ = message_center; +DownloadItemNotification* +DownloadNotificationManagerForProfile::GetNotificationItemByGuid( + const std::string& guid) { + for (auto& item : items_) { + if (item.first->GetGuid() == guid) + return item.second.get(); + } + + NOTREACHED(); + return nullptr; }
diff --git a/chrome/browser/download/notification/download_notification_manager.h b/chrome/browser/download/notification/download_notification_manager.h index a3e9e761..2a4609a 100644 --- a/chrome/browser/download/notification/download_notification_manager.h +++ b/chrome/browser/download/notification/download_notification_manager.h
@@ -41,10 +41,6 @@ Profile* profile, DownloadNotificationManager* parent_manager); ~DownloadNotificationManagerForProfile() override; - message_center::MessageCenter* message_center() const { - return message_center_; - } - // DownloadItem::Observer overrides: void OnDownloadUpdated(content::DownloadItem* download) override; void OnDownloadOpened(content::DownloadItem* download) override; @@ -53,20 +49,16 @@ void OnNewDownloadReady(content::DownloadItem* item); + DownloadItemNotification* GetNotificationItemByGuid(const std::string& guid); + private: friend class test::DownloadItemNotificationTest; - void OverrideMessageCenterForTest( - message_center::MessageCenter* message_center); - Profile* profile_ = nullptr; DownloadNotificationManager* parent_manager_; // weak std::set<content::DownloadItem*> downloading_items_; std::map<content::DownloadItem*, std::unique_ptr<DownloadItemNotification>> items_; - - // Pointer to the message center instance. - message_center::MessageCenter* message_center_; }; #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_
diff --git a/chrome/browser/download/save_package_file_picker.cc b/chrome/browser/download/save_package_file_picker.cc index d374372..908d18a5 100644 --- a/chrome/browser/download/save_package_file_picker.cc +++ b/chrome/browser/download/save_package_file_picker.cc
@@ -6,6 +6,8 @@ #include <stddef.h> +#include <memory> + #include "base/bind.h" #include "base/command_line.h" #include "base/i18n/file_util_icu.h" @@ -22,6 +24,7 @@ #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h" #include "content/public/browser/download_manager.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/save_page_type.h" #include "content/public/browser/web_contents.h" @@ -132,7 +135,7 @@ bool can_save_as_complete, DownloadPrefs* download_prefs, const content::SavePackagePathPickedCallback& callback) - : render_process_id_(web_contents->GetRenderProcessHost()->GetID()), + : render_process_id_(web_contents->GetMainFrame()->GetProcess()->GetID()), can_save_as_complete_(can_save_as_complete), download_prefs_(download_prefs), callback_(callback) {
diff --git a/chrome/browser/extensions/api/file_system/request_file_system_notification.cc b/chrome/browser/extensions/api/file_system/request_file_system_notification.cc index b2301ae..42b9103 100644 --- a/chrome/browser/extensions/api/file_system/request_file_system_notification.cc +++ b/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
@@ -43,7 +43,6 @@ const std::string notification_id = extension.id() + "-" + volume->volume_id(); message_center::RichNotificationData data; - data.clickable = false; // TODO(mtomasz): Share this code with RequestFileSystemDialogView. const base::string16 display_name =
diff --git a/chrome/browser/extensions/chrome_url_request_util.cc b/chrome/browser/extensions/chrome_url_request_util.cc index f137be74..c23634ee 100644 --- a/chrome/browser/extensions/chrome_url_request_util.cc +++ b/chrome/browser/extensions/chrome_url_request_util.cc
@@ -60,7 +60,7 @@ std::string* charset, scoped_refptr<base::RefCountedMemory>* data, const net::CompletionCallback& callback) const override { - const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + const ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); *data = rb.LoadDataResourceBytes(resource_id_); // Add the Content-Length header now that we know the resource length.
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 2448982..7d26da7 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc
@@ -186,7 +186,7 @@ return std::string(); base::StringPiece manifest_contents = - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( manifest_resource_id); return Add(manifest_contents, root_directory, true); } @@ -406,7 +406,7 @@ return; base::StringPiece manifest_contents = - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( manifest_resource_id); // The Value is kept for the lifetime of the ComponentLoader. This is
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index e3e6e6b..84415e9 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -440,7 +440,7 @@ rating_fractional = 0; } - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); int i; for (i = 0; i < rating_integer; i++) { appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_ON), data);
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc index 60bb87c..bcf96614 100644 --- a/chrome/browser/extensions/extension_service_sync_unittest.cc +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -1812,8 +1812,8 @@ } bool IsPendingCustodianApproval(const std::string& extension_id) { - auto function = make_scoped_refptr( - new WebstorePrivateIsPendingCustodianApprovalFunction()); + auto function = base::MakeRefCounted< + WebstorePrivateIsPendingCustodianApprovalFunction>(); std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult( function.get(), "[\"" + extension_id + "\"]", browser_context()));
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc index 2b4c4ab..b82bbb7 100644 --- a/chrome/browser/extensions/extension_util.cc +++ b/chrome/browser/extensions/extension_util.cc
@@ -294,12 +294,12 @@ } const gfx::ImageSkia& GetDefaultAppIcon() { - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_APP_DEFAULT_ICON); } const gfx::ImageSkia& GetDefaultExtensionIcon() { - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_EXTENSION_DEFAULT_ICON); }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 56e9965..d58814d0 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1530,12 +1530,6 @@ "credentials are synchronized subject to user preferences. (See also, " "chrome://settings/syncSetup.)"; -const char kWindowNavNativeFlagName[] = - "Enable native window navigation buttons."; -const char kWindowNavNativeFlagDescription[] = - "Whether the window frame buttons should be drawn using the system theme. " - "Has no effect unless using the GTK3 theme."; - const char kZeroCopyName[] = "Zero-copy rasterizer"; const char kZeroCopyDescription[] = "Raster threads write directly to GPU memory associated with tiles."; @@ -2259,6 +2253,10 @@ extern const char kMacRTLDescription[] = "Mirrors the UI for RTL language users"; +extern const char kMacSystemShareMenuName[] = "Enable System Share Menu"; +extern const char kMacSystemShareMenuDescription[] = + "Enables sharing via macOS share extensions."; + extern const char kMacTouchBarName[] = "Hardware Touch Bar"; extern const char kMacTouchBarDescription[] = "Control the use of the Touch Bar.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 0acad5f5..5d26322 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -941,9 +941,6 @@ extern const char kWifiCredentialSyncName[]; extern const char kWifiCredentialSyncDescription[]; -extern const char kWindowNavNativeFlagName[]; -extern const char kWindowNavNativeFlagDescription[]; - extern const char kZeroCopyName[]; extern const char kZeroCopyDescription[]; @@ -1383,6 +1380,9 @@ extern const char kMacRTLName[]; extern const char kMacRTLDescription[]; +extern const char kMacSystemShareMenuName[]; +extern const char kMacSystemShareMenuDescription[]; + extern const char kMacTouchBarName[]; extern const char kMacTouchBarDescription[];
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc index d96ce084..26cf461 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc +++ b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h" #include <map> +#include <utility> #include "base/metrics/user_metrics.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" @@ -153,17 +154,14 @@ // It is safe to hold an unretained pointer to // ChromeWebViewPermissionHelperDelegate because this callback is called from // ChromeWebViewPermissionHelperDelegate::SetPermission. - const WebViewPermissionHelper::PermissionResponseCallback - permission_callback = - base::Bind(&ChromeWebViewPermissionHelperDelegate:: + WebViewPermissionHelper::PermissionResponseCallback permission_callback = + base::BindOnce(&ChromeWebViewPermissionHelperDelegate:: OnGeolocationPermissionResponse, weak_factory_.GetWeakPtr(), bridge_id, user_gesture, base::Bind(&CallbackWrapper, callback)); int request_id = web_view_permission_helper()->RequestPermission( - WEB_VIEW_PERMISSION_TYPE_GEOLOCATION, - request_info, - permission_callback, - false /* allowed_by_default */); + WEB_VIEW_PERMISSION_TYPE_GEOLOCATION, request_info, + std::move(permission_callback), false /* allowed_by_default */); bridge_id_to_request_id_map_[bridge_id] = request_id; }
diff --git a/chrome/browser/icon_loader_chromeos.cc b/chrome/browser/icon_loader_chromeos.cc index 70f78c12..03e53ee 100644 --- a/chrome/browser/icon_loader_chromeos.cc +++ b/chrome/browser/icon_loader_chromeos.cc
@@ -202,7 +202,7 @@ static base::LazyInstance<IconMapper>::Leaky icon_mapper = LAZY_INSTANCE_INITIALIZER; int idr = icon_mapper.Get().Lookup(group_, icon_size_); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), IconSizeToDIPSize(icon_size_))); image_skia.MakeThreadSafe();
diff --git a/chrome/browser/install_verification/win/module_ids.cc b/chrome/browser/install_verification/win/module_ids.cc index ade80d5..409eaab8 100644 --- a/chrome/browser/install_verification/win/module_ids.cc +++ b/chrome/browser/install_verification/win/module_ids.cc
@@ -88,7 +88,7 @@ base::StringPiece additional_module_ids; #if defined(GOOGLE_CHROME_BUILD) additional_module_ids = - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_ADDITIONAL_MODULE_IDS); #endif ParseAdditionalModuleIDs(additional_module_ids, module_ids);
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 5b2a568..521f1552 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc
@@ -64,6 +64,7 @@ #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/user_agent.h" +#include "content/public/network/url_request_context_builder_mojo.h" #include "extensions/features/features.h" #include "net/base/logging_network_change_observer.h" #include "net/cert/caching_cert_verifier.h" @@ -96,7 +97,6 @@ #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" -#include "net/url_request/url_request_context_builder_mojo.h" #include "net/url_request/url_request_context_getter.h" #include "url/url_constants.h" @@ -717,7 +717,7 @@ } void IOThread::SetUpProxyConfigService( - net::URLRequestContextBuilderMojo* builder, + content::URLRequestContextBuilderMojo* builder, std::unique_ptr<net::ProxyConfigService> proxy_config_service) const { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -747,8 +747,8 @@ } void IOThread::ConstructSystemRequestContext() { - std::unique_ptr<net::URLRequestContextBuilderMojo> builder = - base::MakeUnique<net::URLRequestContextBuilderMojo>(); + std::unique_ptr<content::URLRequestContextBuilderMojo> builder = + base::MakeUnique<content::URLRequestContextBuilderMojo>(); builder->set_network_quality_estimator( globals_->network_quality_estimator.get());
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index de92a52..5406c32 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h
@@ -56,6 +56,10 @@ class DnsProbeService; } +namespace content { +class URLRequestContextBuilderMojo; +} + namespace data_usage { class DataUseAggregator; } @@ -79,7 +83,6 @@ class RTTAndThroughputEstimatesObserver; class SSLConfigService; class URLRequestContext; -class URLRequestContextBuilderMojo; class URLRequestContextGetter; namespace ct { @@ -220,7 +223,7 @@ // |proxy_config_service| and sets a number of proxy-related options based on // prefs, policies, and the command line. void SetUpProxyConfigService( - net::URLRequestContextBuilderMojo* builder, + content::URLRequestContextBuilderMojo* builder, std::unique_ptr<net::ProxyConfigService> proxy_config_service) const; private:
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc index bd80bfa..ec1aedd 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc
@@ -11,10 +11,12 @@ #include "chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h" #include "chrome/browser/media/router/discovery/mdns/dns_sd_delegate.h" #include "chrome/browser/media/router/discovery/mdns/dns_sd_registry.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/common/media_router/media_sink.h" #include "components/cast_channel/cast_socket_service.h" #include "net/base/host_port_pair.h" #include "net/base/ip_address.h" +#include "net/url_request/url_request_context_getter.h" namespace { @@ -91,7 +93,9 @@ const OnSinksDiscoveredCallback& callback, content::BrowserContext* browser_context, const scoped_refptr<base::SequencedTaskRunner>& task_runner) - : MediaSinkService(callback), task_runner_(task_runner) { + : MediaSinkService(callback), + task_runner_(task_runner), + browser_context_(browser_context) { // TODO(crbug.com/749305): Migrate the discovery code to use sequences. DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(task_runner_); @@ -120,7 +124,9 @@ base::BindRepeating(&CastMediaSinkService::OnSinksDiscoveredOnIOThread, this), cast_channel::CastSocketService::GetInstance(), - DiscoveryNetworkMonitor::GetInstance(), task_runner_)); + DiscoveryNetworkMonitor::GetInstance(), + Profile::FromBrowserContext(browser_context_)->GetRequestContext(), + task_runner_)); } task_runner_->PostTask(
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.h b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.h index 16f0bad..ad7448d 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.h +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service.h
@@ -98,6 +98,8 @@ // List of cast sinks found in current round of mDNS discovery. std::vector<MediaSinkInternal> cast_sinks_; + content::BrowserContext* browser_context_; + DISALLOW_COPY_AND_ASSIGN(CastMediaSinkService); };
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc index c74e745..27ac924 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc
@@ -20,6 +20,8 @@ #include "components/net_log/chrome_net_log.h" #include "net/base/backoff_entry.h" #include "net/base/net_errors.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_getter.h" namespace { @@ -180,13 +182,14 @@ const OnSinksDiscoveredCallback& callback, cast_channel::CastSocketService* cast_socket_service, DiscoveryNetworkMonitor* network_monitor, + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, const scoped_refptr<base::SequencedTaskRunner>& task_runner) : MediaSinkServiceBase(callback), cast_socket_service_(cast_socket_service), network_monitor_(network_monitor), backoff_policy_(kDefaultBackoffPolicy), task_runner_(task_runner), - net_log_(g_browser_process->net_log()), + url_request_context_getter_(std::move(url_request_context_getter)), clock_(new base::DefaultClock()) { DETACH_FROM_SEQUENCE(sequence_checker_); DCHECK(cast_socket_service_); @@ -363,7 +366,10 @@ kDefaultConnectTimeoutInSeconds); cast_socket_service_->OpenSocket( - ip_endpoint, net_log_, + ip_endpoint, + url_request_context_getter_.get() + ? url_request_context_getter_->GetURLRequestContext()->net_log() + : nullptr, base::TimeDelta::FromSeconds(connect_timeout_in_seconds), base::BindOnce(&CastMediaSinkServiceImpl::OnChannelOpened, AsWeakPtr(), cast_sink, std::move(backoff_entry), sink_source,
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h index 61f407dd..677027b 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h
@@ -9,6 +9,7 @@ #include <set> #include "base/gtest_prod_util.h" +#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "chrome/browser/media/router/discovery/discovery_network_monitor.h" @@ -17,6 +18,7 @@ #include "components/cast_channel/cast_channel_enum.h" #include "components/cast_channel/cast_socket.h" #include "net/base/backoff_entry.h" +#include "net/url_request/url_request_context_getter.h" namespace cast_channel { class CastSocketService; @@ -41,6 +43,7 @@ const OnSinksDiscoveredCallback& callback, cast_channel::CastSocketService* cast_socket_service, DiscoveryNetworkMonitor* network_monitor, + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, const scoped_refptr<base::SequencedTaskRunner>& task_runner); ~CastMediaSinkServiceImpl() override; @@ -223,8 +226,9 @@ scoped_refptr<base::SequencedTaskRunner> task_runner_; - // Owned by |g_browser_process|. - net::NetLog* const net_log_; + // This is a temporary workaround to get access to the net::NetLog* from the + // NetworkService. + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; std::unique_ptr<base::Clock> clock_;
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc index e84c228b..e6212fa 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc
@@ -82,6 +82,7 @@ media_sink_service_impl_(mock_sink_discovered_cb_.Get(), mock_cast_socket_service_.get(), discovery_network_monitor_.get(), + nullptr /* url_request_context_getter */, mock_time_task_runner_.get()) {} void SetUp() override {
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_unittest.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_unittest.cc index 852dca9..ff17d400 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_unittest.cc +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_unittest.cc
@@ -62,6 +62,7 @@ : CastMediaSinkServiceImpl(callback, cast_socket_service, network_monitor, + nullptr /* url_request_context_getter */, task_runner) {} ~MockCastMediaSinkServiceImpl() override {}
diff --git a/chrome/browser/net/DEPS b/chrome/browser/net/DEPS index 4e3a9cb..ca7e7cf 100644 --- a/chrome/browser/net/DEPS +++ b/chrome/browser/net/DEPS
@@ -2,5 +2,6 @@ "+components/data_use_measurement", # For nss_context_chromeos_browsertest.cc. "+components/user_manager", + "+services/proxy_resolver/public/cpp", ]
diff --git a/chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc b/chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc index 3ed6244..44505c8e 100644 --- a/chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc +++ b/chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc
@@ -21,7 +21,7 @@ #include "ui/base/l10n/l10n_util.h" #else // defined(OS_ANDROID) #include "mojo/public/cpp/bindings/strong_binding.h" -#include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h" #endif // !defined(OS_ANDROID) namespace { @@ -47,8 +47,8 @@ std::unique_ptr<base::ScopedClosureRunner> ChromeMojoProxyResolverFactory::CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, - net::interfaces::ProxyResolverFactoryRequestClientPtr client) { + mojo::InterfaceRequest<proxy_resolver::mojom::ProxyResolver> req, + proxy_resolver::mojom::ProxyResolverFactoryRequestClientPtr client) { DCHECK(thread_checker_.CalledOnValidThread()); if (!resolver_factory_) CreateFactory(); @@ -73,8 +73,9 @@ DCHECK(!resolver_factory_); #if defined(OS_ANDROID) - mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(), - mojo::MakeRequest(&resolver_factory_)); + mojo::MakeStrongBinding( + base::MakeUnique<proxy_resolver::MojoProxyResolverFactoryImpl>(), + mojo::MakeRequest(&resolver_factory_)); #else // !defined(OS_ANDROID) DCHECK(!weak_utility_process_host_);
diff --git a/chrome/browser/net/chrome_mojo_proxy_resolver_factory.h b/chrome/browser/net/chrome_mojo_proxy_resolver_factory.h index 610b146..25bacf0 100644 --- a/chrome/browser/net/chrome_mojo_proxy_resolver_factory.h +++ b/chrome/browser/net/chrome_mojo_proxy_resolver_factory.h
@@ -11,7 +11,7 @@ #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "base/timer/timer.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" #if !defined(OS_ANDROID) namespace content { @@ -28,15 +28,17 @@ // Android, the proxy resolvers will run in the browser process, and on other // platforms, they'll all be run in the same utility process. Utility process // crashes are detected and the utility process is automatically restarted. -class ChromeMojoProxyResolverFactory : public net::MojoProxyResolverFactory { +class ChromeMojoProxyResolverFactory + : public proxy_resolver::MojoProxyResolverFactory { public: static ChromeMojoProxyResolverFactory* GetInstance(); - // Overridden from net::MojoProxyResolverFactory: + // Overridden from proxy_resolver::MojoProxyResolverFactory: std::unique_ptr<base::ScopedClosureRunner> CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, - net::interfaces::ProxyResolverFactoryRequestClientPtr client) override; + mojo::InterfaceRequest<proxy_resolver::mojom::ProxyResolver> req, + proxy_resolver::mojom::ProxyResolverFactoryRequestClientPtr client) + override; private: friend struct base::DefaultSingletonTraits<ChromeMojoProxyResolverFactory>; @@ -58,7 +60,7 @@ // destroyed. void OnIdleTimeout(); - net::interfaces::ProxyResolverFactoryPtr resolver_factory_; + proxy_resolver::mojom::ProxyResolverFactoryPtr resolver_factory_; #if !defined(OS_ANDROID) base::WeakPtr<content::UtilityProcessHost> weak_utility_process_host_;
diff --git a/chrome/browser/net/network_context_configuration_browsertest.cc b/chrome/browser/net/network_context_configuration_browsertest.cc index 4a8ef218..bbbc960 100644 --- a/chrome/browser/net/network_context_configuration_browsertest.cc +++ b/chrome/browser/net/network_context_configuration_browsertest.cc
@@ -85,29 +85,36 @@ void SetUpOnMainThread() override { switch (GetParam().network_context_type) { case NetworkContextType::kSystem: { - network_context_ = - g_browser_process->system_network_context_manager()->GetContext(); + SystemNetworkContextManager* system_network_context_manager = + g_browser_process->system_network_context_manager(); + network_context_ = system_network_context_manager->GetContext(); + loader_factory_ = system_network_context_manager->GetURLLoaderFactory(); break; } case NetworkContextType::kProfile: { - network_context_ = content::BrowserContext::GetDefaultStoragePartition( - browser()->profile()) - ->GetNetworkContext(); + content::StoragePartition* storage_partition = + content::BrowserContext::GetDefaultStoragePartition( + browser()->profile()); + network_context_ = storage_partition->GetNetworkContext(); + loader_factory_ = + storage_partition->GetURLLoaderFactoryForBrowserProcess(); break; } case NetworkContextType::kIncognitoProfile: { Browser* incognito = CreateIncognitoBrowser(); - network_context_ = content::BrowserContext::GetDefaultStoragePartition( - incognito->profile()) - ->GetNetworkContext(); + content::StoragePartition* storage_partition = + content::BrowserContext::GetDefaultStoragePartition( + incognito->profile()); + network_context_ = storage_partition->GetNetworkContext(); + loader_factory_ = + storage_partition->GetURLLoaderFactoryForBrowserProcess(); break; } } - network_context_->CreateURLLoaderFactory(MakeRequest(&loader_factory_), 0); } content::mojom::URLLoaderFactory* loader_factory() const { - return loader_factory_.get(); + return loader_factory_; } content::mojom::NetworkContext* network_context() const { @@ -129,7 +136,7 @@ private: content::mojom::NetworkContext* network_context_ = nullptr; - content::mojom::URLLoaderFactoryPtr loader_factory_; + content::mojom::URLLoaderFactory* loader_factory_ = nullptr; base::test::ScopedFeatureList feature_list_; };
diff --git a/chrome/browser/net/profile_network_context_service_browsertest.cc b/chrome/browser/net/profile_network_context_service_browsertest.cc index 829d29c7..5d9f51d 100644 --- a/chrome/browser/net/profile_network_context_service_browsertest.cc +++ b/chrome/browser/net/profile_network_context_service_browsertest.cc
@@ -27,7 +27,6 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/content_features.h" -#include "content/public/common/network_service.mojom.h" #include "content/public/common/url_loader_factory.mojom.h" #include "content/public/test/simple_url_loader_test_helper.h" #include "content/public/test/test_url_loader_client.h" @@ -60,20 +59,18 @@ } void SetUpOnMainThread() override { - network_context_ = content::BrowserContext::GetDefaultStoragePartition( - browser()->profile()) - ->GetNetworkContext(); - network_context_->CreateURLLoaderFactory(MakeRequest(&loader_factory_), 0); + loader_factory_ = content::BrowserContext::GetDefaultStoragePartition( + browser()->profile()) + ->GetURLLoaderFactoryForBrowserProcess(); } content::mojom::URLLoaderFactory* loader_factory() const { - return loader_factory_.get(); + return loader_factory_; } private: base::test::ScopedFeatureList feature_list_; - content::mojom::NetworkContext* network_context_ = nullptr; - content::mojom::URLLoaderFactoryPtr loader_factory_; + content::mojom::URLLoaderFactory* loader_factory_ = nullptr; }; IN_PROC_BROWSER_TEST_P(ProfileNetworkContextServiceBrowsertest,
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc index 7fdb3f9..882d291d 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc
@@ -9,6 +9,7 @@ #include "base/feature_list.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/process/process_handle.h" #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" @@ -85,6 +86,15 @@ return network_service_network_context_.get(); } +content::mojom::URLLoaderFactory* +SystemNetworkContextManager::GetURLLoaderFactory() { + if (!url_loader_factory_) { + GetContext()->CreateURLLoaderFactory( + mojo::MakeRequest(&url_loader_factory_), base::GetUniqueIdForProcess()); + } + return url_loader_factory_.get(); +} + void SystemNetworkContextManager::SetUp( content::mojom::NetworkContextRequest* network_context_request, content::mojom::NetworkContextParamsPtr* network_context_params,
diff --git a/chrome/browser/net/system_network_context_manager.h b/chrome/browser/net/system_network_context_manager.h index b06f8ef..529031c2b 100644 --- a/chrome/browser/net/system_network_context_manager.h +++ b/chrome/browser/net/system_network_context_manager.h
@@ -52,12 +52,18 @@ // called. content::mojom::NetworkContext* GetContext(); + // Returns a URLLoaderFactory owned by the SystemNetworkContextManager that is + // backed by the SystemNetworkContext. Allows sharing of the URLLoaderFactory. + // Prefer this to creating a new one. Call Clone() on the value returned by + // this method to get a URLLoaderFactory that can be used on other threads. + content::mojom::URLLoaderFactory* GetURLLoaderFactory(); + // Permanently disables QUIC, both for NetworkContexts using the IOThread's // NetworkService, and for those using the network service (if enabled). void DisableQuic(); private: - // NetworkContext using the network service, if the/ network service is + // NetworkContext using the network service, if the network service is // enabled. nullptr, otherwise. content::mojom::NetworkContextPtr network_service_network_context_; @@ -66,6 +72,10 @@ // network service is disabled. content::mojom::NetworkContextPtr io_thread_network_context_; + // URLLoaderFactory backed by the NetworkContext returned by GetContext(), so + // consumers don't all need to create their own factory. + content::mojom::URLLoaderFactoryPtr url_loader_factory_; + bool is_quic_allowed_ = true; DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager);
diff --git a/chrome/browser/notifications/message_center_display_service.cc b/chrome/browser/notifications/message_center_display_service.cc index d47f7d7..1fc2093 100644 --- a/chrome/browser/notifications/message_center_display_service.cc +++ b/chrome/browser/notifications/message_center_display_service.cc
@@ -8,6 +8,7 @@ #include <set> #include <string> +#include "chrome/browser/browser_process.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_display_service_factory.h" #include "chrome/browser/notifications/notification_handler.h" @@ -23,8 +24,7 @@ // display service (and on to the appropriate handler). This is a temporary // class to ease the transition from NotificationDelegate to // NotificationHandler. -// TODO(estade): also handle Click() and other NotificationDelegate actions as -// needed. +// TODO(estade): also handle other NotificationDelegate actions as needed. class PassThroughDelegate : public message_center::NotificationDelegate { public: PassThroughDelegate(Profile* profile, @@ -34,6 +34,22 @@ notification_(notification), notification_type_(notification_type) {} + void Close(bool by_user) override { + NotificationDisplayServiceFactory::GetForProfile(profile_) + ->ProcessNotificationOperation( + NotificationCommon::CLOSE, notification_type_, + notification_.origin_url().possibly_invalid_spec(), + notification_.id(), base::nullopt, base::nullopt, by_user); + } + + void Click() override { + NotificationDisplayServiceFactory::GetForProfile(profile_) + ->ProcessNotificationOperation( + NotificationCommon::CLICK, notification_type_, + notification_.origin_url().possibly_invalid_spec(), + notification_.id(), base::nullopt, base::nullopt, base::nullopt); + } + void ButtonClick(int button_index) override { NotificationDisplayServiceFactory::GetForProfile(profile_) ->ProcessNotificationOperation( @@ -55,12 +71,8 @@ } // namespace -MessageCenterDisplayService::MessageCenterDisplayService( - Profile* profile, - NotificationUIManager* ui_manager) - : NotificationDisplayService(profile), - profile_(profile), - ui_manager_(ui_manager) {} +MessageCenterDisplayService::MessageCenterDisplayService(Profile* profile) + : NotificationDisplayService(profile), profile_(profile) {} MessageCenterDisplayService::~MessageCenterDisplayService() {} @@ -73,11 +85,18 @@ // for Close/Click operations once the Notification object becomes a mojom // type. + // This can be called when the browser is shutting down and the + // NotificationUiManager has already destructed. + NotificationUIManager* ui_manager = + g_browser_process->notification_ui_manager(); + if (!ui_manager) + return; + NotificationHandler* handler = GetNotificationHandler(notification_type); handler->OnShow(profile_, notification_id); if (notification.delegate()) { - ui_manager_->Add(notification, profile_); + ui_manager->Add(notification, profile_); return; } @@ -90,20 +109,26 @@ notification.tag(), notification.rich_notification_data(), make_scoped_refptr( new PassThroughDelegate(profile_, notification, notification_type))); - ui_manager_->Add(notification_with_delegate, profile_); + ui_manager->Add(notification_with_delegate, profile_); } void MessageCenterDisplayService::Close( NotificationCommon::Type notification_type, const std::string& notification_id) { - ui_manager_->CancelById(notification_id, - NotificationUIManager::GetProfileID(profile_)); + // This can be called when the browser is shutting down and the + // NotificationUiManager has already destructed. + NotificationUIManager* ui_manager = + g_browser_process->notification_ui_manager(); + if (ui_manager) { + ui_manager->CancelById(notification_id, + NotificationUIManager::GetProfileID(profile_)); + } } void MessageCenterDisplayService::GetDisplayed( const DisplayedNotificationsCallback& callback) { - auto displayed_notifications = - std::make_unique<std::set<std::string>>(ui_manager_->GetAllIdsByProfile( + auto displayed_notifications = std::make_unique<std::set<std::string>>( + g_browser_process->notification_ui_manager()->GetAllIdsByProfile( NotificationUIManager::GetProfileID(profile_))); content::BrowserThread::PostTask(
diff --git a/chrome/browser/notifications/message_center_display_service.h b/chrome/browser/notifications/message_center_display_service.h index e0b9d5a..f42145d 100644 --- a/chrome/browser/notifications/message_center_display_service.h +++ b/chrome/browser/notifications/message_center_display_service.h
@@ -10,15 +10,13 @@ #include "chrome/browser/notifications/notification_display_service.h" class Notification; -class NotificationUIManager; class Profile; // Implementation of display service for notifications displayed by chrome // instead of the native platform notification center. class MessageCenterDisplayService : public NotificationDisplayService { public: - MessageCenterDisplayService(Profile* profile, - NotificationUIManager* ui_manager); + explicit MessageCenterDisplayService(Profile* profile); ~MessageCenterDisplayService() override; // NotificationDisplayService implementation. @@ -32,7 +30,6 @@ private: Profile* profile_; - NotificationUIManager* ui_manager_; DISALLOW_COPY_AND_ASSIGN(MessageCenterDisplayService); };
diff --git a/chrome/browser/notifications/native_notification_display_service.cc b/chrome/browser/notifications/native_notification_display_service.cc index 0801d46..093c0719 100644 --- a/chrome/browser/notifications/native_notification_display_service.cc +++ b/chrome/browser/notifications/native_notification_display_service.cc
@@ -58,8 +58,7 @@ notification_bridge_ready_ = true; } else { message_center_display_service_ = - std::make_unique<MessageCenterDisplayService>( - profile_, g_browser_process->notification_ui_manager()); + std::make_unique<MessageCenterDisplayService>(profile_); } while (!actions_.empty()) {
diff --git a/chrome/browser/notifications/notification_common.h b/chrome/browser/notifications/notification_common.h index e16f752..ec4dc5d 100644 --- a/chrome/browser/notifications/notification_common.h +++ b/chrome/browser/notifications/notification_common.h
@@ -41,7 +41,8 @@ NON_PERSISTENT = 1, EXTENSION = 2, PRODUCT_EOL = 3, - TYPE_MAX = PRODUCT_EOL, + DOWNLOAD = 4, + TYPE_MAX = DOWNLOAD, }; // A struct that contains extra data about a notification specific to one of
diff --git a/chrome/browser/notifications/notification_display_service.cc b/chrome/browser/notifications/notification_display_service.cc index afe19e1..40492e3 100644 --- a/chrome/browser/notifications/notification_display_service.cc +++ b/chrome/browser/notifications/notification_display_service.cc
@@ -40,6 +40,13 @@ notification_handlers_[notification_type] = std::move(handler); } +void NotificationDisplayService::RemoveNotificationHandler( + NotificationCommon::Type notification_type) { + auto iter = notification_handlers_.find(notification_type); + DCHECK(iter != notification_handlers_.end()); + notification_handlers_.erase(iter); +} + NotificationHandler* NotificationDisplayService::GetNotificationHandler( NotificationCommon::Type notification_type) { auto found = notification_handlers_.find(notification_type);
diff --git a/chrome/browser/notifications/notification_display_service.h b/chrome/browser/notifications/notification_display_service.h index a66180d..276e03d 100644 --- a/chrome/browser/notifications/notification_display_service.h +++ b/chrome/browser/notifications/notification_display_service.h
@@ -77,6 +77,9 @@ void AddNotificationHandler(NotificationCommon::Type notification_type, std::unique_ptr<NotificationHandler> handler); + // Removes an implementation object added via AddNotificationHandler. + void RemoveNotificationHandler(NotificationCommon::Type notification_type); + private: std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>> notification_handlers_;
diff --git a/chrome/browser/notifications/notification_display_service_factory.cc b/chrome/browser/notifications/notification_display_service_factory.cc index d662b66..860bf1c356 100644 --- a/chrome/browser/notifications/notification_display_service_factory.cc +++ b/chrome/browser/notifications/notification_display_service_factory.cc
@@ -10,7 +10,6 @@ #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/notifications/message_center_display_service.h" -#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h" @@ -74,9 +73,7 @@ g_browser_process->notification_platform_bridge()); } #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) - return new MessageCenterDisplayService( - Profile::FromBrowserContext(context), - g_browser_process->notification_ui_manager()); + return new MessageCenterDisplayService(Profile::FromBrowserContext(context)); } content::BrowserContext*
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc index 4db3f4e8..7e4a68b 100644 --- a/chrome/browser/notifications/notification_platform_bridge_linux.cc +++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc
@@ -14,6 +14,7 @@ #include <vector> #include "base/barrier_closure.h" +#include "base/files/file_path_watcher.h" #include "base/files/file_util.h" #include "base/i18n/number_formatting.h" #include "base/metrics/histogram_macros.h" @@ -30,6 +31,8 @@ #include "chrome/browser/notifications/notification_display_service_factory.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/shell_integration_linux.h" +#include "chrome/grit/chrome_unscaled_resources.h" +#include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/url_formatter/elide_url.h" #include "content/public/browser/browser_thread.h" @@ -38,8 +41,10 @@ #include "dbus/message.h" #include "dbus/object_proxy.h" #include "net/base/escape.h" +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "skia/ext/image_operations.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image_skia.h" namespace { @@ -80,6 +85,9 @@ // Notification on-screen time, in milliseconds. const int32_t kExpireTimeout = 25000; +// The maximum amount of characters for displaying the full origin path. +const size_t kMaxAllowedOriginLength = 28; + // The values in this enumeration correspond to those of the // Linux.NotificationPlatformBridge.InitializationStatus histogram, so // the ordering should not be changed. New error codes should be @@ -208,6 +216,7 @@ explicit ResourceFile(const base::FilePath& file_path) : file_path_(file_path) { DCHECK(!file_path.empty()); + DCHECK(file_path.IsAbsolute()); } ~ResourceFile() { base::DeleteFile(file_path_, false); } @@ -270,6 +279,10 @@ // count will go to 0 and the object would be prematurely // destructed. void Init() { + product_logo_png_bytes_ = + gfx::Image(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_PRODUCT_LOGO_256)) + .As1xPNGBytes(); PostTaskToTaskRunnerThread(base::BindOnce( &NotificationPlatformBridgeLinuxImpl::InitOnTaskRunner, this)); } @@ -378,9 +391,7 @@ }; ~NotificationPlatformBridgeLinuxImpl() override { - DCHECK(!bus_); - DCHECK(!notification_proxy_); - DCHECK(notifications_.empty()); + DCHECK(clean_up_on_task_runner_called_); } void Observe(int type, @@ -480,7 +491,11 @@ bus_->ShutdownAndBlock(); bus_ = nullptr; notification_proxy_ = nullptr; + product_logo_png_bytes_ = nullptr; + product_logo_file_.reset(); + product_logo_file_watcher_.reset(); notifications_.clear(); + clean_up_on_task_runner_called_ = true; } // Makes the "Notify" call to D-Bus. @@ -507,13 +522,18 @@ dbus::MethodCall method_call(kFreedesktopNotificationsName, kMethodNotify); dbus::MessageWriter writer(&method_call); - // app_name passed implicitly via desktop-entry. - writer.AppendString(""); + // app_name + writer.AppendString(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)); writer.AppendUint32(data->dbus_id); - // app_icon passed implicitly via desktop-entry. - writer.AppendString(""); + // app_icon + if (!product_logo_file_) { + RewriteProductLogoFile(); + } + writer.AppendString( + product_logo_file_ ? "file://" + product_logo_file_->file_path().value() + : ""); writer.AppendString( base::UTF16ToUTF8(CreateNotificationTitle(*notification))); @@ -528,6 +548,16 @@ base::UTF16ToUTF8(url_formatter::FormatUrlForSecurityDisplay( notification->origin_url(), url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS)); + if (url_display_text.size() > kMaxAllowedOriginLength) { + std::string domain_and_registry = + net::registry_controlled_domains::GetDomainAndRegistry( + notification->origin_url(), + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); + // localhost, raw IPs etc. are not handled by GetDomainAndRegistry. + if (!domain_and_registry.empty()) { + url_display_text = domain_and_registry; + } + } EscapeUnsafeCharacters(&url_display_text); if (body_markup && base::ContainsKey(capabilities_, kCapabilityBodyHyperlinks)) { @@ -548,9 +578,11 @@ std::string message = base::UTF16ToUTF8(notification->message()); if (body_markup) EscapeUnsafeCharacters(&message); - if (body.tellp()) - body << "\n"; - body << message; + if (!message.empty()) { + if (body.tellp()) + body << "\n"; + body << message; + } if (notification->type() == message_center::NOTIFICATION_TYPE_MULTIPLE) { for (const auto& item : notification->items()) { @@ -843,6 +875,15 @@ connected_signals_barrier_.Run(); } + void OnProductLogoFileChanged(const base::FilePath& path, bool error) { + // |error| should always be false on Linux. + DCHECK(!error); + // This callback runs whenever the file is deleted or modified. + // In either case, we want to rewrite the file. + product_logo_file_.reset(); + product_logo_file_watcher_.reset(); + } + void RecordMetricsForCapabilities() { // Histogram macros must be called with the same name for each // callsite, so we can't roll the below into a nice loop. @@ -875,6 +916,25 @@ base::ContainsKey(capabilities_, kCapabilitySound)); } + void RewriteProductLogoFile() { + product_logo_file_watcher_.reset(); + product_logo_file_ = WriteDataToTmpFile(product_logo_png_bytes_); + if (!product_logo_file_) + return; + // Temporary files may periodically get cleaned up on Linux. + // Watch for file deletion and rewrite the file in case we have a + // long-running Chrome process. + product_logo_file_watcher_ = std::make_unique<base::FilePathWatcher>(); + if (!product_logo_file_watcher_->Watch( + product_logo_file_->file_path(), false, + base::Bind( + &NotificationPlatformBridgeLinuxImpl::OnProductLogoFileChanged, + this))) { + product_logo_file_.reset(); + product_logo_file_watcher_.reset(); + } + } + ////////////////////////////////////////////////////////////////////////////// // Members used only on the UI thread. @@ -902,6 +962,10 @@ base::Closure connected_signals_barrier_; + scoped_refptr<base::RefCountedMemory> product_logo_png_bytes_; + std::unique_ptr<ResourceFile> product_logo_file_; + std::unique_ptr<base::FilePathWatcher> product_logo_file_watcher_; + // A std::set<std::unique_ptr<T>> doesn't work well because // eg. std::set::erase(T) would require a std::unique_ptr<T> // argument, so the data would get double-destructed. @@ -910,6 +974,8 @@ UnorderedUniqueSet<NotificationData> notifications_; + bool clean_up_on_task_runner_called_ = false; + DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeLinuxImpl); };
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc index a6a7ad39..f2fd0e7 100644 --- a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc +++ b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
@@ -520,3 +520,67 @@ NotificationCommon::PERSISTENT, "", "", false, NotificationBuilder("2").SetSilent(true).GetResult(), nullptr); } + +TEST_F(NotificationPlatformBridgeLinuxTest, OriginUrlFormat) { + EXPECT_CALL(*mock_notification_proxy_.get(), + CallMethodAndBlock(Calls("Notify"), _)) + .WillOnce(OnNotify( + [=](const NotificationRequest& request) { + EXPECT_EQ("google.com", request.body); + }, + 1)) + .WillOnce(OnNotify( + [=](const NotificationRequest& request) { + EXPECT_EQ("mail.google.com", request.body); + }, + 2)) + .WillOnce(OnNotify( + [=](const NotificationRequest& request) { + EXPECT_EQ("123.123.123.123", request.body); + }, + 3)) + .WillOnce(OnNotify( + [=](const NotificationRequest& request) { + EXPECT_EQ("a.b.c.co.uk", request.body); + }, + 4)) + .WillOnce(OnNotify( + [=](const NotificationRequest& request) { + EXPECT_EQ("evilsite.com", request.body); + }, + 4)); + + CreateNotificationBridgeLinux(std::vector<std::string>{"actions", "body"}, + true, true, true); + notification_bridge_linux_->Display( + NotificationCommon::PERSISTENT, "", "", false, + NotificationBuilder("1") + .SetOriginUrl(GURL("https://google.com")) + .GetResult(), + nullptr); + notification_bridge_linux_->Display( + NotificationCommon::PERSISTENT, "", "", false, + NotificationBuilder("2") + .SetOriginUrl(GURL("https://mail.google.com")) + .GetResult(), + nullptr); + notification_bridge_linux_->Display( + NotificationCommon::PERSISTENT, "", "", false, + NotificationBuilder("3") + .SetOriginUrl(GURL("https://123.123.123.123")) + .GetResult(), + nullptr); + notification_bridge_linux_->Display( + NotificationCommon::PERSISTENT, "", "", false, + NotificationBuilder("4") + .SetOriginUrl(GURL("https://a.b.c.co.uk/file.html")) + .GetResult(), + nullptr); + notification_bridge_linux_->Display( + NotificationCommon::PERSISTENT, "", "", false, + NotificationBuilder("5") + .SetOriginUrl(GURL( + "https://google.com.blahblahblahblahblahblahblah.evilsite.com")) + .GetResult(), + nullptr); +}
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc index 9ef57c6..7efe207 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -442,6 +442,8 @@ // TODO(peter): Handle different screen densities instead of always using the // 1x bitmap - crbug.com/585815. + // TODO(estade): The RichNotificationData should set |clickable| if there's a + // click handler. Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, notification_data.title, notification_data.body,
diff --git a/chrome/browser/pdf/pdf_extension_test_util.cc b/chrome/browser/pdf/pdf_extension_test_util.cc index 3d7c049..cd1dc783 100644 --- a/chrome/browser/pdf/pdf_extension_test_util.cc +++ b/chrome/browser/pdf/pdf_extension_test_util.cc
@@ -12,7 +12,7 @@ bool EnsurePDFHasLoaded(content::WebContents* web_contents) { std::string scripting_api_js = - ResourceBundle::GetSharedInstance() + ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_PDF_PDF_SCRIPTING_API_JS) .as_string(); CHECK(content::ExecuteScript(web_contents, scripting_api_js));
diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc index 3290c51f..55f4be2 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc
@@ -27,9 +27,9 @@ #endif std::string GetManifest() { - std::string manifest_contents = - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_PDF_MANIFEST).as_string(); + std::string manifest_contents = ui::ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_PDF_MANIFEST) + .as_string(); DCHECK(manifest_contents.find(kNameTag) != std::string::npos); base::ReplaceFirstSubstringAfterOffset( &manifest_contents, 0, kNameTag,
diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index 75c6ecab..6c9261e1 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc
@@ -181,7 +181,7 @@ // static base::DictionaryValue* PluginFinder::LoadBuiltInPluginList() { base::StringPiece json_resource( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_PLUGIN_DB_JSON)); std::string error_str; int error_code = base::JSONReader::JSON_NO_ERROR;
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index f1f3aa5c..6ba3a76a 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -880,7 +880,7 @@ // The "en-US" ResourceBundle is always loaded before this step for tests, // but in this test we want the browser to load the bundle as it // normally would. - ResourceBundle::CleanupSharedInstance(); + ui::ResourceBundle::CleanupSharedInstance(); } };
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index bc4a2a7..40b13586 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -355,8 +355,9 @@ #endif std::string seed; #if defined(GOOGLE_CHROME_BUILD) - seed = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_PREF_HASH_SEED_BIN).as_string(); + seed = ui::ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_PREF_HASH_SEED_BIN) + .as_string(); #endif return base::MakeUnique<ProfilePrefStoreManager>(profile_path, seed, legacy_device_id); @@ -376,8 +377,8 @@ #if BUILDFLAG(ENABLE_SUPERVISED_USERS) if (supervised_user_settings) { - scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr( - new SupervisedUserPrefStore(supervised_user_settings)); + scoped_refptr<PrefStore> supervised_user_prefs = + base::MakeRefCounted<SupervisedUserPrefStore>(supervised_user_settings); DCHECK(async || supervised_user_prefs->IsInitializationComplete()); factory->set_supervised_user_prefs(supervised_user_prefs); } @@ -385,8 +386,9 @@ factory->set_async(async); factory->set_extension_prefs(extension_prefs); - factory->set_command_line_prefs(make_scoped_refptr( - new ChromeCommandLinePrefStore(base::CommandLine::ForCurrentProcess()))); + factory->set_command_line_prefs( + base::MakeRefCounted<ChromeCommandLinePrefStore>( + base::CommandLine::ForCurrentProcess())); factory->set_read_error_callback(base::Bind(&HandleReadError, pref_filename)); factory->set_user_prefs(user_pref_store); factory->SetPrefModelAssociatorClient(
diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc index 96d10d2..365c3ca 100644 --- a/chrome/browser/printing/print_job_manager.cc +++ b/chrome/browser/printing/print_job_manager.cc
@@ -47,8 +47,7 @@ scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery( int render_process_id, int render_frame_id) { - return make_scoped_refptr( - new PrinterQuery(render_process_id, render_frame_id)); + return base::MakeRefCounted<PrinterQuery>(render_process_id, render_frame_id); } void PrintQueriesQueue::Shutdown() {
diff --git a/chrome/browser/profiles/avatar_menu_desktop.cc b/chrome/browser/profiles/avatar_menu_desktop.cc index cd8ec22..40b6a4e3 100644 --- a/chrome/browser/profiles/avatar_menu_desktop.cc +++ b/chrome/browser/profiles/avatar_menu_desktop.cc
@@ -49,7 +49,8 @@ const size_t icon_index = entry->GetAvatarIconIndex(); const int resource_id = profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index); - *image = ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); + *image = + ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); return status; }
diff --git a/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc b/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc index 0eb20e7..b442ea1 100644 --- a/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc +++ b/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc
@@ -36,7 +36,8 @@ TEST(ProfileInfoUtilTest, SizedMenuIcon) { // Test that an avatar icon isn't changed. const gfx::Image& profile_image( - ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PROFILE_AVATAR_0)); gfx::Image result = profiles::GetSizedAvatarIcon(profile_image, false, 50, 50); @@ -56,7 +57,8 @@ TEST(ProfileInfoUtilTest, MenuIcon) { // Test that an avatar icon isn't changed. const gfx::Image& profile_image( - ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PROFILE_AVATAR_0)); gfx::Image result = profiles::GetAvatarIconForMenu(profile_image, false); EXPECT_FALSE(gfx::test::IsEmpty(result)); EXPECT_TRUE(gfx::test::AreImagesEqual(profile_image, result)); @@ -72,7 +74,8 @@ TEST(ProfileInfoUtilTest, WebUIIcon) { // Test that an avatar icon isn't changed. const gfx::Image& profile_image( - ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PROFILE_AVATAR_0)); gfx::Image result = profiles::GetAvatarIconForWebUI(profile_image, false); EXPECT_FALSE(gfx::test::IsEmpty(result)); EXPECT_TRUE(gfx::test::AreImagesEqual(profile_image, result)); @@ -91,7 +94,8 @@ // Test that an avatar icon isn't changed. const gfx::Image& profile_image( - ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PROFILE_AVATAR_0)); gfx::Image result = profiles::GetAvatarIconForTitleBar( profile_image, false, width, height); EXPECT_FALSE(gfx::test::IsEmpty(result));
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index ce163b3..e0122ed 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -229,7 +229,8 @@ int resource_id = profiles::GetDefaultAvatarIconResourceIDAtIndex( GetAvatarIconIndexOfProfileAtIndex(index)); - return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( + resource_id); } bool ProfileInfoCache::GetBackgroundStatusOfProfileAtIndex(
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 510da2766..d3517ac 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -367,7 +367,7 @@ int default_avatar_id = profiles::GetDefaultAvatarIconResourceIDAtIndex(kDefaultAvatarIndex); const gfx::Image& default_avatar_image( - ResourceBundle::GetSharedInstance().GetImageNamed(default_avatar_id)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed(default_avatar_id)); EXPECT_TRUE(gfx::test::AreImagesEqual( default_avatar_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); @@ -393,7 +393,7 @@ int other_avatar_id = profiles::GetDefaultAvatarIconResourceIDAtIndex(kOtherAvatarIndex); const gfx::Image& other_avatar_image( - ResourceBundle::GetSharedInstance().GetImageNamed(other_avatar_id)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed(other_avatar_id)); EXPECT_TRUE(gfx::test::AreImagesEqual( other_avatar_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); @@ -461,7 +461,7 @@ base::string16 profile_name = ASCIIToUTF16("name_1"); int id = profiles::GetDefaultAvatarIconResourceIDAtIndex(0); const gfx::Image& profile_image( - ResourceBundle::GetSharedInstance().GetImageNamed(id)); + ui::ResourceBundle::GetSharedInstance().GetImageNamed(id)); GetCache()->AddProfileToCache( GetProfilePath("path_1"), profile_name, std::string(), base::string16(),
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 253b70e9..535904b 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc
@@ -81,6 +81,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_context.h" #include "content/public/common/content_switches.h" +#include "content/public/network/url_request_context_builder_mojo.h" #include "extensions/features/features.h" #include "net/cert/cert_verifier.h" #include "net/cert/ct_log_verifier.h" @@ -107,7 +108,6 @@ #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" -#include "net/url_request/url_request_context_builder_mojo.h" #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_intercepting_job_factory.h" @@ -143,6 +143,7 @@ #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/net/nss_context.h" +#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/settings/cros_settings_names.h" #include "chromeos/tpm/tpm_token_info_getter.h" @@ -283,16 +284,14 @@ void DidGetTPMInfoForUserOnUIThread( std::unique_ptr<chromeos::TPMTokenInfoGetter> getter, const std::string& username_hash, - const chromeos::TPMTokenInfo& info) { + base::Optional<chromeos::CryptohomeClient::TpmTokenInfo> token_info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (info.tpm_is_enabled && info.token_slot_id != -1) { + if (token_info.has_value() && token_info->slot != -1) { DVLOG(1) << "Got TPM slot for " << username_hash << ": " - << info.token_slot_id; - BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, - base::Bind(&crypto::InitializeTPMForChromeOSUser, - username_hash, info.token_slot_id)); + << token_info->slot; + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(&crypto::InitializeTPMForChromeOSUser, + username_hash, token_info->slot)); } else { NOTREACHED() << "TPMTokenInfoGetter reported invalid token."; } @@ -314,10 +313,9 @@ // before TPM token info is fetched. // TODO(tbarzic, pneubeck): Handle this in a nicer way when this logic is // moved to a separate profile service. - token_info_getter->Start( - base::Bind(&DidGetTPMInfoForUserOnUIThread, - base::Passed(&scoped_token_info_getter), - username_hash)); + token_info_getter->Start(base::BindOnce(&DidGetTPMInfoForUserOnUIThread, + std::move(scoped_token_info_getter), + username_hash)); } void StartTPMSlotInitializationOnIOThread(const AccountId& account_id, @@ -1008,8 +1006,8 @@ extensions_request_context_->set_name("extensions"); // Create the main request context. - std::unique_ptr<net::URLRequestContextBuilderMojo> builder = - base::MakeUnique<net::URLRequestContextBuilderMojo>(); + std::unique_ptr<content::URLRequestContextBuilderMojo> builder = + base::MakeUnique<content::URLRequestContextBuilderMojo>(); builder->set_net_log(io_thread->net_log()); builder->set_shared_http_user_agent_settings(
diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index cc90f97..5bb4cc0 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc
@@ -683,7 +683,7 @@ // to another thread. SkBitmap GetImageResourceSkBitmapCopy(int resource_id) { const gfx::Image image = - ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); + ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); return GetSkBitmapCopy(image); }
diff --git a/chrome/browser/resources/md_history/app.html b/chrome/browser/resources/md_history/app.html index b4fd0e1..ddd7280 100644 --- a/chrome/browser/resources/md_history/app.html +++ b/chrome/browser/resources/md_history/app.html
@@ -71,7 +71,6 @@ querying="[[queryState_.querying]]" search-term="[[queryState_.searchTerm]]" show-menu-promo="[[showMenuPromo_]]" - show-sync-notice="[[showSyncNotice_(hasSyncedResults, selectedPage_)]]" spinner-active="[[shouldShowSpinner_(queryState_.querying, queryState_.incremental, queryState_.searchTerm)]]">
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js index 9644ae6..0c25e14 100644 --- a/chrome/browser/resources/md_history/app.js +++ b/chrome/browser/resources/md_history/app.js
@@ -76,8 +76,6 @@ // Used to display notices for profile sign-in status. showSidebarFooter: Boolean, - - hasSyncedResults: Boolean, }, listeners: { @@ -278,16 +276,6 @@ return querying && !incremental && searchTerm != ''; }, - /** - * @param {boolean} hasSyncedResults - * @param {string} selectedPage - * @return {boolean} Whether the (i) synced results notice should be shown. - * @private - */ - showSyncNotice_: function(hasSyncedResults, selectedPage) { - return hasSyncedResults && selectedPage != 'syncedTabs'; - }, - /** @private */ selectedPageChanged_: function() { this.unselectAll();
diff --git a/chrome/browser/resources/md_history/externs.js b/chrome/browser/resources/md_history/externs.js index 590c127..8f7d7c26 100644 --- a/chrome/browser/resources/md_history/externs.js +++ b/chrome/browser/resources/md_history/externs.js
@@ -34,7 +34,6 @@ * chrome/browser/ui/webui/browsing_history_handler.cc: * BrowsingHistoryHandler::QueryComplete() * @typedef {{finished: boolean, - * hasSyncedResults: boolean, * term: string}} */ var HistoryQuery;
diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js index e6c5ff0..c9571285 100644 --- a/chrome/browser/resources/md_history/history.js +++ b/chrome/browser/resources/md_history/history.js
@@ -52,16 +52,13 @@ /** * Called by the history backend after receiving results and after discovering * the existence of other forms of browsing history. - * @param {boolean} hasSyncedResults Whether there are synced results. * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include * a sentence about the existence of other forms of browsing history. */ -function showNotification( - hasSyncedResults, includeOtherFormsOfBrowsingHistory) { +function showNotification(includeOtherFormsOfBrowsingHistory) { waitForAppUpgrade().then(function() { var app = /** @type {HistoryAppElement} */ ($('history-app')); app.showSidebarFooter = includeOtherFormsOfBrowsingHistory; - app.hasSyncedResults = hasSyncedResults; }); }
diff --git a/chrome/browser/resources/md_history/history_toolbar.html b/chrome/browser/resources/md_history/history_toolbar.html index 2a69ab5..12fd39c 100644 --- a/chrome/browser/resources/md_history/history_toolbar.html +++ b/chrome/browser/resources/md_history/history_toolbar.html
@@ -37,43 +37,6 @@ cr-toolbar-selection-overlay { --selection-overlay-max-width: var(--card-max-width); } - - /* Info button and dropdown. */ - - #info-button { - /* Additional styles for unresolved <button>. */ - background: none; - border: none; - color: inherit; - height: 32px; - margin: 6px; - outline: none; - padding: 0; - width: 32px; - } - - #info-button-icon { - height: 20px; - width: 20px; - } - - #sync-notice { - @apply(--shadow-elevation-2dp); - background-color: white; - border-radius: 2px; - color: var(--primary-text-color); - overflow: hidden; - padding: 12px 20px; - position: absolute; - right: 24px; - top: 46px; - z-index: 1; - } - - :host-context([dir=rtl]) #sync-notice { - left: 24px; - right: auto; - } </style> <cr-toolbar id="main-toolbar" page-name="$i18n{title}" @@ -87,20 +50,7 @@ menu-promo="$i18n{menuPromo}" close-menu-promo="$i18n{closeMenuPromo}" on-search-changed="onSearchChanged_"> - <div class="more-actions"> - <template is="dom-if" if="[[showSyncNotice]]"> - <button is="paper-icon-button-light" id="info-button" - on-click="onInfoButtonTap_" - aria-label="$i18n{hasSyncedResultsDescription}"> - <iron-icon icon="history:info-outline" id="info-button-icon"> - </iron-icon> - </button> - </template> - </div> </cr-toolbar> - <div id="sync-notice" hidden="[[!syncNoticeVisible_]]"> - $i18nRaw{hasSyncedResults} - </div> <template is="dom-if" if="[[itemsSelected_]]"> <cr-toolbar-selection-overlay delete-label="$i18n{delete}" cancel-label="$i18n{cancel}"
diff --git a/chrome/browser/resources/md_history/history_toolbar.js b/chrome/browser/resources/md_history/history_toolbar.js index 62da493..7b70d8ea 100644 --- a/chrome/browser/resources/md_history/history_toolbar.js +++ b/chrome/browser/resources/md_history/history_toolbar.js
@@ -41,19 +41,6 @@ reflectToAttribute: true, }, - // Show an (i) button on the right of the toolbar to display a notice about - // synced history. - showSyncNotice: { - type: Boolean, - observer: 'showSyncNoticeChanged_', - }, - - // Sync notice is currently visible. - syncNoticeVisible_: { - type: Boolean, - value: false, - }, - hasMoreResults: Boolean, querying: Boolean, @@ -65,27 +52,6 @@ showMenuPromo: Boolean, }, - /** - * True if the document currently has listeners to dismiss the sync notice, - * which are added when the notice is first opened. - * @private{boolean} - */ - hasDismissListeners_: false, - - /** @private{?function(!Event)} */ - boundOnDocumentClick_: null, - - /** @private{?function(!Event)} */ - boundOnDocumentKeydown_: null, - - /** @override */ - detached: function() { - if (this.hasDismissListeners_) { - document.removeEventListener('click', this.boundOnDocumentClick_); - document.removeEventListener('keydown', this.boundOnDocumentKeydown_); - } - }, - /** @return {CrToolbarSearchFieldElement} */ get searchField() { return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) @@ -125,12 +91,6 @@ } }, - /** @private */ - showSyncNoticeChanged_: function() { - if (!this.showSyncNotice) - this.syncNoticeVisible_ = false; - }, - /** * @param {!CustomEvent} event * @private @@ -139,43 +99,6 @@ this.fire('change-query', {search: event.detail}); }, - /** - * @param {!MouseEvent} e - * @private - */ - onInfoButtonTap_: function(e) { - this.syncNoticeVisible_ = !this.syncNoticeVisible_; - e.stopPropagation(); - - if (this.hasDismissListeners_) - return; - - this.boundOnDocumentClick_ = this.onDocumentClick_.bind(this); - this.boundOnDocumentKeydown_ = this.onDocumentKeydown_.bind(this); - document.addEventListener('click', this.boundOnDocumentClick_); - document.addEventListener('keydown', this.boundOnDocumentKeydown_); - - this.hasDismissListeners_ = true; - }, - - /** - * @param {!Event} e - * @private - */ - onDocumentClick_: function(e) { - if (e.path.indexOf(this.$['sync-notice']) == -1) - this.syncNoticeVisible_ = false; - }, - - /** - * @param {!Event} e - * @private - */ - onDocumentKeydown_: function(e) { - if (e.key == 'Escape') - this.syncNoticeVisible_ = false; - }, - /** @private */ numberOfItemsSelected_: function(count) { return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : '';
diff --git a/chrome/browser/resources/md_history/icons.html b/chrome/browser/resources/md_history/icons.html index 7f0f09a9..2714b83 100644 --- a/chrome/browser/resources/md_history/icons.html +++ b/chrome/browser/resources/md_history/icons.html
@@ -9,7 +9,6 @@ See http://goo.gl/Y1OdAq for instructions on adding additional icons. --> <g id="chevron-left"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g> - <g id="info-outline"><path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"></path></g> <g id="today"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"></path></g> </defs> </svg>
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.cc b/chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.cc index 26626ea5..626ca93 100644 --- a/chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.cc +++ b/chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.cc
@@ -62,7 +62,7 @@ webui::SetLoadTimeDataDefaults(controller()->GetApplicationLocale(), &load_time_data); std::string html = - ResourceBundle::GetSharedInstance() + ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_QUIET_HTML) .as_string(); webui::AppendWebUiCssTextDefaults(&html);
diff --git a/chrome/browser/search/iframe_source.cc b/chrome/browser/search/iframe_source.cc index a64a254..5149906f 100644 --- a/chrome/browser/search/iframe_source.cc +++ b/chrome/browser/search/iframe_source.cc
@@ -73,7 +73,8 @@ int resource_id, const content::URLDataSource::GotDataCallback& callback) { scoped_refptr<base::RefCountedMemory> response( - ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id)); + ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( + resource_id)); callback.Run(response.get()); } @@ -88,7 +89,7 @@ } base::StringPiece template_js = - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); + ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); std::string response(template_js.as_string()); base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin); callback.Run(base::RefCountedString::TakeString(&response));
diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index 809c30ef..b551c38 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc
@@ -517,7 +517,7 @@ #endif // !defined(GOOGLE_CHROME_BUILD) if (stripped_path == kMainHtmlFilename) { - std::string html = ResourceBundle::GetSharedInstance() + std::string html = ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_LOCAL_NTP_HTML) .as_string(); std::string config_integrity = base::StringPrintf( @@ -549,7 +549,7 @@ for (size_t i = 0; i < arraysize(kResources); ++i) { if (filename == kResources[i].filename) { scoped_refptr<base::RefCountedMemory> response( - ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( kResources[i].identifier, scale_factor)); callback.Run(response.get()); return;
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 195ea49b3..8c075e1 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc
@@ -1041,7 +1041,7 @@ } gfx::ImageFamily icon_images; - ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); icon_images.Add(*resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_16)); icon_images.Add(*resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_32)); icon_images.Add(*resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_48));
diff --git a/chrome/browser/supervised_user/supervised_user_theme.cc b/chrome/browser/supervised_user/supervised_user_theme.cc index 6c59bb92..bf8ecadd 100644 --- a/chrome/browser/supervised_user/supervised_user_theme.cc +++ b/chrome/browser/supervised_user/supervised_user_theme.cc
@@ -61,7 +61,7 @@ return gfx::Image(); id = MapToSupervisedUserResourceIds(id); - return ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); } bool SupervisedUserTheme::HasCustomImage(int id) const {
diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc index 98a80a8e4..b535ad218 100644 --- a/chrome/browser/sync/test/integration/autofill_helper.cc +++ b/chrome/browser/sync/test/integration/autofill_helper.cc
@@ -305,7 +305,7 @@ PersonalDataManager* pdm = GetPersonalDataManager(profile); pdm->Refresh(); - // PersonalDataManager::web_profiles() simply returns the current values that + // PersonalDataManager::GetProfiles() simply returns the current values that // have been last reported to the UI sequence. PersonalDataManager::Refresh() // will post a task to the DB sequence to read back the latest values, and we // very much want the latest values. Unfortunately, the Refresh() call is @@ -315,13 +315,13 @@ // scheduled, and we cannot ensure that we have the latest view. Instead // explicitly wait for our Refresh to have executed. It is possible for // another write to sneak in between our Refresh() and the task that is - // blocked for, causing the web_profiles() read to return even more current + // blocked for, causing the GetProfiles() read to return even more current // data, but this shouldn't cause problems. While PersonalDataManager will // cancel outstanding queries, this is only instigated on the UI sequence, // which we are about to block, which means we are safe. base::TaskScheduler::GetInstance()->FlushForTesting(); - return pdm->web_profiles(); + return pdm->GetProfiles(); } int GetProfileCount(int profile) { @@ -380,9 +380,9 @@ bool AutofillProfileChecker::IsExitConditionSatisfied() { const std::vector<AutofillProfile*>& autofill_profiles_a = - autofill_helper::GetPersonalDataManager(profile_a_)->web_profiles(); + autofill_helper::GetPersonalDataManager(profile_a_)->GetProfiles(); const std::vector<AutofillProfile*>& autofill_profiles_b = - autofill_helper::GetPersonalDataManager(profile_b_)->web_profiles(); + autofill_helper::GetPersonalDataManager(profile_b_)->GetProfiles(); return ProfilesMatchImpl(profile_a_, autofill_profiles_a, profile_b_, autofill_profiles_b); }
diff --git a/chrome/browser/task_manager/providers/browser_process_task.cc b/chrome/browser/task_manager/providers/browser_process_task.cc index d12a0e1..fd476a1 100644 --- a/chrome/browser/task_manager/providers/browser_process_task.cc +++ b/chrome/browser/task_manager/providers/browser_process_task.cc
@@ -18,8 +18,8 @@ gfx::ImageSkia* g_default_icon = nullptr; gfx::ImageSkia* GetDefaultIcon() { - if (!g_default_icon && ResourceBundle::HasSharedInstance()) { - g_default_icon = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + if (!g_default_icon && ui::ResourceBundle::HasSharedInstance()) { + g_default_icon = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PRODUCT_LOGO_16); if (g_default_icon) g_default_icon->MakeThreadSafe();
diff --git a/chrome/browser/task_manager/providers/child_process_task.cc b/chrome/browser/task_manager/providers/child_process_task.cc index 871c975c..9fb5c49a 100644 --- a/chrome/browser/task_manager/providers/child_process_task.cc +++ b/chrome/browser/task_manager/providers/child_process_task.cc
@@ -36,8 +36,8 @@ gfx::ImageSkia* g_default_icon = nullptr; gfx::ImageSkia* GetDefaultIcon() { - if (!g_default_icon && ResourceBundle::HasSharedInstance()) { - g_default_icon = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + if (!g_default_icon && ui::ResourceBundle::HasSharedInstance()) { + g_default_icon = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PLUGINS_FAVICON); }
diff --git a/chrome/browser/task_manager/providers/web_contents/background_contents_task.cc b/chrome/browser/task_manager/providers/web_contents/background_contents_task.cc index f55ee9f..194338a 100644 --- a/chrome/browser/task_manager/providers/web_contents/background_contents_task.cc +++ b/chrome/browser/task_manager/providers/web_contents/background_contents_task.cc
@@ -29,8 +29,8 @@ gfx::ImageSkia* g_default_icon = nullptr; gfx::ImageSkia* GetDefaultIcon() { - if (!g_default_icon && ResourceBundle::HasSharedInstance()) { - g_default_icon = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + if (!g_default_icon && ui::ResourceBundle::HasSharedInstance()) { + g_default_icon = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PLUGINS_FAVICON); }
diff --git a/chrome/browser/task_manager/providers/web_contents/extension_task.cc b/chrome/browser/task_manager/providers/web_contents/extension_task.cc index a6eaec1..1d0268d 100644 --- a/chrome/browser/task_manager/providers/web_contents/extension_task.cc +++ b/chrome/browser/task_manager/providers/web_contents/extension_task.cc
@@ -27,11 +27,11 @@ gfx::ImageSkia* g_default_icon = nullptr; gfx::ImageSkia* GetDefaultIcon() { - if (!ResourceBundle::HasSharedInstance()) + if (!ui::ResourceBundle::HasSharedInstance()) return nullptr; if (!g_default_icon) { - g_default_icon = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + g_default_icon = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_EXTENSIONS_FAVICON); }
diff --git a/chrome/browser/task_manager/providers/web_contents/prerender_task.cc b/chrome/browser/task_manager/providers/web_contents/prerender_task.cc index c0efd6e..70633d6 100644 --- a/chrome/browser/task_manager/providers/web_contents/prerender_task.cc +++ b/chrome/browser/task_manager/providers/web_contents/prerender_task.cc
@@ -22,11 +22,11 @@ if (g_prerender_icon) return g_prerender_icon; - if (!ResourceBundle::HasSharedInstance()) + if (!ui::ResourceBundle::HasSharedInstance()) return nullptr; g_prerender_icon = - ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_PRERENDER); + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_PRERENDER); return g_prerender_icon; }
diff --git a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc index 6b359f22..e717f987 100644 --- a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc +++ b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc
@@ -316,7 +316,7 @@ // Check that the task manager uses the default favicon for the page. gfx::Image default_favicon_image = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( + ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_DEFAULT_FAVICON); EXPECT_TRUE(gfx::test::AreImagesEqual(default_favicon_image, gfx::Image(task->icon())));
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index e57a1c29..601aef0b 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc
@@ -236,7 +236,7 @@ ThemeService::ThemeService() : ready_(false), - rb_(ResourceBundle::GetSharedInstance()), + rb_(ui::ResourceBundle::GetSharedInstance()), profile_(nullptr), installed_pending_load_id_(kDefaultThemeID), number_of_infobars_(0),
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 8115b5ed..7846b43 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1601,6 +1601,8 @@ "cocoa/renderer_context_menu/render_view_context_menu_mac.mm", "cocoa/scoped_menu_bar_lock.h", "cocoa/scoped_menu_bar_lock.mm", + "cocoa/share_menu_controller.h", + "cocoa/share_menu_controller.mm", "cocoa/status_icons/status_icon_mac.h", "cocoa/status_icons/status_icon_mac.mm", "cocoa/status_icons/status_tray_mac.h",
diff --git a/chrome/browser/ui/app_list/arc/arc_app_icon.cc b/chrome/browser/ui/app_list/arc/arc_app_icon.cc index bf92986..187ce0b 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_icon.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_icon.cc
@@ -148,8 +148,8 @@ if (it != default_icons_cache_.Get().end()) return it->second.GetRepresentation(scale); - const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance(). - GetImageSkiaNamed(resource_id); + const gfx::ImageSkia* default_image = + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); CHECK(default_image); gfx::ImageSkia resized_image = gfx::ImageSkiaOperations::CreateResizedImage( *default_image, skia::ImageOperations::RESIZE_BEST,
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc index 3ebcc15..f31fee09 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc
@@ -102,7 +102,7 @@ int resource_id = scale >= 1.5f ? IDR_ARC_SUPPORT_ICON_96 : IDR_ARC_SUPPORT_ICON_48; icon_to_scale = - ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); } else { icon_to_scale = &decoded_icon_; }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 20c08a5..bbce633a 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -1088,7 +1088,7 @@ ash::ShelfItem browser_shortcut; browser_shortcut.type = ash::TYPE_BROWSER_SHORTCUT; browser_shortcut.id = ash::ShelfID(kChromeAppId); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); browser_shortcut.image = *rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_32); browser_shortcut.title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); std::unique_ptr<BrowserShortcutLauncherItemController> item_delegate =
diff --git a/chrome/browser/ui/ash/networking_config_delegate_chromeos_browsertest.cc b/chrome/browser/ui/ash/networking_config_delegate_chromeos_browsertest.cc index c2eda4b9..4adc80ec 100644 --- a/chrome/browser/ui/ash/networking_config_delegate_chromeos_browsertest.cc +++ b/chrome/browser/ui/ash/networking_config_delegate_chromeos_browsertest.cc
@@ -62,7 +62,7 @@ // Show the network detail view. ash::TrayNetwork* tray_network = ash::SystemTrayTestApi(system_tray).tray_network(); - system_tray->ShowDetailedView(tray_network, 0, false, ash::BUBBLE_CREATE_NEW); + system_tray->ShowDetailedView(tray_network, 0, ash::BUBBLE_CREATE_NEW); content::RunAllPendingInMessageLoop(); ASSERT_TRUE(tray_network->detailed());
diff --git a/chrome/browser/ui/ash/session_controller_client.cc b/chrome/browser/ui/ash/session_controller_client.cc index 1215cb9..0e88b6c 100644 --- a/chrome/browser/ui/ash/session_controller_client.cc +++ b/chrome/browser/ui/ash/session_controller_client.cc
@@ -94,7 +94,7 @@ session->user_info->avatar = user.GetImage(); if (session->user_info->avatar.isNull()) { session->user_info->avatar = - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_LOGIN_DEFAULT_USER); }
diff --git a/chrome/browser/ui/cocoa/accelerators_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/accelerators_cocoa_browsertest.mm index 9191a67d..82e51af 100644 --- a/chrome/browser/ui/cocoa/accelerators_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/accelerators_cocoa_browsertest.mm
@@ -7,9 +7,11 @@ #include "base/logging.h" #include "chrome/app/chrome_command_ids.h" #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" +#include "chrome/grit/generated_resources.h" #include "chrome/test/base/in_process_browser_test.h" #include "testing/gtest_mac.h" #include "ui/base/accelerators/platform_accelerator_cocoa.h" +#include "ui/base/l10n/l10n_util_mac.h" #import "ui/events/keycodes/keyboard_code_conversion_mac.h" typedef InProcessBrowserTest AcceleratorsCocoaBrowserTest; @@ -112,6 +114,13 @@ IN_PROC_BROWSER_TEST_F(AcceleratorsCocoaBrowserTest, MappingAcceleratorsInMainMenu) { AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance(); + // The "Share" menu is dynamically populated. + NSMenu* mainMenu = [NSApp mainMenu]; + NSMenu* fileMenu = [[mainMenu itemWithTag:IDC_FILE_MENU] submenu]; + NSMenu* shareMenu = + [[fileMenu itemWithTitle:l10n_util::GetNSString(IDS_SHARE_MAC)] submenu]; + [[shareMenu delegate] menuNeedsUpdate:shareMenu]; + for (AcceleratorsCocoa::AcceleratorMap::iterator it = keymap->accelerators_.begin(); it != keymap->accelerators_.end();
diff --git a/chrome/browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm index 132e49f..8be7748 100644 --- a/chrome/browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm
@@ -188,7 +188,7 @@ EXPECT_EQ(6, [recent_tabs_menu numberOfItems]); // Send a icon changed event and verify that the icon is updated. - gfx::Image icon(ResourceBundle::GetSharedInstance().GetNativeImageNamed( + gfx::Image icon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_BOOKMARKS_FAVICON)); recent_tabs_sub_menu_model.SetIcon(3, icon); EXPECT_NSNE(icon.ToNSImage(), [[recent_tabs_menu itemAtIndex:3] image]);
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm index 0fa1525..fcc16d0 100644 --- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm +++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm
@@ -60,7 +60,7 @@ gfx::CreateVectorIcon(kCreditCardIcon, 16, SK_ColorWHITE)); } - return ResourceBundle::GetSharedInstance() + return ui::ResourceBundle::GetSharedInstance() .GetNativeImageNamed(iconId) .AsNSImage(); }
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index de8c331..9924c9e 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -281,7 +281,7 @@ profile:browser_->profile()]); didCreateExtraButtons_ = NO; - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); folderImage_.reset( rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); folderImageWhite_.reset( @@ -664,13 +664,13 @@ if (forADarkTheme) { if (node == managedBookmarkService_->managed_node()) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed( IDR_BOOKMARK_BAR_FOLDER_MANAGED_WHITE).ToNSImage(); } if (node == managedBookmarkService_->supervised_node()) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed( IDR_BOOKMARK_BAR_FOLDER_SUPERVISED_WHITE).ToNSImage(); } @@ -680,14 +680,14 @@ } else { if (node == managedBookmarkService_->managed_node()) { // Most users never see this node, so the image is only loaded if needed. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed( IDR_BOOKMARK_BAR_FOLDER_MANAGED).ToNSImage(); } if (node == managedBookmarkService_->supervised_node()) { // Most users never see this node, so the image is only loaded if needed. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed( IDR_BOOKMARK_BAR_FOLDER_SUPERVISED).ToNSImage(); } @@ -1221,7 +1221,7 @@ return; } - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSString* text = l10n_util::GetNSString(IDS_BOOKMARK_BAR_APPS_SHORTCUT_NAME); NSImage* image = rb.GetNativeImageNamed( IDR_BOOKMARK_BAR_APPS_SHORTCUT).ToNSImage();
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell_unittest.mm index b84191f..e3e030b6 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell_unittest.mm
@@ -33,7 +33,7 @@ ASSERT_TRUE(view.get()); ASSERT_TRUE(folder_view.get()); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); base::scoped_nsobject<NSImage> image( rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); ASSERT_TRUE(image.get());
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm index f26117f0..744098f 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm
@@ -71,7 +71,7 @@ [view setCell:cell.get()]; [[test_window() contentView] addSubview:view]; - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); base::scoped_nsobject<NSImage> image( rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); EXPECT_TRUE(image.get()); @@ -230,7 +230,7 @@ model->AddURL(bar, bar->child_count(), base::ASCIIToUTF16("This cell has a longer title "), GURL("http://www.google.com/a")); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); base::scoped_nsobject<NSImage> image( rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); CGFloat width_for_node_a =
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm index cb2d766e..f1a9965 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm
@@ -68,7 +68,7 @@ return; if (!folder_image_) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); folder_image_.reset( rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); [folder_image_ setTemplate:YES]; @@ -87,14 +87,14 @@ [bookmark_menu addItem:[NSMenuItem separatorItem]]; if (!managedNode->empty()) { // Most users never see this node, so the image is only loaded if needed. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* image = rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER_MANAGED).ToNSImage(); AddNodeAsSubmenu(bookmark_menu, managedNode, image, !is_submenu); } if (!supervisedNode->empty()) { // Most users never see this node, so the image is only loaded if needed. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* image = rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER_SUPERVISED).ToNSImage(); AddNodeAsSubmenu(bookmark_menu, supervisedNode, image, !is_submenu); @@ -304,7 +304,7 @@ } // If we do not have a loaded favicon, use the default site image instead. if (!favicon) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); favicon = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); [favicon setTemplate:YES]; }
diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm index 11a102b..4a06c42 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm
@@ -137,7 +137,7 @@ } - (void)awakeFromNib { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* infoIcon = rb.GetNativeImageNamed(IDR_INFO).ToNSImage(); [infoBarIcon_ setImage:infoIcon]; @@ -370,7 +370,7 @@ } // Default icon will be the last item in the array. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); // TODO(rsesek): Rename this resource now that it's in multiple places. [icons_ addObject: rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).ToNSImage()];
diff --git a/chrome/browser/ui/cocoa/download/download_show_all_button.mm b/chrome/browser/ui/cocoa/download/download_show_all_button.mm index 5d73380..a8aee539 100644 --- a/chrome/browser/ui/cocoa/download/download_show_all_button.mm +++ b/chrome/browser/ui/cocoa/download/download_show_all_button.mm
@@ -16,7 +16,7 @@ - (void)awakeFromNib { DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON).ToNSImage(); [self setImage:favicon]; }
diff --git a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm index 4c38bf9..cdd8602 100644 --- a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm +++ b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm
@@ -48,7 +48,7 @@ - (id)initWithWebContents:(content::WebContents*)webContents { if ((self = [super init])) { // Load the image of the download arrow. - ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); NSImage* image = base::FeatureList::IsEnabled(features::kMacMaterialDesignDownloadShelf) ? NSImageFromImageSkia(gfx::CreateVectorIcon(
diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index d79d437..ad3d153 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm
@@ -96,7 +96,7 @@ } } - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); default_favicon_.reset( rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage());
diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index ba39627..8e2bb9b 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
@@ -104,7 +104,7 @@ - (void)awakeFromNib { // Load in the image. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* backgroundImage = rb.GetNativeImageNamed(IDR_FROZEN_TAB_ICON).ToNSImage(); [imageView_ setImage:backgroundImage];
diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm index affe1e3..ff125a86 100644 --- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
@@ -56,8 +56,9 @@ NSImage* KeywordHintDecoration::GetHintImage() { if (!hint_image_) { - hint_image_.reset(ResourceBundle::GetSharedInstance(). - GetNativeImageNamed(IDR_OMNIBOX_KEYWORD_HINT_TAB).CopyNSImage()); + hint_image_.reset(ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_OMNIBOX_KEYWORD_HINT_TAB) + .CopyNSImage()); } return hint_image_; }
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_separator_view.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_separator_view.mm index 0841a7d6..f763108 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_separator_view.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_separator_view.mm
@@ -27,7 +27,7 @@ @implementation OmniboxPopupBottomSeparatorView + (CGFloat)preferredHeight { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* shadowImage = rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); return [shadowImage size].height; @@ -66,7 +66,7 @@ } // Draw the shadow. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); NSImage* shadowImage = rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); [shadowImage drawInRect:bounds
diff --git a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm index ce5b9375..bbe5d4f 100644 --- a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm +++ b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
@@ -218,8 +218,8 @@ } else { NSString* text = base::SysUTF16ToNSString( labels.first + base::ASCIIToUTF16("\n") + labels.second); - NSFont* font = ResourceBundle::GetSharedInstance() - .GetFontList(ResourceBundle::SmallFont) + NSFont* font = ui::ResourceBundle::GetSharedInstance() + .GetFontList(ui::ResourceBundle::SmallFont) .GetPrimaryFont() .GetNativeFont(); NSDictionary* attrsDictionary =
diff --git a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm index 115dac3b..c001247a 100644 --- a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm +++ b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm
@@ -71,10 +71,10 @@ // Text. confirmationText_.reset([[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); - NSFont* font = ResourceBundle::GetSharedInstance() - .GetFontList(ResourceBundle::SmallFont) - .GetPrimaryFont() - .GetNativeFont(); + NSFont* font = ui::ResourceBundle::GetSharedInstance() + .GetFontList(ui::ResourceBundle::SmallFont) + .GetPrimaryFont() + .GetNativeFont(); NSColor* textColor = [NSColor blackColor]; [confirmationText_ setMessage:base::SysUTF16ToNSString( self.model->save_confirmation_text())
diff --git a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm index 95578554..35f693f 100644 --- a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm +++ b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm
@@ -121,8 +121,8 @@ [self setCell:cell.get()]; [self setBordered:NO]; - [self setFont:ResourceBundle::GetSharedInstance() - .GetFontList(ResourceBundle::SmallFont) + [self setFont:ui::ResourceBundle::GetSharedInstance() + .GetFontList(ui::ResourceBundle::SmallFont) .GetPrimaryFont() .GetNativeFont()]; [self setButtonType:NSMomentaryLightButton]; @@ -146,7 +146,7 @@ + (NSImage*)defaultAvatar { return gfx::NSImageFromImageSkia(ScaleImageForAccountAvatar( - *ResourceBundle::GetSharedInstance() + *ui::ResourceBundle::GetSharedInstance() .GetImageNamed(IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE) .ToImageSkia())); }
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.mm b/chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.mm index fca6f7b..71e5ed7 100644 --- a/chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.mm +++ b/chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.mm
@@ -133,24 +133,22 @@ HyperlinkTextView* TitleDialogLabelWithLink(const base::string16& text, gfx::Range range, id<NSTextViewDelegate> delegate) { - return LabelWithLink( - text, SK_ColorBLACK, - ResourceBundle::GetSharedInstance() - .GetFontList(chrome_style::kTitleFontStyle) - .GetPrimaryFont() - .GetNativeFont(), - range, delegate); + return LabelWithLink(text, SK_ColorBLACK, + ui::ResourceBundle::GetSharedInstance() + .GetFontList(chrome_style::kTitleFontStyle) + .GetPrimaryFont() + .GetNativeFont(), + range, delegate); } HyperlinkTextView* LabelWithLink(const base::string16& text, SkColor color, gfx::Range range, id<NSTextViewDelegate> delegate) { - return LabelWithLink( - text, color, - ResourceBundle::GetSharedInstance() - .GetFontList(ResourceBundle::SmallFont) - .GetPrimaryFont() - .GetNativeFont(), - range, delegate); + return LabelWithLink(text, color, + ui::ResourceBundle::GetSharedInstance() + .GetFontList(ui::ResourceBundle::SmallFont) + .GetPrimaryFont() + .GetNativeFont(), + range, delegate); }
diff --git a/chrome/browser/ui/cocoa/share_menu_controller.h b/chrome/browser/ui/cocoa/share_menu_controller.h new file mode 100644 index 0000000..2be8d9a --- /dev/null +++ b/chrome/browser/ui/cocoa/share_menu_controller.h
@@ -0,0 +1,23 @@ +// 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_UI_COCOA_SHARE_MENU_CONTROLLER_H_ +#define CHROME_BROWSER_UI_COCOA_SHARE_MENU_CONTROLLER_H_ + +#import <Cocoa/Cocoa.h> + +// Set this as the delegate of a menu to populate with potential sharing service +// items. Handles performing share actions chosen by the user and opening the +// sharing service pref pane so that the user can enable or disable services. +@interface ShareMenuController + : NSObject<NSMenuDelegate, NSSharingServiceDelegate> +@end + +@interface ShareMenuController (ExposedForTesting) +// Whether the menu should add a "More..." item that opens the +// Sharing Extension pref pane. ++ (BOOL)shouldShowMoreItem; +@end + +#endif // CHROME_BROWSER_UI_COCOA_SHARE_MENU_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/share_menu_controller.mm b/chrome/browser/ui/cocoa/share_menu_controller.mm new file mode 100644 index 0000000..0de964fb --- /dev/null +++ b/chrome/browser/ui/cocoa/share_menu_controller.mm
@@ -0,0 +1,240 @@ +// 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. + +#import "chrome/browser/ui/cocoa/share_menu_controller.h" + +#include "base/mac/foundation_util.h" +#include "base/mac/mac_util.h" +#include "base/strings/sys_string_conversions.h" +#include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/browser_window.h" +#import "chrome/browser/ui/cocoa/accelerators_cocoa.h" +#import "chrome/browser/ui/cocoa/browser_window_controller.h" +#import "chrome/browser/ui/cocoa/fast_resize_view.h" +#import "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" +#include "chrome/grit/generated_resources.h" +#include "net/base/mac/url_conversions.h" +#include "ui/base/accelerators/platform_accelerator_cocoa.h" +#include "ui/base/l10n/l10n_util_mac.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/image/image.h" +#include "ui/snapshot/snapshot.h" + +namespace { + +NSString* const kExtensionPrefPanePath = + @"/System/Library/PreferencePanes/Extensions.prefPane"; +// Undocumented, used by Safari. +const UInt32 kOpenSharingSubpaneDescriptorType = 'ptru'; +NSString* const kOpenSharingSubpaneActionKey = @"action"; +NSString* const kOpenSharingSubpaneActionValue = @"revealExtensionPoint"; +NSString* const kOpenSharingSubpaneProtocolKey = @"protocol"; +NSString* const kOpenSharingSubpaneProtocolValue = @"com.apple.share-services"; + +} // namespace + +@implementation ShareMenuController { + // The following three ivars are provided to the system via NSSharingService + // delegates. They're needed for the transition animation, and to provide a + // screenshot of the shared site for services that support it. + NSWindow* windowForShare_; // weak + NSRect rectForShare_; + base::scoped_nsobject<NSImage> snapshotForShare_; +} + ++ (BOOL)shouldShowMoreItem { + return base::mac::IsAtLeastOS10_10(); +} + +// NSMenuDelegate +- (void)menuNeedsUpdate:(NSMenu*)menu { + [menu removeAllItems]; + [menu setAutoenablesItems:NO]; + + Browser* lastActiveBrowser = chrome::GetLastActiveBrowser(); + BOOL canShare = + lastActiveBrowser != nullptr && + // Avoid |CanEmailPageLocation| segfault in interactive UI tests + lastActiveBrowser->tab_strip_model()->GetActiveWebContents() != nullptr && + chrome::CanEmailPageLocation(chrome::GetLastActiveBrowser()); + // Using a real URL instead of empty string to avoid system log about relative + // URLs in the pasteboard. This URL will not actually be shared to, just used + // to fetch sharing services that can handle the NSURL type. + NSArray* services = [NSSharingService + sharingServicesForItems:@[ [NSURL URLWithString:@"https://google.com"] ]]; + NSSharingService* readingListService = [NSSharingService + sharingServiceNamed:NSSharingServiceNameAddToSafariReadingList]; + for (NSSharingService* service in services) { + // Don't include "Add to Reading List". + if ([service isEqual:readingListService]) + continue; + NSMenuItem* item = [self menuItemForService:service]; + [item setEnabled:canShare]; + [menu addItem:item]; + } + if (![[self class] shouldShowMoreItem]) { + return; + } + base::scoped_nsobject<NSMenuItem> moreItem([[NSMenuItem alloc] + initWithTitle:l10n_util::GetNSString(IDS_SHARING_MORE_MAC) + action:@selector(openSharingPrefs:) + keyEquivalent:@""]); + [moreItem setTarget:self]; + [moreItem setImage:[self moreImage]]; + [menu addItem:moreItem]; +} + +// NSSharingServiceDelegate + +- (void)sharingService:(NSSharingService*)service + didShareItems:(NSArray*)items { + // TODO(lgrey): Add an UMA stat. + [self clearTransitionData]; +} + +- (void)sharingService:(NSSharingService*)service + didFailToShareItems:(NSArray*)items + error:(NSError*)error { + // TODO(lgrey): Add an UMA stat. + [self clearTransitionData]; +} + +- (NSRect)sharingService:(NSSharingService*)service + sourceFrameOnScreenForShareItem:(id)item { + return rectForShare_; +} + +- (NSWindow*)sharingService:(NSSharingService*)service + sourceWindowForShareItems:(NSArray*)items + sharingContentScope:(NSSharingContentScope*)scope { + *scope = NSSharingContentScopeFull; + return windowForShare_; +} + +- (NSImage*)sharingService:(NSSharingService*)service + transitionImageForShareItem:(id)item + contentRect:(NSRect*)contentRect { + return snapshotForShare_; +} + +// Private methods + +// Saves details required by delegate methods for the transition animation. +- (void)saveTransitionDataFromBrowser:(Browser*)browser { + windowForShare_ = browser->window()->GetNativeWindow(); + + NSView* contentsView = [[windowForShare_ windowController] tabContentArea]; + NSRect rectInWindow = + [[contentsView superview] convertRect:[contentsView frame] toView:nil]; + rectForShare_ = [windowForShare_ convertRectToScreen:rectInWindow]; + + gfx::Image image; + gfx::Rect rect = gfx::Rect(NSRectToCGRect([contentsView bounds])); + if (ui::GrabViewSnapshot(contentsView, rect, &image)) { + snapshotForShare_.reset(image.CopyNSImage()); + } +} + +- (void)clearTransitionData { + windowForShare_ = nil; + rectForShare_ = NSZeroRect; + snapshotForShare_.reset(); +} + +// Performs the share action using the sharing service represented by |sender|. +- (void)performShare:(NSMenuItem*)sender { + Browser* browser = chrome::GetLastActiveBrowser(); + DCHECK(browser); + [self saveTransitionDataFromBrowser:browser]; + + content::WebContents* contents = + browser->tab_strip_model()->GetActiveWebContents(); + NSURL* url = net::NSURLWithGURL(contents->GetLastCommittedURL()); + NSString* title = base::SysUTF16ToNSString(contents->GetTitle()); + + NSSharingService* service = + base::mac::ObjCCastStrict<NSSharingService>([sender representedObject]); + [service setDelegate:self]; + [service setSubject:title]; + + NSArray* itemsToShare; + if ([service + isEqual:[NSSharingService + sharingServiceNamed:NSSharingServiceNamePostOnTwitter]]) { + // The Twitter share service expects the title as an additional share item. + // This is the same approach system apps use. + itemsToShare = @[ url, title ]; + } else { + itemsToShare = @[ url ]; + } + [service performWithItems:itemsToShare]; +} + +// Opens the "Sharing" subpane of the "Extensions" macOS preference pane. +- (void)openSharingPrefs:(NSMenuItem*)sender { + DCHECK([[self class] shouldShowMoreItem]); + NSURL* prefPaneURL = + [NSURL fileURLWithPath:kExtensionPrefPanePath isDirectory:YES]; + NSDictionary* args = @{ + kOpenSharingSubpaneActionKey : kOpenSharingSubpaneActionValue, + kOpenSharingSubpaneProtocolKey : kOpenSharingSubpaneProtocolValue + }; + NSData* data = [NSPropertyListSerialization + dataWithPropertyList:args + format:NSPropertyListXMLFormat_v1_0 + options:0 + error:nil]; + base::scoped_nsobject<NSAppleEventDescriptor> descriptor( + [[NSAppleEventDescriptor alloc] + initWithDescriptorType:kOpenSharingSubpaneDescriptorType + data:data]); + [[NSWorkspace sharedWorkspace] openURLs:@[ prefPaneURL ] + withAppBundleIdentifier:nil + options:NSWorkspaceLaunchAsync + additionalEventParamDescriptor:descriptor + launchIdentifiers:NULL]; +} + +// Returns the image to be used for the "More..." menu item, or nil on macOS +// version where this private method is unsupported. +- (NSImage*)moreImage { + if ([NSSharingServicePicker + respondsToSelector:@selector(sharedMoreMenuImage)]) { + return + [NSSharingServicePicker performSelector:@selector(sharedMoreMenuImage)]; + } + return nil; +} + +// Creates a menu item that calls |service| when invoked. +- (NSMenuItem*)menuItemForService:(NSSharingService*)service { + BOOL isMail = [service + isEqual:[NSSharingService + sharingServiceNamed:NSSharingServiceNameComposeEmail]]; + NSString* keyEquivalent = isMail ? [self keyEquivalentForMail] : @""; + NSString* title = isMail ? l10n_util::GetNSString(IDS_EMAIL_PAGE_LOCATION_MAC) + : service.menuItemTitle; + base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] + initWithTitle:title + action:@selector(performShare:) + keyEquivalent:keyEquivalent]); + [item setTarget:self]; + [item setImage:[service image]]; + [item setRepresentedObject:service]; + return item.autorelease(); +} + +- (NSString*)keyEquivalentForMail { + AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance(); + const ui::Accelerator* accelerator = + keymap->GetAcceleratorForCommand(IDC_EMAIL_PAGE_LOCATION); + const ui::PlatformAcceleratorCocoa* platform = + static_cast<const ui::PlatformAcceleratorCocoa*>( + accelerator->platform_accelerator()); + return platform->characters(); +} + +@end
diff --git a/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm b/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm new file mode 100644 index 0000000..f1ecb680 --- /dev/null +++ b/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm
@@ -0,0 +1,190 @@ +// 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. + +#import "chrome/browser/ui/cocoa/share_menu_controller.h" + +#import "base/mac/scoped_nsobject.h" +#import "base/path_service.h" +#include "base/strings/sys_string_conversions.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/cocoa/test/cocoa_profile_test.h" +#import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/grit/generated_resources.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "net/base/mac/url_conversions.h" +#include "testing/gtest_mac.h" +#include "ui/base/l10n/l10n_util_mac.h" + +// Mock sharing service for sensing shared items. +@interface MockSharingService : NSSharingService +// Weak since both this object and the shared item +// should only live in the scope of the test. +@property(nonatomic, assign) id sharedItem; + +@end + +@implementation MockSharingService + +// The real one is backed by SHKSharingService parameters which +// don't appear to be present when inheriting from vanilla +// |NSSharingService|. +@synthesize subject; +@synthesize sharedItem = sharedItem_; + +- (void)performWithItems:(NSArray*)items { + [self setSharedItem:[items firstObject]]; +} + +@end + +namespace { +base::scoped_nsobject<MockSharingService> MakeMockSharingService() { + return base::scoped_nsobject<MockSharingService>([[MockSharingService alloc] + initWithTitle:@"Mock service" + image:[NSImage imageNamed:NSImageNameAddTemplate] + alternateImage:nil + handler:^{ + }]); +} +} // namespace + +class ShareMenuControllerTest : public InProcessBrowserTest { + public: + ShareMenuControllerTest() {} + + void SetUpOnMainThread() override { + base::FilePath test_data_dir; + PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); + embedded_test_server()->ServeFilesFromDirectory(test_data_dir); + ASSERT_TRUE(embedded_test_server()->Start()); + + url_ = embedded_test_server()->GetURL("/title2.html"); + AddTabAtIndex(0, url_, ui::PAGE_TRANSITION_TYPED); + controller_.reset([[ShareMenuController alloc] init]); + } + + protected: + // Create a menu item for |service| and trigger it using + // the target/action of real menu items created by + // |controller_| + void PerformShare(NSSharingService* service) { + base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Share"]); + + [controller_ menuNeedsUpdate:menu]; + + base::scoped_nsobject<NSMenuItem> mock_menu_item([[NSMenuItem alloc] + initWithTitle:@"test" + action:nil + keyEquivalent:@""]); + [mock_menu_item setRepresentedObject:service]; + + NSMenuItem* first_menu_item = [menu itemAtIndex:0]; + id target = [first_menu_item target]; + SEL action = [first_menu_item action]; + [target performSelector:action withObject:mock_menu_item.get()]; + } + GURL url_; + base::scoped_nsobject<ShareMenuController> controller_; +}; + +IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, PopulatesMenu) { + base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Share"]); + NSArray* sharing_services_for_url = [NSSharingService + sharingServicesForItems:@[ [NSURL URLWithString:@"http://example.com"] ]]; + EXPECT_GT([sharing_services_for_url count], 0U); + + [controller_ menuNeedsUpdate:menu]; + + // -1 for reading list, +1 for "More..." if it's showing. + // This cancels out, so only decrement if the "More..." item + // isn't showing. + NSInteger expected_count = [sharing_services_for_url count]; + if (![ShareMenuController shouldShowMoreItem]) { + --expected_count; + } + EXPECT_EQ([menu numberOfItems], expected_count); + + NSSharingService* reading_list_service = [NSSharingService + sharingServiceNamed:NSSharingServiceNameAddToSafariReadingList]; + + NSUInteger i = 0; + // Ensure there's a menu item for each service besides reading list. + for (NSSharingService* service in sharing_services_for_url) { + if ([service isEqual:reading_list_service]) + continue; + NSMenuItem* menu_item = [menu itemAtIndex:i]; + EXPECT_NSEQ([menu_item representedObject], service); + EXPECT_EQ([menu_item target], static_cast<id>(controller_)); + ++i; + } + + // Ensure the menu is cleared between updates. + [controller_ menuNeedsUpdate:menu]; + EXPECT_EQ([menu numberOfItems], expected_count); +} + +IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, AddsMoreButton) { + if (![ShareMenuController shouldShowMoreItem]) { + return; + } + base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Share"]); + [controller_ menuNeedsUpdate:menu]; + + NSInteger number_of_items = [menu numberOfItems]; + EXPECT_GT(number_of_items, 0); + NSMenuItem* last_item = [menu itemAtIndex:number_of_items - 1]; + EXPECT_NSEQ(last_item.title, l10n_util::GetNSString(IDS_SHARING_MORE_MAC)); +} + +IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, ActionPerformsShare) { + base::scoped_nsobject<MockSharingService> service = MakeMockSharingService(); + EXPECT_FALSE([service sharedItem]); + + PerformShare(service); + + EXPECT_NSEQ([service sharedItem], net::NSURLWithGURL(url_)); + // Title of chrome/test/data/title2.html + EXPECT_NSEQ([service subject], @"Title Of Awesomeness"); + EXPECT_EQ([service delegate], + static_cast<id<NSSharingServiceDelegate>>(controller_)); +} + +IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, SharingDelegate) { + NSURL* url = [NSURL URLWithString:@"http://google.com"]; + base::scoped_nsobject<NSSharingService> service([[NSSharingService alloc] + initWithTitle:@"Mock service" + image:[NSImage imageNamed:NSImageNameAddTemplate] + alternateImage:nil + handler:^{ + // Verify inside the block since everything is cleared after the + // share. + + // Extra service since the service param on the delegate + // methods is nonnull and circular references could get hairy. + base::scoped_nsobject<MockSharingService> mockService = + MakeMockSharingService(); + + NSWindow* browser_window = + browser()->window()->GetNativeWindow(); + EXPECT_NSNE([controller_ sharingService:mockService + sourceFrameOnScreenForShareItem:url], + NSZeroRect); + NSSharingContentScope scope = NSSharingContentScopeItem; + EXPECT_NSEQ([controller_ sharingService:mockService + sourceWindowForShareItems:@[ url ] + sharingContentScope:&scope], + browser_window); + EXPECT_EQ(scope, NSSharingContentScopeFull); + NSRect contentRect; + EXPECT_TRUE([controller_ sharingService:mockService + transitionImageForShareItem:url + contentRect:&contentRect]); + }]); + + PerformShare(service); +}
diff --git a/chrome/browser/ui/cocoa/simple_message_box_bridge_views.mm b/chrome/browser/ui/cocoa/simple_message_box_bridge_views.mm index 2d08ddd1..5f148d4c 100644 --- a/chrome/browser/ui/cocoa/simple_message_box_bridge_views.mm +++ b/chrome/browser/ui/cocoa/simple_message_box_bridge_views.mm
@@ -26,7 +26,7 @@ // back to native Cocoa message boxes. if (base::MessageLoopForUI::IsCurrent() && base::RunLoop::IsRunningOnCurrentThread() && - ResourceBundle::HasSharedInstance() && + ui::ResourceBundle::HasSharedInstance() && ui::MaterialDesignController::IsSecondaryUiMaterial()) { return SimpleMessageBoxViews::Show(parent, title, message, type, yes_text, no_text, checkbox_text);
diff --git a/chrome/browser/ui/cocoa/sprite_view_unittest.mm b/chrome/browser/ui/cocoa/sprite_view_unittest.mm index f3bf874..64af444 100644 --- a/chrome/browser/ui/cocoa/sprite_view_unittest.mm +++ b/chrome/browser/ui/cocoa/sprite_view_unittest.mm
@@ -33,7 +33,7 @@ class SpriteViewTest : public CocoaTest { public: SpriteViewTest() { - image_.reset(ResourceBundle::GetSharedInstance() + image_.reset(ui::ResourceBundle::GetSharedInstance() .GetNativeImageNamed(IDR_THROBBER) .CopyNSImage()); view_.reset([[SpriteView alloc] init]);
diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm index 376b1ee..0c5af6a 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm
@@ -63,7 +63,7 @@ [NSColor colorWithCalibratedWhite:245.0f / 255.0f alpha:1.0].CGColor; container_ = [[SadTabContainerView new] autorelease]; - NSImage* iconImage = ResourceBundle::GetSharedInstance() + NSImage* iconImage = ui::ResourceBundle::GetSharedInstance() .GetNativeImageNamed(IDR_CRASH_SAD_TAB) .ToNSImage(); NSImageView* icon = [[NSImageView new] autorelease];
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 6e61aad..9ecc8fe 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -434,7 +434,7 @@ // (see |-addSubviewToPermanentList:|) will be wiped out. permanentSubviews_.reset([[NSMutableArray alloc] init]); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); defaultFavicon_.reset( rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); @@ -1564,19 +1564,22 @@ return; static NSImage* throbberWaitingImage = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_THROBBER_WAITING).CopyNSImage(); + ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_THROBBER_WAITING) + .CopyNSImage(); static NSImage* throbberWaitingIncognitoImage = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_THROBBER_WAITING_INCOGNITO).CopyNSImage(); - static NSImage* throbberLoadingImage = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_THROBBER).CopyNSImage(); + ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_THROBBER_WAITING_INCOGNITO) + .CopyNSImage(); + static NSImage* throbberLoadingImage = ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_THROBBER) + .CopyNSImage(); static NSImage* throbberLoadingIncognitoImage = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_THROBBER_INCOGNITO).CopyNSImage(); + ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_THROBBER_INCOGNITO) + .CopyNSImage(); static NSImage* sadFaviconImage = - ResourceBundle::GetSharedInstance() + ui::ResourceBundle::GetSharedInstance() .GetNativeImageNamed(IDR_CRASH_SAD_FAVICON) .CopyNSImage();
diff --git a/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm b/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm index 2fc70ee..30dc4d7 100644 --- a/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm +++ b/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm
@@ -70,8 +70,9 @@ NSRect contentFrame = NSMakeRect(kWindowPadding, kWindowPadding, 0, 0); FlippedView* contentView = [[FlippedView alloc] initWithFrame:contentFrame]; - NSImage* image = ResourceBundle::GetSharedInstance() - .GetNativeImageNamed(IDR_INPUT_ALERT).ToNSImage(); + NSImage* image = ui::ResourceBundle::GetSharedInstance() + .GetNativeImageNamed(IDR_INPUT_ALERT) + .ToNSImage(); base::scoped_nsobject<NSImageView> imageView([[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, image.size.width, image.size.height)]); [imageView setImageFrameStyle:NSImageFrameNone];
diff --git a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc index 9e15547..1f848e5 100644 --- a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc +++ b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
@@ -110,8 +110,8 @@ ? gfx::kGoogleBlue500 : SkColorSetA(badge_->background_color, SK_AlphaOPAQUE); - ResourceBundle* rb = &ResourceBundle::GetSharedInstance(); - gfx::FontList base_font = rb->GetFontList(ResourceBundle::BaseFont) + ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); + gfx::FontList base_font = rb->GetFontList(ui::ResourceBundle::BaseFont) .DeriveWithHeightUpperBound(kBadgeHeight); base::string16 utf16_text = base::UTF8ToUTF16(badge_->text); @@ -187,8 +187,9 @@ void IconWithBadgeImageSource::PaintBlockedActionDecoration( gfx::Canvas* canvas) { canvas->Save(); - gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_BLOCKED_EXTENSION_SCRIPT); + gfx::ImageSkia img = + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_BLOCKED_EXTENSION_SCRIPT); canvas->DrawImageInt(img, size().width() - img.width(), 0); canvas->Restore(); }
diff --git a/chrome/browser/ui/global_error/global_error.cc b/chrome/browser/ui/global_error/global_error.cc index 370a8ad..2a9365c 100644 --- a/chrome/browser/ui/global_error/global_error.cc +++ b/chrome/browser/ui/global_error/global_error.cc
@@ -27,7 +27,7 @@ gfx::Image GlobalError::MenuItemIcon() { #if defined(OS_ANDROID) - return ResourceBundle::GetSharedInstance().GetNativeImageNamed( + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_INPUT_ALERT_MENU); #else return gfx::Image( @@ -65,7 +65,7 @@ gfx::Image GlobalErrorWithStandardBubble::GetBubbleViewIcon() { // If you change this make sure to also change the menu icon and the app menu // icon color. - return ResourceBundle::GetSharedInstance().GetNativeImageNamed( + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_INPUT_ALERT); }
diff --git a/chrome/browser/ui/history_ui.cc b/chrome/browser/ui/history_ui.cc index 9452c3e..05665ec 100644 --- a/chrome/browser/ui/history_ui.cc +++ b/chrome/browser/ui/history_ui.cc
@@ -10,7 +10,7 @@ namespace history_ui { base::RefCountedMemory* GetFaviconResourceBytes(ui::ScaleFactor scale_factor) { - return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( IDR_HISTORY_FAVICON, scale_factor); }
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc index 83f8b4c9..5ee381a 100644 --- a/chrome/browser/ui/libgtkui/gtk_ui.cc +++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -92,15 +92,6 @@ namespace { -// We would like this to be a feature flag, but GtkUi gets initialized -// earlier than the feature flag registry, so just use a simple bool. -// The reason for wanting a flag is so that we can release the GTK3 -// nav button layout manager and the GTK3 nav button provider at the -// same time (so users don't have to deal with things changing twice). -// Since this was never really intended to be toggled by users, this -// is fine for now. -const bool kUseGtkNavButtonLayoutManager = true; - const double kDefaultDPI = 96; class GtkButtonImageSource : public gfx::ImageSkiaSource { @@ -282,7 +273,7 @@ std::unique_ptr<NavButtonLayoutManager> CreateNavButtonLayoutManager( GtkUi* gtk_ui) { #if GTK_MAJOR_VERSION == 3 - if (GtkVersionCheck(3, 14) && kUseGtkNavButtonLayoutManager) + if (GtkVersionCheck(3, 14)) return std::make_unique<NavButtonLayoutManagerGtk3>(gtk_ui); #endif #if defined(USE_GCONF)
diff --git a/chrome/browser/ui/page_info/page_info_ui.cc b/chrome/browser/ui/page_info/page_info_ui.cc index d44f1136..7f29882 100644 --- a/chrome/browser/ui/page_info/page_info_ui.cc +++ b/chrome/browser/ui/page_info/page_info_ui.cc
@@ -378,7 +378,7 @@ ContentSetting setting = info.setting; if (setting == CONTENT_SETTING_DEFAULT) setting = info.default_setting; - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed(GetPermissionIconID(info.type, setting)); } @@ -394,7 +394,7 @@ const gfx::Image& PageInfoUI::GetChosenObjectIcon( const ChosenObjectInfo& object, bool deleted) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed(deleted ? object.ui_info.blocked_icon_id : object.ui_info.allowed_icon_id); }
diff --git a/chrome/browser/ui/startup/bad_flags_prompt.cc b/chrome/browser/ui/startup/bad_flags_prompt.cc index fd7a2cf3..7094ce5f 100644 --- a/chrome/browser/ui/startup/bad_flags_prompt.cc +++ b/chrome/browser/ui/startup/bad_flags_prompt.cc
@@ -157,7 +157,7 @@ // Ensure the ResourceBundle is initialized for string resource access. bool cleanup_resource_bundle = false; - if (!ResourceBundle::HasSharedInstance()) { + if (!ui::ResourceBundle::HasSharedInstance()) { cleanup_resource_bundle = true; std::string locale = l10n_util::GetApplicationLocale(std::string()); const char kUserDataDirDialogFallbackLocale[] = "en-US"; @@ -174,7 +174,7 @@ user_data_dir.LossyDisplayName()); if (cleanup_resource_bundle) - ResourceBundle::CleanupSharedInstance(); + ui::ResourceBundle::CleanupSharedInstance(); // More complex dialogs cannot be shown before the earliest calls here. ShowWarningMessageBox(NULL, title, message);
diff --git a/chrome/browser/ui/toolbar/app_menu_model.cc b/chrome/browser/ui/toolbar/app_menu_model.cc index 10f23d7..89a42fe 100644 --- a/chrome/browser/ui/toolbar/app_menu_model.cc +++ b/chrome/browser/ui/toolbar/app_menu_model.cc
@@ -157,7 +157,7 @@ if (base::FeatureList::IsEnabled(kIncludeBetaForumMenuItem)) AddItem(IDC_SHOW_BETA_FORUM, l10n_util::GetStringUTF16(IDS_BETA_FORUM)); if (browser_defaults::kShowHelpMenuItemIcon) { - ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE_VIA_MENU), rb.GetNativeImageNamed(IDR_HELP_MENU)); }
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index 63697a5e..d61eb5e6 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -139,7 +139,7 @@ return false; if (index == GetItemCount() - 1) { - *icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed( + *icon = ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_HISTORY_FAVICON); } else { NavigationEntry* entry = GetNavigationEntry(index);
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc index 28acb13..0b483e68 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc
@@ -323,7 +323,7 @@ const CreditCard& card = controller_->GetCard(); views::ImageView* card_type_icon = new views::ImageView(); card_type_icon->SetImage( - ResourceBundle::GetSharedInstance() + ui::ResourceBundle::GetSharedInstance() .GetImageNamed(CreditCard::IconResourceId(card.network())) .AsImageSkia()); card_type_icon->SetTooltipText(card.NetworkForDisplay());
diff --git a/chrome/browser/ui/views/device_chooser_content_view.cc b/chrome/browser/ui/views/device_chooser_content_view.cc index 7a773ab..3a8f7954 100644 --- a/chrome/browser/ui/views/device_chooser_content_view.cc +++ b/chrome/browser/ui/views/device_chooser_content_view.cc
@@ -170,7 +170,7 @@ DCHECK_GE(level, 0); DCHECK_LT(level, static_cast<int>(arraysize(kSignalStrengthLevelImageIds))); - return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( kSignalStrengthLevelImageIds[level]); }
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index c4f3c76..545f18f 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -18,8 +18,6 @@ #include "chrome/browser/ui/views/tab_icon_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "chrome/common/chrome_features.h" -#include "chrome/common/features.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" #include "components/strings/grit/components_strings.h" @@ -436,8 +434,6 @@ #if BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS) if (!nav_button_provider_) return false; - if (!base::FeatureList::IsEnabled(features::kNativeWindowNavButtons)) - return false; return ThemeServiceFactory::GetForProfile( browser_view()->browser()->profile()) ->UsingSystemTheme();
diff --git a/chrome/browser/ui/views/harmony/chrome_typography.h b/chrome/browser/ui/views/harmony/chrome_typography.h index f3a9894..5c63e35c 100644 --- a/chrome/browser/ui/views/harmony/chrome_typography.h +++ b/chrome/browser/ui/views/harmony/chrome_typography.h
@@ -34,9 +34,9 @@ // mimic the native Windows 10 look and feel. CONTEXT_WINDOWS10_NATIVE, - // ResourceBundle::SmallFont (11 pt). There is no equivalent in the Harmony - // spec, so new code should not be using this. It is only provided to avoid - // changing existing UI and it will eventually be removed. + // ui::ResourceBundle::SmallFont (11 pt). There is no equivalent in the + // Harmony spec, so new code should not be using this. It is only provided to + // avoid changing existing UI and it will eventually be removed. CONTEXT_DEPRECATED_SMALL, };
diff --git a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc index 0495723..591e863 100644 --- a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc +++ b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
@@ -220,7 +220,7 @@ constexpr int kTemplateStyle = views::style::STYLE_PRIMARY; // TODO(tapted): These statics should be cleared out when something invokes - // ResourceBundle::ReloadFonts(). Currently that only happens on ChromeOS. + // ui::ResourceBundle::ReloadFonts(). Currently that only happens on ChromeOS. // See http://crbug.com/708943. static const int headline_height = GetFont(CONTEXT_HEADLINE, kTemplateStyle).GetHeight() -
diff --git a/chrome/browser/ui/views/harmony/layout_provider_unittest.cc b/chrome/browser/ui/views/harmony/layout_provider_unittest.cc index 879f4d0..4dfb7af 100644 --- a/chrome/browser/ui/views/harmony/layout_provider_unittest.cc +++ b/chrome/browser/ui/views/harmony/layout_provider_unittest.cc
@@ -57,7 +57,7 @@ // changed by mistake. // Disabled since this relies on machine configuration. http://crbug.com/701241. TEST_F(LayoutProviderTest, DISABLED_LegacyFontSizeConstants) { - ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::FontList label_font = rb.GetFontListWithDelta(ui::kLabelFontSizeDelta); EXPECT_EQ(12, label_font.GetFontSize()); @@ -111,13 +111,13 @@ EXPECT_EQ(8, title_font.GetExpectedTextWidth(1)); #endif - gfx::FontList small_font = rb.GetFontList(ResourceBundle::SmallFont); - gfx::FontList base_font = rb.GetFontList(ResourceBundle::BaseFont); - gfx::FontList bold_font = rb.GetFontList(ResourceBundle::BoldFont); - gfx::FontList medium_font = rb.GetFontList(ResourceBundle::MediumFont); + gfx::FontList small_font = rb.GetFontList(ui::ResourceBundle::SmallFont); + gfx::FontList base_font = rb.GetFontList(ui::ResourceBundle::BaseFont); + gfx::FontList bold_font = rb.GetFontList(ui::ResourceBundle::BoldFont); + gfx::FontList medium_font = rb.GetFontList(ui::ResourceBundle::MediumFont); gfx::FontList medium_bold_font = - rb.GetFontList(ResourceBundle::MediumBoldFont); - gfx::FontList large_font = rb.GetFontList(ResourceBundle::LargeFont); + rb.GetFontList(ui::ResourceBundle::MediumBoldFont); + gfx::FontList large_font = rb.GetFontList(ui::ResourceBundle::LargeFont); #if defined(OS_MACOSX) EXPECT_EQ(12, small_font.GetFontSize()); @@ -163,7 +163,7 @@ constexpr gfx::Font::Weight kButtonWeight = gfx::Font::Weight::MEDIUM; #endif - ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::FontList headline_font = rb.GetFontListWithDelta(kHeadline - kBase); gfx::FontList title_font = rb.GetFontListWithDelta(kTitle - kBase);
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 10a0788..da5ff2a 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -154,8 +154,8 @@ layer()->SetMasksToBounds(true); // Determine the main font. - gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( - ResourceBundle::BaseFont); + gfx::FontList font_list = ui::ResourceBundle::GetSharedInstance().GetFontList( + ui::ResourceBundle::BaseFont); const int current_font_size = font_list.GetFontSize(); constexpr int kDesiredFontSize = 14; if (current_font_size != kDesiredFontSize) {
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc index 342540f..1ef15f4 100644 --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
@@ -421,7 +421,7 @@ extension_info_.id = extension->id(); extension_info_.name = extension->name(); - ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); const gfx::ImageSkia& default_extension_icon_image = *rb.GetImageSkiaNamed(IDR_EXTENSIONS_FAVICON); int icon_size = gfx::kFaviconSize;
diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.cc b/chrome/browser/ui/views/passwords/credentials_item_view.cc index 2e1ec17..1f255ca0 100644 --- a/chrome/browser/ui/views/passwords/credentials_item_view.cc +++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc
@@ -75,7 +75,7 @@ // the parent can receive the events instead. image_view_ = new CircularImageView; image_view_->set_can_process_events_within_subtree(false); - gfx::Image image = ResourceBundle::GetSharedInstance().GetImageNamed( + gfx::Image image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE); DCHECK(image.Width() >= kAvatarImageSize && image.Height() >= kAvatarImageSize);
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc index 1c2365e..4e0aef6d 100644 --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -220,17 +220,19 @@ button->SetToggledTooltipText( l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_HIDE_PASSWORD)); button->SetImage(views::ImageButton::STATE_NORMAL, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD)); button->SetImage(views::ImageButton::STATE_HOVERED, - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SHOW_PASSWORD_HOVER)); button->SetToggledImage( views::ImageButton::STATE_NORMAL, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_HIDE_PASSWORD)); - button->SetToggledImage(views::ImageButton::STATE_HOVERED, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_HIDE_PASSWORD_HOVER)); + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_HIDE_PASSWORD)); + button->SetToggledImage( + views::ImageButton::STATE_HOVERED, + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_HIDE_PASSWORD_HOVER)); button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); return button;
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc index 0f2dfb2..48a0a94 100644 --- a/chrome/browser/ui/views/payments/payment_request_views_util.cc +++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -245,7 +245,7 @@ if (img != nullptr) { icon_view->SetImage(*img); } else { - icon_view->SetImage(ResourceBundle::GetSharedInstance() + icon_view->SetImage(ui::ResourceBundle::GetSharedInstance() .GetImageNamed(icon_resource_id) .AsImageSkia()); } @@ -270,7 +270,7 @@ std::unique_ptr<views::ImageView> chrome_logo = base::MakeUnique<views::ImageView>(); chrome_logo->set_can_process_events_within_subtree(false); - chrome_logo->SetImage(ResourceBundle::GetSharedInstance() + chrome_logo->SetImage(ui::ResourceBundle::GetSharedInstance() .GetImageNamed(IDR_PRODUCT_LOGO_NAME_22) .AsImageSkia()); chrome_logo->SetTooltipText(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); @@ -351,8 +351,10 @@ // Also, it needs to handle user setups where the default font is BOLD already // since asking for a MEDIUM font will give a lighter font. std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); - label->SetFontList(ResourceBundle::GetSharedInstance().GetFontListWithDelta( - ui::kLabelFontSizeDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); + label->SetFontList( + ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( + ui::kLabelFontSizeDelta, gfx::Font::NORMAL, + gfx::Font::Weight::MEDIUM)); return label; }
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc index 3079d2c..02c595e 100644 --- a/chrome/browser/ui/views/simple_message_box_views.cc +++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -107,7 +107,7 @@ #if defined(OS_WIN) if (!base::MessageLoopForUI::IsCurrent() || !base::RunLoop::IsRunningOnCurrentThread() || - !ResourceBundle::HasSharedInstance()) { + !ui::ResourceBundle::HasSharedInstance()) { LOG_IF(ERROR, !checkbox_text.empty()) << "Dialog checkbox won't be shown"; int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message, title, GetMessageBoxFlagsFromType(type)); @@ -118,7 +118,7 @@ } #else if (!base::MessageLoopForUI::IsCurrent() || - !ResourceBundle::HasSharedInstance()) { + !ui::ResourceBundle::HasSharedInstance()) { LOG(ERROR) << "Unable to show a dialog outside the UI thread message loop: " << title << " - " << message; std::move(callback).Run(chrome::MESSAGE_BOX_RESULT_NO);
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 5c6c5e3..ac6af4c 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc
@@ -313,7 +313,7 @@ void StartOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (path_ == kKeyboardUtilsPath) { - contents_ = ResourceBundle::GetSharedInstance() + contents_ = ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_KEYBOARD_UTILS_JS) .as_string(); ResponseOnUIThread(); @@ -339,7 +339,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); // If we fail to load Chrome OS credits from disk, load it from resources. if (contents_.empty() && path_ != kKeyboardUtilsPath) { - contents_ = ResourceBundle::GetSharedInstance() + contents_ = ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_OS_CREDITS_HTML) .as_string(); } @@ -718,7 +718,7 @@ if (idr == IDR_ABOUT_UI_CREDITS_HTML) { response = about_ui::GetCredits(true /*include_scripts*/); } else { - response = ResourceBundle::GetSharedInstance() + response = ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(idr) .as_string(); }
diff --git a/chrome/browser/ui/webui/browsing_history_handler.cc b/chrome/browser/ui/webui/browsing_history_handler.cc index c5cc78e5..24add4e1 100644 --- a/chrome/browser/ui/webui/browsing_history_handler.cc +++ b/chrome/browser/ui/webui/browsing_history_handler.cc
@@ -377,8 +377,6 @@ // results_info_value_. results_info.SetString("term", query_results_info.search_text); results_info.SetBoolean("finished", query_results_info.reached_beginning); - results_info.SetBoolean("hasSyncedResults", - query_results_info.has_synced_results); web_ui()->CallJavascriptFunctionUnsafe("historyResult", results_info, results_value); @@ -400,7 +398,6 @@ bool has_other_forms, bool has_synced_results) { web_ui()->CallJavascriptFunctionUnsafe("showNotification", - base::Value(has_synced_results), base::Value(has_other_forms)); }
diff --git a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc index 3933864..cc49e53 100644 --- a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
@@ -217,7 +217,7 @@ app.name = l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME); if (app.icon.isNull()) { - app.icon = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + app.icon = *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PRODUCT_LOGO_128); }
diff --git a/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc index 6b1ae2fd..5b46e98 100644 --- a/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc
@@ -86,7 +86,7 @@ out_info->SetString("name", l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); out_info->SetString( "iconURL", - webui::GetBitmapDataUrl(*ResourceBundle::GetSharedInstance() + webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance() .GetImageSkiaNamed(IDR_PRODUCT_LOGO_128) ->bitmap())); }
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc b/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc index ded2b60..1ea6854 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc
@@ -118,7 +118,7 @@ std::string icon_url; if (app_data.icon.isNull()) { icon_url = - webui::GetBitmapDataUrl(*ResourceBundle::GetSharedInstance() + webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance() .GetImageNamed(IDR_APP_DEFAULT_ICON) .ToSkBitmap()); } else { @@ -144,7 +144,7 @@ std::string icon_url; if (arc_apps[i]->icon().isNull()) { icon_url = - webui::GetBitmapDataUrl(*ResourceBundle::GetSharedInstance() + webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance() .GetImageNamed(IDR_APP_DEFAULT_ICON) .ToSkBitmap()); } else {
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index 58d4d25..9e01da21 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -345,12 +345,12 @@ std::string full_html; if (activation_state == shill::kActivationStateActivated) { static const base::StringPiece html_for_activated( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_MOBILE_SETUP_PORTAL_PAGE_HTML)); full_html = webui::GetI18nTemplateHtml(html_for_activated, &strings); } else { static const base::StringPiece html_for_non_activated( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_MOBILE_SETUP_PAGE_HTML)); full_html = webui::GetI18nTemplateHtml(html_for_non_activated, &strings); }
diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index 896d5cad..023317e 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc
@@ -337,7 +337,7 @@ webui::SetLoadTimeDataDefaults(app_locale, &strings); static const base::StringPiece html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_SIM_UNLOCK_HTML)); std::string full_html = webui::GetI18nTemplateHtml(html, &strings);
diff --git a/chrome/browser/ui/webui/chromeos/user_image_source.cc b/chrome/browser/ui/webui/chromeos/user_image_source.cc index 1846282..becf0775 100644 --- a/chrome/browser/ui/webui/chromeos/user_image_source.cc +++ b/chrome/browser/ui/webui/chromeos/user_image_source.cc
@@ -69,8 +69,8 @@ ui::ScaleFactor scale_factor) { // Load all frames. if (frame == -1) { - return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( - resource_id, scale_factor); + return ui::ResourceBundle::GetSharedInstance() + .LoadDataResourceBytesForScale(resource_id, scale_factor); } // TODO(reveman): Add support frames beyond 0 (crbug.com/750064). if (frame) { @@ -78,7 +78,7 @@ return nullptr; } gfx::ImageSkia* image = - ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); float scale = ui::GetScaleForScaleFactor(scale_factor); scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes); gfx::PNGCodec::EncodeBGRASkBitmap(image->GetRepresentation(scale).sk_bitmap(),
diff --git a/chrome/browser/ui/webui/components_ui.cc b/chrome/browser/ui/webui/components_ui.cc index e7ec3d6..03550e1 100644 --- a/chrome/browser/ui/webui/components_ui.cc +++ b/chrome/browser/ui/webui/components_ui.cc
@@ -196,8 +196,8 @@ // static base::RefCountedMemory* ComponentsUI::GetFaviconResourceBytes( ui::ScaleFactor scale_factor) { - return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + IDR_PLUGINS_FAVICON, scale_factor); } base::string16 ComponentsUI::ComponentEventToString(Events event) {
diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc index bf8f50a0c4..120b6ad 100644 --- a/chrome/browser/ui/webui/conflicts_ui.cc +++ b/chrome/browser/ui/webui/conflicts_ui.cc
@@ -75,6 +75,6 @@ base::RefCountedMemory* ConflictsUI::GetFaviconResourceBytes( ui::ScaleFactor scale_factor) { return static_cast<base::RefCountedMemory*>( - ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( IDR_CONFLICT_FAVICON, scale_factor)); }
diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc index 684c4aa..5c5a6ba2 100644 --- a/chrome/browser/ui/webui/crashes_ui.cc +++ b/chrome/browser/ui/webui/crashes_ui.cc
@@ -237,6 +237,6 @@ // static base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( ui::ScaleFactor scale_factor) { - return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( IDR_CRASH_SAD_FAVICON, scale_factor); }
diff --git a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc index 44acfb1f..f6fed88 100644 --- a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc +++ b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
@@ -46,7 +46,7 @@ base::DictionaryValue* app_dict) { std::string icon_url; if (app_data.icon.isNull()) { - icon_url = webui::GetBitmapDataUrl(*ResourceBundle::GetSharedInstance() + icon_url = webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance() .GetImageNamed(IDR_APP_DEFAULT_ICON) .ToSkBitmap()); } else {
diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index 46f69c5..051c2662 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc
@@ -92,7 +92,7 @@ // static SkBitmap* ExtensionIconSource::LoadImageByResourceId(int resource_id) { base::StringPiece contents = - ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( + ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( resource_id, ui::SCALE_FACTOR_100P); // Convert and return it.
diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index a36ccbf..a6d9325 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc
@@ -101,8 +101,9 @@ ui::ScaleFactor resource_scale_factor = ui::GetSupportedScaleFactor(parsed.device_scale_factor); callback.Run( - ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( - prepopulated_page.favicon_id, resource_scale_factor)); + ui::ResourceBundle::GetSharedInstance() + .LoadDataResourceBytesForScale(prepopulated_page.favicon_id, + resource_scale_factor)); return; } } @@ -194,7 +195,7 @@ } base::RefCountedMemory* default_favicon = - ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( resource_id, ui::GetSupportedScaleFactor(icon_request.device_scale_factor));
diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc index 293a141..fb2004f 100644 --- a/chrome/browser/ui/webui/flags_ui.cc +++ b/chrome/browser/ui/webui/flags_ui.cc
@@ -339,6 +339,6 @@ // static base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes( ui::ScaleFactor scale_factor) { - return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + IDR_FLAGS_FAVICON, scale_factor); }
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index 0bab4ae..eef48b39 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -475,7 +475,7 @@ } else if (interstitial_delegate.get()) { html = interstitial_delegate.get()->GetHTMLContents(); } else { - html = ResourceBundle::GetSharedInstance() + html = ui::ResourceBundle::GetSharedInstance() .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) .as_string(); }
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc index 3b1acc0..c031a38 100644 --- a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc +++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
@@ -163,6 +163,6 @@ // static base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( ui::ScaleFactor scale_factor) { - return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( + IDR_DOWNLOADS_FAVICON, scale_factor); }
diff --git a/chrome/browser/ui/webui/md_history_ui.cc b/chrome/browser/ui/webui/md_history_ui.cc index 33111b5..be4233a 100644 --- a/chrome/browser/ui/webui/md_history_ui.cc +++ b/chrome/browser/ui/webui/md_history_ui.cc
@@ -4,6 +4,11 @@ #include "chrome/browser/ui/webui/md_history_ui.h" +#include <memory> +#include <string> +#include <utility> +#include <vector> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" @@ -71,10 +76,6 @@ IDS_HISTORY_OTHER_SESSIONS_EXPAND_SESSION); source->AddLocalizedString("foundSearchResults", IDS_HISTORY_FOUND_SEARCH_RESULTS); - source->AddLocalizedString("hasSyncedResults", - IDS_MD_HISTORY_HAS_SYNCED_RESULTS); - source->AddLocalizedString("hasSyncedResultsDescription", - IDS_MD_HISTORY_HAS_SYNCED_RESULTS_DESCRIPTION); source->AddLocalizedString("historyMenuButton", IDS_MD_HISTORY_HISTORY_MENU_DESCRIPTION); source->AddLocalizedString("historyMenuItem",
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 2afecb6..f48c2c4 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -302,7 +302,7 @@ webui::SetLoadTimeDataDefaults(app_locale, &replacements); static const base::StringPiece incognito_tab_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( is_md_incognito_ntp_enabled ? IDR_MD_INCOGNITO_TAB_HTML : IDR_INCOGNITO_TAB_HTML)); @@ -368,7 +368,8 @@ webui::SetLoadTimeDataDefaults(app_locale, &localized_strings); static const base::StringPiece guest_tab_html( - ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( + guest_tab_ids)); ui::TemplateReplacements replacements; ui::TemplateReplacementsFromDictionaryValue(localized_strings, &replacements); @@ -474,8 +475,9 @@ SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); // Load the new tab page appropriate for this build. - base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_NEW_TAB_4_HTML)); + base::StringPiece new_tab_html( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_NEW_TAB_4_HTML)); std::string full_html = webui::GetI18nTemplateHtml(new_tab_html, &load_time_data); new_tab_html_ = base::RefCountedString::TakeString(&full_html); @@ -510,7 +512,7 @@ // Get our template. static const base::StringPiece new_tab_theme_css( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_NEW_INCOGNITO_TAB_THEME_CSS)); // Create the string from our template and the replacements. @@ -586,7 +588,7 @@ // Get our template. static const base::StringPiece new_tab_theme_css( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_NEW_TAB_4_THEME_CSS)); // Create the string from our template and the replacements.
diff --git a/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc b/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc index 08a6aad..28f8fd5 100644 --- a/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc +++ b/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
@@ -292,7 +292,8 @@ const base::Value* callback_id; CHECK(args->Get(0, &callback_id)); - offline_pages::ShowPrefetchedContentNotification(GURL("www.example.com")); + offline_pages::ShowPrefetchedContentNotification( + GURL("https://www.example.com")); ResolveJavascriptCallback(*callback_id, base::Value("Scheduled.")); } @@ -453,74 +454,74 @@ web_ui()->RegisterMessageCallback( "deleteSelectedPages", base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "deleteSelectedRequests", base::Bind( &OfflineInternalsUIMessageHandler::HandleDeleteSelectedRequests, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getRequestQueue", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetRequestQueue, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getStoredPages", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetStoredPages, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getEventLogs", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetEventLogs, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "setRecordRequestQueue", base::Bind(&OfflineInternalsUIMessageHandler::HandleSetRecordRequestQueue, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "setRecordPageModel", base::Bind(&OfflineInternalsUIMessageHandler::HandleSetRecordPageModel, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "setRecordPrefetchService", base::Bind( &OfflineInternalsUIMessageHandler::HandleSetRecordPrefetchService, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getLoggingState", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetLoggingState, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "addToRequestQueue", base::Bind(&OfflineInternalsUIMessageHandler::HandleAddToRequestQueue, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getNetworkStatus", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetNetworkStatus, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "scheduleNwake", base::Bind(&OfflineInternalsUIMessageHandler::HandleScheduleNwake, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "cancelNwake", base::Bind(&OfflineInternalsUIMessageHandler::HandleCancelNwake, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "showPrefetchNotification", base::Bind( &OfflineInternalsUIMessageHandler::HandleShowPrefetchNotification, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "generatePageBundle", base::Bind(&OfflineInternalsUIMessageHandler::HandleGeneratePageBundle, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getOperation", base::Bind(&OfflineInternalsUIMessageHandler::HandleGetOperation, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "downloadArchive", base::Bind(&OfflineInternalsUIMessageHandler::HandleDownloadArchive, - weak_ptr_factory_.GetWeakPtr())); + base::Unretained(this))); // Get the offline page model associated with this web ui. Profile* profile = Profile::FromWebUI(web_ui());
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc index 1fea2b8..53bf085 100644 --- a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
@@ -4,13 +4,15 @@ #include "chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h" -#include "ash/new_window_controller.h" -#include "ash/shell.h" +#include "ash/public/interfaces/constants.mojom.h" +#include "ash/public/interfaces/new_window.mojom.h" #include "base/bind.h" #include "base/command_line.h" #include "base/values.h" #include "chromeos/chromeos_switches.h" #include "content/public/browser/web_ui.h" +#include "content/public/common/service_manager_connection.h" +#include "services/service_manager/public/cpp/connector.h" #include "ui/events/devices/input_device_manager.h" namespace { @@ -71,7 +73,11 @@ void KeyboardHandler::HandleShowKeyboardShortcutsOverlay( const base::ListValue* args) const { - ash::Shell::Get()->new_window_controller()->ShowKeyboardOverlay(); + ash::mojom::NewWindowControllerPtr new_window_controller; + content::ServiceManagerConnection::GetForProcess() + ->GetConnector() + ->BindInterface(ash::mojom::kServiceName, &new_window_controller); + new_window_controller->ShowKeyboardOverlay(); } void KeyboardHandler::UpdateShowKeys() {
diff --git a/chrome/browser/ui/webui/system_info_ui.cc b/chrome/browser/ui/webui/system_info_ui.cc index e478be7..ba6a1ad0 100644 --- a/chrome/browser/ui/webui/system_info_ui.cc +++ b/chrome/browser/ui/webui/system_info_ui.cc
@@ -165,7 +165,7 @@ strings.Set("details", std::move(details)); } static const base::StringPiece systeminfo_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_ABOUT_SYS_HTML)); std::string full_html = webui::GetI18nTemplateHtml(systeminfo_html, &strings); callback_.Run(base::RefCountedString::TakeString(&full_html));
diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc index 529e500..1aa3453d 100644 --- a/chrome/browser/ui/webui/theme_source.cc +++ b/chrome/browser/ui/webui/theme_source.cc
@@ -58,7 +58,7 @@ scoped_refptr<base::RefCountedBytes> data) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ProcessImageOnUiThread( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id), + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id), scale, data); } @@ -132,7 +132,7 @@ // use 2x scale without 2x data packs, as well as omnibox requests for larger // (but still reasonable) scales (see below). const float max_scale = ui::GetScaleForScaleFactor( - ResourceBundle::GetSharedInstance().GetMaxScaleFactor()); + ui::ResourceBundle::GetSharedInstance().GetMaxScaleFactor()); const float unreasonable_scale = max_scale * 32; // TODO(reveman): Add support frames beyond 0 (crbug.com/750064). if ((resource_id == -1) || (scale >= unreasonable_scale) || (frame > 0)) { @@ -209,7 +209,7 @@ callback.Run(image_data.get()); } else { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + const ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); } }
diff --git a/chrome/browser/vr/BUILD.gn b/chrome/browser/vr/BUILD.gn index b0d176bd..b928216 100644 --- a/chrome/browser/vr/BUILD.gn +++ b/chrome/browser/vr/BUILD.gn
@@ -101,6 +101,10 @@ "gltf_parser.cc", "gltf_parser.h", "model/model.h", + "service/vr_device_manager.cc", + "service/vr_device_manager.h", + "service/vr_service_impl.cc", + "service/vr_service_impl.h", "target_property.h", "toolbar_helper.cc", "toolbar_helper.h", @@ -166,7 +170,7 @@ "elements/viewport_aware_root_unittest.cc", "fps_meter_unittest.cc", "gltf_parser_unittest.cc", - "run_all_unittests.cc", + "service/vr_device_manager_unittest.cc", "test/animation_utils.cc", "test/animation_utils.h", "test/constants.h", @@ -181,6 +185,7 @@ "test/mock_content_input_delegate.h", "test/paths.cc", "test/paths.h", + "test/run_all_unittests.cc", "test/ui_pixel_test.cc", "test/ui_pixel_test.h", "test/ui_scene_manager_test.cc", @@ -198,6 +203,12 @@ "//base/test:test_support", "//components/security_state/core", "//components/toolbar:vector_icons", + + # TODO(mthiesse, crbug.com/769373): Remove dependency on device/vr:fakes. + "//device/vr:fakes", + "//mojo/common", + "//mojo/edk/system", + "//mojo/public/cpp/bindings", "//skia", "//testing/gmock", "//testing/gtest",
diff --git a/chrome/browser/vr/service/DEPS b/chrome/browser/vr/service/DEPS new file mode 100644 index 0000000..1d7233d --- /dev/null +++ b/chrome/browser/vr/service/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+device/vr", +]
diff --git a/chrome/browser/vr/service/vr_device_manager.cc b/chrome/browser/vr/service/vr_device_manager.cc new file mode 100644 index 0000000..31e31a4 --- /dev/null +++ b/chrome/browser/vr/service/vr_device_manager.cc
@@ -0,0 +1,122 @@ +// Copyright 2015 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/vr/service/vr_device_manager.h" + +#include <utility> + +#include "base/bind.h" +#include "base/memory/ptr_util.h" +#include "base/memory/singleton.h" +#include "build/build_config.h" +#include "device/vr/features/features.h" + +#if defined(OS_ANDROID) +#include "device/vr/android/gvr/gvr_device_provider.h" +#endif + +#if BUILDFLAG(ENABLE_OPENVR) +#include "device/vr/openvr/openvr_device_provider.h" +#endif + +namespace vr { + +namespace { +VRDeviceManager* g_vr_device_manager = nullptr; +} + +VRDeviceManager* VRDeviceManager::GetInstance() { + if (!g_vr_device_manager) { + // Register VRDeviceProviders for the current platform + ProviderList providers; +#if defined(OS_ANDROID) + providers.emplace_back(std::make_unique<device::GvrDeviceProvider>()); +#endif + +#if BUILDFLAG(ENABLE_OPENVR) + providers.emplace_back(std::make_unique<OpenVRDeviceProvider>()); +#endif + new VRDeviceManager(std::move(providers)); + } + return g_vr_device_manager; +} + +bool VRDeviceManager::HasInstance() { + return g_vr_device_manager != nullptr; +} + +VRDeviceManager::VRDeviceManager(ProviderList providers) + : providers_(std::move(providers)) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + CHECK(!g_vr_device_manager); + g_vr_device_manager = this; +} + +VRDeviceManager::~VRDeviceManager() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + g_vr_device_manager = nullptr; +} + +void VRDeviceManager::AddService(VRServiceImpl* service) { + // Loop through any currently active devices and send Connected messages to + // the service. Future devices that come online will send a Connected message + // when they are created. + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + InitializeProviders(); + + std::vector<device::VRDevice*> devices; + for (const auto& provider : providers_) + provider->GetDevices(&devices); + + for (auto* device : devices) { + if (device->id() == device::VR_DEVICE_LAST_ID) + continue; + + if (devices_.find(device->id()) == devices_.end()) + devices_[device->id()] = device; + + service->ConnectDevice(device); + } + + services_.insert(service); +} + +void VRDeviceManager::RemoveService(VRServiceImpl* service) { + services_.erase(service); + + if (services_.empty()) { + // Delete the device manager when it has no active connections. + delete g_vr_device_manager; + } +} + +device::VRDevice* VRDeviceManager::GetDevice(unsigned int index) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (index == 0) + return nullptr; + + DeviceMap::iterator iter = devices_.find(index); + if (iter == devices_.end()) + return nullptr; + + return iter->second; +} + +void VRDeviceManager::InitializeProviders() { + if (vr_initialized_) + return; + + for (const auto& provider : providers_) + provider->Initialize(); + + vr_initialized_ = true; +} + +size_t VRDeviceManager::NumberOfConnectedServices() { + return services_.size(); +} + +} // namespace vr
diff --git a/chrome/browser/vr/service/vr_device_manager.h b/chrome/browser/vr/service/vr_device_manager.h new file mode 100644 index 0000000..c78137a0 --- /dev/null +++ b/chrome/browser/vr/service/vr_device_manager.h
@@ -0,0 +1,74 @@ +// Copyright 2015 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_VR_SERVICE_VR_DEVICE_MANAGER_H_ +#define CHROME_BROWSER_VR_SERVICE_VR_DEVICE_MANAGER_H_ + +#include <stdint.h> + +#include <map> +#include <memory> +#include <vector> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/threading/thread_checker.h" +#include "base/timer/timer.h" +#include "chrome/browser/vr/service/vr_service_impl.h" +#include "device/vr/vr_device.h" +#include "device/vr/vr_device_provider.h" +#include "device/vr/vr_service.mojom.h" +#include "mojo/public/cpp/bindings/binding_set.h" + +namespace vr { + +// Singleton used to provide the platform's VR devices to VRServiceImpl +// instances. +class VRDeviceManager { + public: + virtual ~VRDeviceManager(); + + // Returns the VRDeviceManager singleton. + static VRDeviceManager* GetInstance(); + static bool HasInstance(); + + // Adds a listener for device manager events. VRDeviceManager does not own + // this object. + // Automatically connects all currently available VR devices by querying + // the device providers and, for each returned device, calling + // VRServiceImpl::ConnectDevice. + void AddService(VRServiceImpl* service); + void RemoveService(VRServiceImpl* service); + + device::VRDevice* GetDevice(unsigned int index); + + protected: + using ProviderList = std::vector<std::unique_ptr<device::VRDeviceProvider>>; + + // Used by tests to supply providers. + explicit VRDeviceManager(ProviderList providers); + + size_t NumberOfConnectedServices(); + + private: + void InitializeProviders(); + + ProviderList providers_; + + // Devices are owned by their providers. + using DeviceMap = std::map<unsigned int, device::VRDevice*>; + DeviceMap devices_; + + bool vr_initialized_ = false; + + std::set<VRServiceImpl*> services_; + + THREAD_CHECKER(thread_checker_); + + DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_SERVICE_VR_DEVICE_MANAGER_H_
diff --git a/chrome/browser/vr/service/vr_device_manager_unittest.cc b/chrome/browser/vr/service/vr_device_manager_unittest.cc new file mode 100644 index 0000000..9d549d8 --- /dev/null +++ b/chrome/browser/vr/service/vr_device_manager_unittest.cc
@@ -0,0 +1,142 @@ +// Copyright 2015 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 <memory> +#include <utility> +#include <vector> + +#include "base/macros.h" +#include "base/memory/linked_ptr.h" +#include "base/memory/ptr_util.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "chrome/browser/vr/service/vr_device_manager.h" +#include "chrome/browser/vr/service/vr_service_impl.h" +#include "device/vr/test/fake_vr_device.h" +#include "device/vr/test/fake_vr_device_provider.h" +#include "device/vr/test/fake_vr_service_client.h" +#include "device/vr/vr_device_provider.h" +#include "device/vr/vr_service.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace vr { + +namespace { + +class VRDeviceManagerForTesting : public VRDeviceManager { + public: + explicit VRDeviceManagerForTesting(ProviderList providers) + : VRDeviceManager(std::move(providers)) {} + ~VRDeviceManagerForTesting() override = default; + + size_t NumberOfConnectedServices() { + return VRDeviceManager::NumberOfConnectedServices(); + } +}; + +} // namespace + +class VRDeviceManagerTest : public testing::Test { + public: + void onDisplaySynced() {} + + protected: + VRDeviceManagerTest() = default; + ~VRDeviceManagerTest() override = default; + + void SetUp() override { + std::vector<std::unique_ptr<device::VRDeviceProvider>> providers; + provider_ = new device::FakeVRDeviceProvider(); + providers.emplace_back( + std::unique_ptr<device::FakeVRDeviceProvider>(provider_)); + new VRDeviceManagerForTesting(std::move(providers)); + } + + void TearDown() override { EXPECT_FALSE(VRDeviceManager::HasInstance()); } + + std::unique_ptr<VRServiceImpl> BindService() { + device::mojom::VRServiceClientPtr proxy; + device::FakeVRServiceClient client(mojo::MakeRequest(&proxy)); + auto service = base::WrapUnique(new VRServiceImpl(-1, -1)); + service->SetClient(std::move(proxy), + base::Bind(&VRDeviceManagerTest::onDisplaySynced, + base::Unretained(this))); + return service; + } + + VRDeviceManagerForTesting* DeviceManager() { + EXPECT_TRUE(VRDeviceManager::HasInstance()); + return static_cast<VRDeviceManagerForTesting*>( + VRDeviceManager::GetInstance()); + } + + size_t ServiceCount() { return DeviceManager()->NumberOfConnectedServices(); } + + device::FakeVRDeviceProvider* Provider() { + EXPECT_TRUE(VRDeviceManager::HasInstance()); + return provider_; + } + + private: + base::MessageLoop message_loop_; + device::FakeVRDeviceProvider* provider_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(VRDeviceManagerTest); +}; + +TEST_F(VRDeviceManagerTest, InitializationTest) { + EXPECT_FALSE(Provider()->IsInitialized()); + + // Calling GetDevices should initialize the service if it hasn't been + // initialized yet or the providesr have been released. + // The mojom::VRService should initialize each of it's providers upon it's own + // initialization. And SetClient method in VRService class will invoke + // GetVRDevices too. + auto service = BindService(); + DeviceManager()->AddService(service.get()); + EXPECT_TRUE(Provider()->IsInitialized()); +} + +TEST_F(VRDeviceManagerTest, GetNoDevicesTest) { + auto service = BindService(); + DeviceManager()->AddService(service.get()); + // Calling GetVRDevices should initialize the providers. + EXPECT_TRUE(Provider()->IsInitialized()); + + // GetDeviceByIndex should return nullptr if an invalid index in queried. + device::VRDevice* queried_device = DeviceManager()->GetDevice(1); + EXPECT_EQ(nullptr, queried_device); +} + +TEST_F(VRDeviceManagerTest, GetDevicesTest) { + device::FakeVRDevice* device1 = new device::FakeVRDevice(); + Provider()->AddDevice(base::WrapUnique(device1)); + // VRDeviceManager will query devices as a side effect. + auto service_1 = BindService(); + // Should have successfully returned one device. + EXPECT_EQ(device1, DeviceManager()->GetDevice(device1->id())); + + device::FakeVRDevice* device2 = new device::FakeVRDevice(); + Provider()->AddDevice(base::WrapUnique(device2)); + auto service_2 = BindService(); + // Querying the WebVRDevice index should return the correct device. + EXPECT_EQ(device1, DeviceManager()->GetDevice(device1->id())); + EXPECT_EQ(device2, DeviceManager()->GetDevice(device2->id())); +} + +// Ensure that services are registered with the device manager as they are +// created and removed from the device manager as their connections are closed. +TEST_F(VRDeviceManagerTest, DeviceManagerRegistration) { + EXPECT_EQ(0u, ServiceCount()); + auto service_1 = BindService(); + EXPECT_EQ(1u, ServiceCount()); + auto service_2 = BindService(); + EXPECT_EQ(2u, ServiceCount()); + service_1.reset(); + EXPECT_EQ(1u, ServiceCount()); + service_2.reset(); + EXPECT_FALSE(VRDeviceManager::HasInstance()); +} + +} // namespace vr
diff --git a/device/vr/vr_service_impl.cc b/chrome/browser/vr/service/vr_service_impl.cc similarity index 81% rename from device/vr/vr_service_impl.cc rename to chrome/browser/vr/service/vr_service_impl.cc index 20dc19ce..cdb1be6 100644 --- a/device/vr/vr_service_impl.cc +++ b/chrome/browser/vr/service/vr_service_impl.cc
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/vr/vr_service_impl.h" +#include "chrome/browser/vr/service/vr_service_impl.h" #include <utility> #include "base/auto_reset.h" #include "base/bind.h" #include "base/memory/ptr_util.h" +#include "chrome/browser/vr/service/vr_device_manager.h" #include "device/vr/vr_device.h" -#include "device/vr/vr_device_manager.h" #include "device/vr/vr_display_impl.h" #include "mojo/public/cpp/bindings/strong_binding.h" -namespace device { +namespace vr { VRServiceImpl::VRServiceImpl(int render_frame_process_id, int render_frame_routing_id) @@ -35,13 +35,13 @@ void VRServiceImpl::Create(int render_frame_process_id, int render_frame_routing_id, - mojom::VRServiceRequest request) { + device::mojom::VRServiceRequest request) { mojo::MakeStrongBinding(std::make_unique<VRServiceImpl>( render_frame_process_id, render_frame_routing_id), std::move(request)); } -void VRServiceImpl::SetClient(mojom::VRServiceClientPtr service_client, +void VRServiceImpl::SetClient(device::mojom::VRServiceClientPtr service_client, SetClientCallback callback) { DCHECK(!client_.get()); client_ = std::move(service_client); @@ -59,15 +59,15 @@ // Creates a VRDisplayImpl unique to this service so that the associated page // can communicate with the VRDevice. -void VRServiceImpl::ConnectDevice(VRDevice* device) { +void VRServiceImpl::ConnectDevice(device::VRDevice* device) { // Client should always be set as this is called through SetClient. DCHECK(client_); DCHECK(displays_.count(device) == 0); - mojom::VRDisplayInfoPtr display_info = device->GetVRDisplayInfo(); + device::mojom::VRDisplayInfoPtr display_info = device->GetVRDisplayInfo(); DCHECK(display_info); if (!display_info) return; - displays_[device] = std::make_unique<VRDisplayImpl>( + displays_[device] = std::make_unique<device::VRDisplayImpl>( device, render_frame_process_id_, render_frame_routing_id_, client_.get(), std::move(display_info)); } @@ -78,9 +78,10 @@ } } -VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting(VRDevice* device) { +device::VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting( + device::VRDevice* device) { auto it = displays_.find(device); return (it == displays_.end()) ? nullptr : it->second.get(); } -} // namespace device +} // namespace vr
diff --git a/chrome/browser/vr/service/vr_service_impl.h b/chrome/browser/vr/service/vr_service_impl.h new file mode 100644 index 0000000..fa09cbf --- /dev/null +++ b/chrome/browser/vr/service/vr_service_impl.h
@@ -0,0 +1,68 @@ +// Copyright 2016 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_VR_SERVICE_VR_SERVICE_IMPL_H_ +#define CHROME_BROWSER_VR_SERVICE_VR_SERVICE_IMPL_H_ + +#include <memory> + +#include "base/macros.h" + +#include "device/vr/vr_device.h" +#include "device/vr/vr_service.mojom.h" +#include "mojo/public/cpp/bindings/binding.h" + +namespace device { +class VRDisplayImpl; +} + +namespace vr { + +// Browser process representation of a WebVR site session. Instantiated through +// Mojo once the user loads a page containing WebVR. +// It instantiates a VRDisplayImpl for each newly connected VRDisplay and sends +// the display's info to the render process through its connected +// mojom::VRServiceClient. +class VRServiceImpl : public device::mojom::VRService { + public: + VRServiceImpl(int render_frame_process_id, int render_frame_routing_id); + ~VRServiceImpl() override; + + static void Create(int render_frame_process_id, + int render_frame_routing_id, + device::mojom::VRServiceRequest request); + + // device::mojom::VRService implementation + // Adds this service to the VRDeviceManager. + void SetClient(device::mojom::VRServiceClientPtr service_client, + SetClientCallback callback) override; + + // Tells the render process that a new VR device is available. + void ConnectDevice(device::VRDevice* device); + + private: + // TODO(mthiesse): Make testable parts protected and have the test expose them + // through getters in a subclass. + friend class VRDisplayImplTest; + + void SetListeningForActivate(bool listening) override; + + std::map<device::VRDevice*, std::unique_ptr<device::VRDisplayImpl>> displays_; + + device::mojom::VRServiceClientPtr client_; + + const int render_frame_process_id_; + const int render_frame_routing_id_; + + base::WeakPtrFactory<VRServiceImpl> weak_ptr_factory_; + + // Getter for testing. + device::VRDisplayImpl* GetVRDisplayImplForTesting(device::VRDevice* device); + + DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_SERVICE_VR_SERVICE_IMPL_H_
diff --git a/chrome/browser/vr/test/DEPS b/chrome/browser/vr/test/DEPS new file mode 100644 index 0000000..0c9b053 --- /dev/null +++ b/chrome/browser/vr/test/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+mojo/edk/embedder", +] \ No newline at end of file
diff --git a/chrome/browser/vr/run_all_unittests.cc b/chrome/browser/vr/test/run_all_unittests.cc similarity index 95% rename from chrome/browser/vr/run_all_unittests.cc rename to chrome/browser/vr/test/run_all_unittests.cc index 8995188..2a93546 100644 --- a/chrome/browser/vr/run_all_unittests.cc +++ b/chrome/browser/vr/test/run_all_unittests.cc
@@ -8,6 +8,7 @@ #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" #include "build/build_config.h" +#include "mojo/edk/embedder/embedder.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -21,6 +22,8 @@ void Initialize() override { base::TestSuite::Initialize(); + mojo::edk::Init(); + ui::RegisterPathProvider(); base::FilePath pak_path;
diff --git a/chrome/browser/vr/vr_controller_model.cc b/chrome/browser/vr/vr_controller_model.cc index ea6feb9..cd3845f 100644 --- a/chrome/browser/vr/vr_controller_model.cc +++ b/chrome/browser/vr/vr_controller_model.cc
@@ -34,7 +34,7 @@ sk_sp<SkImage> LoadPng(int resource_id) { base::StringPiece data = - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); + ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); SkBitmap bitmap; bool decoded = gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(data.data()), @@ -147,7 +147,7 @@ std::unique_ptr<VrControllerModel> VrControllerModel::LoadFromResources() { TRACE_EVENT0("gpu", "VrControllerModel::LoadFromResources"); std::vector<std::unique_ptr<vr::gltf::Buffer>> buffers; - auto model_data = ResourceBundle::GetSharedInstance().GetRawDataResource( + auto model_data = ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_VR_SHELL_DDCONTROLLER_MODEL); std::unique_ptr<vr::gltf::Asset> asset = vr::BinaryGltfParser::Parse(model_data, &buffers);
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 2188351..9a680cc 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc
@@ -92,7 +92,8 @@ // use the standard application icon. if (image_family.empty()) { gfx::Image default_icon = - ResourceBundle::GetSharedInstance().GetImageNamed(IDR_APP_DEFAULT_ICON); + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_APP_DEFAULT_ICON); int size = kDesiredSizes[kNumDesiredSizes - 1]; SkBitmap bmp = skia::ImageOperations::Resize( *default_icon.ToSkBitmap(), skia::ImageOperations::RESIZE_BEST,
diff --git a/chrome/browser/web_bluetooth_browsertest.cc b/chrome/browser/web_bluetooth_browsertest.cc index fa8ab9d..89e768e 100644 --- a/chrome/browser/web_bluetooth_browsertest.cc +++ b/chrome/browser/web_bluetooth_browsertest.cc
@@ -76,7 +76,8 @@ EXPECT_EQ("NotFoundError: Bluetooth adapter not available.", result); // Crash the renderer process. - content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); + content::RenderProcessHost* process = + web_contents_->GetMainFrame()->GetProcess(); content::RenderProcessHostWatcher crash_observer( process, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); process->Shutdown(0, false);
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index d004dfa..52241443 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -675,17 +675,19 @@ base::StringPiece ChromeContentClient::GetDataResource( int resource_id, ui::ScaleFactor scale_factor) const { - return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( + return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( resource_id, scale_factor); } base::RefCountedMemory* ChromeContentClient::GetDataResourceBytes( int resource_id) const { - return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( + resource_id); } gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const { - return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( + resource_id); } std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index c4490d8..bba82d74f 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -231,6 +231,10 @@ // removed once we feel okay about leaving it on. const base::Feature kMacFullSizeContentView{"MacFullSizeContentView", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Enables "Share" submenu in File menu. +const base::Feature kMacSystemShareMenu{"MacSystemShareMenu", + base::FEATURE_DISABLED_BY_DEFAULT}; #endif // Enables or disables the Material Design version of chrome://bookmarks. @@ -305,11 +309,6 @@ #endif #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) -#if BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS) -const base::Feature kNativeWindowNavButtons{"NativeWindowNavButtons", - base::FEATURE_ENABLED_BY_DEFAULT}; -#endif // BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS) - const base::Feature kNetworkPrediction{"NetworkPrediction", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 2c25c0ca..9cf3301 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -123,6 +123,7 @@ #if defined(OS_MACOSX) extern const base::Feature kMacRTL; extern const base::Feature kMacFullSizeContentView; +extern const base::Feature kMacSystemShareMenu; #endif extern const base::Feature kMaterialDesignBookmarks; @@ -157,10 +158,6 @@ extern const base::Feature kNativeNotifications; #endif -#if BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS) -extern const base::Feature kNativeWindowNavButtons; -#endif - extern const base::Feature kNetworkPrediction; extern const base::Feature kOfflinePageDownloadSuggestionsFeature;
diff --git a/chrome/common/net/net_resource_provider.cc b/chrome/common/net/net_resource_provider.cc index ff8e7c7..4628a12 100644 --- a/chrome/common/net/net_resource_provider.cc +++ b/chrome/common/net/net_resource_provider.cc
@@ -44,7 +44,7 @@ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); value.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); html_data = webui::GetI18nTemplateHtml( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_DIR_HEADER_HTML), &value); } @@ -62,7 +62,7 @@ if (IDR_DIR_HEADER_HTML == key) return base::StringPiece(lazy_dir_lister.html_data); - return ResourceBundle::GetSharedInstance().GetRawDataResource(key); + return ui::ResourceBundle::GetSharedInstance().GetRawDataResource(key); } } // namespace chrome_common_net
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 4d5469666..2c593ce1 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -657,13 +657,15 @@ } SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() { - return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance(). - GetImageNamed(IDR_SAD_PLUGIN).ToSkBitmap()); + return const_cast<SkBitmap*>(ui::ResourceBundle::GetSharedInstance() + .GetImageNamed(IDR_SAD_PLUGIN) + .ToSkBitmap()); } SkBitmap* ChromeContentRendererClient::GetSadWebViewBitmap() { - return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance(). - GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap()); + return const_cast<SkBitmap*>(ui::ResourceBundle::GetSharedInstance() + .GetImageNamed(IDR_SAD_WEBVIEW) + .ToSkBitmap()); } bool ChromeContentRendererClient::OverrideCreatePlugin(
diff --git a/chrome/renderer/net/net_error_helper.cc b/chrome/renderer/net/net_error_helper.cc index ae41514..ef08b17 100644 --- a/chrome/renderer/net/net_error_helper.cc +++ b/chrome/renderer/net/net_error_helper.cc
@@ -231,7 +231,7 @@ int resource_id = IDR_NET_ERROR_HTML; const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); + ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); if (template_html.empty()) { NOTREACHED() << "unable to load template."; } else {
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc index 9e9ad14..1ba73163 100644 --- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -89,7 +89,7 @@ content::RenderFrame* render_frame, const blink::WebPluginParams& params) { const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_BLOCKED_PLUGIN_HTML)); base::DictionaryValue values; @@ -141,7 +141,7 @@ } const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); + ui::ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); DCHECK(!template_html.empty()) << "unable to load template. ID: " << template_id;
diff --git a/chrome/renderer/plugins/non_loadable_plugin_placeholder.cc b/chrome/renderer/plugins/non_loadable_plugin_placeholder.cc index 09b9484..4bf1993 100644 --- a/chrome/renderer/plugins/non_loadable_plugin_placeholder.cc +++ b/chrome/renderer/plugins/non_loadable_plugin_placeholder.cc
@@ -23,7 +23,7 @@ content::RenderFrame* render_frame, const blink::WebPluginParams& params) { const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_BLOCKED_PLUGIN_HTML)); base::DictionaryValue values; @@ -45,7 +45,7 @@ l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR)); const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_BLOCKED_PLUGIN_HTML)); std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
diff --git a/chrome/renderer/plugins/pdf_plugin_placeholder.cc b/chrome/renderer/plugins/pdf_plugin_placeholder.cc index 878b402f..7db11f5 100644 --- a/chrome/renderer/plugins/pdf_plugin_placeholder.cc +++ b/chrome/renderer/plugins/pdf_plugin_placeholder.cc
@@ -25,7 +25,7 @@ content::RenderFrame* render_frame, const blink::WebPluginParams& params) { const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_PDF_PLUGIN_HTML)); base::DictionaryValue values; values.SetString("fileName", GURL(params.url).ExtractFileName());
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 8c36394..7c548166 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -411,8 +411,9 @@ // static v8::Extension* SearchBoxExtension::Get() { - return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_SEARCHBOX_API)); + return new SearchBoxExtensionWrapper( + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_SEARCHBOX_API)); } // static
diff --git a/chrome/renderer/translate/translate_script_browsertest.cc b/chrome/renderer/translate/translate_script_browsertest.cc index ae818e7..8f08b1d9 100644 --- a/chrome/renderer/translate/translate_script_browsertest.cc +++ b/chrome/renderer/translate/translate_script_browsertest.cc
@@ -80,8 +80,9 @@ protected: void InjectElementLibrary() { std::string script; - base::StringPiece translate_js = ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_TRANSLATE_JS); + base::StringPiece translate_js = + ui::ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_TRANSLATE_JS); translate_js.CopyToString(&script); script += kElementJs; ExecuteScript(script);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 100950d97..90f5a76 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2476,6 +2476,7 @@ "../browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm", "../browser/ui/cocoa/applescript/window_applescript_test.mm", "../browser/ui/cocoa/certificate_viewer_mac_browsertest.mm", + "../browser/ui/cocoa/share_menu_controller_browsertest.mm", ] sources -= [ # TODO(groby): This test depends on hunspell and we cannot run it on
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc index 00db1bb..418a809 100644 --- a/chrome/test/base/chrome_unit_test_suite.cc +++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -110,7 +110,7 @@ } void ChromeUnitTestSuite::Shutdown() { - ResourceBundle::CleanupSharedInstance(); + ui::ResourceBundle::CleanupSharedInstance(); ChromeTestSuite::Shutdown(); } @@ -158,6 +158,6 @@ "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); }
diff --git a/chrome/test/chromedriver/VERSION b/chrome/test/chromedriver/VERSION index 0f34dc7..f3283c08 100644 --- a/chrome/test/chromedriver/VERSION +++ b/chrome/test/chromedriver/VERSION
@@ -1 +1 @@ -2.32 +2.33
diff --git a/chrome/test/data/webui/md_history/history_toolbar_test.js b/chrome/test/data/webui/md_history/history_toolbar_test.js index f2dfa7ef..bc4fb38 100644 --- a/chrome/test/data/webui/md_history/history_toolbar_test.js +++ b/chrome/test/data/webui/md_history/history_toolbar_test.js
@@ -69,38 +69,6 @@ toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); }); - test('sync notice shows and hides', function() { - toolbar.showSyncNotice = true; - Polymer.dom.flush(); - - var button = toolbar.$$('#info-button'); - var notice = toolbar.$$('#sync-notice'); - - assertTrue(!!button); - MockInteractions.tap(button); - - assertFalse(notice.hidden); - - // Tapping the notice does not dismiss it. - MockInteractions.tap(notice); - assertFalse(notice.hidden); - - // Tapping elsewhere does dismiss the notice. - MockInteractions.tap(toolbar); - assertTrue(notice.hidden); - - // Pressing escape hides the notice. - MockInteractions.tap(button); - assertFalse(notice.hidden); - MockInteractions.pressAndReleaseKeyOn(notice, /* esc */ 27, '', 'Escape'); - assertTrue(notice.hidden); - - // Hiding the button hides the notice. - MockInteractions.tap(button); - toolbar.showSyncNotice = false; - assertTrue(notice.hidden); - }); - test('menu promo hides when drawer is opened', function() { app.showMenuPromo_ = true; app.hasDrawer_ = true;
diff --git a/chrome/test/data/webui/md_history/test_util.js b/chrome/test/data/webui/md_history/test_util.js index 7e781fc2..5cb0d63 100644 --- a/chrome/test/data/webui/md_history/test_util.js +++ b/chrome/test/data/webui/md_history/test_util.js
@@ -89,9 +89,6 @@ function createHistoryInfo(searchTerm) { return { finished: true, - hasSyncedResults: false, - queryInterval: 'Monday - Tuesday', - queryMonth: 'June', term: searchTerm || '' }; }
diff --git a/chrome/test/data/webui/webui_resource_browsertest.cc b/chrome/test/data/webui/webui_resource_browsertest.cc index b83d4ed..feb0efd 100644 --- a/chrome/test/data/webui/webui_resource_browsertest.cc +++ b/chrome/test/data/webui/webui_resource_browsertest.cc
@@ -23,7 +23,7 @@ base::FilePath pak_path; ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path)); pak_path = pak_path.AppendASCII("browser_tests.pak"); - ResourceBundle::GetSharedInstance().AddDataPackFromPath( + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( pak_path, ui::SCALE_FACTOR_NONE); } @@ -34,7 +34,7 @@ } void LoadResource(int idr) { - ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); scoped_refptr<base::RefCountedMemory> resource = bundle.LoadDataResourceBytes(idr); RunTest(GURL(std::string("data:text/html,") +
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn index d3726b9..cf2c5a1 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn
@@ -46,6 +46,7 @@ "//components/url_formatter", "//content/public/child", "//content/public/common", + "//content/public/network", "//content/public/utility", "//courgette:courgette_lib", "//extensions/features", @@ -53,6 +54,8 @@ "//media", "//net:net_with_v8", "//printing/features", + "//services/proxy_resolver/public/cpp:cpp_browser", + "//services/proxy_resolver/public/cpp:cpp_utility", "//services/service_manager/public/cpp", "//skia", "//sql", @@ -98,7 +101,6 @@ deps += [ "//chrome/common:mojo_bindings", "//chrome/common/importer:interfaces", - "//net:net_utility_services", "//services/data_decoder:lib", ] }
diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS index eccb81c..e8a81f0 100644 --- a/chrome/utility/DEPS +++ b/chrome/utility/DEPS
@@ -9,11 +9,13 @@ "+components/safe_json", "+components/wifi", "+content/public/child", + "+content/public/network", "+content/public/utility", "+courgette", "+extensions/common", "+extensions/features", "+media", + "+services/proxy_resolver/public/cpp", "+services/service_manager/embedder", "+services/service_manager/public/cpp", "+services/ui/public",
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index c07194f..98e844e 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc
@@ -32,6 +32,7 @@ #include "extensions/features/features.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "printing/features/features.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h" #include "services/service_manager/embedder/embedded_service_info.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "third_party/zlib/google/zip.h" @@ -41,7 +42,7 @@ #include "chrome/utility/importer/profile_import_impl.h" #include "chrome/utility/importer/profile_import_service.h" #include "chrome/utility/media_router/dial_device_description_parser_impl.h" -#include "net/proxy/mojo_proxy_resolver_factory_impl.h" // nogncheck +#include "content/public/network/url_request_context_builder_mojo.h" #include "net/proxy/proxy_resolver_v8.h" #endif // !defined(OS_ANDROID) @@ -206,9 +207,10 @@ #if !defined(OS_ANDROID) void CreateProxyResolverFactory( - net::interfaces::ProxyResolverFactoryRequest request) { - mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(), - std::move(request)); + proxy_resolver::mojom::ProxyResolverFactoryRequest request) { + mojo::MakeStrongBinding( + base::MakeUnique<proxy_resolver::MojoProxyResolverFactoryImpl>(), + std::move(request)); } class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter { @@ -288,7 +290,7 @@ registry->AddInterface(base::Bind(&FilePatcherImpl::Create), base::ThreadTaskRunnerHandle::Get()); #if !defined(OS_ANDROID) - registry->AddInterface<net::interfaces::ProxyResolverFactory>( + registry->AddInterface<proxy_resolver::mojom::ProxyResolverFactory>( base::Bind(CreateProxyResolverFactory), base::ThreadTaskRunnerHandle::Get()); registry->AddInterface(base::Bind(CreateResourceUsageReporter),
diff --git a/chrome_elf/nt_registry/nt_registry.cc b/chrome_elf/nt_registry/nt_registry.cc index aca2a074..69b11c75 100644 --- a/chrome_elf/nt_registry/nt_registry.cc +++ b/chrome_elf/nt_registry/nt_registry.cc
@@ -17,6 +17,8 @@ NtDeleteKeyFunction g_nt_delete_key = nullptr; NtOpenKeyExFunction g_nt_open_key_ex = nullptr; NtCloseFunction g_nt_close = nullptr; +NtQueryKeyFunction g_nt_query_key = nullptr; +NtEnumerateKeyFunction g_nt_enumerate_key = nullptr; NtQueryValueKeyFunction g_nt_query_value_key = nullptr; NtSetValueKeyFunction g_nt_set_value_key = nullptr; @@ -28,6 +30,10 @@ wchar_t g_kRegPathHKCU[nt::g_kRegMaxPathLen + 1] = L""; wchar_t g_current_user_sid_string[nt::g_kRegMaxPathLen + 1] = L""; +// Max number of tries for system API calls when STATUS_BUFFER_TOO_SMALL can be +// returned. +enum { kMaxTries = 5 }; + // For testing only. wchar_t g_HKLM_override[nt::g_kRegMaxPathLen + 1] = L""; wchar_t g_HKCU_override[nt::g_kRegMaxPathLen + 1] = L""; @@ -88,6 +94,12 @@ g_nt_close = reinterpret_cast<NtCloseFunction>(::GetProcAddress(ntdll, "NtClose")); + g_nt_query_key = reinterpret_cast<NtQueryKeyFunction>( + ::GetProcAddress(ntdll, "NtQueryKey")); + + g_nt_enumerate_key = reinterpret_cast<NtEnumerateKeyFunction>( + ::GetProcAddress(ntdll, "NtEnumerateKey")); + g_nt_query_value_key = reinterpret_cast<NtQueryValueKeyFunction>( ::GetProcAddress(ntdll, "NtQueryValueKey")); @@ -95,8 +107,8 @@ ::GetProcAddress(ntdll, "NtSetValueKey")); if (!g_rtl_init_unicode_string || !g_nt_create_key || !g_nt_open_key_ex || - !g_nt_delete_key || !g_nt_close || !g_nt_query_value_key || - !g_nt_set_value_key) + !g_nt_delete_key || !g_nt_close || !g_nt_query_key || + !g_nt_enumerate_key || !g_nt_query_value_key || !g_nt_set_value_key) return false; // We need to set HKCU based on the sid of the current user account. @@ -620,8 +632,8 @@ ::wcsnlen(key_path, g_kRegMaxPathLen + 1) == g_kRegMaxPathLen + 1) return false; - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; if (root == nt::AUTO) root = g_system_install ? nt::HKLM : nt::HKCU; @@ -711,8 +723,8 @@ ::wcsnlen(key_path, g_kRegMaxPathLen + 1) == g_kRegMaxPathLen + 1) return false; - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; NTSTATUS status = STATUS_UNSUCCESSFUL; UNICODE_STRING key_path_uni = {}; @@ -746,17 +758,12 @@ } bool DeleteRegKey(HANDLE key) { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; - NTSTATUS status = STATUS_UNSUCCESSFUL; + NTSTATUS status = g_nt_delete_key(key); - status = g_nt_delete_key(key); - - if (NT_SUCCESS(status)) - return true; - - return false; + return NT_SUCCESS(status); } // wrapper function @@ -791,27 +798,27 @@ const wchar_t* value_name, ULONG* out_type, std::vector<BYTE>* out_buffer) { - if (!g_initialized) - InitNativeRegApi(); - - NTSTATUS ntstatus = STATUS_UNSUCCESSFUL; - UNICODE_STRING value_uni = {}; - g_rtl_init_unicode_string(&value_uni, value_name); - DWORD size_needed = 0; - - // First call to find out how much room we need for the value! - ntstatus = g_nt_query_value_key(key, &value_uni, KeyValueFullInformation, - nullptr, 0, &size_needed); - if (ntstatus != STATUS_BUFFER_TOO_SMALL) + if (!g_initialized && !InitNativeRegApi()) return false; - std::unique_ptr<BYTE[]> buffer(new BYTE[size_needed]); - KEY_VALUE_FULL_INFORMATION* value_info = - reinterpret_cast<KEY_VALUE_FULL_INFORMATION*>(buffer.get()); + UNICODE_STRING value_uni = {}; + g_rtl_init_unicode_string(&value_uni, value_name); - // Second call to get the value. - ntstatus = g_nt_query_value_key(key, &value_uni, KeyValueFullInformation, - value_info, size_needed, &size_needed); + // Use a loop here, to be a little more tolerant of concurrent registry + // changes. + NTSTATUS ntstatus = STATUS_UNSUCCESSFUL; + int tries = 0; + DWORD size_needed = 1; + std::vector<BYTE> buffer; + KEY_VALUE_FULL_INFORMATION* value_info = nullptr; + do { + buffer.resize(size_needed); + value_info = reinterpret_cast<KEY_VALUE_FULL_INFORMATION*>(buffer.data()); + + ntstatus = g_nt_query_value_key(key, &value_uni, KeyValueFullInformation, + value_info, size_needed, &size_needed); + } while (ntstatus == STATUS_BUFFER_TOO_SMALL && ++tries < kMaxTries); + if (!NT_SUCCESS(ntstatus)) return false; @@ -967,8 +974,8 @@ ULONG type, const BYTE* data, DWORD data_size) { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; NTSTATUS ntstatus = STATUS_UNSUCCESSFUL; UNICODE_STRING value_uni = {}; @@ -1093,26 +1100,98 @@ } //------------------------------------------------------------------------------ +// Enumeration Support +//------------------------------------------------------------------------------ + +bool QueryRegEnumerationInfo(HANDLE key, ULONG* out_subkey_count) { + if (!g_initialized && !InitNativeRegApi()) + return false; + + // Use a loop here, to be a little more tolerant of concurrent registry + // changes. + NTSTATUS ntstatus = STATUS_UNSUCCESSFUL; + int tries = 0; + // Start with sizeof the structure. It's very common for the variable sized + // "Class" element to be of length 0. + DWORD size_needed = sizeof(KEY_FULL_INFORMATION); + std::vector<BYTE> buffer; + KEY_FULL_INFORMATION* key_info = nullptr; + do { + buffer.resize(size_needed); + key_info = reinterpret_cast<KEY_FULL_INFORMATION*>(buffer.data()); + + ntstatus = g_nt_query_key(key, KeyFullInformation, key_info, size_needed, + &size_needed); + } while (ntstatus == STATUS_BUFFER_TOO_SMALL && ++tries < kMaxTries); + + if (!NT_SUCCESS(ntstatus)) + return false; + + // Move desired information to out variables. + *out_subkey_count = key_info->SubKeys; + + return true; +} + +bool QueryRegSubkey(HANDLE key, + ULONG subkey_index, + std::wstring* out_subkey_name) { + if (!g_initialized && !InitNativeRegApi()) + return false; + + // Use a loop here, to be a little more tolerant of concurrent registry + // changes. + NTSTATUS ntstatus = STATUS_UNSUCCESSFUL; + int tries = 0; + // Start with sizeof the structure, plus 12 characters. It's very common for + // key names to be < 12 characters (without being inefficient as an initial + // allocation). + DWORD size_needed = sizeof(KEY_BASIC_INFORMATION) + (12 * sizeof(wchar_t)); + std::vector<BYTE> buffer; + KEY_BASIC_INFORMATION* subkey_info = nullptr; + do { + buffer.resize(size_needed); + subkey_info = reinterpret_cast<KEY_BASIC_INFORMATION*>(buffer.data()); + + ntstatus = g_nt_enumerate_key(key, subkey_index, KeyBasicInformation, + subkey_info, size_needed, &size_needed); + } while (ntstatus == STATUS_BUFFER_TOO_SMALL && ++tries < kMaxTries); + + if (!NT_SUCCESS(ntstatus)) + return false; + + // Move desired information to out variables. + // NOTE: NameLength is size of Name array in bytes. Name array is also + // NOT null terminated! + BYTE* name = reinterpret_cast<BYTE*>(subkey_info->Name); + std::vector<BYTE> content(name, name + subkey_info->NameLength); + EnsureTerminatedSZ(&content, false); + out_subkey_name->assign(reinterpret_cast<wchar_t*>(content.data())); + + return true; +} + +//------------------------------------------------------------------------------ // Utils //------------------------------------------------------------------------------ const wchar_t* GetCurrentUserSidString() { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return nullptr; return g_current_user_sid_string; } bool IsCurrentProcWow64() { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; return g_wow64_proc; } bool SetTestingOverride(ROOT_KEY root, const std::wstring& new_path) { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return false; std::wstring sani_new_path = new_path; SanitizeSubkeyPath(&sani_new_path); @@ -1128,8 +1207,8 @@ } std::wstring GetTestingOverride(ROOT_KEY root) { - if (!g_initialized) - InitNativeRegApi(); + if (!g_initialized && !InitNativeRegApi()) + return std::wstring(); if (root == HKCU || (root == AUTO && !g_system_install)) return g_HKCU_override;
diff --git a/chrome_elf/nt_registry/nt_registry.h b/chrome_elf/nt_registry/nt_registry.h index 5db8771c..c5d37a33 100644 --- a/chrome_elf/nt_registry/nt_registry.h +++ b/chrome_elf/nt_registry/nt_registry.h
@@ -13,8 +13,10 @@ // Note that this API is currently lazy initialized. Any function that is // NOT merely a wrapper function (i.e. any function that directly interacts with // NTDLL) will immediately check: -// if (!g_initialized) -// InitNativeRegApi(); +// +// if (!g_initialized && !InitNativeRegApi()) +// return false; +// // There is currently no multi-threading lock around the lazy initialization, // as the main client for this API (chrome_elf) does not introduce // a multi-threading concern. This can easily be changed if needed. @@ -73,11 +75,13 @@ // Delete a registry key. // - Caller must still call CloseRegKey after the delete. +// - Non-recursive. Must have no subkeys. bool DeleteRegKey(HANDLE key); // Delete a registry key. // - WRAPPER: Function opens and closes the target key for caller. // - Use |wow64_override| to force redirection behaviour, or pass nt::NONE. +// - Non-recursive. Must have no subkeys. bool DeleteRegKey(ROOT_KEY root, WOW64_OVERRIDE wow64_override, const wchar_t* key_path); @@ -223,6 +227,25 @@ const std::vector<std::wstring>& values); //------------------------------------------------------------------------------ +// Enumeration Support +//------------------------------------------------------------------------------ + +// Query key information for subkey enumeration. +// - Key handle should have been opened with OpenRegKey (with at least +// KEY_ENUMERATE_SUB_KEYS access rights). +// - Currently only returns the number of subkeys. Use |subkey_count| +// in a loop for calling QueryRegSubkey. +bool QueryRegEnumerationInfo(HANDLE key, ULONG* out_subkey_count); + +// Enumerate subkeys by index. +// - Key handle should have been opened with OpenRegKey (with at least +// KEY_ENUMERATE_SUB_KEYS access rights). +// - Get subkey count by calling QueryRegEnumerationInfo. +bool QueryRegSubkey(HANDLE key, + ULONG subkey_index, + std::wstring* out_subkey_name); + +//------------------------------------------------------------------------------ // Utils //------------------------------------------------------------------------------
diff --git a/chrome_elf/nt_registry/nt_registry_unittest.cc b/chrome_elf/nt_registry/nt_registry_unittest.cc index ee8f1af..08728db 100644 --- a/chrome_elf/nt_registry/nt_registry_unittest.cc +++ b/chrome_elf/nt_registry/nt_registry_unittest.cc
@@ -8,6 +8,7 @@ #include <rpc.h> #include <stddef.h> +#include "base/callback_helpers.h" #include "base/test/test_reg_util_win.h" #include "testing/gtest/include/gtest/gtest.h" @@ -316,7 +317,7 @@ // NT registry API tests //------------------------------------------------------------------------------ -TEST_F(NtRegistryTest, API_DWORD) { +TEST_F(NtRegistryTest, ApiDword) { HANDLE key_handle; const wchar_t* dword_val_name = L"DwordTestValue"; DWORD dword_val = 1234; @@ -326,6 +327,8 @@ &key_handle)); ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); ASSERT_NE(key_handle, nullptr); + base::ScopedClosureRunner key_closer( + base::BindOnce(&nt::CloseRegKey, key_handle)); DWORD get_dword = 0; EXPECT_FALSE(nt::QueryRegValueDWORD(key_handle, dword_val_name, &get_dword)); @@ -335,14 +338,12 @@ // Get EXPECT_TRUE(nt::QueryRegValueDWORD(key_handle, dword_val_name, &get_dword)); - EXPECT_TRUE(get_dword == dword_val); + EXPECT_EQ(get_dword, dword_val); - // Clean up - EXPECT_TRUE(nt::DeleteRegKey(key_handle)); - nt::CloseRegKey(key_handle); + // Clean up done by NtRegistryTest. } -TEST_F(NtRegistryTest, API_SZ) { +TEST_F(NtRegistryTest, ApiSz) { HANDLE key_handle; const wchar_t* sz_val_name = L"SzTestValue"; std::wstring sz_val = L"blah de blah de blahhhhh."; @@ -363,6 +364,8 @@ &key_handle)); ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); ASSERT_NE(key_handle, nullptr); + base::ScopedClosureRunner key_closer( + base::BindOnce(&nt::CloseRegKey, key_handle)); std::wstring get_sz; EXPECT_FALSE(nt::QueryRegValueSZ(key_handle, sz_val_name, &get_sz)); @@ -386,44 +389,26 @@ // Get // ------------------------------ EXPECT_TRUE(nt::QueryRegValueSZ(key_handle, sz_val_name, &get_sz)); - EXPECT_TRUE(get_sz.compare(sz_val) == 0); + EXPECT_EQ(get_sz, sz_val); EXPECT_TRUE(nt::QueryRegValueSZ(key_handle, sz_val_name2, &get_sz)); - EXPECT_TRUE(get_sz.compare(sz_val2) == 0); + EXPECT_EQ(get_sz, sz_val2); EXPECT_TRUE(nt::QueryRegValueSZ(key_handle, sz_val_name3, &get_sz)); // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(get_sz.compare(sz_val3) == 0); + EXPECT_EQ(get_sz, sz_val3); EXPECT_TRUE(nt::QueryRegValueSZ(key_handle, sz_val_name4, &get_sz)); // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(get_sz.compare(sz_val3) == 0); + EXPECT_EQ(get_sz, sz_val3); EXPECT_TRUE(nt::QueryRegValueSZ(key_handle, sz_val_name5, &get_sz)); // Should be adjusted under the hood to an empty string. - EXPECT_TRUE(get_sz.compare(sz_val2) == 0); + EXPECT_EQ(get_sz, sz_val2); - // Clean up - // ------------------------------ - EXPECT_TRUE(nt::DeleteRegKey(key_handle)); - nt::CloseRegKey(key_handle); + // Clean up done by NtRegistryTest. } -TEST_F(NtRegistryTest, API_MULTISZ) { +TEST_F(NtRegistryTest, ApiMultiSz) { HANDLE key_handle; - const wchar_t* multisz_val_name = L"SzmultiTestValue"; - std::vector<std::wstring> multisz_val; - std::wstring multi1 = L"one"; - std::wstring multi2 = L"two"; - std::wstring multi3 = L"three"; - const wchar_t* multisz_val_name2 = L"SzmultiTestValueBad"; - std::wstring multi_empty = L""; - const wchar_t* multisz_val_name3 = L"SzmultiTestValueMalformed"; - const wchar_t* multisz_val_name4 = L"SzmultiTestValueMalformed2"; - const wchar_t* multisz_val_name5 = L"SzmultiTestValueMalformed3"; - const wchar_t* multisz_val_name6 = L"SzmultiTestValueMalformed4"; - std::wstring multisz_val3 = L"malformed"; - BYTE* multisz_val3_byte = reinterpret_cast<BYTE*>(&multisz_val3[0]); - std::vector<BYTE> malform; - for (size_t i = 0; i < (multisz_val3.size() * sizeof(wchar_t)); i++) - malform.push_back(multisz_val3_byte[i]); - const wchar_t* multisz_val_name7 = L"SzmultiTestValueSize0"; + std::vector<std::wstring> multisz_val_set; + std::vector<std::wstring> multisz_val_get; // Create a subkey to play under. // ------------------------------ @@ -431,113 +416,115 @@ &key_handle)); ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); ASSERT_NE(key_handle, nullptr); + base::ScopedClosureRunner key_closer( + base::BindOnce(&nt::CloseRegKey, key_handle)); - multisz_val.push_back(multi1); - multisz_val.push_back(multi2); - multisz_val.push_back(multi3); - - // Set + // Test 1 - Success // ------------------------------ + const wchar_t* multisz_val_name = L"SzmultiTestValue"; + std::wstring multi1 = L"one"; + std::wstring multi2 = L"two"; + std::wstring multi3 = L"three"; + + multisz_val_set.push_back(multi1); + multisz_val_set.push_back(multi2); + multisz_val_set.push_back(multi3); EXPECT_TRUE( - nt::SetRegValueMULTISZ(key_handle, multisz_val_name, multisz_val)); - multisz_val.clear(); - multisz_val.push_back(multi_empty); + nt::SetRegValueMULTISZ(key_handle, multisz_val_name, multisz_val_set)); EXPECT_TRUE( - nt::SetRegValueMULTISZ(key_handle, multisz_val_name2, multisz_val)); - multisz_val.clear(); + nt::QueryRegValueMULTISZ(key_handle, multisz_val_name, &multisz_val_get)); + EXPECT_EQ(multisz_val_get, multisz_val_set); + multisz_val_set.clear(); + multisz_val_get.clear(); - // No null terminator. + // Test 2 - Bad value + // ------------------------------ + const wchar_t* multisz_val_name2 = L"SzmultiTestValueBad"; + std::wstring multi_empty = L""; + + multisz_val_set.push_back(multi_empty); + EXPECT_TRUE( + nt::SetRegValueMULTISZ(key_handle, multisz_val_name2, multisz_val_set)); + + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name2, + &multisz_val_get)); + EXPECT_EQ(multisz_val_get.size(), static_cast<DWORD>(0)); + multisz_val_set.clear(); + multisz_val_get.clear(); + + // Test 3 - Malformed + // ------------------------------ + std::wstring multisz_val3 = L"malformed"; + multisz_val_set.push_back(multisz_val3); + BYTE* multisz_val3_byte = reinterpret_cast<BYTE*>(&multisz_val3[0]); + std::vector<BYTE> malform; + for (size_t i = 0; i < (multisz_val3.size() * sizeof(wchar_t)); i++) + malform.push_back(multisz_val3_byte[i]); + + // 3.1: No null terminator. + // ------------------------------ + const wchar_t* multisz_val_name3 = L"SzmultiTestValueMalformed"; EXPECT_TRUE(nt::SetRegKeyValue(key_handle, multisz_val_name3, REG_MULTI_SZ, malform.data(), static_cast<DWORD>(malform.size()))); + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name3, + &multisz_val_get)); + // Should be adjusted under the hood to equal multisz_val3. + EXPECT_EQ(multisz_val_get, multisz_val_set); + multisz_val_get.clear(); + + // 3.2: Single trailing 0 byte. + // ------------------------------ + const wchar_t* multisz_val_name4 = L"SzmultiTestValueMalformed2"; malform.push_back(0); - // Single trailing 0 byte. EXPECT_TRUE(nt::SetRegKeyValue(key_handle, multisz_val_name4, REG_MULTI_SZ, malform.data(), static_cast<DWORD>(malform.size()))); + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name4, + &multisz_val_get)); + // Should be adjusted under the hood to equal multisz_val3. + EXPECT_EQ(multisz_val_get, multisz_val_set); + multisz_val_get.clear(); + + // 3.3: Two trailing 0 bytes. + // ------------------------------ + const wchar_t* multisz_val_name5 = L"SzmultiTestValueMalformed3"; malform.push_back(0); - // Two trailing 0 bytes. EXPECT_TRUE(nt::SetRegKeyValue(key_handle, multisz_val_name5, REG_MULTI_SZ, malform.data(), static_cast<DWORD>(malform.size()))); + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name5, + &multisz_val_get)); + // Should be adjusted under the hood to equal multisz_val3. + EXPECT_EQ(multisz_val_get, multisz_val_set); + multisz_val_get.clear(); + + // 3.4: Three trailing 0 bytes. + // ------------------------------ + const wchar_t* multisz_val_name6 = L"SzmultiTestValueMalformed4"; malform.push_back(0); - // Three trailing 0 bytes. EXPECT_TRUE(nt::SetRegKeyValue(key_handle, multisz_val_name6, REG_MULTI_SZ, malform.data(), static_cast<DWORD>(malform.size()))); + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name6, + &multisz_val_get)); + // Should be adjusted under the hood to equal multisz_val3. + EXPECT_EQ(multisz_val_get, multisz_val_set); + multisz_val_set.clear(); + multisz_val_get.clear(); - // Size 0 value. + // Test 4 - Size zero + // ------------------------------ + const wchar_t* multisz_val_name7 = L"SzmultiTestValueSize0"; EXPECT_TRUE(nt::SetRegKeyValue(key_handle, multisz_val_name7, REG_MULTI_SZ, nullptr, 0)); + EXPECT_TRUE(nt::QueryRegValueMULTISZ(key_handle, multisz_val_name7, + &multisz_val_get)); + // Should be empty. + EXPECT_EQ(multisz_val_get, multisz_val_set); - // Get - // ------------------------------ - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name, &multisz_val)); - if (multisz_val.size() == 3) { - EXPECT_TRUE(multi1.compare(multisz_val.at(0)) == 0); - EXPECT_TRUE(multi2.compare(multisz_val.at(1)) == 0); - EXPECT_TRUE(multi3.compare(multisz_val.at(2)) == 0); - } else { - EXPECT_TRUE(false); - } - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name2, &multisz_val)); - EXPECT_EQ(multisz_val.size(), static_cast<DWORD>(0)); - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name3, &multisz_val)); - if (multisz_val.size(), 1) { - // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(multisz_val3.compare(multisz_val.at(0)) == 0); - } else { - EXPECT_TRUE(false); - } - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name4, &multisz_val)); - if (multisz_val.size(), 1) { - // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(multisz_val3.compare(multisz_val.at(0)) == 0); - } else { - EXPECT_TRUE(false); - } - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name5, &multisz_val)); - if (multisz_val.size(), 1) { - // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(multisz_val3.compare(multisz_val.at(0)) == 0); - } else { - EXPECT_TRUE(false); - } - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name6, &multisz_val)); - if (multisz_val.size(), 1) { - // Should be adjusted under the hood to equal sz_val3. - EXPECT_TRUE(multisz_val3.compare(multisz_val.at(0)) == 0); - } else { - EXPECT_TRUE(false); - } - multisz_val.clear(); - - EXPECT_TRUE( - nt::QueryRegValueMULTISZ(key_handle, multisz_val_name7, &multisz_val)); - // Should be adjusted under the hood to an empty string. - EXPECT_TRUE(multisz_val.empty()); - - // Clean up - // ------------------------------ - EXPECT_TRUE(nt::DeleteRegKey(key_handle)); - nt::CloseRegKey(key_handle); + // Clean up done by NtRegistryTest. } TEST_F(NtRegistryTest, CreateRegKeyRecursion) { @@ -573,6 +560,90 @@ ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); ASSERT_NE(key_handle, nullptr); nt::CloseRegKey(key_handle); + + // Clean up done by NtRegistryTest. +} + +TEST_F(NtRegistryTest, ApiEnumeration) { + HANDLE key_handle; + HANDLE subkey_handle; + static constexpr wchar_t key[] = L"NTRegistry\\enum"; + static constexpr wchar_t subkey1[] = L"NTRegistry\\enum\\subkey1"; + static constexpr wchar_t subkey2[] = L"NTRegistry\\enum\\subkey2"; + static constexpr wchar_t subkey3[] = L"NTRegistry\\enum\\subkey3"; + static constexpr const wchar_t* check_names[] = { + L"subkey1", L"subkey2", L"subkey3", + }; + // Test out the "(Default)" value name in this suite. + static constexpr wchar_t subkey_val_name[] = L""; + DWORD subkey_val = 1234; + + // Create a subkey to play under. + // ------------------------------ + ASSERT_TRUE(nt::CreateRegKey(nt::HKCU, key, KEY_ALL_ACCESS, &key_handle)); + ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); + ASSERT_NE(key_handle, nullptr); + base::ScopedClosureRunner key_closer( + base::BindOnce(&nt::CloseRegKey, key_handle)); + + // Set + // ------------------------------ + // Sub-subkey with a default value. + ASSERT_TRUE( + nt::CreateRegKey(nt::HKCU, subkey1, KEY_ALL_ACCESS, &subkey_handle)); + ASSERT_NE(subkey_handle, INVALID_HANDLE_VALUE); + ASSERT_NE(subkey_handle, nullptr); + EXPECT_TRUE(nt::SetRegValueDWORD(subkey_handle, subkey_val_name, subkey_val)); + nt::CloseRegKey(subkey_handle); + + // Sub-subkey with a default value. + ASSERT_TRUE( + nt::CreateRegKey(nt::HKCU, subkey2, KEY_ALL_ACCESS, &subkey_handle)); + ASSERT_NE(subkey_handle, INVALID_HANDLE_VALUE); + ASSERT_NE(subkey_handle, nullptr); + EXPECT_TRUE(nt::SetRegValueDWORD(subkey_handle, subkey_val_name, subkey_val)); + nt::CloseRegKey(subkey_handle); + + // Sub-subkey with a default value. + ASSERT_TRUE( + nt::CreateRegKey(nt::HKCU, subkey3, KEY_ALL_ACCESS, &subkey_handle)); + ASSERT_NE(subkey_handle, INVALID_HANDLE_VALUE); + ASSERT_NE(subkey_handle, nullptr); + EXPECT_TRUE(nt::SetRegValueDWORD(subkey_handle, subkey_val_name, subkey_val)); + nt::CloseRegKey(subkey_handle); + + // Get (via enumeration) + // ------------------------------ + ULONG subkey_count = 0; + EXPECT_TRUE(nt::QueryRegEnumerationInfo(key_handle, &subkey_count)); + ASSERT_EQ(subkey_count, ULONG{3}); + + std::wstring subkey_name; + for (ULONG i = 0; i < subkey_count; i++) { + ASSERT_TRUE(nt::QueryRegSubkey(key_handle, i, &subkey_name)); + + bool found = false; + for (size_t index = 0; index < arraysize(check_names); index++) { + if (0 == subkey_name.compare(check_names[index])) { + found = true; + break; + } + } + ASSERT_TRUE(found); + + // Grab the default DWORD value out of this subkey. + DWORD value = 0; + std::wstring temp(key); + temp.append(L"\\"); + temp.append(subkey_name); + EXPECT_TRUE(nt::QueryRegValueDWORD(nt::HKCU, nt::NONE, temp.c_str(), + subkey_val_name, &value)); + EXPECT_EQ(value, subkey_val); + } + // Also test a known bad index. + EXPECT_FALSE(nt::QueryRegSubkey(key_handle, subkey_count, &subkey_name)); + + // Clean up done by NtRegistryTest. } } // namespace
diff --git a/chromecast/OWNERS b/chromecast/OWNERS index 741029b..5b43e742 100644 --- a/chromecast/OWNERS +++ b/chromecast/OWNERS
@@ -1,5 +1,6 @@ halliwell@chromium.org lcwu@chromium.org +servolk@chromium.org slan@chromium.org # COMPONENT: Chromecast
diff --git a/chromecast/media/cma/decoder/cast_audio_decoder.cc b/chromecast/media/cma/decoder/cast_audio_decoder.cc index 90f6af2..238e7f9 100644 --- a/chromecast/media/cma/decoder/cast_audio_decoder.cc +++ b/chromecast/media/cma/decoder/cast_audio_decoder.cc
@@ -238,8 +238,8 @@ result->set_duration(base::TimeDelta::FromMicroseconds( bus->frames() * base::Time::kMicrosecondsPerSecond / config_.samples_per_second)); - return make_scoped_refptr( - new media::DecoderBufferAdapter(config_.id, result)); + return base::MakeRefCounted<media::DecoderBufferAdapter>(config_.id, + result); } ::media::MediaLog media_log_;
diff --git a/chromecast/net/connectivity_checker.cc b/chromecast/net/connectivity_checker.cc index 9f0e7a1..5e9679e 100644 --- a/chromecast/net/connectivity_checker.cc +++ b/chromecast/net/connectivity_checker.cc
@@ -36,8 +36,8 @@ scoped_refptr<ConnectivityChecker> ConnectivityChecker::Create( const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, net::URLRequestContextGetter* url_request_context_getter) { - return make_scoped_refptr( - new ConnectivityCheckerImpl(task_runner, url_request_context_getter)); + return base::MakeRefCounted<ConnectivityCheckerImpl>( + task_runner, url_request_context_getter); } } // namespace chromecast
diff --git a/chromeos/components/tether/ble_synchronizer_unittest.cc b/chromeos/components/tether/ble_synchronizer_unittest.cc index e70e489..142aa22 100644 --- a/chromeos/components/tether/ble_synchronizer_unittest.cc +++ b/chromeos/components/tether/ble_synchronizer_unittest.cc
@@ -197,8 +197,8 @@ num_stop_error_ = 0; register_args_list_.clear(); - mock_adapter_ = make_scoped_refptr( - new NiceMock<MockBluetoothAdapterWithAdvertisements>()); + mock_adapter_ = base::MakeRefCounted< + NiceMock<MockBluetoothAdapterWithAdvertisements>>(); ON_CALL(*mock_adapter_, RegisterAdvertisementWithArgsStruct(_)) .WillByDefault( Invoke(this, &BleSynchronizerTest::OnAdapterRegisterAdvertisement)); @@ -250,7 +250,7 @@ if (success) { register_args_list_[reg_arg_index]->callback.Run( - make_scoped_refptr(new device::MockBluetoothAdvertisement())); + base::MakeRefCounted<device::MockBluetoothAdvertisement>()); } else { register_args_list_[reg_arg_index]->error_callback.Run( device::BluetoothAdvertisement::ErrorCode::
diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h index 9f40926..1e8093a1 100644 --- a/chromeos/dbus/cryptohome_client.h +++ b/chromeos/dbus/cryptohome_client.h
@@ -76,6 +76,9 @@ uint64_t total)> DircryptoMigrationProgessHandler; + // TPM Token Information retrieved from cryptohome. + // For invalid token |label| and |user_pin| will be empty, while |slot| will + // be set to -1. struct TpmTokenInfo { // Holds the PKCS #11 token label. This is not useful in practice to // identify a token but may be meaningful to a user.
diff --git a/chromeos/tpm/tpm_token_info_getter.cc b/chromeos/tpm/tpm_token_info_getter.cc index add206e..afcab9d 100644 --- a/chromeos/tpm/tpm_token_info_getter.cc +++ b/chromeos/tpm/tpm_token_info_getter.cc
@@ -6,6 +6,8 @@ #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/task_runner.h" @@ -36,13 +38,6 @@ namespace chromeos { -TPMTokenInfo::TPMTokenInfo() - : tpm_is_enabled(false), - token_slot_id(-1) { -} - -TPMTokenInfo::~TPMTokenInfo() {} - // static std::unique_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForUserToken( const AccountId& account_id, @@ -63,11 +58,11 @@ TPMTokenInfoGetter::~TPMTokenInfoGetter() {} -void TPMTokenInfoGetter::Start(const TPMTokenInfoCallback& callback) { +void TPMTokenInfoGetter::Start(TpmTokenInfoCallback callback) { CHECK(state_ == STATE_INITIAL); CHECK(!callback.is_null()); - callback_ = callback; + callback_ = std::move(callback); state_ = STATE_STARTED; Continue(); @@ -130,7 +125,7 @@ if (!tpm_is_enabled.value()) { state_ = STATE_DONE; - callback_.Run(TPMTokenInfo()); + std::move(callback_).Run(base::nullopt); return; } @@ -146,14 +141,7 @@ } state_ = STATE_DONE; - - TPMTokenInfo out_token_info; - out_token_info.tpm_is_enabled = true; - out_token_info.token_name = token_info->label; - out_token_info.user_pin = token_info->user_pin; - out_token_info.token_slot_id = token_info->slot; - - callback_.Run(out_token_info); + std::move(callback_).Run(std::move(token_info)); } } // namespace chromeos
diff --git a/chromeos/tpm/tpm_token_info_getter.h b/chromeos/tpm/tpm_token_info_getter.h index 26b6383..38b4ac7 100644 --- a/chromeos/tpm/tpm_token_info_getter.h +++ b/chromeos/tpm/tpm_token_info_getter.h
@@ -24,27 +24,12 @@ namespace chromeos { -// Information retrieved from cryptohome by TPMTokenInfoGetter. -// For invalid token |token_name| and |user_pin| will be empty, while -// |token_slot_id| will be set to -1. -// TODO(hidehiko): This struct is conceptually as same as -// base::Optional<CryptohomeClient::TpmTokenInfo>. Migrate into it. -struct TPMTokenInfo { - // Default constructor creates token info for disabled TPM. - TPMTokenInfo(); - ~TPMTokenInfo(); - - bool tpm_is_enabled; - std::string token_name; - std::string user_pin; - int token_slot_id; -}; - // Class for getting a user or the system TPM token info from cryptohome during // TPM token loading. class CHROMEOS_EXPORT TPMTokenInfoGetter { public: - using TPMTokenInfoCallback = base::Callback<void(const TPMTokenInfo& info)>; + using TpmTokenInfoCallback = base::OnceCallback<void( + base::Optional<CryptohomeClient::TpmTokenInfo> token_info)>; // Factory method for TPMTokenInfoGetter for a user token. static std::unique_ptr<TPMTokenInfoGetter> CreateForUserToken( @@ -64,7 +49,7 @@ // The object may get deleted before |callback| is called, which is equivalent // to cancelling the info getting (in which case |callback| will never get // called). - void Start(const TPMTokenInfoCallback& callback); + void Start(TpmTokenInfoCallback callback); private: enum Type { @@ -109,7 +94,7 @@ // token. AccountId account_id_; - TPMTokenInfoCallback callback_; + TpmTokenInfoCallback callback_; // The current request delay before the next attempt to initialize the // TPM. Will be adapted after each attempt.
diff --git a/chromeos/tpm/tpm_token_info_getter_unittest.cc b/chromeos/tpm/tpm_token_info_getter_unittest.cc index 5f00a9b..c941d62 100644 --- a/chromeos/tpm/tpm_token_info_getter_unittest.cc +++ b/chromeos/tpm/tpm_token_info_getter_unittest.cc
@@ -18,35 +18,24 @@ #include "base/task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/cryptohome/cryptohome_parameters.h" +#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/fake_cryptohome_client.h" #include "chromeos/tpm/tpm_token_info_getter.h" #include "testing/gtest/include/gtest/gtest.h" namespace { -// The struct holding information returned by TPMTokenInfoGetter::Start -// callback. -struct TestTPMTokenInfo { - TestTPMTokenInfo() : enabled(false), slot_id(-2) {} +using TpmTokenInfo = chromeos::CryptohomeClient::TpmTokenInfo; - bool IsReady() const { - return slot_id >= 0; - } - - bool enabled; - std::string name; - std::string pin; - int slot_id; -}; - -// Callback for TPMTokenInfoGetter::Start. It records the values returned -// by TPMTokenInfoGetter to |info|. -void RecordGetterResult(TestTPMTokenInfo* target, - const chromeos::TPMTokenInfo& source) { - target->enabled = source.tpm_is_enabled; - target->name = source.token_name; - target->pin = source.user_pin; - target->slot_id = source.token_slot_id; +// On invocation, set |called| to true, and store the result |token_info| +// to the |result|. +void OnTpmTokenInfoGetterCompleted(bool* called, + base::Optional<TpmTokenInfo>* result, + base::Optional<TpmTokenInfo> token_info) { + DCHECK(called); + DCHECK(result); + *called = true; + *result = std::move(token_info); } // Task runner for handling delayed tasks posted by TPMTokenInfoGetter when @@ -122,14 +111,9 @@ // Sets the tpm tpken info to be reported by the test CryptohomeClient. // If there is |Pkcs11GetTpmTokenInfo| in progress, runs the pending // callback with the set tpm token info. - void SetTPMTokenInfo(const std::string& token_name, - const std::string& pin, - int slot_id) { - tpm_token_info_.name = token_name; - tpm_token_info_.pin = pin; - tpm_token_info_.slot_id = slot_id; - - ASSERT_TRUE(tpm_token_info_.IsReady()); + void SetTpmTokenInfo(const TpmTokenInfo& token_info) { + tpm_token_info_ = token_info; + ASSERT_NE(-1, tpm_token_info_->slot); InvokeGetTpmTokenInfoCallbackIfReady(); } @@ -196,7 +180,7 @@ } void InvokeGetTpmTokenInfoCallbackIfReady() { - if (!tpm_token_info_.IsReady() || + if (!tpm_token_info_.has_value() || tpm_token_info_->slot == -1 || pending_get_tpm_token_info_callback_.is_null()) return; @@ -205,8 +189,7 @@ // tests). Unlike with other Cryptohome callbacks, TPMTokenInfoGetter does // not rely on this callback being called asynchronously. base::ResetAndReturn(&pending_get_tpm_token_info_callback_) - .Run(TpmTokenInfo{tpm_token_info_.name, tpm_token_info_.pin, - tpm_token_info_.slot_id}); + .Run(tpm_token_info_); } AccountId account_id_; @@ -218,7 +201,7 @@ bool get_tpm_token_info_succeeded_; chromeos::DBusMethodCallback<TpmTokenInfo> pending_get_tpm_token_info_callback_; - TestTPMTokenInfo tpm_token_info_; + base::Optional<TpmTokenInfo> tpm_token_info_; DISALLOW_COPY_AND_ASSIGN(TestCryptohomeClient); }; @@ -239,7 +222,6 @@ protected: std::unique_ptr<TestCryptohomeClient> cryptohome_client_; std::unique_ptr<chromeos::TPMTokenInfoGetter> tpm_token_info_getter_; - std::vector<int64_t> delays_; private: @@ -275,39 +257,41 @@ }; TEST_F(SystemTPMTokenInfoGetterTest, BasicFlow) { - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); EXPECT_EQ(std::vector<int64_t>(), delays_); } TEST_F(SystemTPMTokenInfoGetterTest, TokenSlotIdEqualsZero) { - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_0", "2222", 0); + const TpmTokenInfo fake_token_info = {"TOKEN_0", "2222", 0}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - base::RunLoop().RunUntilIdle(); - - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_0", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(0, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_0", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(0, result->slot); EXPECT_EQ(std::vector<int64_t>(), delays_); } @@ -315,13 +299,12 @@ TEST_F(SystemTPMTokenInfoGetterTest, TPMNotEnabled) { cryptohome_client_->set_tpm_is_enabled(false); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); - - EXPECT_FALSE(reported_info.IsReady()); - EXPECT_FALSE(reported_info.enabled); + EXPECT_TRUE(completed); EXPECT_EQ(std::vector<int64_t>(), delays_); } @@ -329,19 +312,21 @@ TEST_F(SystemTPMTokenInfoGetterTest, TpmEnabledCallFails) { cryptohome_client_->set_tpm_is_enabled_failure_count(1); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); const int64_t kExpectedDelays[] = {100}; EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, @@ -352,19 +337,21 @@ TEST_F(SystemTPMTokenInfoGetterTest, GetTpmTokenInfoInitiallyNotReady) { cryptohome_client_->set_get_tpm_token_info_not_set_count(1); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); const int64_t kExpectedDelays[] = {100}; EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, @@ -375,19 +362,21 @@ TEST_F(SystemTPMTokenInfoGetterTest, GetTpmTokenInfoInitiallyFails) { cryptohome_client_->set_get_tpm_token_info_failure_count(1); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); const int64_t kExpectedDelays[] = {100}; EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, @@ -400,19 +389,21 @@ cryptohome_client_->set_get_tpm_token_info_failure_count(1); cryptohome_client_->set_get_tpm_token_info_not_set_count(3); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 2); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(2, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); int64_t kExpectedDelays[] = {100, 200, 400, 800, 1600, 3200}; ASSERT_EQ(std::vector<int64_t>(kExpectedDelays, @@ -425,19 +416,21 @@ cryptohome_client_->set_get_tpm_token_info_failure_count(5); cryptohome_client_->set_get_tpm_token_info_not_set_count(6); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); int64_t kExpectedDelays[] = {100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, @@ -448,19 +441,21 @@ } TEST_F(UserTPMTokenInfoGetterTest, BasicFlow) { - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); EXPECT_EQ(std::vector<int64_t>(), delays_); } @@ -468,19 +463,21 @@ TEST_F(UserTPMTokenInfoGetterTest, GetTpmTokenInfoInitiallyFails) { cryptohome_client_->set_get_tpm_token_info_failure_count(1); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); const int64_t kExpectedDelays[] = {100}; EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, @@ -491,19 +488,21 @@ TEST_F(UserTPMTokenInfoGetterTest, GetTpmTokenInfoInitiallyNotReady) { cryptohome_client_->set_get_tpm_token_info_not_set_count(1); - TestTPMTokenInfo reported_info; + bool completed = false; + base::Optional<TpmTokenInfo> result; tpm_token_info_getter_->Start( - base::Bind(&RecordGetterResult, &reported_info)); + base::BindOnce(&OnTpmTokenInfoGetterCompleted, &completed, &result)); base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(completed); - EXPECT_FALSE(reported_info.IsReady()); - cryptohome_client_->SetTPMTokenInfo("TOKEN_1", "2222", 1); + const TpmTokenInfo fake_token_info = {"TOKEN_1", "2222", 1}; + cryptohome_client_->SetTpmTokenInfo(fake_token_info); - EXPECT_TRUE(reported_info.IsReady()); - EXPECT_TRUE(reported_info.enabled); - EXPECT_EQ("TOKEN_1", reported_info.name); - EXPECT_EQ("2222", reported_info.pin); - EXPECT_EQ(1, reported_info.slot_id); + EXPECT_TRUE(completed); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ("TOKEN_1", result->label); + EXPECT_EQ("2222", result->user_pin); + EXPECT_EQ(1, result->slot); const int64_t kExpectedDelays[] = {100}; EXPECT_EQ(std::vector<int64_t>(kExpectedDelays,
diff --git a/chromeos/tpm/tpm_token_loader.cc b/chromeos/tpm/tpm_token_loader.cc index e0999e7..ee563df 100644 --- a/chromeos/tpm/tpm_token_loader.cc +++ b/chromeos/tpm/tpm_token_loader.cc
@@ -162,9 +162,8 @@ return; } case TPM_TOKEN_ENABLED_FOR_NSS: { - tpm_token_info_getter_->Start( - base::Bind(&TPMTokenLoader::OnGotTpmTokenInfo, - weak_factory_.GetWeakPtr())); + tpm_token_info_getter_->Start(base::BindOnce( + &TPMTokenLoader::OnGotTpmTokenInfo, weak_factory_.GetWeakPtr())); return; } case TPM_DISABLED: { @@ -197,15 +196,16 @@ ContinueTokenInitialization(); } -void TPMTokenLoader::OnGotTpmTokenInfo(const TPMTokenInfo& token_info) { - if (!token_info.tpm_is_enabled) { +void TPMTokenLoader::OnGotTpmTokenInfo( + base::Optional<CryptohomeClient::TpmTokenInfo> token_info) { + if (!token_info.has_value()) { tpm_token_state_ = TPM_DISABLED; ContinueTokenInitialization(); return; } - tpm_token_slot_id_ = token_info.token_slot_id; - tpm_user_pin_ = token_info.user_pin; + tpm_token_slot_id_ = token_info->slot; + tpm_user_pin_ = token_info->user_pin; tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED; ContinueTokenInitialization();
diff --git a/chromeos/tpm/tpm_token_loader.h b/chromeos/tpm/tpm_token_loader.h index bf2f8e7d..c5611bdd 100644 --- a/chromeos/tpm/tpm_token_loader.h +++ b/chromeos/tpm/tpm_token_loader.h
@@ -14,9 +14,12 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/optional.h" #include "base/threading/thread_checker.h" #include "chromeos/chromeos_export.h" +#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/login/login_state.h" +#include "chromeos/tpm/tpm_token_info_getter.h" namespace base { class SequencedTaskRunner; @@ -24,9 +27,6 @@ namespace chromeos { -struct TPMTokenInfo; -class TPMTokenInfoGetter; - // This class is responsible for loading the TPM backed token for the system // slot when the user logs in. It is expected to be constructed on the UI thread // and public methods should all be called from the UI thread. @@ -93,7 +93,8 @@ // This is the cyclic chain of callbacks to initialize the TPM token. void ContinueTokenInitialization(); void OnTPMTokenEnabledForNSS(); - void OnGotTpmTokenInfo(const TPMTokenInfo& token_info); + void OnGotTpmTokenInfo( + base::Optional<CryptohomeClient::TpmTokenInfo> token_info); void OnTPMTokenInitialized(bool success); // Notifies observers that the TPM token is ready.
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index 7078d21..95e08e0 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -675,7 +675,7 @@ return personal_data_->GetLocalCreditCards(); } - const std::vector<CreditCard*>& GetCreditCards() const { + std::vector<CreditCard*> GetCreditCards() const { return personal_data_->GetCreditCards(); }
diff --git a/components/autofill/core/browser/autofill_merge_unittest.cc b/components/autofill/core/browser/autofill_merge_unittest.cc index d04acca..08c6ead9 100644 --- a/components/autofill/core/browser/autofill_merge_unittest.cc +++ b/components/autofill/core/browser/autofill_merge_unittest.cc
@@ -117,7 +117,7 @@ // PersonalDataManager: std::string SaveImportedProfile(const AutofillProfile& profile) override; - std::vector<AutofillProfile*> web_profiles() const override; + std::vector<AutofillProfile*> GetProfiles() const override; private: std::vector<std::unique_ptr<AutofillProfile>> profiles_; @@ -146,7 +146,7 @@ return merged_guid; } -std::vector<AutofillProfile*> PersonalDataManagerMock::web_profiles() const { +std::vector<AutofillProfile*> PersonalDataManagerMock::GetProfiles() const { std::vector<AutofillProfile*> result; for (const auto& profile : profiles_) result.push_back(profile.get()); @@ -282,7 +282,7 @@ } } - *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); + *merged_profiles = SerializeProfiles(personal_data_.GetProfiles()); } ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) {
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 159f32a..0edd157e 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -925,12 +925,9 @@ return is_data_loaded_; } -const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles() const { - return GetProfiles(false); -} - -std::vector<AutofillProfile*> PersonalDataManager::web_profiles() const { +std::vector<AutofillProfile*> PersonalDataManager::GetProfiles() const { std::vector<AutofillProfile*> result; + result.reserve(web_profiles_.size()); for (const auto& profile : web_profiles_) result.push_back(profile.get()); return result; @@ -938,6 +935,7 @@ std::vector<AutofillProfile*> PersonalDataManager::GetServerProfiles() const { std::vector<AutofillProfile*> result; + result.reserve(server_profiles_.size()); for (const auto& profile : server_profiles_) result.push_back(profile.get()); return result; @@ -945,20 +943,22 @@ std::vector<CreditCard*> PersonalDataManager::GetLocalCreditCards() const { std::vector<CreditCard*> result; + result.reserve(local_credit_cards_.size()); for (const auto& card : local_credit_cards_) result.push_back(card.get()); return result; } -const std::vector<CreditCard*>& PersonalDataManager::GetCreditCards() const { - credit_cards_.clear(); +std::vector<CreditCard*> PersonalDataManager::GetCreditCards() const { + std::vector<CreditCard*> result; + result.reserve(local_credit_cards_.size() + server_credit_cards_.size()); for (const auto& card : local_credit_cards_) - credit_cards_.push_back(card.get()); + result.push_back(card.get()); if (pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { for (const auto& card : server_credit_cards_) - credit_cards_.push_back(card.get()); + result.push_back(card.get()); } - return credit_cards_; + return result; } void PersonalDataManager::Refresh() { @@ -968,7 +968,7 @@ std::vector<AutofillProfile*> PersonalDataManager::GetProfilesToSuggest() const { - std::vector<AutofillProfile*> profiles = GetProfiles(true); + std::vector<AutofillProfile*> profiles = GetProfiles(); // Rank the suggestions by frecency (see AutofillDataModel for details). const base::Time comparison_time = AutofillClock::Now(); @@ -1291,7 +1291,7 @@ const std::string& country_code) const { DCHECK_EQ(2U, country_code.size()); - const std::vector<AutofillProfile*>& profiles = web_profiles(); + const std::vector<AutofillProfile*>& profiles = GetProfiles(); std::list<std::string> country_codes; for (size_t i = 0; i < profiles.size(); ++i) { country_codes.push_back(base::ToLowerASCII( @@ -1574,7 +1574,7 @@ std::map<std::string, int> votes; // TODO(estade): can we make this GetProfiles() instead? It seems to cause // errors in tests on mac trybots. See http://crbug.com/57221 - const std::vector<AutofillProfile*>& profiles = web_profiles(); + const std::vector<AutofillProfile*>& profiles = GetProfiles(); const std::vector<std::string>& country_codes = CountryDataMap::GetInstance()->country_codes(); for (size_t i = 0; i < profiles.size(); ++i) { @@ -1897,14 +1897,6 @@ return false; } -const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles( - bool record_metrics) const { - profiles_.clear(); - for (const auto& profile : web_profiles_) - profiles_.push_back(profile.get()); - return profiles_; -} - std::vector<Suggestion> PersonalDataManager::GetSuggestionsForCards( const AutofillType& type, const base::string16& field_contents, @@ -1992,7 +1984,7 @@ std::vector<AutofillProfile> profiles; bool has_changed_data = false; - for (AutofillProfile* profile : web_profiles()) { + for (AutofillProfile* profile : GetProfiles()) { if (profile->use_date() == base::Time()) { profile->set_use_date(AutofillClock::Now() - base::TimeDelta::FromDays(14)); @@ -2504,4 +2496,4 @@ return true; } -} // namespace autofill \ No newline at end of file +} // namespace autofill
diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index 08083491..6c6bac0 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h
@@ -200,16 +200,13 @@ // This PersonalDataManager owns these profiles and credit cards. Their // lifetime is until the web database is updated with new profile and credit // card information, respectively. - // TODO(crbug.com/687352): Remove one of these since they do the same thing. - // |GetProfiles()| and |web_profiles()| returns only local profiles. - virtual const std::vector<AutofillProfile*>& GetProfiles() const; - virtual std::vector<AutofillProfile*> web_profiles() const; + virtual std::vector<AutofillProfile*> GetProfiles() const; // Returns just SERVER_PROFILES. virtual std::vector<AutofillProfile*> GetServerProfiles() const; // Returns just LOCAL_CARD cards. virtual std::vector<CreditCard*> GetLocalCreditCards() const; // Returns all credit cards, server and local. - virtual const std::vector<CreditCard*>& GetCreditCards() const; + virtual std::vector<CreditCard*> GetCreditCards() const; // Returns the profiles to suggest to the user, ordered by frecency. std::vector<AutofillProfile*> GetProfilesToSuggest() const; @@ -481,10 +478,6 @@ std::vector<std::unique_ptr<CreditCard>> local_credit_cards_; std::vector<std::unique_ptr<CreditCard>> server_credit_cards_; - // A combination of local and server credit cards. The pointers are owned - // by the local/server_credit_cards_ vectors. - mutable std::vector<CreditCard*> credit_cards_; - // When the manager makes a request from WebDataServiceBase, the database // is queried on another sequence, we record the query handle until we // get called back. We store handles for both profile and credit card queries @@ -535,12 +528,6 @@ CreditCard ExtractCreditCardFromForm(const FormStructure& form, bool* hasDuplicateFieldType); - // Functionally equivalent to GetProfiles(), but also records metrics if - // |record_metrics| is true. Metrics should be recorded when the returned - // profiles will be used to populate the fields shown in an Autofill popup. - virtual const std::vector<AutofillProfile*>& GetProfiles( - bool record_metrics) const; - // Returns credit card suggestions based on the |cards_to_suggest| and the // |type| and |field_contents| of the credit card field. std::vector<Suggestion> GetSuggestionsForCards(
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index bdad57e1..a9c1e08 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -3342,7 +3342,7 @@ // Make sure everything is set up correctly. WaitForOnPersonalDataChanged(); - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetProfiles().size()); profile.set_language_code("en"); @@ -6713,7 +6713,7 @@ // Make sure everything is set up correctly. personal_data_->Refresh(); WaitForOnPersonalDataChanged(); - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); @@ -6728,7 +6728,7 @@ WaitForOnPersonalDataChanged(); // The Wallet address should have been added as a new local profile. - EXPECT_EQ(2U, personal_data_->web_profiles().size()); + EXPECT_EQ(2U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); histogram_tester.ExpectUniqueSample("Autofill.WalletAddressConversionType", AutofillMetrics::CONVERTED_ADDRESS_ADDED, @@ -6818,7 +6818,7 @@ // Make sure everything is set up correctly. personal_data_->Refresh(); WaitForOnPersonalDataChanged(); - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); @@ -6833,7 +6833,7 @@ WaitForOnPersonalDataChanged(); // The Wallet address should have been merged with the existing local profile. - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); histogram_tester.ExpectUniqueSample("Autofill.WalletAddressConversionType", AutofillMetrics::CONVERTED_ADDRESS_MERGED, @@ -6890,7 +6890,7 @@ // Make sure everything is set up correctly. personal_data_->Refresh(); WaitForOnPersonalDataChanged(); - EXPECT_EQ(0U, personal_data_->web_profiles().size()); + EXPECT_EQ(0U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); /////////////////////////////////////////////////////////////////////// @@ -6909,7 +6909,7 @@ WaitForOnPersonalDataChanged(); // There should be no local profiles added. - EXPECT_EQ(0U, personal_data_->web_profiles().size()); + EXPECT_EQ(0U, personal_data_->GetProfiles().size()); EXPECT_EQ(1U, personal_data_->GetServerProfiles().size()); } @@ -6986,7 +6986,7 @@ // Make sure everything is set up correctly. personal_data_->Refresh(); WaitForOnPersonalDataChanged(); - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(2U, personal_data_->GetServerProfiles().size()); EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); @@ -7002,7 +7002,7 @@ // The first Wallet address should have been added as a new local profile and // the second one should have merged with the first. - EXPECT_EQ(2U, personal_data_->web_profiles().size()); + EXPECT_EQ(2U, personal_data_->GetProfiles().size()); EXPECT_EQ(2U, personal_data_->GetServerProfiles().size()); histogram_tester.ExpectBucketCount("Autofill.WalletAddressConversionType", AutofillMetrics::CONVERTED_ADDRESS_ADDED, @@ -7088,7 +7088,7 @@ WaitForOnPersonalDataChanged(); // The Wallet address should have been converted to a new local profile. - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); // The conversion should be recorded in the Wallet address. EXPECT_TRUE(personal_data_->GetServerProfiles().back()->has_converted()); @@ -7113,7 +7113,7 @@ // Make sure everything is set up correctly. personal_data_->Refresh(); WaitForOnPersonalDataChanged(); - EXPECT_EQ(1U, personal_data_->web_profiles().size()); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); ///////////////////////////////////////////////////////////////////////
diff --git a/components/autofill/core/browser/test_personal_data_manager.cc b/components/autofill/core/browser/test_personal_data_manager.cc index d663cde..18413eec 100644 --- a/components/autofill/core/browser/test_personal_data_manager.cc +++ b/components/autofill/core/browser/test_personal_data_manager.cc
@@ -33,17 +33,11 @@ server_credit_cards_.push_back(base::MakeUnique<CreditCard>(credit_card)); } -const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles() - const { - return GetProfiles(false); -} - -std::vector<AutofillProfile*> TestPersonalDataManager::web_profiles() const { +std::vector<AutofillProfile*> TestPersonalDataManager::GetProfiles() const { return profiles_; } -const std::vector<CreditCard*>& TestPersonalDataManager::GetCreditCards() - const { +std::vector<CreditCard*> TestPersonalDataManager::GetCreditCards() const { return credit_cards_; } @@ -72,9 +66,4 @@ return default_country_code_; } -const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles( - bool record_metrics) const { - return profiles_; -} - } // namespace autofill
diff --git a/components/autofill/core/browser/test_personal_data_manager.h b/components/autofill/core/browser/test_personal_data_manager.h index 71e06180..d9868d8c 100644 --- a/components/autofill/core/browser/test_personal_data_manager.h +++ b/components/autofill/core/browser/test_personal_data_manager.h
@@ -33,9 +33,8 @@ // Adds |credit_card| to |server_credit_cards_| by copying. void AddTestingServerCreditCard(const CreditCard& credit_card); - const std::vector<AutofillProfile*>& GetProfiles() const override; - std::vector<AutofillProfile*> web_profiles() const override; - const std::vector<CreditCard*>& GetCreditCards() const override; + std::vector<AutofillProfile*> GetProfiles() const override; + std::vector<CreditCard*> GetCreditCards() const override; std::string SaveImportedProfile( const AutofillProfile& imported_profile) override; @@ -56,9 +55,6 @@ const CreditCard& imported_credit_card() { return imported_credit_card_; } private: - const std::vector<AutofillProfile*>& GetProfiles( - bool record_metrics) const override; - std::vector<AutofillProfile*> profiles_; std::vector<CreditCard*> credit_cards_; AutofillProfile imported_profile_;
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index 99e7a50..831a49d 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -662,6 +662,7 @@ "test/javatests/src/org/chromium/net/BrotliTest.java", "test/javatests/src/org/chromium/net/Criteria.java", "test/javatests/src/org/chromium/net/CronetEngineBuilderTest.java", + "test/javatests/src/org/chromium/net/CronetStressTest.java", "test/javatests/src/org/chromium/net/CronetTestCommon.java", "test/javatests/src/org/chromium/net/CronetTestRule.java", "test/javatests/src/org/chromium/net/CronetTestRuleTest.java",
diff --git a/components/cronet/android/api/src/org/chromium/net/UploadDataProvider.java b/components/cronet/android/api/src/org/chromium/net/UploadDataProvider.java index 03edd98..37ed263 100644 --- a/components/cronet/android/api/src/org/chromium/net/UploadDataProvider.java +++ b/components/cronet/android/api/src/org/chromium/net/UploadDataProvider.java
@@ -42,7 +42,8 @@ * * @param uploadDataSink The object to notify when the read has completed, * successfully or otherwise. - * @param byteBuffer The buffer to copy the read bytes into. + * @param byteBuffer The buffer to copy the read bytes into. Do not change + * byteBuffer's limit. * @throws IOException if any IOException occurred during the process. * {@link UrlRequest.Callback#onFailed} will be called with the * thrown exception set as the cause of the
diff --git a/components/cronet/android/cronet_upload_data_stream_adapter.cc b/components/cronet/android/cronet_upload_data_stream_adapter.cc index b1200d6..0881069 100644 --- a/components/cronet/android/cronet_upload_data_stream_adapter.cc +++ b/components/cronet/android/cronet_upload_data_stream_adapter.cc
@@ -11,9 +11,11 @@ #include "base/android/jni_string.h" #include "base/bind.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/cronet/android/cronet_url_request_adapter.h" +#include "components/cronet/android/io_buffer_with_byte_buffer.h" #include "jni/CronetUploadDataStream_jni.h" using base::android::JavaParamRef; @@ -44,15 +46,16 @@ DCHECK(network_task_runner_); DCHECK(network_task_runner_->BelongsToCurrentThread()); DCHECK_GT(buf_len, 0); - DCHECK(!buffer_.get()); - buffer_ = buffer; - // TODO(mmenke): Consider preserving the java buffer across reads, when the - // IOBuffer's data pointer and its length are unchanged. JNIEnv* env = base::android::AttachCurrentThread(); - base::android::ScopedJavaLocalRef<jobject> java_buffer( - env, env->NewDirectByteBuffer(buffer->data(), buf_len)); - Java_CronetUploadDataStream_readData(env, jupload_data_stream_, java_buffer); + // Allow buffer reuse if |buffer| and |buf_len| are exactly the same as the + // ones used last time. + if (!(buffer_ && buffer_->io_buffer()->data() == buffer->data() && + buffer_->io_buffer_len() == buf_len)) { + buffer_ = base::MakeUnique<ByteBufferWithIOBuffer>(env, buffer, buf_len); + } + Java_CronetUploadDataStream_readData(env, jupload_data_stream_, + buffer_->byte_buffer()); } void CronetUploadDataStreamAdapter::Rewind() { @@ -82,7 +85,6 @@ bool final_chunk) { DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0)); - buffer_ = nullptr; network_task_runner_->PostTask( FROM_HERE, base::Bind(&CronetUploadDataStream::OnReadSuccess, upload_data_stream_, bytes_read, final_chunk));
diff --git a/components/cronet/android/cronet_upload_data_stream_adapter.h b/components/cronet/android/cronet_upload_data_stream_adapter.h index 5256051..7519305 100644 --- a/components/cronet/android/cronet_upload_data_stream_adapter.h +++ b/components/cronet/android/cronet_upload_data_stream_adapter.h
@@ -19,6 +19,7 @@ } // namespace base namespace cronet { +class ByteBufferWithIOBuffer; // The Adapter holds onto a reference to the IOBuffer that is currently being // written to in Java, so may not be deleted until any read operation in Java @@ -66,9 +67,8 @@ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; base::WeakPtr<CronetUploadDataStream> upload_data_stream_; - // Used to keep the read buffer alive until the callback from Java has been - // received. - scoped_refptr<net::IOBuffer> buffer_; + // Keeps the net::IOBuffer and Java ByteBuffer alive until the next Read(). + std::unique_ptr<ByteBufferWithIOBuffer> buffer_; DISALLOW_COPY_AND_ASSIGN(CronetUploadDataStreamAdapter); };
diff --git a/components/cronet/android/io_buffer_with_byte_buffer.cc b/components/cronet/android/io_buffer_with_byte_buffer.cc index e6be670..7c9c9cf 100644 --- a/components/cronet/android/io_buffer_with_byte_buffer.cc +++ b/components/cronet/android/io_buffer_with_byte_buffer.cc
@@ -24,4 +24,17 @@ IOBufferWithByteBuffer::~IOBufferWithByteBuffer() {} +ByteBufferWithIOBuffer::ByteBufferWithIOBuffer(JNIEnv* env, + net::IOBuffer* io_buffer, + int io_buffer_len) + : io_buffer_(io_buffer), io_buffer_len_(io_buffer_len) { + // An intermediate ScopedJavaLocalRef is needed here to release the local + // reference created by env->NewDirectByteBuffer(). + base::android::ScopedJavaLocalRef<jobject> java_buffer( + env, env->NewDirectByteBuffer(io_buffer_->data(), io_buffer_len_)); + byte_buffer_.Reset(env, java_buffer.obj()); +} + +ByteBufferWithIOBuffer::~ByteBufferWithIOBuffer() {} + } // namespace cronet
diff --git a/components/cronet/android/io_buffer_with_byte_buffer.h b/components/cronet/android/io_buffer_with_byte_buffer.h index 2df91ff..b543ed84 100644 --- a/components/cronet/android/io_buffer_with_byte_buffer.h +++ b/components/cronet/android/io_buffer_with_byte_buffer.h
@@ -48,6 +48,31 @@ DISALLOW_COPY_AND_ASSIGN(IOBufferWithByteBuffer); }; +// Represents a Java direct ByteBuffer backed by a net::IOBuffer. Keeps both the +// net::IOBuffer and the Java ByteBuffer object alive until destroyed. +class ByteBufferWithIOBuffer { + public: + ByteBufferWithIOBuffer(JNIEnv* env, + net::IOBuffer* io_buffer, + int io_buffer_len); + + ~ByteBufferWithIOBuffer(); + const net::IOBuffer* io_buffer() const { return io_buffer_.get(); } + int io_buffer_len() const { return io_buffer_len_; } + + const base::android::JavaRef<jobject>& byte_buffer() const { + return byte_buffer_; + } + + private: + scoped_refptr<net::IOBuffer> io_buffer_; + int io_buffer_len_; + + base::android::ScopedJavaGlobalRef<jobject> byte_buffer_; + + DISALLOW_COPY_AND_ASSIGN(ByteBufferWithIOBuffer); +}; + } // namespace cronet #endif // COMPONENTS_CRONET_ANDROID_IO_BUFFER_WITH_BYTE_BUFFER_H_
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java b/components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java index 6e0864ab..ce4fd23f 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/CronetUploadDataStream.java
@@ -39,6 +39,7 @@ private final VersionSafeCallbacks.UploadDataProviderWrapper mDataProvider; private long mLength; private long mRemainingLength; + private long mByteBufferLimit; private CronetUrlRequest mRequest; // Reusable read task, to reduce redundant memory allocation. @@ -57,6 +58,7 @@ } try { checkCallingThread(); + assert mByteBuffer.position() == 0; mDataProvider.read(CronetUploadDataStream.this, mByteBuffer); } catch (Exception exception) { onError(exception); @@ -109,6 +111,7 @@ @CalledByNative void readData(ByteBuffer byteBuffer) { mByteBuffer = byteBuffer; + mByteBufferLimit = byteBuffer.limit(); postTaskToExecutor(mReadTask); } @@ -206,6 +209,9 @@ public void onReadSucceeded(boolean lastChunk) { synchronized (mLock) { checkState(UserCallback.READ); + if (mByteBufferLimit != mByteBuffer.limit()) { + throw new IllegalStateException("ByteBuffer limit changed"); + } if (lastChunk && mLength >= 0) { throw new IllegalArgumentException("Non-chunked upload can't have last chunk"); } @@ -216,6 +222,7 @@ String.format("Read upload data length %d exceeds expected length %d", mLength - mRemainingLength, mLength)); } + mByteBuffer.position(0); mByteBuffer = null; mInWhichUserCallback = UserCallback.NOT_IN_CALLBACK;
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/CronetStressTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/CronetStressTest.java new file mode 100644 index 0000000..78cceb5 --- /dev/null +++ b/components/cronet/android/test/javatests/src/org/chromium/net/CronetStressTest.java
@@ -0,0 +1,70 @@ +// 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. + +package org.chromium.net; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import static org.chromium.net.CronetTestRule.getContext; + +import android.support.test.filters.LargeTest; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.Feature; +import org.chromium.net.CronetTestRule.CronetTestFramework; +import org.chromium.net.CronetTestRule.OnlyRunNativeCronet; + +/** + * Tests that making a large number of requests do not lead to crashes. + */ +@RunWith(BaseJUnit4ClassRunner.class) +public class CronetStressTest { + @Rule + public final CronetTestRule mTestRule = new CronetTestRule(); + private CronetTestFramework mTestFramework; + + @Before + public void setUp() throws Exception { + mTestFramework = mTestRule.startCronetTestFramework(); + assertTrue(NativeTestServer.startNativeTestServer(getContext())); + } + + @After + public void tearDown() throws Exception { + NativeTestServer.shutdownNativeTestServer(); + mTestFramework.mCronetEngine.shutdown(); + } + + @Test + @LargeTest + @OnlyRunNativeCronet + @Feature({"Cronet"}) + public void testLargeNumberOfUploads() throws Exception { + final int kNumRequest = 1000; + final int kNumRequestHeaders = 100; + final int kNumUploadBytes = 1000; + for (int i = 0; i < kNumRequest; i++) { + TestUrlRequestCallback callback = new TestUrlRequestCallback(); + UrlRequest.Builder builder = mTestFramework.mCronetEngine.newUrlRequestBuilder( + NativeTestServer.getEchoAllHeadersURL(), callback, callback.getExecutor()); + for (int j = 0; j < kNumRequestHeaders; j++) { + builder.addHeader("header" + j, Integer.toString(j)); + } + builder.addHeader("content-type", "useless/string"); + byte[] b = new byte[kNumUploadBytes]; + builder.setUploadDataProvider( + UploadDataProviders.create(b, 0, kNumUploadBytes), callback.getExecutor()); + builder.build().start(); + callback.blockForDone(); + assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); + } + } +}
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java index cc270ea..21f77524 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java
@@ -24,6 +24,7 @@ import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; import org.chromium.net.CronetTestRule.CronetTestFramework; +import org.chromium.net.CronetTestRule.OnlyRunNativeCronet; import java.io.File; import java.io.FileOutputStream; @@ -138,6 +139,47 @@ @Test @SmallTest @Feature({"Cronet"}) + @OnlyRunNativeCronet + // Tests that ByteBuffer's limit cannot be changed by the caller. + public void testUploadChangeBufferLimit() throws Exception { + TestUrlRequestCallback callback = new TestUrlRequestCallback(); + UrlRequest.Builder builder = mTestFramework.mCronetEngine.newUrlRequestBuilder( + NativeTestServer.getEchoBodyURL(), callback, callback.getExecutor()); + builder.addHeader("Content-Type", "useless/string"); + builder.setUploadDataProvider(new UploadDataProvider() { + private static final String CONTENT = "hello"; + @Override + public long getLength() throws IOException { + return CONTENT.length(); + } + + @Override + public void read(UploadDataSink uploadDataSink, ByteBuffer byteBuffer) + throws IOException { + int oldPos = byteBuffer.position(); + int oldLimit = byteBuffer.limit(); + byteBuffer.put(CONTENT.getBytes()); + assertEquals(oldPos + CONTENT.length(), byteBuffer.position()); + assertEquals(oldLimit, byteBuffer.limit()); + // Now change the limit to something else. This should give an error. + byteBuffer.limit(oldLimit - 1); + uploadDataSink.onReadSucceeded(false); + } + + @Override + public void rewind(UploadDataSink uploadDataSink) throws IOException {} + }, callback.getExecutor()); + UrlRequest urlRequest = builder.build(); + urlRequest.start(); + callback.blockForDone(); + assertTrue(callback.mOnErrorCalled); + assertContains("Exception received from UploadDataProvider", callback.mError.getMessage()); + assertContains("ByteBuffer limit changed", callback.mError.getCause().getMessage()); + } + + @Test + @SmallTest + @Feature({"Cronet"}) public void testNoErrorWhenCanceledDuringStart() throws Exception { TestUrlRequestCallback callback = new TestUrlRequestCallback(); UrlRequest.Builder builder = mTestFramework.mCronetEngine.newUrlRequestBuilder(
diff --git a/components/history/content/browser/web_contents_top_sites_observer.cc b/components/history/content/browser/web_contents_top_sites_observer.cc index 2e7f10bc..50546ecf 100644 --- a/components/history/content/browser/web_contents_top_sites_observer.cc +++ b/components/history/content/browser/web_contents_top_sites_observer.cc
@@ -38,8 +38,16 @@ void WebContentsTopSitesObserver::NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) { DCHECK(load_details.entry); - if (top_sites_) + + // Frame-wise, we only care about navigating the main frame. + // Type-wise, we only care about navigating to a new page, or renavigating to + // an existing navigation entry. + if (top_sites_ && load_details.is_main_frame && + (load_details.type == content::NavigationType::NAVIGATION_TYPE_NEW_PAGE || + load_details.type == + content::NavigationType::NAVIGATION_TYPE_EXISTING_PAGE)) { top_sites_->OnNavigationCommitted(load_details.entry->GetURL()); + } } } // namespace history
diff --git a/components/history/core/browser/top_sites_impl.cc b/components/history/core/browser/top_sites_impl.cc index 43e0687..22fe7bf1 100644 --- a/components/history/core/browser/top_sites_impl.cc +++ b/components/history/core/browser/top_sites_impl.cc
@@ -85,17 +85,21 @@ const size_t kMaxTempTopImages = 8; const int kDaysOfHistory = 90; -// Time from startup to first HistoryService query. -const int64_t kUpdateIntervalSecs = 15; -// Intervals between requests to HistoryService. -const int64_t kMinUpdateIntervalMinutes = 1; + +// The delay for the first HistoryService query at startup. +constexpr base::TimeDelta kFirstDelayAtStartup = + base::TimeDelta::FromSeconds(15); + +// The delay for the all HistoryService queries other than the first one. #if defined(OS_IOS) || defined(OS_ANDROID) // On mobile, having the max at 60 minutes results in the topsites database // being not updated often enough since the app isn't usually running for long // stretches of time. -const int64_t kMaxUpdateIntervalMinutes = 5; +constexpr base::TimeDelta kDelayForUpdates = base::TimeDelta::FromMinutes(5); +; #else -const int64_t kMaxUpdateIntervalMinutes = 60; +constexpr base::TimeDelta kDelayForUpdates = base::TimeDelta::FromMinutes(60); +; #endif // defined(OS_IOS) || defined(OS_ANDROID) // Use 100 quality (highest quality) because we're very sensitive to @@ -118,7 +122,6 @@ : backend_(nullptr), cache_(base::MakeUnique<TopSitesCache>()), thread_safe_cache_(base::MakeUnique<TopSitesCache>()), - last_num_urls_changed_(0), prepopulated_pages_(prepopulated_pages), pref_service_(pref_service), history_service_(history_service), @@ -265,10 +268,8 @@ void TopSitesImpl::SyncWithHistory() { DCHECK(thread_checker_.CalledOnValidThread()); - if (loaded_) { - timer_.Stop(); + if (loaded_) StartQueryForMostVisited(); - } } bool TopSitesImpl::HasBlacklistedItems() const { @@ -382,14 +383,11 @@ void TopSitesImpl::OnNavigationCommitted(const GURL& url) { DCHECK(thread_checker_.CalledOnValidThread()); - if (!loaded_ || IsNonForcedFull()) + if (!loaded_) return; - if (!cache_->IsKnownURL(url) && can_add_url_to_history_.Run(url)) { - // To avoid slamming history we throttle requests when the url updates. To - // do otherwise negatively impacts perf tests. - RestartQueryForTopSitesTimer(GetUpdateDelay()); - } + if (can_add_url_to_history_.Run(url)) + ScheduleUpdateTimer(); } void TopSitesImpl::ShutdownOnUIThread() { @@ -412,6 +410,8 @@ void TopSitesImpl::StartQueryForMostVisited() { DCHECK(loaded_); + timer_.Stop(); + if (!history_service_) return; @@ -613,10 +613,6 @@ temp_images_.push_back(image); } -void TopSitesImpl::TimerFired() { - StartQueryForMostVisited(); -} - // static int TopSitesImpl::GetRedirectDistanceForURL(const MostVisitedURL& most_visited, const GURL& url) { @@ -648,9 +644,9 @@ std::set<GURL> all_new_urls; size_t num_forced = 0; for (size_t i = 0; i < new_list->size(); ++i) { - for (size_t j = 0; j < (*new_list)[i].redirects.size(); j++) { + for (size_t j = 0; j < (*new_list)[i].redirects.size(); j++) all_new_urls.insert((*new_list)[i].redirects[j]); - } + if (!(*new_list)[i].last_forced_time.is_null()) ++num_forced; } @@ -717,16 +713,6 @@ return base::MD5String(url.spec()); } -base::TimeDelta TopSitesImpl::GetUpdateDelay() const { - if (cache_->top_sites().size() <= prepopulated_pages_.size()) - return base::TimeDelta::FromSeconds(30); - - int64_t range = kMaxUpdateIntervalMinutes - kMinUpdateIntervalMinutes; - int64_t minutes = kMaxUpdateIntervalMinutes - - last_num_urls_changed_ * range / cache_->top_sites().size(); - return base::TimeDelta::FromMinutes(minutes); -} - void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites, const CallLocation location) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -763,11 +749,8 @@ } // If there is no url change in top sites, check if the titles have changes. // Notify observers if there's a change in titles. - if (!should_notify_observers) { + if (!should_notify_observers) should_notify_observers = DoTitlesDiffer(cache_->top_sites(), top_sites); - } - - last_num_urls_changed_ = delta.added.size() + delta.moved.size(); // We always do the following steps (setting top sites in cache, and resetting // thread safe cache ...) as this method is invoked during startup at which @@ -814,9 +797,6 @@ NotifyTopSitesChanged(TopSitesObserver::ChangeReason::MOST_VISITED); } - // Restart the timer that queries history for top sites. This is done to - // ensure we stay in sync with history. - RestartQueryForTopSitesTimer(GetUpdateDelay()); } int TopSitesImpl::num_results_to_request_from_history() const { @@ -874,15 +854,12 @@ thread_safe_cache_->SetThumbnails(cache_->images()); } -void TopSitesImpl::RestartQueryForTopSitesTimer(base::TimeDelta delta) { - if (timer_.IsRunning() && ((timer_start_time_ + timer_.GetCurrentDelay()) < - (base::TimeTicks::Now() + delta))) { +void TopSitesImpl::ScheduleUpdateTimer() { + if (timer_.IsRunning()) return; - } - timer_start_time_ = base::TimeTicks::Now(); - timer_.Stop(); - timer_.Start(FROM_HERE, delta, this, &TopSitesImpl::TimerFired); + timer_.Start(FROM_HERE, kDelayForUpdates, this, + &TopSitesImpl::StartQueryForMostVisited); } void TopSitesImpl::OnGotMostVisitedThumbnails( @@ -901,8 +878,8 @@ MoveStateToLoaded(); // Start a timer that refreshes top sites from history. - RestartQueryForTopSitesTimer( - base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); + timer_.Start(FROM_HERE, kFirstDelayAtStartup, this, + &TopSitesImpl::StartQueryForMostVisited); } void TopSitesImpl::OnTopSitesAvailableFromHistory(
diff --git a/components/history/core/browser/top_sites_impl.h b/components/history/core/browser/top_sites_impl.h index c60f9b4be..7e6cb35 100644 --- a/components/history/core/browser/top_sites_impl.h +++ b/components/history/core/browser/top_sites_impl.h
@@ -149,6 +149,9 @@ typedef std::list<TempImage> TempImages; typedef std::vector<PendingCallback> PendingCallbacks; + // Starts to query most visited URLs from history database instantly. + // Also cancels any pending queries requested in a delayed manner by + // cancelling the timer. void StartQueryForMostVisited(); // Generates the diff of things that happened between "old" and "new." @@ -194,26 +197,23 @@ // in |temp_images_|. void RemoveTemporaryThumbnailByURL(const GURL& url); - // Add a thumbnail for an unknown url. See |temp_images_|. + // Adds a thumbnail for an unknown url. See |temp_images_|. void AddTemporaryThumbnail(const GURL& url, base::RefCountedMemory* thumbnail, const ThumbnailScore& score); - // Called by our timer. Starts the query for the most visited sites. - void TimerFired(); - // Finds the given URL in the redirect chain for the given TopSite, and // returns the distance from the destination in hops that the given URL is. // The URL is assumed to be in the list. The destination is 0. static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited, const GURL& url); - // Add prepopulated pages: 'welcome to Chrome' and themes gallery to |urls|. + // Adds prepopulated pages: 'welcome to Chrome' and themes gallery to |urls|. // Returns true if any pages were added. bool AddPrepopulatedPages(MostVisitedURLList* urls, size_t num_forced_urls) const; - // Add all the forced URLs from |cache_| into |new_list|, making sure not to + // Adds all the forced URLs from |cache_| into |new_list|, making sure not to // add any URL that's already in |new_list|'s non-forced URLs. The forced URLs // in |cache_| and |new_list| are assumed to appear at the front of the list // and be sorted in increasing |last_forced_time|. This will still be true @@ -229,10 +229,6 @@ // Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs. static std::string GetURLHash(const GURL& url); - // Returns the delay until the next update of history is needed. - // Uses |last_num_urls_changed_|. - base::TimeDelta GetUpdateDelay() const; - // Updates URLs in |cache_| and the db (in the background). // The non-forced URLs in |new_top_sites| replace those in |cache_|. // The forced URLs of |new_top_sites| are merged with those in |cache_|, @@ -255,8 +251,9 @@ void ResetThreadSafeImageCache(); - // Stops and starts timer with a delay of |delta|. - void RestartQueryForTopSitesTimer(base::TimeDelta delta); + // Schedules a timer to update top sites with a delay. + // Does nothing if there is already a request queued. + void ScheduleUpdateTimer(); // Callback from TopSites with the top sites/thumbnails. Should be called // from the UI thread. @@ -292,16 +289,10 @@ // Task tracker for history and backend requests. base::CancelableTaskTracker cancelable_task_tracker_; - // Timer that asks history for the top sites. This is used to make sure our - // data stays in sync with history. + // Timer that asks history for the top sites. This is used to coalesce + // requests that are generated in quick succession. base::OneShotTimer timer_; - // The time we started |timer_| at. Only valid if |timer_| is running. - base::TimeTicks timer_start_time_; - - // The number of URLs changed on the last update. - size_t last_num_urls_changed_; - // The pending requests for the top sites list. Can only be non-empty at // startup. After we read the top sites from the DB, we'll always have a // cached list and be able to run callbacks immediately.
diff --git a/components/history/core/browser/top_sites_impl_unittest.cc b/components/history/core/browser/top_sites_impl_unittest.cc index 59134af..682116d8 100644 --- a/components/history/core/browser/top_sites_impl_unittest.cc +++ b/components/history/core/browser/top_sites_impl_unittest.cc
@@ -255,14 +255,6 @@ void StartQueryForMostVisited() { top_sites()->StartQueryForMostVisited(); } - void SetLastNumUrlsChanged(size_t value) { - top_sites()->last_num_urls_changed_ = value; - } - - size_t last_num_urls_changed() { return top_sites()->last_num_urls_changed_; } - - base::TimeDelta GetUpdateDelay() { return top_sites()->GetUpdateDelay(); } - bool IsTopSitesLoaded() { return top_sites()->loaded_; } bool AddPrepopulatedPages(MostVisitedURLList* urls) { @@ -1047,43 +1039,6 @@ } } -// Makes sure GetUpdateDelay is updated appropriately. -TEST_F(TopSitesImplTest, GetUpdateDelay) { -#if defined(OS_IOS) || defined(OS_ANDROID) - const int64_t kExpectedUpdateDelayInSecondEmpty = 30; - const int64_t kExpectedUpdateDelayInMinute0Changed = 5; - const int64_t kExpectedUpdateDelayInMinute3Changed = 5; - const int64_t kExpectedUpdateDelayInMinute20Changed = 1; -#else - const int64_t kExpectedUpdateDelayInSecondEmpty = 30; - const int64_t kExpectedUpdateDelayInMinute0Changed = 60; - const int64_t kExpectedUpdateDelayInMinute3Changed = 52; - const int64_t kExpectedUpdateDelayInMinute20Changed = 1; -#endif - - SetLastNumUrlsChanged(0); - EXPECT_EQ(kExpectedUpdateDelayInSecondEmpty, GetUpdateDelay().InSeconds()); - - MostVisitedURLList url_list; - url_list.resize(20); - GURL tmp_url(GURL("http://x")); - for (size_t i = 0; i < url_list.size(); ++i) { - url_list[i].url = tmp_url; - url_list[i].redirects.push_back(tmp_url); - } - SetTopSites(url_list); - EXPECT_EQ(20u, last_num_urls_changed()); - SetLastNumUrlsChanged(0); - EXPECT_EQ(kExpectedUpdateDelayInMinute0Changed, GetUpdateDelay().InMinutes()); - - SetLastNumUrlsChanged(3); - EXPECT_EQ(kExpectedUpdateDelayInMinute3Changed, GetUpdateDelay().InMinutes()); - - SetLastNumUrlsChanged(20); - EXPECT_EQ(kExpectedUpdateDelayInMinute20Changed, - GetUpdateDelay().InMinutes()); -} - // Verifies that callbacks are notified correctly if requested before top sites // has loaded. TEST_F(TopSitesImplTest, NotifyCallbacksWhenLoaded) { @@ -1463,8 +1418,6 @@ // Set the initial list of URLs. SetTopSites(old_url_list); - EXPECT_EQ(kNumOldForcedURLs + kNonForcedTopSitesCount, - last_num_urls_changed()); TopSitesQuerier querier; // Query only non-forced URLs first.
diff --git a/components/net_log/net_export_file_writer_unittest.cc b/components/net_log/net_export_file_writer_unittest.cc index 8b32e04..8817123 100644 --- a/components/net_log/net_export_file_writer_unittest.cc +++ b/components/net_log/net_export_file_writer_unittest.cc
@@ -415,7 +415,23 @@ return ::testing::AssertionSuccess(); } - protected: + ChromeNetLog* net_log() { return &net_log_; } + + NetExportFileWriter* file_writer() { return &file_writer_; } + + const base::FilePath& GetLogTempDirPath() const { + return log_temp_dir_.GetPath(); + } + + const base::FilePath& default_log_path() const { return default_log_path_; } + + base::Thread* net_thread() { return &net_thread_; } + + TestStateObserver* test_state_observer() { return &test_state_observer_; } + + private: + base::test::ScopedTaskEnvironment scoped_task_environment_; + ChromeNetLog net_log_; // |file_writer_| is initialized after |net_log_| so that it can stop @@ -430,15 +446,12 @@ base::Thread net_thread_; TestStateObserver test_state_observer_; - - private: - base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(NetExportFileWriterTest, InitFail) { // Override file_writer_'s default log base directory getter to always // fail. - file_writer_.SetDefaultLogBaseDirectoryGetterForTest( + file_writer()->SetDefaultLogBaseDirectoryGetterForTest( base::Bind([](base::FilePath* path) -> bool { return false; })); // Initialization should fail due to the override. @@ -461,14 +474,14 @@ // Create and close an empty log file to simulate existence of a previous log // file. ASSERT_TRUE( - base::CreateDirectoryAndGetError(default_log_path_.DirName(), nullptr)); - base::ScopedFILE empty_file(base::OpenFile(default_log_path_, "w")); + base::CreateDirectoryAndGetError(default_log_path().DirName(), nullptr)); + base::ScopedFILE empty_file(base::OpenFile(default_log_path(), "w")); ASSERT_TRUE(empty_file.get()); empty_file.reset(); ASSERT_TRUE(InitializeThenVerifyNewState(true, true)); - EXPECT_EQ(default_log_path_, FileWriterGetFilePathToCompletedLog()); + EXPECT_EQ(default_log_path(), FileWriterGetFilePathToCompletedLog()); } TEST_F(NetExportFileWriterTest, StartAndStopWithAllCaptureModes) { @@ -493,15 +506,18 @@ // Calling StartNetLog() again should be a no-op. Try doing StartNetLog() // with various capture modes; they should all be ignored and result in no // state change. - file_writer_.StartNetLog(base::FilePath(), capture_modes[i], - kMaxLogSizeBytes, base::CommandLine::StringType(), - kChannelString, URLRequestContextGetterList()); - file_writer_.StartNetLog(base::FilePath(), capture_modes[(i + 1) % 3], - kMaxLogSizeBytes, base::CommandLine::StringType(), - kChannelString, URLRequestContextGetterList()); - file_writer_.StartNetLog(base::FilePath(), capture_modes[(i + 2) % 3], - kMaxLogSizeBytes, base::CommandLine::StringType(), - kChannelString, URLRequestContextGetterList()); + file_writer()->StartNetLog(base::FilePath(), capture_modes[i], + kMaxLogSizeBytes, + base::CommandLine::StringType(), kChannelString, + URLRequestContextGetterList()); + file_writer()->StartNetLog(base::FilePath(), capture_modes[(i + 1) % 3], + kMaxLogSizeBytes, + base::CommandLine::StringType(), kChannelString, + URLRequestContextGetterList()); + file_writer()->StartNetLog(base::FilePath(), capture_modes[(i + 2) % 3], + kMaxLogSizeBytes, + base::CommandLine::StringType(), kChannelString, + URLRequestContextGetterList()); // StopNetLog(), should result in state change. The capture mode should // match that of the first StartNetLog() call (called by @@ -510,7 +526,7 @@ base::FilePath(), nullptr, nullptr, capture_mode_strings[i])); // Stopping a second time should be a no-op. - file_writer_.StopNetLog(nullptr, nullptr); + file_writer()->StopNetLog(nullptr, nullptr); } // Start and stop one more time just to make sure the last StopNetLog() call @@ -536,15 +552,15 @@ kCaptureModeDefaultString)); int64_t stop_file_size; - EXPECT_TRUE(base::GetFileSize(default_log_path_, &stop_file_size)); + EXPECT_TRUE(base::GetFileSize(default_log_path(), &stop_file_size)); // Add some junk at the end of the file. std::string junk_data("Hello"); - EXPECT_TRUE(base::AppendToFile(default_log_path_, junk_data.c_str(), + EXPECT_TRUE(base::AppendToFile(default_log_path(), junk_data.c_str(), junk_data.size())); int64_t junk_file_size; - EXPECT_TRUE(base::GetFileSize(default_log_path_, &junk_file_size)); + EXPECT_TRUE(base::GetFileSize(default_log_path(), &junk_file_size)); EXPECT_GT(junk_file_size, stop_file_size); // Start and stop again and make sure the file is back to the size it was @@ -557,7 +573,7 @@ kCaptureModeDefaultString)); int64_t new_stop_file_size; - EXPECT_TRUE(base::GetFileSize(default_log_path_, &new_stop_file_size)); + EXPECT_TRUE(base::GetFileSize(default_log_path(), &new_stop_file_size)); EXPECT_EQ(stop_file_size, new_stop_file_size); } @@ -576,20 +592,20 @@ // Get file size without the event. int64_t stop_file_size; - EXPECT_TRUE(base::GetFileSize(default_log_path_, &stop_file_size)); + EXPECT_TRUE(base::GetFileSize(default_log_path(), &stop_file_size)); ASSERT_TRUE(StartThenVerifyNewState( base::FilePath(), net::NetLogCaptureMode::Default(), kCaptureModeDefaultString, URLRequestContextGetterList())); - net_log_.AddGlobalEntry(net::NetLogEventType::CANCELLED); + net_log()->AddGlobalEntry(net::NetLogEventType::CANCELLED); ASSERT_TRUE(StopThenVerifyNewStateAndFile(base::FilePath(), nullptr, nullptr, kCaptureModeDefaultString)); // Get file size after adding the event and make sure it's larger than before. int64_t new_stop_file_size; - EXPECT_TRUE(base::GetFileSize(default_log_path_, &new_stop_file_size)); + EXPECT_TRUE(base::GetFileSize(default_log_path(), &new_stop_file_size)); EXPECT_GE(new_stop_file_size, stop_file_size); } @@ -601,7 +617,7 @@ base::FilePath::CharType kCustomRelativePath[] = FILE_PATH_LITERAL("custom/custom/chrome-net-export-log.json"); base::FilePath custom_log_path = - log_temp_dir_.GetPath().Append(kCustomRelativePath); + GetLogTempDirPath().Append(kCustomRelativePath); EXPECT_TRUE( base::CreateDirectoryAndGetError(custom_log_path.DirName(), nullptr)); @@ -620,7 +636,7 @@ custom_log_path, net::NetLogCaptureMode::Default(), kCaptureModeDefaultString, URLRequestContextGetterList())); - net_log_.AddGlobalEntry(net::NetLogEventType::CANCELLED); + net_log()->AddGlobalEntry(net::NetLogEventType::CANCELLED); ASSERT_TRUE(StopThenVerifyNewStateAndFile(custom_log_path, nullptr, nullptr, kCaptureModeDefaultString)); @@ -645,9 +661,9 @@ scoped_refptr<net::TestURLRequestContextGetter> context_getter; const int kDummyQuicParam = 75; net::TestClosure init_done; - net_thread_.task_runner()->PostTaskAndReply( + net_thread()->task_runner()->PostTaskAndReply( FROM_HERE, - base::Bind(&SetUpTestContextGetterWithQuicTimeoutInfo, &net_log_, + base::Bind(&SetUpTestContextGetterWithQuicTimeoutInfo, net_log(), kDummyQuicParam, &context_getter), init_done.closure()); init_done.WaitForResult(); @@ -662,7 +678,7 @@ // Read polledData from log file. std::unique_ptr<base::DictionaryValue> root; - ASSERT_TRUE(ReadCompleteLogFile(default_log_path_, &root)); + ASSERT_TRUE(ReadCompleteLogFile(default_log_path(), &root)); base::DictionaryValue* polled_data; ASSERT_TRUE(root->GetDictionary("polledData", &polled_data)); @@ -695,9 +711,9 @@ delegate.set_quit_on_complete(false); net::TestClosure init_done; - net_thread_.task_runner()->PostTaskAndReply( + net_thread()->task_runner()->PostTaskAndReply( FROM_HERE, - base::Bind(&SetUpTestContextGetterWithRequest, &net_log_, GURL(kDummyUrl), + base::Bind(&SetUpTestContextGetterWithRequest, net_log(), GURL(kDummyUrl), &delegate, &context_getter, &request), init_done.closure()); init_done.WaitForResult(); @@ -711,7 +727,7 @@ // Read events from log file. std::unique_ptr<base::DictionaryValue> root; - ASSERT_TRUE(ReadCompleteLogFile(default_log_path_, &root)); + ASSERT_TRUE(ReadCompleteLogFile(default_log_path(), &root)); base::ListValue* events; ASSERT_TRUE(root->GetList("events", &events)); @@ -727,29 +743,30 @@ EXPECT_TRUE(event_params->GetString("url", &event_url)); EXPECT_EQ(kDummyUrl, event_url); - net_thread_.task_runner()->DeleteSoon(FROM_HERE, request.release()); + net_thread()->task_runner()->DeleteSoon(FROM_HERE, request.release()); } TEST_F(NetExportFileWriterTest, ReceiveStartWhileInitializing) { // Trigger initialization of |file_writer_|. - file_writer_.Initialize(net_thread_.task_runner()); + file_writer()->Initialize(net_thread()->task_runner()); // Before running the main message loop, tell |file_writer_| to start // logging. Not running the main message loop prevents the initialization // process from completing, so this ensures that StartNetLog() is received // before |file_writer_| finishes initialization, which means this // should be a no-op. - file_writer_.StartNetLog(base::FilePath(), net::NetLogCaptureMode::Default(), - kMaxLogSizeBytes, base::CommandLine::StringType(), - kChannelString, URLRequestContextGetterList()); + file_writer()->StartNetLog(base::FilePath(), + net::NetLogCaptureMode::Default(), + kMaxLogSizeBytes, base::CommandLine::StringType(), + kChannelString, URLRequestContextGetterList()); // Now run the main message loop. Make sure StartNetLog() was ignored by // checking that the next two states are "initializing" followed by // "not-logging". std::unique_ptr<base::DictionaryValue> state = - test_state_observer_.WaitForNewState(); + test_state_observer()->WaitForNewState(); ASSERT_TRUE(VerifyState(std::move(state), kStateInitializingString)); - state = test_state_observer_.WaitForNewState(); + state = test_state_observer()->WaitForNewState(); ASSERT_TRUE( VerifyState(std::move(state), kStateNotLoggingString, false, false, "")); } @@ -763,25 +780,26 @@ kCaptureModeIncludeSocketBytesString, URLRequestContextGetterList())); // Tell |file_writer_| to stop logging. - file_writer_.StopNetLog(nullptr, nullptr); + file_writer()->StopNetLog(nullptr, nullptr); // Before running the main message loop, tell |file_writer_| to start // logging. Not running the main message loop prevents the stopping process // from completing, so this ensures StartNetLog() is received before // |file_writer_| finishes stopping, which means this should be a // no-op. - file_writer_.StartNetLog(base::FilePath(), net::NetLogCaptureMode::Default(), - kMaxLogSizeBytes, base::CommandLine::StringType(), - kChannelString, URLRequestContextGetterList()); + file_writer()->StartNetLog(base::FilePath(), + net::NetLogCaptureMode::Default(), + kMaxLogSizeBytes, base::CommandLine::StringType(), + kChannelString, URLRequestContextGetterList()); // Now run the main message loop. Make sure the last StartNetLog() was // ignored by checking that the next two states are "stopping-log" followed by // "not-logging". Also make sure the capture mode matches that of the first // StartNetLog() call (called by StartThenVerifyState()). std::unique_ptr<base::DictionaryValue> state = - test_state_observer_.WaitForNewState(); + test_state_observer()->WaitForNewState(); ASSERT_TRUE(VerifyState(std::move(state), kStateStoppingLogString)); - state = test_state_observer_.WaitForNewState(); + state = test_state_observer()->WaitForNewState(); ASSERT_TRUE(VerifyState(std::move(state), kStateNotLoggingString, true, true, kCaptureModeIncludeSocketBytesString)); }
diff --git a/components/url_matcher/url_matcher_unittest.cc b/components/url_matcher/url_matcher_unittest.cc index 3fa9377e..7c3f7c21 100644 --- a/components/url_matcher/url_matcher_unittest.cc +++ b/components/url_matcher/url_matcher_unittest.cc
@@ -830,8 +830,8 @@ const int kConditionSetId1 = 1; URLMatcherConditionSet::Vector insert1; - insert1.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId1, conditions1))); + insert1.push_back(base::MakeRefCounted<URLMatcherConditionSet>( + kConditionSetId1, conditions1)); matcher.AddConditionSets(insert1); EXPECT_EQ(1u, matcher.MatchURL(url1).size()); EXPECT_EQ(0u, matcher.MatchURL(url2).size()); @@ -842,8 +842,8 @@ const int kConditionSetId2 = 2; URLMatcherConditionSet::Vector insert2; - insert2.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId2, conditions2))); + insert2.push_back(base::MakeRefCounted<URLMatcherConditionSet>( + kConditionSetId2, conditions2)); matcher.AddConditionSets(insert2); EXPECT_EQ(2u, matcher.MatchURL(url1).size()); EXPECT_EQ(1u, matcher.MatchURL(url2).size()); @@ -859,8 +859,8 @@ const int kConditionSetId3 = 3; URLMatcherConditionSet::Vector insert3; - insert3.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId3, conditions3))); + insert3.push_back(base::MakeRefCounted<URLMatcherConditionSet>( + kConditionSetId3, conditions3)); matcher.AddConditionSets(insert3); EXPECT_EQ(3u, matcher.MatchURL(url1).size()); EXPECT_EQ(1u, matcher.MatchURL(url2).size()); @@ -945,8 +945,8 @@ const int kConditionSetId = 1; URLMatcherConditionSet::Vector insert; - insert.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId, conditions))); + insert.push_back(base::MakeRefCounted<URLMatcherConditionSet>(kConditionSetId, + conditions)); matcher.AddConditionSets(insert); EXPECT_EQ(1u, matcher.MatchURL(url).size()); } @@ -963,8 +963,8 @@ conditions.insert(factory->CreateOriginAndPathMatchesCondition("w..hp")); const int kConditionSetId = 1; URLMatcherConditionSet::Vector insert; - insert.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId, conditions))); + insert.push_back(base::MakeRefCounted<URLMatcherConditionSet>(kConditionSetId, + conditions)); matcher.AddConditionSets(insert); EXPECT_EQ(1u, matcher.MatchURL(url).size()); } @@ -981,8 +981,8 @@ conditions.insert(factory->CreateOriginAndPathMatchesCondition("val")); const int kConditionSetId = 1; URLMatcherConditionSet::Vector insert; - insert.push_back(make_scoped_refptr( - new URLMatcherConditionSet(kConditionSetId, conditions))); + insert.push_back(base::MakeRefCounted<URLMatcherConditionSet>(kConditionSetId, + conditions)); matcher.AddConditionSets(insert); EXPECT_EQ(0u, matcher.MatchURL(url).size()); }
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 8b6a311..e9db211df 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -1076,10 +1076,9 @@ GetWebContents()->SendScreenRects(); if (local_surface_id_ != local_surface_id) { local_surface_id_ = local_surface_id; - web_contents() - ->GetRenderWidgetHostView() - ->GetRenderWidgetHost() - ->WasResized(); + RenderWidgetHostView* view = web_contents()->GetRenderWidgetHostView(); + if (view) + view->GetRenderWidgetHost()->WasResized(); } }
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc index 7fb89fe..e4f5e078 100644 --- a/content/browser/loader/navigation_url_loader_network_service.cc +++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -550,6 +550,10 @@ new_request->report_raw_headers = request_info->report_raw_headers; new_request->allow_download = allow_download_; + new_request->fetch_request_mode = FETCH_REQUEST_MODE_NAVIGATE; + new_request->fetch_credentials_mode = FETCH_CREDENTIALS_MODE_INCLUDE; + new_request->fetch_redirect_mode = FetchRedirectMode::MANUAL_MODE; + int frame_tree_node_id = request_info->frame_tree_node_id; // Check if a web UI scheme wants to handle this request.
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc index 7bbfe6e..58d885f9 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc +++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
@@ -80,6 +80,7 @@ current_surface_scale_factor_(1.f), frame_connector_(nullptr), background_color_(SK_ColorWHITE), + scroll_bubbling_state_(NO_ACTIVE_GESTURE_SCROLL), weak_factory_(this) { if (!IsUsingMus()) { GetHostFrameSinkManager()->RegisterFrameSinkId(frame_sink_id_, this); @@ -453,14 +454,32 @@ frame_connector_->BubbleScrollEvent(event); } } else { + // Consumption of the first GestureScrollUpdate determines whether to + // bubble the sequence of GestureScrollUpdates. + // If the child consumed some scroll, then stopped consuming once it could + // no longer scroll, we don't want to bubble those unconsumed GSUs as we + // want the user to start a new gesture in order to scroll the parent. + // Unfortunately, this is only effective for touch scrolling as wheel + // scrolling wraps GSUs in GSB/GSE pairs. + if (event.GetType() == blink::WebInputEvent::kGestureScrollBegin) { + DCHECK_EQ(NO_ACTIVE_GESTURE_SCROLL, scroll_bubbling_state_); + scroll_bubbling_state_ = AWAITING_FIRST_UPDATE; + } else if (scroll_bubbling_state_ == AWAITING_FIRST_UPDATE && + event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) { + scroll_bubbling_state_ = (should_bubble ? BUBBLE : SCROLL_CHILD); + } else if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd || + event.GetType() == blink::WebInputEvent::kGestureFlingStart) { + scroll_bubbling_state_ = NO_ACTIVE_GESTURE_SCROLL; + } + // GestureScrollBegin is consumed by the target frame and not forwarded, // because we don't know whether we will need to bubble scroll until we - // receive a GestureScrollUpdate ACK. GestureScrollUpdate with unused - // scroll extent is forwarded for bubbling, while GestureScrollEnd is - // always forwarded and handled according to current scroll state in the - // RenderWidgetHostInputEventRouter. + // receive a GestureScrollUpdate ACK. GestureScrollUpdates are forwarded + // for bubbling if the first GSU has unused scroll extent, + // while GestureScrollEnd is always forwarded and handled according to + // current scroll state in the RenderWidgetHostInputEventRouter. if ((event.GetType() == blink::WebInputEvent::kGestureScrollUpdate && - should_bubble) || + scroll_bubbling_state_ == BUBBLE) || event.GetType() == blink::WebInputEvent::kGestureScrollEnd || event.GetType() == blink::WebInputEvent::kGestureFlingStart) { frame_connector_->BubbleScrollEvent(event);
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h index 854f7e4..b0617bb1 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame.h +++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
@@ -311,6 +311,17 @@ std::unique_ptr<TouchSelectionControllerClientChildFrame> selection_controller_client_; + // Used to prevent bubbling of subsequent GestureScrollUpdates in a scroll + // gesture if the child consumed the first GSU. + // TODO(mcnee): This is only needed for |!wheel_scroll_latching_enabled()| + // and can be removed once scroll-latching lands. crbug.com/526463 + enum ScrollBubblingState { + NO_ACTIVE_GESTURE_SCROLL, + AWAITING_FIRST_UPDATE, + BUBBLE, + SCROLL_CHILD, + } scroll_bubbling_state_; + base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); };
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame_unittest.cc b/content/browser/renderer_host/render_widget_host_view_child_frame_unittest.cc index ad2f2622..79d4178 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_child_frame_unittest.cc
@@ -12,6 +12,7 @@ #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -28,6 +29,7 @@ #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/view_messages.h" #include "content/public/browser/render_widget_host_view.h" +#include "content/public/common/content_features.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" #include "content/test/dummy_render_widget_host_delegate.h" @@ -64,7 +66,13 @@ return nullptr; } + void BubbleScrollEvent(const blink::WebGestureEvent& event) override { + if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) + seen_bubbled_gsu_ = true; + } + viz::SurfaceInfo last_surface_info_; + bool seen_bubbled_gsu_ = false; }; class RenderWidgetHostViewChildFrameTest : public testing::Test { @@ -268,4 +276,47 @@ EXPECT_EQ(intersection_rect, std::get<0>(sent_rect)); } +// Tests specific to non-scroll-latching behaviour. +// TODO(mcnee): Remove once scroll-latching lands. crbug.com/526463 +class RenderWidgetHostViewChildFrameScrollLatchingDisabledTest + : public RenderWidgetHostViewChildFrameTest { + public: + RenderWidgetHostViewChildFrameScrollLatchingDisabledTest() {} + + void SetUp() override { + feature_list_.InitWithFeatures({}, + {features::kTouchpadAndWheelScrollLatching, + features::kAsyncWheelEvents}); + + RenderWidgetHostViewChildFrameTest::SetUp(); + DCHECK(!view_->wheel_scroll_latching_enabled()); + } + + private: + base::test::ScopedFeatureList feature_list_; + + DISALLOW_COPY_AND_ASSIGN( + RenderWidgetHostViewChildFrameScrollLatchingDisabledTest); +}; + +// Test that when a child scrolls and then stops consuming once it hits the +// extent, we don't bubble the subsequent unconsumed GestureScrollUpdates +// in the same gesture. +TEST_F(RenderWidgetHostViewChildFrameScrollLatchingDisabledTest, + DoNotBubbleIfChildHasAlreadyScrolled) { + blink::WebGestureEvent gesture_scroll( + blink::WebGestureEvent::kGestureScrollBegin, + blink::WebInputEvent::kNoModifiers, + blink::WebInputEvent::kTimeStampForTesting); + view_->GestureEventAck(gesture_scroll, INPUT_EVENT_ACK_STATE_IGNORED); + + gesture_scroll.SetType(blink::WebGestureEvent::kGestureScrollUpdate); + view_->GestureEventAck(gesture_scroll, INPUT_EVENT_ACK_STATE_CONSUMED); + ASSERT_FALSE(test_frame_connector_->seen_bubbled_gsu_); + + view_->GestureEventAck(gesture_scroll, + INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); + EXPECT_FALSE(test_frame_connector_->seen_bubbled_gsu_); +} + } // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index c6fd8d4..d60210d 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1078,6 +1078,8 @@ if (text_input_manager_) text_input_manager_->RemoveObserver(this); + mouse_wheel_phase_handler_.IgnorePendingWheelEndEvent(); + // We get this call just before |render_widget_host_| deletes // itself. But we are owned by |cocoa_view_|, which may be retained // by some other code. Examples are WebContentsViewMac's
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 0e47a4a..1f63302 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
@@ -1494,6 +1494,17 @@ process_host->sink().ClearMessages(); host->ShutdownAndDestroyWidget(true); + + // Wait for the mouse_wheel_end_dispatch_timer_ to expire after host is + // destroyed. The pending wheel end event won't get dispatched since the + // render_widget_host_ is null. This waiting confirms that no crash happens + // because of an attempt to send the pending wheel end event. + // https://crbug.com/770057 + base::RunLoop run_loop; + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, run_loop.QuitClosure(), + base::TimeDelta::FromMilliseconds(100)); + run_loop.Run(); } TEST_F(RenderWidgetHostViewMacWithWheelScrollLatchingEnabledTest,
diff --git a/content/browser/service_worker/service_worker_url_loader_job.cc b/content/browser/service_worker/service_worker_url_loader_job.cc index 9793c4f1..f5635f52 100644 --- a/content/browser/service_worker/service_worker_url_loader_job.cc +++ b/content/browser/service_worker/service_worker_url_loader_job.cc
@@ -107,6 +107,11 @@ blob_client_binding_(this), binding_(this), weak_factory_(this) { + DCHECK_EQ(FETCH_REQUEST_MODE_NAVIGATE, resource_request_.fetch_request_mode); + DCHECK_EQ(FETCH_CREDENTIALS_MODE_INCLUDE, + resource_request_.fetch_credentials_mode); + DCHECK_EQ(FetchRedirectMode::MANUAL_MODE, + resource_request_.fetch_redirect_mode); response_head_.load_timing.request_start = base::TimeTicks::Now(); response_head_.load_timing.request_start_time = base::Time::Now(); }
diff --git a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc index 6276c8f..acaef8d 100644 --- a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
@@ -537,6 +537,9 @@ base::MakeUnique<ResourceRequest>(); request->url = GURL("https://www.example.com/"); request->method = "GET"; + request->fetch_request_mode = FETCH_REQUEST_MODE_NAVIGATE; + request->fetch_credentials_mode = FETCH_CREDENTIALS_MODE_INCLUDE; + request->fetch_redirect_mode = FetchRedirectMode::MANUAL_MODE; return request; } @@ -821,6 +824,9 @@ ResourceRequest request; request.url = GURL("https://www.example.com/"); request.method = "GET"; + request.fetch_request_mode = FETCH_REQUEST_MODE_NAVIGATE; + request.fetch_credentials_mode = FETCH_CREDENTIALS_MODE_INCLUDE; + request.fetch_redirect_mode = FetchRedirectMode::MANUAL_MODE; StartLoaderCallback callback; auto job = base::MakeUnique<ServiceWorkerURLLoaderJob>(
diff --git a/content/browser/snapshot_browsertest.cc b/content/browser/snapshot_browsertest.cc index 48d181f..20e50c0 100644 --- a/content/browser/snapshot_browsertest.cc +++ b/content/browser/snapshot_browsertest.cc
@@ -236,13 +236,9 @@ } } -// This test is flaky Mac10.9 Tests (dbg). See crbug.com/771119. -#if defined(OS_MACOSX) -#define MAYBE_SyncMultiWindowTest DISABLED_SyncMultiWindowTest -#else -#define MAYBE_SyncMultiWindowTest SyncMultiWindowTest -#endif -IN_PROC_BROWSER_TEST_F(SnapshotBrowserTest, MAYBE_SyncMultiWindowTest) { +// This is flaky for Mac10.9 Tests (dbg) and Win7 Tests (dbg). See +// crbug.com/771119. +IN_PROC_BROWSER_TEST_F(SnapshotBrowserTest, DISABLED_SyncMultiWindowTest) { SetupTestServer(); for (int i = 0; i < 3; ++i) { @@ -295,13 +291,9 @@ } } -// This test is flaky Mac10.9 Tests (dbg). See crbug.com/771119. -#if defined(OS_MACOSX) -#define MAYBE_AsyncMultiWindowTest DISABLED_AsyncMultiWindowTest -#else -#define MAYBE_AsyncMultiWindowTest AsyncMultiWindowTest -#endif -IN_PROC_BROWSER_TEST_F(SnapshotBrowserTest, MAYBE_AsyncMultiWindowTest) { +// This is flaky for Mac10.9 Tests (dbg) and Win7 Tests (dbg). See +// crbug.com/771119. +IN_PROC_BROWSER_TEST_F(SnapshotBrowserTest, DISABLED_AsyncMultiWindowTest) { SetupTestServer(); for (int i = 0; i < 3; ++i) {
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 6dbd00d6..240e693 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -588,7 +588,7 @@ mojom::NetworkContext* StoragePartitionImpl::GetNetworkContext() { // Create the NetworkContext as needed, when the network service is disabled. - if (!network_context_.get()) { + if (!network_context_) { DCHECK(!base::FeatureList::IsEnabled(features::kNetworkService)); DCHECK(!network_context_owner_); network_context_owner_ = base::MakeUnique<NetworkContextOwner>(); @@ -601,6 +601,17 @@ return network_context_.get(); } +mojom::URLLoaderFactory* +StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() { + // Create the URLLoaderFactory as needed. + if (!url_loader_factory_for_browser_process_) { + GetNetworkContext()->CreateURLLoaderFactory( + mojo::MakeRequest(&url_loader_factory_for_browser_process_), + base::GetUniqueIdForProcess()); + } + return url_loader_factory_for_browser_process_.get(); +} + storage::QuotaManager* StoragePartitionImpl::GetQuotaManager() { return quota_manager_.get(); }
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 47137cf..f9563f8 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -15,6 +15,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/process/process_handle.h" #include "content/browser/appcache/chrome_appcache_service.h" #include "content/browser/background_fetch/background_fetch_context.h" #include "content/browser/background_sync/background_sync_context.h" @@ -74,6 +75,7 @@ net::URLRequestContextGetter* GetURLRequestContext() override; net::URLRequestContextGetter* GetMediaURLRequestContext() override; mojom::NetworkContext* GetNetworkContext() override; + mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() override; storage::QuotaManager* GetQuotaManager() override; ChromeAppCacheService* GetAppCacheService() override; storage::FileSystemContext* GetFileSystemContext() override; @@ -272,6 +274,11 @@ // by |network_context_owner_|. mojom::NetworkContextPtr network_context_; + // URLLoaderFactory for use in the browser process only. See the method + // comment for StoragePartition::GetURLLoaderFactoryForBrowserProcess() for + // more details + mojom::URLLoaderFactoryPtr url_loader_factory_for_browser_process_; + // When the network service is disabled, a NetworkContext is created on the IO // thread that wraps access to the URLRequestContext. std::unique_ptr<NetworkContextOwner> network_context_owner_;
diff --git a/content/network/BUILD.gn b/content/network/BUILD.gn index 85dd2130..094ae5e 100644 --- a/content/network/BUILD.gn +++ b/content/network/BUILD.gn
@@ -60,6 +60,7 @@ "//content/common", "//content/common:mojo_bindings", "//content/public/common:common_sources", + "//content/public/network:network_sources", "//mojo/public/cpp/bindings", "//net", "//services/network/public/cpp",
diff --git a/content/network/DEPS b/content/network/DEPS index 6f964b4a..2ae6f35f 100644 --- a/content/network/DEPS +++ b/content/network/DEPS
@@ -11,6 +11,7 @@ "+content/public/common/content_switches.h", "+content/public/common/cookie_manager.mojom.h", "+content/public/common/network_service.mojom.h", + "+content/public/common/proxy_resolver.mojom.h", "+content/public/common/referrer.h", "+content/public/common/resource_request.h", "+content/public/common/resource_response.h",
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h index cf270b8..c3c1aa9 100644 --- a/content/public/browser/storage_partition.h +++ b/content/public/browser/storage_partition.h
@@ -56,6 +56,7 @@ namespace mojom { class NetworkContext; +class URLLoaderFactory; } // Defines what persistent state a child process can access. @@ -69,9 +70,13 @@ virtual base::FilePath GetPath() = 0; virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; - // Returns the NetworkContext associated with this storage partition. Must - // only be called when the network service is enabled. virtual mojom::NetworkContext* GetNetworkContext() = 0; + // Returns a pointer to a URLLoaderFactory owned by the storage partition. + // Prefer to use this instead of creating a new URLLoaderFactory when issuing + // requests from the Browser process, to share resources. The returned + // URLLoaderFactory should not be sent to subprocesses, due to its + // permissions. + virtual mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() = 0; virtual storage::QuotaManager* GetQuotaManager() = 0; virtual AppCacheService* GetAppCacheService() = 0; virtual storage::FileSystemContext* GetFileSystemContext() = 0;
diff --git a/content/public/network/BUILD.gn b/content/public/network/BUILD.gn index 3e44f5108..aff25db 100644 --- a/content/public/network/BUILD.gn +++ b/content/public/network/BUILD.gn
@@ -22,14 +22,14 @@ sources = [ "network_service.h", + "url_request_context_builder_mojo.cc", + "url_request_context_builder_mojo.h", ] deps = [ "//base", "//content:export", "//content/common:mojo_bindings", - "//content/network:network_sources", + "//services/proxy_resolver/public/cpp:cpp_browser", ] - - allow_circular_includes_from = [ "//content/network:network_sources" ] }
diff --git a/content/public/network/DEPS b/content/public/network/DEPS index 31545d0..22b25d15 100644 --- a/content/public/network/DEPS +++ b/content/public/network/DEPS
@@ -1,5 +1,6 @@ specific_include_rules = { ".*\.cc": [ "+content/network", + "+services/proxy_resolver/public/cpp", ], }
diff --git a/content/public/network/url_request_context_builder_mojo.cc b/content/public/network/url_request_context_builder_mojo.cc new file mode 100644 index 0000000..6c6bca51 --- /dev/null +++ b/content/public/network/url_request_context_builder_mojo.cc
@@ -0,0 +1,46 @@ +// 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 "content/public/network/url_request_context_builder_mojo.h" + +#include "base/logging.h" +#include "build/build_config.h" +#include "net/proxy/proxy_config_service.h" +#include "net/proxy/proxy_script_fetcher_impl.h" +#include "services/proxy_resolver/public/cpp/proxy_service_mojo.h" + +namespace content { + +URLRequestContextBuilderMojo::URLRequestContextBuilderMojo() + : dhcp_fetcher_factory_(new net::DhcpProxyScriptFetcherFactory()) {} + +URLRequestContextBuilderMojo::~URLRequestContextBuilderMojo() = default; + +std::unique_ptr<net::ProxyService> +URLRequestContextBuilderMojo::CreateProxyService( + std::unique_ptr<net::ProxyConfigService> proxy_config_service, + net::URLRequestContext* url_request_context, + net::HostResolver* host_resolver, + net::NetworkDelegate* network_delegate, + net::NetLog* net_log) { + DCHECK(url_request_context); + DCHECK(host_resolver); + + if (!mojo_proxy_resolver_factory_) { + return net::URLRequestContextBuilder::CreateProxyService( + std::move(proxy_config_service), url_request_context, host_resolver, + network_delegate, net_log); + } + + std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher = + dhcp_fetcher_factory_->Create(url_request_context); + std::unique_ptr<net::ProxyScriptFetcher> proxy_script_fetcher = + std::make_unique<net::ProxyScriptFetcherImpl>(url_request_context); + return proxy_resolver::CreateProxyServiceUsingMojoFactory( + mojo_proxy_resolver_factory_, std::move(proxy_config_service), + proxy_script_fetcher.release(), std::move(dhcp_proxy_script_fetcher), + host_resolver, net_log, network_delegate); +} + +} // namespace content
diff --git a/content/public/network/url_request_context_builder_mojo.h b/content/public/network/url_request_context_builder_mojo.h new file mode 100644 index 0000000..4950b9b3 --- /dev/null +++ b/content/public/network/url_request_context_builder_mojo.h
@@ -0,0 +1,74 @@ +// 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 CONTENT_PUBLIC_NETWORK_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_ +#define CONTENT_PUBLIC_NETWORK_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_ + +#include <memory> + +#include "base/macros.h" +#include "build/build_config.h" +#include "content/common/content_export.h" +#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" +#include "net/url_request/url_request_context_builder.h" + +namespace net { +class HostResolver; +class NetLog; +class NetworkDelegate; +class ProxyService; +class URLRequestContext; +} // namespace net + +namespace proxy_resolver { +class MojoProxyResolverFactory; +} // namespace proxy_resolver + +namespace content { + +// Specialization of URLRequestContextBuilder that can create a ProxyService +// that uses a Mojo ProxyResolver. The consumer is responsible for providing +// the MojoProxyResolverFactory. If a PoxyService is set directly via the +// URLRequestContextBuilder API, it will be used instead. +class CONTENT_EXPORT URLRequestContextBuilderMojo + : public net::URLRequestContextBuilder { + public: + URLRequestContextBuilderMojo(); + ~URLRequestContextBuilderMojo() override; + + // Overrides default DhcpProxyScriptFetcherFactory. Ignored if no + // MojoProxyResolverFactory is provided. + void set_dhcp_fetcher_factory( + std::unique_ptr<net::DhcpProxyScriptFetcherFactory> + dhcp_fetcher_factory) { + dhcp_fetcher_factory_ = std::move(dhcp_fetcher_factory); + } + + // Sets Mojo factory used to create ProxyResolvers. If not set, falls back to + // URLRequestContext's default behavior. The passed in factory must outlive + // the URLRequestContext the builder creates. + void set_mojo_proxy_resolver_factory( + proxy_resolver::MojoProxyResolverFactory* mojo_proxy_resolver_factory) { + mojo_proxy_resolver_factory_ = mojo_proxy_resolver_factory; + } + + private: + std::unique_ptr<net::ProxyService> CreateProxyService( + std::unique_ptr<net::ProxyConfigService> proxy_config_service, + net::URLRequestContext* url_request_context, + net::HostResolver* host_resolver, + net::NetworkDelegate* network_delegate, + net::NetLog* net_log) override; + + std::unique_ptr<net::DhcpProxyScriptFetcherFactory> dhcp_fetcher_factory_; + + proxy_resolver::MojoProxyResolverFactory* mojo_proxy_resolver_factory_ = + nullptr; + + DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilderMojo); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_NETWORK_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_
diff --git a/content/public/test/DEPS b/content/public/test/DEPS index 18c7e4b..b707fc2 100644 --- a/content/public/test/DEPS +++ b/content/public/test/DEPS
@@ -5,6 +5,7 @@ "+components/viz/service", "+device/geolocation/android/geolocation_jni_registrar.h", "+mojo/android/system/mojo_jni_registrar.h", + "+services/proxy_resolver/public/cpp", "+services/resource_coordinator", "+services/service_manager", "+v8/include/v8.h",
diff --git a/content/public/test/test_storage_partition.cc b/content/public/test/test_storage_partition.cc index caa2eb62..57dd0ebe 100644 --- a/content/public/test/test_storage_partition.cc +++ b/content/public/test/test_storage_partition.cc
@@ -26,6 +26,11 @@ return network_context_; } +mojom::URLLoaderFactory* +TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() { + return url_loader_factory_for_browser_process_; +} + storage::QuotaManager* TestStoragePartition::GetQuotaManager() { return quota_manager_; }
diff --git a/content/public/test/test_storage_partition.h b/content/public/test/test_storage_partition.h index 198c5ff..3d9bb69 100644 --- a/content/public/test/test_storage_partition.h +++ b/content/public/test/test_storage_partition.h
@@ -30,6 +30,7 @@ namespace mojom { class NetworkContext; +class URLLoaderFactory; } // Fake implementation of StoragePartition. @@ -56,6 +57,13 @@ } mojom::NetworkContext* GetNetworkContext() override; + void set_url_loader_factory_for_browser_process( + mojom::URLLoaderFactory* url_loader_factory_for_browser_process) { + url_loader_factory_for_browser_process_ = + url_loader_factory_for_browser_process; + } + mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() override; + void set_quota_manager(storage::QuotaManager* manager) { quota_manager_ = manager; } @@ -150,22 +158,23 @@ private: base::FilePath file_path_; - net::URLRequestContextGetter* url_request_context_getter_; - net::URLRequestContextGetter* media_url_request_context_getter_; - mojom::NetworkContext* network_context_; - storage::QuotaManager* quota_manager_; - AppCacheService* app_cache_service_; - storage::FileSystemContext* file_system_context_; - storage::DatabaseTracker* database_tracker_; - DOMStorageContext* dom_storage_context_; - IndexedDBContext* indexed_db_context_; - ServiceWorkerContext* service_worker_context_; - CacheStorageContext* cache_storage_context_; - PlatformNotificationContext* platform_notification_context_; + net::URLRequestContextGetter* url_request_context_getter_ = nullptr; + net::URLRequestContextGetter* media_url_request_context_getter_ = nullptr; + mojom::NetworkContext* network_context_ = nullptr; + mojom::URLLoaderFactory* url_loader_factory_for_browser_process_ = nullptr; + storage::QuotaManager* quota_manager_ = nullptr; + AppCacheService* app_cache_service_ = nullptr; + storage::FileSystemContext* file_system_context_ = nullptr; + storage::DatabaseTracker* database_tracker_ = nullptr; + DOMStorageContext* dom_storage_context_ = nullptr; + IndexedDBContext* indexed_db_context_ = nullptr; + ServiceWorkerContext* service_worker_context_ = nullptr; + CacheStorageContext* cache_storage_context_ = nullptr; + PlatformNotificationContext* platform_notification_context_ = nullptr; #if !defined(OS_ANDROID) - HostZoomMap* host_zoom_map_; - HostZoomLevelContext* host_zoom_level_context_; - ZoomLevelDelegate* zoom_level_delegate_; + HostZoomMap* host_zoom_map_ = nullptr; + HostZoomLevelContext* host_zoom_level_context_ = nullptr; + ZoomLevelDelegate* zoom_level_delegate_ = nullptr; #endif // !defined(OS_ANDROID) DISALLOW_COPY_AND_ASSIGN(TestStoragePartition);
diff --git a/content/public/test/url_request_context_builder_mojo_unittest.cc b/content/public/test/url_request_context_builder_mojo_unittest.cc new file mode 100644 index 0000000..3c8fd60 --- /dev/null +++ b/content/public/test/url_request_context_builder_mojo_unittest.cc
@@ -0,0 +1,122 @@ +// 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 "content/public/network/url_request_context_builder_mojo.h" + +#include "base/run_loop.h" +#include "base/strings/stringprintf.h" +#include "base/test/scoped_task_environment.h" +#include "net/base/host_port_pair.h" +#include "net/proxy/proxy_config.h" +#include "net/proxy/proxy_config_service_fixed.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_request.h" +#include "net/test/embedded_test_server/http_response.h" +#include "net/test/embedded_test_server/simple_connection_listener.h" +#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_test_util.h" +#include "services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" +#include "url/gurl.h" + +using proxy_resolver::TestMojoProxyResolverFactory; + +namespace content { + +namespace { + +const char kPacPath[] = "/super.pac"; + +// When kPacPath is requested, returns a PAC script that uses the test server +// itself as the proxy. +std::unique_ptr<net::test_server::HttpResponse> HandlePacRequest( + const net::test_server::HttpRequest& request) { + if (request.relative_url != kPacPath) + return nullptr; + std::unique_ptr<net::test_server::BasicHttpResponse> response = + std::make_unique<net::test_server::BasicHttpResponse>(); + response->set_content(base::StringPrintf( + "function FindProxyForURL(url, host) { return 'PROXY %s;'; }", + net::HostPortPair::FromURL(request.base_url).ToString().c_str())); + response->set_content_type("text/html"); + return std::move(response); +} + +class URLRequestContextBuilderMojoTest : public PlatformTest { + protected: + URLRequestContextBuilderMojoTest() + : task_environment_( + base::test::ScopedTaskEnvironment::MainThreadType::IO) { + test_server_.RegisterRequestHandler(base::Bind(&HandlePacRequest)); + test_server_.AddDefaultHandlers( + base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); + } + + base::test::ScopedTaskEnvironment task_environment_; + TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_; + net::EmbeddedTestServer test_server_; + URLRequestContextBuilderMojo builder_; +}; + +TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) { + EXPECT_TRUE(test_server_.Start()); + + builder_.set_proxy_config_service( + std::make_unique<net::ProxyConfigServiceFixed>( + net::ProxyConfig::CreateFromCustomPacURL( + test_server_.GetURL(kPacPath)))); + builder_.set_mojo_proxy_resolver_factory(&test_mojo_proxy_resolver_factory_); + + std::unique_ptr<net::URLRequestContext> context(builder_.Build()); + net::TestDelegate delegate; + std::unique_ptr<net::URLRequest> request(context->CreateRequest( + GURL("http://hats:12345/echoheader?Foo"), net::DEFAULT_PRIORITY, + &delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); + request->SetExtraRequestHeaderByName("Foo", "Bar", false); + request->Start(); + base::RunLoop().Run(); + EXPECT_EQ("Bar", delegate.data_received()); + + // Make sure that the Mojo factory was used. + EXPECT_TRUE(test_mojo_proxy_resolver_factory_.resolver_created()); +} + +// Makes sure that pending PAC requests are correctly shut down during teardown. +TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) { + net::test_server::SimpleConnectionListener connection_listener( + 1, net::test_server::SimpleConnectionListener:: + FAIL_ON_ADDITIONAL_CONNECTIONS); + test_server_.SetConnectionListener(&connection_listener); + EXPECT_TRUE(test_server_.Start()); + + builder_.set_proxy_config_service( + std::make_unique<net::ProxyConfigServiceFixed>( + net::ProxyConfig::CreateFromCustomPacURL( + test_server_.GetURL("/hung")))); + builder_.set_mojo_proxy_resolver_factory(&test_mojo_proxy_resolver_factory_); + + std::unique_ptr<net::URLRequestContext> context(builder_.Build()); + net::TestDelegate delegate; + std::unique_ptr<net::URLRequest> request(context->CreateRequest( + GURL("http://hats:12345/echoheader?Foo"), net::DEFAULT_PRIORITY, + &delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); + request->Start(); + connection_listener.WaitForConnections(); + + // Tearing down the URLRequestContext should not cause an AssertNoURLRequests + // failure. + request.reset(); + context.reset(); + + // Have to shut down the test server before |connection_listener| falls out of + // scope. + EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); +} + +} // namespace + +} // namespace content
diff --git a/content/renderer/render_thread_impl_browsertest.cc b/content/renderer/render_thread_impl_browsertest.cc index 0c9e7e1e..d002362 100644 --- a/content/renderer/render_thread_impl_browsertest.cc +++ b/content/renderer/render_thread_impl_browsertest.cc
@@ -229,8 +229,8 @@ cmd->InitFromArgv(old_argv); run_loop_ = base::MakeUnique<base::RunLoop>(); - test_msg_filter_ = make_scoped_refptr( - new QuitOnTestMsgFilter(run_loop_->QuitWhenIdleClosure())); + test_msg_filter_ = base::MakeRefCounted<QuitOnTestMsgFilter>( + run_loop_->QuitWhenIdleClosure()); thread_->AddFilter(test_msg_filter_.get()); }
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index a71162d..20a9d8b 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -9,6 +9,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//media/media_options.gni") +import("//net/features.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//ppapi/features/features.gni") import("//services/catalog/public/tools/catalog.gni") @@ -1640,6 +1641,8 @@ "//services/file/public/interfaces", "//services/metrics/public/interfaces", "//services/network/public/interfaces:interfaces", + "//services/proxy_resolver/public/cpp:cpp_browser", + "//services/proxy_resolver/public/cpp:cpp_utility", "//services/service_manager/public/cpp:service_test_support", "//services/video_capture/public/interfaces", "//skia", @@ -1681,6 +1684,12 @@ sources += [ "../browser/posix_file_descriptor_info_impl_unittest.cc" ] } + if (enable_net_mojo) { + sources += [ "../public/test/url_request_context_builder_mojo_unittest.cc" ] + + deps += [ "//net:net_utility_services" ] + } + if (enable_plugins) { # Put WebRTC-related plugins sources in the "enable_webrtc && # enable_plugins" section below.
diff --git a/device/BUILD.gn b/device/BUILD.gn index 6a652203..e89c9ea 100644 --- a/device/BUILD.gn +++ b/device/BUILD.gn
@@ -71,7 +71,9 @@ "sensors/sensor_manager_android_unittest.cc", "sensors/sensor_manager_chromeos_unittest.cc", "test/run_all_unittests.cc", + "u2f/u2f_apdu_unittest.cc", "u2f/u2f_ble_frames_unittest.cc", + "u2f/u2f_message_unittest.cc", ] deps = [ @@ -92,6 +94,7 @@ "//device/sensors/public/cpp:full", "//device/sensors/public/interfaces", "//device/u2f", + "//device/u2f:mocks", "//mojo/common", "//mojo/edk/system", "//mojo/public/cpp/bindings", @@ -116,9 +119,7 @@ "hid/test_report_descriptors.cc", "hid/test_report_descriptors.h", "serial/serial_io_handler_posix_unittest.cc", - "u2f/u2f_apdu_unittest.cc", "u2f/u2f_hid_device_unittest.cc", - "u2f/u2f_message_unittest.cc", "u2f/u2f_register_unittest.cc", "u2f/u2f_request_unittest.cc", "u2f/u2f_sign_unittest.cc", @@ -127,8 +128,6 @@ "//device/hid", "//device/hid:mocks", "//device/serial", - "//device/u2f", - "//device/u2f:mocks", ] } @@ -165,6 +164,10 @@ "//device/usb/public/interfaces", "//net:test_support", ] + + if (!is_android) { + deps += [ "//device/hid" ] + } } # UsbContext is a libusb-specific object. @@ -241,11 +244,7 @@ } if (enable_vr && is_android) { - sources += [ - "vr/vr_device_manager_unittest.cc", - "vr/vr_display_impl_unittest.cc", - "vr/vr_service_impl_unittest.cc", - ] + sources += [ "vr/vr_display_impl_unittest.cc" ] deps += [ "//device/vr",
diff --git a/device/base/BUILD.gn b/device/base/BUILD.gn index e1bf178..21b67c04 100644 --- a/device/base/BUILD.gn +++ b/device/base/BUILD.gn
@@ -51,7 +51,10 @@ deps = [ ":base", - "//device/hid:mocks", "//device/usb:test_support", ] + + if (!is_android) { + deps += [ "//device/hid:mocks" ] + } }
diff --git a/device/base/mock_device_client.cc b/device/base/mock_device_client.cc index 1c75231..8d66456 100644 --- a/device/base/mock_device_client.cc +++ b/device/base/mock_device_client.cc
@@ -4,33 +4,41 @@ #include "device/base/mock_device_client.h" -#include "device/hid/mock_hid_service.h" +#include "base/logging.h" #include "device/usb/mock_usb_service.h" +#if !defined(OS_ANDROID) +#include "device/hid/mock_hid_service.h" +#endif + namespace device { MockDeviceClient::MockDeviceClient() {} MockDeviceClient::~MockDeviceClient() {} +#if !defined(OS_ANDROID) HidService* MockDeviceClient::GetHidService() { return hid_service(); } +#endif UsbService* MockDeviceClient::GetUsbService() { return usb_service(); } -MockHidService* MockDeviceClient::hid_service() { - if (!hid_service_) - hid_service_.reset(new MockHidService()); - return hid_service_.get(); -} - MockUsbService* MockDeviceClient::usb_service() { if (!usb_service_) usb_service_.reset(new MockUsbService()); return usb_service_.get(); } +#if !defined(OS_ANDROID) +MockHidService* MockDeviceClient::hid_service() { + if (!hid_service_) + hid_service_.reset(new MockHidService()); + return hid_service_.get(); +} +#endif + } // namespace device
diff --git a/device/base/mock_device_client.h b/device/base/mock_device_client.h index 04fbd16..36cba61 100644 --- a/device/base/mock_device_client.h +++ b/device/base/mock_device_client.h
@@ -7,14 +7,13 @@ #include <memory> +#include "build/build_config.h" #include "device/base/device_client.h" namespace device { -class HidService; class MockHidService; class MockUsbService; -class UsbService; class MockDeviceClient : device::DeviceClient { public: @@ -23,14 +22,20 @@ // device::DeviceClient implementation: UsbService* GetUsbService() override; +#if !defined(OS_ANDROID) HidService* GetHidService() override; +#endif // Accessors for the mock instances. - MockHidService* hid_service(); MockUsbService* usb_service(); +#if !defined(OS_ANDROID) + MockHidService* hid_service(); +#endif private: +#if !defined(OS_ANDROID) std::unique_ptr<MockHidService> hid_service_; +#endif std::unique_ptr<MockUsbService> usb_service_; };
diff --git a/device/hid/BUILD.gn b/device/hid/BUILD.gn index 61b3f527..4e6f5ce 100644 --- a/device/hid/BUILD.gn +++ b/device/hid/BUILD.gn
@@ -6,6 +6,10 @@ import("//testing/libfuzzer/fuzzer_test.gni") source_set("hid") { + # HID is not implemented on Android and we want to be particularly careful + # about not bloating binary size by accidentially including it. + assert(!is_android) + sources = [ "hid_collection_info.cc", "hid_collection_info.h",
diff --git a/device/test/test_device_client.cc b/device/test/test_device_client.cc index a51e5fc..45fe3e2a 100644 --- a/device/test/test_device_client.cc +++ b/device/test/test_device_client.cc
@@ -5,14 +5,11 @@ #include "device/test/test_device_client.h" #include "base/single_thread_task_runner.h" -#include "build/build_config.h" +#include "device/usb/usb_service.h" -// This file unconditionally includes these headers despite conditionally -// depending on the corresponding targets. The code below needs the destructors -// of the classes defined even when the classes are never instantiated. -// TODO: This should probably be done more explicitly to avoid ambiguity. -#include "device/hid/hid_service.h" // nogncheck -#include "device/usb/usb_service.h" // nogncheck +#if !defined(OS_ANDROID) +#include "device/hid/hid_service.h" +#endif namespace device { @@ -20,20 +17,17 @@ TestDeviceClient::~TestDeviceClient() = default; +#if !defined(OS_ANDROID) HidService* TestDeviceClient::GetHidService() { -#if !defined(OS_ANDROID) && !defined(OS_IOS) && \ - !(defined(OS_LINUX) && !defined(USE_UDEV)) if (!hid_service_) hid_service_ = HidService::Create(); -#endif return hid_service_.get(); } +#endif UsbService* TestDeviceClient::GetUsbService() { -#if !defined(OS_ANDROID) && !defined(OS_IOS) if (!usb_service_) usb_service_ = UsbService::Create(); -#endif return usb_service_.get(); }
diff --git a/device/test/test_device_client.h b/device/test/test_device_client.h index 6d6df63bc..88af3b9 100644 --- a/device/test/test_device_client.h +++ b/device/test/test_device_client.h
@@ -4,6 +4,7 @@ #include <memory> +#include "build/build_config.h" #include "device/base/device_client.h" namespace device { @@ -18,11 +19,15 @@ // Must be destroyed when tasks can still be posted to |task_runner|. ~TestDeviceClient() override; +#if !defined(OS_ANDROID) HidService* GetHidService() override; +#endif UsbService* GetUsbService() override; private: +#if !defined(OS_ANDROID) std::unique_ptr<HidService> hid_service_; +#endif std::unique_ptr<UsbService> usb_service_; };
diff --git a/device/u2f/BUILD.gn b/device/u2f/BUILD.gn index 2d7c727b..3ee9c52 100644 --- a/device/u2f/BUILD.gn +++ b/device/u2f/BUILD.gn
@@ -16,19 +16,11 @@ "u2f_command_type.h", "u2f_device.cc", "u2f_device.h", - "u2f_hid_device.cc", - "u2f_hid_device.h", "u2f_message.cc", "u2f_message.h", "u2f_packet.cc", "u2f_packet.h", - "u2f_register.cc", - "u2f_register.h", - "u2f_request.cc", - "u2f_request.h", "u2f_return_code.h", - "u2f_sign.cc", - "u2f_sign.h", ] deps = [ @@ -36,9 +28,24 @@ "//crypto", "//device/base", "//device/bluetooth", - "//device/hid", "//net", ] + + # HID is not supported on Android. + if (!is_android) { + sources += [ + "u2f_hid_device.cc", + "u2f_hid_device.h", + "u2f_register.cc", + "u2f_register.h", + "u2f_request.cc", + "u2f_request.h", + "u2f_sign.cc", + "u2f_sign.h", + ] + + deps += [ "//device/hid" ] + } } source_set("mocks") {
diff --git a/device/vr/BUILD.gn b/device/vr/BUILD.gn index 0337012..b194a923 100644 --- a/device/vr/BUILD.gn +++ b/device/vr/BUILD.gn
@@ -24,13 +24,9 @@ sources += [ "vr_device.cc", "vr_device.h", - "vr_device_manager.cc", - "vr_device_manager.h", "vr_device_provider.h", "vr_display_impl.cc", "vr_display_impl.h", - "vr_service_impl.cc", - "vr_service_impl.h", ] deps += [ @@ -89,6 +85,8 @@ static_library("fakes") { testonly = true + defines = [ "DEVICE_VR_IMPLEMENTATION" ] + sources = [ "test/fake_vr_device.cc", "test/fake_vr_device.h", @@ -98,6 +96,7 @@ "test/fake_vr_display_impl_client.h", "test/fake_vr_service_client.cc", "test/fake_vr_service_client.h", + "vr_export.h", ] public_deps = [
diff --git a/device/vr/android/gvr/gvr_delegate_provider.h b/device/vr/android/gvr/gvr_delegate_provider.h index 1750a8a0..f2eddcb 100644 --- a/device/vr/android/gvr/gvr_delegate_provider.h +++ b/device/vr/android/gvr/gvr_delegate_provider.h
@@ -18,6 +18,8 @@ class VRDisplayImpl; +// TODO(mthiesse, crbug.com/769373): Remove this interface and replace with a +// mojo interface. class DEVICE_VR_EXPORT GvrDelegateProvider { public: GvrDelegateProvider() = default;
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc index 552980e..019c746 100644 --- a/device/vr/android/gvr/gvr_device.cc +++ b/device/vr/android/gvr/gvr_device.cc
@@ -14,7 +14,6 @@ #include "device/vr/android/gvr/gvr_delegate_provider.h" #include "device/vr/android/gvr/gvr_delegate_provider_factory.h" #include "device/vr/android/gvr/gvr_device_provider.h" -#include "device/vr/vr_device_manager.h" #include "device/vr/vr_display_impl.h" #include "jni/NonPresentingGvrContext_jni.h" #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
diff --git a/device/vr/android/gvr/gvr_device.h b/device/vr/android/gvr/gvr_device.h index 0884dd43..7d71e20aa 100644 --- a/device/vr/android/gvr/gvr_device.h +++ b/device/vr/android/gvr/gvr_device.h
@@ -19,6 +19,7 @@ class GvrDelegateProvider; class VRDisplayImpl; +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT GvrDevice : public VRDevice { public: static std::unique_ptr<GvrDevice> Create();
diff --git a/device/vr/android/gvr/gvr_device_provider.h b/device/vr/android/gvr/gvr_device_provider.h index 8ad684d..6bcc5dd 100644 --- a/device/vr/android/gvr/gvr_device_provider.h +++ b/device/vr/android/gvr/gvr_device_provider.h
@@ -9,13 +9,14 @@ #include "base/macros.h" #include "device/vr/vr_device_provider.h" +#include "device/vr/vr_export.h" namespace device { class GvrDelegateProvider; class GvrDevice; -class GvrDeviceProvider : public VRDeviceProvider { +class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { public: GvrDeviceProvider(); ~GvrDeviceProvider() override;
diff --git a/device/vr/test/fake_vr_device.h b/device/vr/test/fake_vr_device.h index d0077d3..939d84b 100644 --- a/device/vr/test/fake_vr_device.h +++ b/device/vr/test/fake_vr_device.h
@@ -9,11 +9,12 @@ #include "base/memory/ref_counted.h" #include "device/vr/vr_device.h" #include "device/vr/vr_device_provider.h" -#include "device/vr/vr_service_impl.h" +#include "device/vr/vr_export.h" namespace device { -class FakeVRDevice : public VRDevice { +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. +class DEVICE_VR_EXPORT FakeVRDevice : public VRDevice { public: explicit FakeVRDevice(); ~FakeVRDevice() override;
diff --git a/device/vr/test/fake_vr_device_provider.h b/device/vr/test/fake_vr_device_provider.h index 7a37f7ad3..73bc2b26 100644 --- a/device/vr/test/fake_vr_device_provider.h +++ b/device/vr/test/fake_vr_device_provider.h
@@ -6,12 +6,15 @@ #define DEVICE_VR_TEST_FAKE_VR_DEVICE_PROVIDER_H_ #include <vector> + #include "device/vr/vr_device.h" #include "device/vr/vr_device_provider.h" +#include "device/vr/vr_export.h" namespace device { -class FakeVRDeviceProvider : public VRDeviceProvider { +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. +class DEVICE_VR_EXPORT FakeVRDeviceProvider : public VRDeviceProvider { public: FakeVRDeviceProvider(); ~FakeVRDeviceProvider() override;
diff --git a/device/vr/test/fake_vr_service_client.h b/device/vr/test/fake_vr_service_client.h index 5bae2c8a..79fb47c 100644 --- a/device/vr/test/fake_vr_service_client.h +++ b/device/vr/test/fake_vr_service_client.h
@@ -5,15 +5,16 @@ #ifndef DEVICE_VR_TEST_FAKE_VR_SERVICE_CLIENT_H_ #define DEVICE_VR_TEST_FAKE_VR_SERVICE_CLIENT_H_ +#include "device/vr/vr_export.h" #include "device/vr/vr_service.mojom.h" -#include "device/vr/vr_service_impl.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/interface_request.h" namespace device { class FakeVRDisplayImplClient; -class FakeVRServiceClient : public mojom::VRServiceClient { +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. +class DEVICE_VR_EXPORT FakeVRServiceClient : public mojom::VRServiceClient { public: FakeVRServiceClient(mojom::VRServiceClientRequest request); ~FakeVRServiceClient() override; @@ -27,7 +28,7 @@ private: std::vector<mojom::VRDisplayInfoPtr> displays_; std::vector<FakeVRDisplayImplClient*> display_clients_; - unsigned int last_device_id_; + unsigned int last_device_id_ = 0; mojo::Binding<mojom::VRServiceClient> m_binding_; DISALLOW_COPY_AND_ASSIGN(FakeVRServiceClient);
diff --git a/device/vr/vr_device.h b/device/vr/vr_device.h index 3db7e7cd..798da6bd 100644 --- a/device/vr/vr_device.h +++ b/device/vr/vr_device.h
@@ -18,6 +18,7 @@ // Represents one of the platform's VR devices. Owned by the respective // VRDeviceProvider. +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT VRDevice { public: VRDevice();
diff --git a/device/vr/vr_device_manager.cc b/device/vr/vr_device_manager.cc deleted file mode 100644 index 111760c..0000000 --- a/device/vr/vr_device_manager.cc +++ /dev/null
@@ -1,132 +0,0 @@ -// Copyright 2015 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 "device/vr/vr_device_manager.h" - -#include <utility> - -#include "base/bind.h" -#include "base/memory/ptr_util.h" -#include "base/memory/singleton.h" -#include "build/build_config.h" -#include "device/vr/features/features.h" - -#if defined(OS_ANDROID) -#include "device/vr/android/gvr/gvr_device_provider.h" -#endif - -#if BUILDFLAG(ENABLE_OPENVR) -#include "device/vr/openvr/openvr_device_provider.h" -#endif - -namespace device { - -namespace { -VRDeviceManager* g_vr_device_manager = nullptr; -} - -VRDeviceManager::VRDeviceManager() : keep_alive_(false) { -// Register VRDeviceProviders for the current platform -#if defined(OS_ANDROID) - RegisterProvider(std::make_unique<GvrDeviceProvider>()); -#endif - -#if BUILDFLAG(ENABLE_OPENVR) - RegisterProvider(std::make_unique<OpenVRDeviceProvider>()); -#endif -} - -VRDeviceManager::VRDeviceManager(std::unique_ptr<VRDeviceProvider> provider) - : keep_alive_(true) { - thread_checker_.DetachFromThread(); - RegisterProvider(std::move(provider)); - CHECK(!g_vr_device_manager); - g_vr_device_manager = this; -} - -VRDeviceManager::~VRDeviceManager() { - DCHECK(thread_checker_.CalledOnValidThread()); - g_vr_device_manager = nullptr; -} - -VRDeviceManager* VRDeviceManager::GetInstance() { - if (!g_vr_device_manager) - g_vr_device_manager = new VRDeviceManager(); - return g_vr_device_manager; -} - -void VRDeviceManager::AddService(VRServiceImpl* service) { - // Loop through any currently active devices and send Connected messages to - // the service. Future devices that come online will send a Connected message - // when they are created. - DCHECK(thread_checker_.CalledOnValidThread()); - - InitializeProviders(); - - std::vector<VRDevice*> devices; - for (const auto& provider : providers_) { - provider->GetDevices(&devices); - } - - for (auto* device : devices) { - if (device->id() == VR_DEVICE_LAST_ID) { - continue; - } - - if (devices_.find(device->id()) == devices_.end()) { - devices_[device->id()] = device; - } - - service->ConnectDevice(device); - } - - services_.insert(service); -} - -void VRDeviceManager::RemoveService(VRServiceImpl* service) { - services_.erase(service); - - if (services_.empty() && !keep_alive_) { - // Delete the device manager when it has no active connections. - delete g_vr_device_manager; - } -} - -unsigned int VRDeviceManager::GetNumberOfConnectedDevices() { - DCHECK(thread_checker_.CalledOnValidThread()); - - return static_cast<unsigned int>(devices_.size()); -} - -VRDevice* VRDeviceManager::GetDevice(unsigned int index) { - DCHECK(thread_checker_.CalledOnValidThread()); - - if (index == 0) - return nullptr; - - DeviceMap::iterator iter = devices_.find(index); - if (iter == devices_.end()) { - return nullptr; - } - return iter->second; -} - -void VRDeviceManager::InitializeProviders() { - if (vr_initialized_) { - return; - } - - for (const auto& provider : providers_) { - provider->Initialize(); - } - - vr_initialized_ = true; -} - -void VRDeviceManager::RegisterProvider( - std::unique_ptr<VRDeviceProvider> provider) { - providers_.push_back(std::move(provider)); -} - -} // namespace device
diff --git a/device/vr/vr_device_manager.h b/device/vr/vr_device_manager.h deleted file mode 100644 index e4e2f8c..0000000 --- a/device/vr/vr_device_manager.h +++ /dev/null
@@ -1,81 +0,0 @@ -// Copyright 2015 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 DEVICE_VR_VR_DEVICE_MANAGER_H -#define DEVICE_VR_VR_DEVICE_MANAGER_H - -#include <stdint.h> - -#include <map> -#include <memory> -#include <vector> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/threading/thread_checker.h" -#include "base/timer/timer.h" -#include "device/vr/vr_device.h" -#include "device/vr/vr_device_provider.h" -#include "device/vr/vr_export.h" -#include "device/vr/vr_service.mojom.h" -#include "device/vr/vr_service_impl.h" -#include "mojo/public/cpp/bindings/binding_set.h" - -namespace device { - -// Singleton used to provide the platform's VR devices to VRServiceImpl -// instances. -class DEVICE_VR_EXPORT VRDeviceManager { - public: - virtual ~VRDeviceManager(); - - // Returns the VRDeviceManager singleton. - static VRDeviceManager* GetInstance(); - - // Adds a listener for device manager events. VRDeviceManager does not own - // this object. - // Automatically connects all currently available VR devices by querying - // the device providers and, for each returned device, calling - // VRServiceImpl::ConnectDevice. - void AddService(VRServiceImpl* service); - void RemoveService(VRServiceImpl* service); - - unsigned int GetNumberOfConnectedDevices(); - - VRDevice* GetDevice(unsigned int index); - - private: - friend class VRDeviceManagerTest; - friend class VRDisplayImplTest; - friend class VRServiceImplTest; - - VRDeviceManager(); - // Constructor for testing. - explicit VRDeviceManager(std::unique_ptr<VRDeviceProvider> provider); - - void InitializeProviders(); - void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider); - - using ProviderList = std::vector<std::unique_ptr<VRDeviceProvider>>; - ProviderList providers_; - - // Devices are owned by their providers. - using DeviceMap = std::map<unsigned int, VRDevice*>; - DeviceMap devices_; - - bool vr_initialized_ = false; - - std::set<VRServiceImpl*> services_; - - // For testing. If true will not delete self when consumer count reaches 0. - bool keep_alive_; - - base::ThreadChecker thread_checker_; - - DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H
diff --git a/device/vr/vr_device_manager_unittest.cc b/device/vr/vr_device_manager_unittest.cc deleted file mode 100644 index 0befceff..0000000 --- a/device/vr/vr_device_manager_unittest.cc +++ /dev/null
@@ -1,107 +0,0 @@ -// Copyright 2015 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 "device/vr/vr_device_manager.h" - -#include <memory> -#include <utility> - -#include "base/macros.h" -#include "base/memory/linked_ptr.h" -#include "base/memory/ptr_util.h" -#include "base/message_loop/message_loop.h" -#include "base/run_loop.h" -#include "device/vr/test/fake_vr_device.h" -#include "device/vr/test/fake_vr_device_provider.h" -#include "device/vr/test/fake_vr_service_client.h" -#include "device/vr/vr_device_provider.h" -#include "device/vr/vr_service.mojom.h" -#include "device/vr/vr_service_impl.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace device { - -class VRDeviceManagerTest : public testing::Test { - public: - void onDisplaySynced() {} - - protected: - VRDeviceManagerTest(); - ~VRDeviceManagerTest() override; - - void SetUp() override; - - std::unique_ptr<VRServiceImpl> BindService(); - - VRDevice* GetDevice(unsigned int index) { - return device_manager_->GetDevice(index); - } - - protected: - base::MessageLoop message_loop_; - FakeVRDeviceProvider* provider_ = nullptr; - std::unique_ptr<VRDeviceManager> device_manager_; - - DISALLOW_COPY_AND_ASSIGN(VRDeviceManagerTest); -}; - -VRDeviceManagerTest::VRDeviceManagerTest() {} - -VRDeviceManagerTest::~VRDeviceManagerTest() {} - -void VRDeviceManagerTest::SetUp() { - provider_ = new FakeVRDeviceProvider(); - device_manager_.reset(new VRDeviceManager(base::WrapUnique(provider_))); -} - -std::unique_ptr<VRServiceImpl> VRDeviceManagerTest::BindService() { - mojom::VRServiceClientPtr proxy; - FakeVRServiceClient client(mojo::MakeRequest(&proxy)); - auto service = base::WrapUnique(new VRServiceImpl(-1, -1)); - service->SetClient(std::move(proxy), - base::Bind(&VRDeviceManagerTest::onDisplaySynced, - base::Unretained(this))); - return service; -} - -TEST_F(VRDeviceManagerTest, InitializationTest) { - EXPECT_FALSE(provider_->IsInitialized()); - - // Calling GetDevices should initialize the service if it hasn't been - // initialized yet or the providesr have been released. - // The mojom::VRService should initialize each of it's providers upon it's own - // initialization. And SetClient method in VRService class will invoke - // GetVRDevices too. - auto service = BindService(); - device_manager_->AddService(service.get()); - EXPECT_TRUE(provider_->IsInitialized()); -} - -TEST_F(VRDeviceManagerTest, GetDevicesTest) { - auto service = BindService(); - device_manager_->AddService(service.get()); - // Calling GetVRDevices should initialize the providers. - EXPECT_TRUE(provider_->IsInitialized()); - - // GetDeviceByIndex should return nullptr if an invalid index in queried. - VRDevice* queried_device = GetDevice(1); - EXPECT_EQ(nullptr, queried_device); - - FakeVRDevice* device1 = new FakeVRDevice(); - provider_->AddDevice(base::WrapUnique(device1)); - // VRDeviceManager will query devices as a side effect. - service = BindService(); - // Should have successfully returned one device. - EXPECT_EQ(device1, GetDevice(device1->id())); - - FakeVRDevice* device2 = new FakeVRDevice(); - provider_->AddDevice(base::WrapUnique(device2)); - // VRDeviceManager will query devices as a side effect. - service = BindService(); - // Querying the WebVRDevice index should return the correct device. - EXPECT_EQ(device1, GetDevice(device1->id())); - EXPECT_EQ(device2, GetDevice(device2->id())); -} - -} // namespace device
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc index fe90329..b43c25b 100644 --- a/device/vr/vr_display_impl.cc +++ b/device/vr/vr_display_impl.cc
@@ -8,8 +8,6 @@ #include "base/bind.h" #include "device/vr/vr_device.h" -#include "device/vr/vr_device_manager.h" -#include "device/vr/vr_service_impl.h" namespace device {
diff --git a/device/vr/vr_display_impl.h b/device/vr/vr_display_impl.h index b1ff4de..9636a5b 100644 --- a/device/vr/vr_display_impl.h +++ b/device/vr/vr_display_impl.h
@@ -16,13 +16,12 @@ namespace device { -class VRServiceImpl; - // Browser process representation of a VRDevice within a WebVR site session // (see VRServiceImpl). VRDisplayImpl receives/sends VR device events // from/to mojom::VRDisplayClient (the render process representation of a VR // device). // VRDisplayImpl objects are owned by their respective VRServiceImpl instances. +// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT VRDisplayImpl : public mojom::VRDisplay { public: VRDisplayImpl(device::VRDevice* device,
diff --git a/device/vr/vr_display_impl_unittest.cc b/device/vr/vr_display_impl_unittest.cc index 3826a99c..ae454d68 100644 --- a/device/vr/vr_display_impl_unittest.cc +++ b/device/vr/vr_display_impl_unittest.cc
@@ -4,6 +4,8 @@ #include "device/vr/vr_display_impl.h" +#include <memory> + #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -11,9 +13,7 @@ #include "device/vr/test/fake_vr_device_provider.h" #include "device/vr/test/fake_vr_display_impl_client.h" #include "device/vr/test/fake_vr_service_client.h" -#include "device/vr/vr_device_manager.h" #include "device/vr/vr_service.mojom.h" -#include "device/vr/vr_service_impl.h" #include "testing/gtest/include/gtest/gtest.h" namespace device { @@ -29,21 +29,14 @@ protected: void SetUp() override { - provider_ = new FakeVRDeviceProvider(); - device_ = new FakeVRDevice(); - provider_->AddDevice(base::WrapUnique(device_)); - device_manager_.reset(new VRDeviceManager(base::WrapUnique(provider_))); + device_ = std::make_unique<FakeVRDevice>(); + mojom::VRServiceClientPtr proxy; + client_ = std::make_unique<FakeVRServiceClient>(mojo::MakeRequest(&proxy)); } - std::unique_ptr<VRServiceImpl> BindService() { - mojom::VRServiceClientPtr proxy; - clients_.push_back(new FakeVRServiceClient(mojo::MakeRequest(&proxy))); - - auto service = base::WrapUnique(new VRServiceImpl(-1, -1)); - service->SetClient(std::move(proxy), - base::Bind(&VRDisplayImplTest::onDisplaySynced, - base::Unretained(this))); - return service; + std::unique_ptr<VRDisplayImpl> MakeDisplay() { + return std::make_unique<VRDisplayImpl>(device(), 0, 0, client(), + device()->GetVRDisplayInfo()); } void RequestPresent(VRDisplayImpl* display_impl) { @@ -60,61 +53,50 @@ void ExitPresent(VRDisplayImpl* display_impl) { display_impl->ExitPresent(); } - void TearDown() override { base::RunLoop().RunUntilIdle(); } - - VRDevice* device() { return device_; } - bool presenting() { return !!device_->presenting_display_; } - - VRDisplayImpl* GetVRDisplayImpl(VRServiceImpl* service, VRDevice* device) { - return service->GetVRDisplayImplForTesting(device); - } + VRDevice* device() { return device_.get(); } + FakeVRServiceClient* client() { return client_.get(); } base::MessageLoop message_loop_; bool is_request_presenting_success_ = false; - FakeVRDeviceProvider* provider_; - FakeVRDevice* device_; - std::vector<FakeVRServiceClient*> clients_; - std::unique_ptr<VRDeviceManager> device_manager_; + std::unique_ptr<FakeVRDevice> device_; + std::unique_ptr<FakeVRServiceClient> client_; DISALLOW_COPY_AND_ASSIGN(VRDisplayImplTest); }; TEST_F(VRDisplayImplTest, DevicePresentationIsolation) { - auto service_1 = BindService(); - auto service_2 = BindService(); - - VRDisplayImpl* display_1 = GetVRDisplayImpl(service_1.get(), device()); - VRDisplayImpl* display_2 = GetVRDisplayImpl(service_2.get(), device()); + std::unique_ptr<VRDisplayImpl> display_1 = MakeDisplay(); + std::unique_ptr<VRDisplayImpl> display_2 = MakeDisplay(); // When not presenting either service should be able to access the device. - EXPECT_TRUE(device()->IsAccessAllowed(display_1)); - EXPECT_TRUE(device()->IsAccessAllowed(display_2)); + EXPECT_TRUE(device()->IsAccessAllowed(display_1.get())); + EXPECT_TRUE(device()->IsAccessAllowed(display_2.get())); // Begin presenting to the fake device with service 1. - RequestPresent(display_1); + RequestPresent(display_1.get()); EXPECT_TRUE(is_request_presenting_success_); EXPECT_TRUE(presenting()); // Service 2 should not be able to present to the device while service 1 // is still presenting. - RequestPresent(display_2); + RequestPresent(display_2.get()); EXPECT_FALSE(is_request_presenting_success_); - EXPECT_TRUE(device()->IsAccessAllowed(display_1)); - EXPECT_FALSE(device()->IsAccessAllowed(display_2)); + EXPECT_TRUE(device()->IsAccessAllowed(display_1.get())); + EXPECT_FALSE(device()->IsAccessAllowed(display_2.get())); // Service 2 should not be able to exit presentation to the device. - ExitPresent(display_2); + ExitPresent(display_2.get()); EXPECT_TRUE(presenting()); // Service 1 should be able to exit the presentation it initiated. - ExitPresent(display_1); + ExitPresent(display_1.get()); EXPECT_FALSE(presenting()); // Once presentation had ended both services should be able to access the // device. - EXPECT_TRUE(device()->IsAccessAllowed(display_1)); - EXPECT_TRUE(device()->IsAccessAllowed(display_2)); + EXPECT_TRUE(device()->IsAccessAllowed(display_1.get())); + EXPECT_TRUE(device()->IsAccessAllowed(display_2.get())); } // This test case tests VRDevice class default behaviour when it @@ -122,14 +104,11 @@ // of the services related with this device will receive "vrdevicechanged" // event. TEST_F(VRDisplayImplTest, DeviceChangedDispatched) { - auto service_1 = BindService(); - auto service_2 = BindService(); - + std::unique_ptr<VRDisplayImpl> display = MakeDisplay(); device()->OnChanged(); base::RunLoop().RunUntilIdle(); - for (auto* client : clients_) - EXPECT_TRUE(client->CheckDeviceId(device()->id())); + EXPECT_TRUE(client()->CheckDeviceId(device()->id())); } }
diff --git a/device/vr/vr_service_impl.h b/device/vr/vr_service_impl.h deleted file mode 100644 index 3601792..0000000 --- a/device/vr/vr_service_impl.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2016 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 DEVICE_VR_VR_SERVICE_IMPL_H -#define DEVICE_VR_VR_SERVICE_IMPL_H - -#include <memory> - -#include "base/macros.h" - -#include "device/vr/vr_device.h" -#include "device/vr/vr_export.h" -#include "device/vr/vr_service.mojom.h" -#include "mojo/public/cpp/bindings/binding.h" - -namespace device { - -class VRDisplayImpl; - -// Browser process representation of a WebVR site session. Instantiated through -// Mojo once the user loads a page containing WebVR. -// It instantiates a VRDisplayImpl for each newly connected VRDisplay and sends -// the display's info to the render process through its connected -// mojom::VRServiceClient. -class VRServiceImpl : public mojom::VRService { - public: - DEVICE_VR_EXPORT VRServiceImpl(int render_frame_process_id, - int render_frame_routing_id); - ~VRServiceImpl() override; - - DEVICE_VR_EXPORT static void Create(int render_frame_process_id, - int render_frame_routing_id, - mojom::VRServiceRequest request); - - // mojom::VRService implementation - // Adds this service to the VRDeviceManager. - void SetClient(mojom::VRServiceClientPtr service_client, - SetClientCallback callback) override; - - // Tells the render process that a new VR device is available. - void ConnectDevice(VRDevice* device); - - private: - friend class VRDisplayImplTest; - - void SetListeningForActivate(bool listening) override; - - std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; - - mojom::VRServiceClientPtr client_; - - const int render_frame_process_id_; - const int render_frame_routing_id_; - - base::WeakPtrFactory<VRServiceImpl> weak_ptr_factory_; - - // Getter for testing. - DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImplForTesting(VRDevice* device); - - DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); -}; - -} // namespace device - -#endif // DEVICE_VR_VR_SERVICE_IMPL_H
diff --git a/device/vr/vr_service_impl_unittest.cc b/device/vr/vr_service_impl_unittest.cc deleted file mode 100644 index e275f94..0000000 --- a/device/vr/vr_service_impl_unittest.cc +++ /dev/null
@@ -1,74 +0,0 @@ -// Copyright 2016 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 "device/vr/vr_service_impl.h" - -#include "base/memory/ptr_util.h" -#include "base/message_loop/message_loop.h" -#include "base/run_loop.h" -#include "device/vr/test/fake_vr_device.h" -#include "device/vr/test/fake_vr_device_provider.h" -#include "device/vr/test/fake_vr_service_client.h" -#include "device/vr/vr_device_manager.h" -#include "device/vr/vr_service.mojom.h" -#include "device/vr/vr_service_impl.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace device { - -class VRServiceImplTest : public testing::Test { - public: - VRServiceImplTest() {} - ~VRServiceImplTest() override {} - void onDisplaySynced() {} - - protected: - void SetUp() override { - provider_ = new FakeVRDeviceProvider(); - device_manager_.reset(new VRDeviceManager(base::WrapUnique(provider_))); - } - - std::unique_ptr<VRServiceImpl> BindService() { - mojom::VRServiceClientPtr proxy; - FakeVRServiceClient client(mojo::MakeRequest(&proxy)); - auto service = base::WrapUnique(new VRServiceImpl(-1, -1)); - service->SetClient(std::move(proxy), - base::Bind(&VRServiceImplTest::onDisplaySynced, - base::Unretained(this))); - return service; - } - - size_t ServiceCount() { return device_manager_->services_.size(); } - - private: - base::MessageLoop message_loop_; - FakeVRDeviceProvider* provider_; - std::unique_ptr<VRDeviceManager> device_manager_; - - DISALLOW_COPY_AND_ASSIGN(VRServiceImplTest); -}; - -// Ensure that services are registered with the device manager as they are -// created and removed from the device manager as their connections are closed. -TEST_F(VRServiceImplTest, DeviceManagerRegistration) { - EXPECT_EQ(0u, ServiceCount()); - - auto service_1 = BindService(); - - EXPECT_EQ(1u, ServiceCount()); - - auto service_2 = BindService(); - - EXPECT_EQ(2u, ServiceCount()); - - service_1.reset(); - - EXPECT_EQ(1u, ServiceCount()); - - service_2.reset(); - - EXPECT_EQ(0u, ServiceCount()); -} - -}
diff --git a/docs/android_debugging_instructions.md b/docs/android_debugging_instructions.md index 62fd19fe..705b538 100644 --- a/docs/android_debugging_instructions.md +++ b/docs/android_debugging_instructions.md
@@ -106,8 +106,8 @@ ## Waiting for Java Debugger on Early Startup -* To debug early startup, pass `--wait-for-java-debugger` to the wrapper - scripts (works for both apk wrappers as well as test wrappers). +* To debug early startup, pass `--wait-for-java-debugger` as a command line + flag. ## Debugging C/C++
diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc index c5e6b54..2c4d22e 100644 --- a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc +++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
@@ -300,7 +300,7 @@ int WebViewPermissionHelper::RequestPermission( WebViewPermissionType permission_type, const base::DictionaryValue& request_info, - const PermissionResponseCallback& callback, + PermissionResponseCallback callback, bool allowed_by_default) { // If there are too many pending permission requests then reject this request. if (pending_permission_requests_.size() >= @@ -310,13 +310,14 @@ // after creation. This is to allow those same objects to be accessed again // in the same scope without fear of use after freeing. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(callback, allowed_by_default, std::string())); + FROM_HERE, + base::BindOnce(std::move(callback), allowed_by_default, std::string())); return webview::kInvalidPermissionRequestID; } int request_id = next_permission_request_id_++; - pending_permission_requests_[request_id] = - PermissionResponseInfo(callback, permission_type, allowed_by_default); + pending_permission_requests_[request_id] = PermissionResponseInfo( + std::move(callback), permission_type, allowed_by_default); std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); args->SetKey(webview::kRequestInfo, request_info.Clone()); args->SetInteger(webview::kRequestId, request_id); @@ -347,17 +348,16 @@ int request_id, PermissionResponseAction action, const std::string& user_input) { - RequestMap::iterator request_itr = - pending_permission_requests_.find(request_id); + auto request_itr = pending_permission_requests_.find(request_id); if (request_itr == pending_permission_requests_.end()) return SET_PERMISSION_INVALID; - const PermissionResponseInfo& info = request_itr->second; + PermissionResponseInfo& info = request_itr->second; bool allow = (action == ALLOW) || ((action == DEFAULT) && info.allowed_by_default); - info.callback.Run(allow, user_input); + std::move(info.callback).Run(allow, user_input); // Only record user initiated (i.e. non-default) actions. if (action != DEFAULT) @@ -369,8 +369,7 @@ } void WebViewPermissionHelper::CancelPendingPermissionRequest(int request_id) { - RequestMap::iterator request_itr = - pending_permission_requests_.find(request_id); + auto request_itr = pending_permission_requests_.find(request_id); if (request_itr == pending_permission_requests_.end()) return; @@ -384,18 +383,17 @@ } WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( - const PermissionResponseCallback& callback, + PermissionResponseCallback callback, WebViewPermissionType permission_type, bool allowed_by_default) - : callback(callback), + : callback(std::move(callback)), permission_type(permission_type), - allowed_by_default(allowed_by_default) { -} + allowed_by_default(allowed_by_default) {} -WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( - const PermissionResponseInfo& other) = default; +WebViewPermissionHelper::PermissionResponseInfo& +WebViewPermissionHelper::PermissionResponseInfo::operator=( + WebViewPermissionHelper::PermissionResponseInfo&& other) = default; -WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { -} +WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() {} } // namespace extensions
diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.h b/extensions/browser/guest_view/web_view/web_view_permission_helper.h index 9da5bd1..6168bc7 100644 --- a/extensions/browser/guest_view/web_view/web_view_permission_helper.h +++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.h
@@ -5,6 +5,9 @@ #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ +#include <map> +#include <memory> + #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "components/guest_view/common/guest_view_constants.h" @@ -28,9 +31,9 @@ public: explicit WebViewPermissionHelper(WebViewGuest* guest); ~WebViewPermissionHelper() override; - typedef base::Callback< - void(bool /* allow */, const std::string& /* user_input */)> - PermissionResponseCallback; + using PermissionResponseCallback = + base::OnceCallback<void(bool /* allow */, + const std::string& /* user_input */)>; // A map to store the callback for a request keyed by the request's id. struct PermissionResponseInfo { @@ -38,18 +41,18 @@ WebViewPermissionType permission_type; bool allowed_by_default; PermissionResponseInfo(); - PermissionResponseInfo(const PermissionResponseCallback& callback, + PermissionResponseInfo(PermissionResponseCallback callback, WebViewPermissionType permission_type, bool allowed_by_default); - PermissionResponseInfo(const PermissionResponseInfo& other); + PermissionResponseInfo& operator=(PermissionResponseInfo&& other); ~PermissionResponseInfo(); }; - typedef std::map<int, PermissionResponseInfo> RequestMap; + using RequestMap = std::map<int, PermissionResponseInfo>; int RequestPermission(WebViewPermissionType permission_type, const base::DictionaryValue& request_info, - const PermissionResponseCallback& callback, + PermissionResponseCallback callback, bool allowed_by_default); static WebViewPermissionHelper* FromWebContents( @@ -132,7 +135,7 @@ // We only need the ids to be unique for a given WebViewGuest. int next_permission_request_id_; - WebViewPermissionHelper::RequestMap pending_permission_requests_; + RequestMap pending_permission_requests_; std::unique_ptr<WebViewPermissionHelperDelegate> web_view_permission_helper_delegate_;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h index d12a394..343b3d6 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h
@@ -26,14 +26,9 @@ NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; -// Presents the bookmark UI for a single bookmark. The |parentView| and |origin| -// are hints that may or may not be used in how the UI for a single bookmark -// will appear. -// Subclasses must override this method. -- (void)presentBookmarkForTab:(Tab*)tab - currentlyBookmarked:(BOOL)bookmarked - inView:(UIView*)parentView - originRect:(CGRect)origin; +// Presents the bookmark UI for a single bookmark. Subclasses must override this +// method. +- (void)presentBookmarkForTab:(Tab*)tab currentlyBookmarked:(BOOL)bookmarked; // Presents the bookmarks browser modally. Subclasses must override this method. - (void)presentBookmarks;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm index 23433ce..8f5520e9a 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm
@@ -71,7 +71,7 @@ @property(nonatomic, readonly, weak) id<ApplicationCommands> dispatcher; // Builds a controller and brings it on screen. -- (void)presentBookmarkForTab:(Tab*)tab; +- (void)presentBookmarkForBookmarkedTab:(Tab*)tab; // Dismisses the bookmark browser. - (void)dismissBookmarkBrowserAnimated:(BOOL)animated; @@ -115,7 +115,7 @@ _bookmarkEditor.delegate = nil; } -- (void)presentBookmarkForTab:(Tab*)tab { +- (void)presentBookmarkForBookmarkedTab:(Tab*)tab { DCHECK(!self.bookmarkBrowser && !self.bookmarkEditor); DCHECK(tab); @@ -140,17 +140,14 @@ completion:nil]; } -- (void)presentBookmarkForTab:(Tab*)tab - currentlyBookmarked:(BOOL)bookmarked - inView:(UIView*)parentView - originRect:(CGRect)origin { +- (void)presentBookmarkForTab:(Tab*)tab currentlyBookmarked:(BOOL)bookmarked { if (!self.bookmarkModel->loaded()) return; if (!tab) return; if (bookmarked) { - [self presentBookmarkForTab:tab]; + [self presentBookmarkForBookmarkedTab:tab]; } else { __weak BookmarkInteractionController* weakSelf = self; __weak Tab* weakTab = tab; @@ -158,7 +155,7 @@ BookmarkInteractionController* strongSelf = weakSelf; if (!strongSelf || !weakTab) return; - [strongSelf presentBookmarkForTab:weakTab]; + [strongSelf presentBookmarkForBookmarkedTab:weakTab]; }; [self.mediator addBookmarkWithTitle:tab.title URL:tab.lastCommittedURL
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index e42a262..74febe8 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -4101,9 +4101,7 @@ [self initializeBookmarkInteractionController]; [_bookmarkInteractionController presentBookmarkForTab:[_model currentTab] - currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() - inView:nil - originRect:CGRectZero]; + currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser()]; } - (void)showToolsMenu {
diff --git a/ios/chrome/browser/ui/payments/payment_request_edit_view_controller.mm b/ios/chrome/browser/ui/payments/payment_request_edit_view_controller.mm index 3beb26a..e0f0bee 100644 --- a/ios/chrome/browser/ui/payments/payment_request_edit_view_controller.mm +++ b/ios/chrome/browser/ui/payments/payment_request_edit_view_controller.mm
@@ -591,11 +591,25 @@ if (index < 0 || index >= static_cast<NSInteger>(self.fields.count)) return; + // Early return if the validation message and not the field is selected. + if (indexPath.row != 0) + return; + EditorField* field = [self.fields objectAtIndex:index]; - // If a selector field is selected, blur the focused text field. - if (field.fieldType == EditorFieldTypeSelector) + // If a selector field is selected, blur the currently focused UITextField. + // And if a text field is selected, focus the corresponding UITextField. + if (field.fieldType == EditorFieldTypeSelector) { [[_currentEditingCell textField] resignFirstResponder]; + } else if (field.fieldType == EditorFieldTypeTextField) { + id cell = [collectionView cellForItemAtIndexPath:indexPath]; + // |cell| may be nil if the cell is not visible. + if (cell) { + AutofillEditCell* autofillEditCell = + base::mac::ObjCCastStrict<AutofillEditCell>(cell); + [autofillEditCell.textField becomeFirstResponder]; + } + } if ([self.delegate respondsToSelector:@selector (paymentRequestEditViewController:didSelectField:)]) {
diff --git a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm index bb113db..1cec9ba 100644 --- a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
@@ -233,7 +233,7 @@ } - (BOOL)localProfilesOrCreditCardsExist { - return !_personalDataManager->web_profiles().empty() || + return !_personalDataManager->GetProfiles().empty() || !_personalDataManager->GetLocalCreditCards().empty(); }
diff --git a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.h b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.h index 3bdeb11..a53d3f4 100644 --- a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.h +++ b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.h
@@ -126,13 +126,6 @@ // Called when the current tab changes or is closed. - (void)selectedTabChanged; -// Returns the bound of the bookmark button. Used to position the bookmark -// editor. -- (CGRect)bookmarkButtonAnchorRect; - -// Returns the bookmark button's view. Used to position the bookmark editor. -- (UIView*)bookmarkButtonView; - // Returns visible omnibox frame in WebToolbarController's view coordinate // system. - (CGRect)visibleOmniboxFrame;
diff --git a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm index bf53931a..ec1795b 100644 --- a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm +++ b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm
@@ -810,16 +810,6 @@ [self cancelOmniboxEdit]; } -- (CGRect)bookmarkButtonAnchorRect { - // Shrink the padding around the bookmark button so the popovers are anchored - // correctly. - return CGRectInset([_starButton bounds], 6, 11); -} - -- (UIView*)bookmarkButtonView { - return _starButton; -} - - (CGRect)visibleOmniboxFrame { CGRect frame = _omniboxBackground.frame; frame = [self.view.superview convertRect:frame
diff --git a/ios/net/cookies/cookie_store_ios_unittest.mm b/ios/net/cookies/cookie_store_ios_unittest.mm index 7273a62..11eaa99c 100644 --- a/ios/net/cookies/cookie_store_ios_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_unittest.mm
@@ -87,11 +87,12 @@ class CookieStoreIOSTest : public testing::Test { public: CookieStoreIOSTest() - : kTestCookieURL("http://foo.google.com/bar"), - kTestCookieURL2("http://foo.google.com/baz"), - kTestCookieURL3("http://foo.google.com"), - kTestCookieURL4("http://bar.google.com/bar"), + : kTestCookieURLFooBar("http://foo.google.com/bar"), + kTestCookieURLFooBaz("http://foo.google.com/baz"), + kTestCookieURLFoo("http://foo.google.com"), + kTestCookieURLBarBar("http://bar.google.com/bar"), backend_(new TestPersistentCookieStore) { + ClearCookies(); std::unique_ptr<NSHTTPSystemCookieStore> system_store( base::MakeUnique<NSHTTPSystemCookieStore>()); // |system_store_| doesn't own the NSHTTPSystemCookieStore object, the @@ -100,23 +101,22 @@ system_store_ = system_store.get(); store_ = base::MakeUnique<net::CookieStoreIOS>(std::move(system_store)); cookie_changed_callback_ = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies_changed_, &cookies_removed_)); } - ~CookieStoreIOSTest() override {} // Gets the cookies. |callback| will be called on completion. void GetCookies(net::CookieStore::GetCookiesCallback callback) { net::CookieOptions options; options.set_include_httponly(); - store_->GetCookiesWithOptionsAsync(kTestCookieURL, options, + store_->GetCookiesWithOptionsAsync(kTestCookieURLFooBar, options, std::move(callback)); } // Sets a cookie. void SetCookie(const std::string& cookie_line) { - net::SetCookie(cookie_line, kTestCookieURL, store_.get()); + net::SetCookie(cookie_line, kTestCookieURLFooBar, store_.get()); } void SetSystemCookie(const GURL& url, @@ -145,10 +145,10 @@ } protected: - const GURL kTestCookieURL; - const GURL kTestCookieURL2; - const GURL kTestCookieURL3; - const GURL kTestCookieURL4; + const GURL kTestCookieURLFooBar; + const GURL kTestCookieURLFooBaz; + const GURL kTestCookieURLFoo; + const GURL kTestCookieURLBarBar; base::MessageLoop loop_; scoped_refptr<TestPersistentCookieStore> backend_; @@ -182,7 +182,7 @@ EXPECT_EQ("abc", cookies_changed_[2].Name()); EXPECT_EQ("ghi", cookies_changed_[2].Value()); EXPECT_FALSE(cookies_removed_[2]); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, DeleteCallsHook) { @@ -191,7 +191,7 @@ SetCookie("abc=def"); EXPECT_EQ(1U, cookies_changed_.size()); EXPECT_EQ(1U, cookies_removed_.size()); - store_->DeleteCookieAsync(kTestCookieURL, "abc", + store_->DeleteCookieAsync(kTestCookieURLFooBar, "abc", base::Bind(&IgnoreBoolean, false)); CookieStoreIOS::NotifySystemCookiesChanged(); base::RunLoop().RunUntilIdle(); @@ -209,7 +209,7 @@ TEST(CookieStoreIOS, GetAllCookiesForURLAsync) { base::MessageLoop loop; - const GURL kTestCookieURL("http://foo.google.com/bar"); + const GURL kTestCookieURLFooBar("http://foo.google.com/bar"); ClearCookies(); std::unique_ptr<CookieStoreIOS> cookie_store(base::MakeUnique<CookieStoreIOS>( base::MakeUnique<NSHTTPSystemCookieStore>())); @@ -218,11 +218,12 @@ net::CookieOptions options; options.set_include_httponly(); cookie_store->SetCookieWithOptionsAsync( - kTestCookieURL, "a=b", options, net::CookieStore::SetCookiesCallback()); + kTestCookieURLFooBar, "a=b", options, + net::CookieStore::SetCookiesCallback()); // Check we can get the cookie. GetAllCookiesCallback callback; cookie_store->GetAllCookiesForURLAsync( - kTestCookieURL, + kTestCookieURLFooBar, base::Bind(&GetAllCookiesCallback::Run, base::Unretained(&callback))); EXPECT_TRUE(callback.did_run()); EXPECT_EQ(1u, callback.cookie_list().size()); @@ -234,19 +235,19 @@ TEST_F(CookieStoreIOSTest, NoInitialNotifyWithNoCookie) { std::vector<net::CanonicalCookie> cookies; store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); } TEST_F(CookieStoreIOSTest, NoInitialNotifyWithSystemCookie) { - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); std::vector<net::CanonicalCookie> cookies; store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, NotifyOnAdd) { @@ -254,23 +255,23 @@ std::vector<bool> removes; std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); EXPECT_EQ(0U, removes.size()); - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); EXPECT_EQ(1U, cookies.size()); EXPECT_EQ(1U, removes.size()); EXPECT_EQ("abc", cookies[0].Name()); EXPECT_EQ("def", cookies[0].Value()); EXPECT_FALSE(removes[0]); - SetSystemCookie(kTestCookieURL, "ghi", "jkl"); + SetSystemCookie(kTestCookieURLFooBar, "ghi", "jkl"); EXPECT_EQ(1U, cookies.size()); EXPECT_EQ(1U, removes.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); - DeleteSystemCookie(kTestCookieURL, "ghi"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "ghi"); } TEST_F(CookieStoreIOSTest, NotifyOnChange) { @@ -278,12 +279,12 @@ std::vector<bool> removes; std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); EXPECT_EQ(1U, cookies.size()); - SetSystemCookie(kTestCookieURL, "abc", "ghi"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "ghi"); EXPECT_EQ(3U, cookies.size()); EXPECT_EQ(3U, removes.size()); EXPECT_EQ("abc", cookies[1].Name()); @@ -293,41 +294,41 @@ EXPECT_EQ("ghi", cookies[2].Value()); EXPECT_FALSE(removes[2]); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, NotifyOnDelete) { std::vector<net::CanonicalCookie> cookies; std::vector<bool> removes; - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); EXPECT_EQ(1U, cookies.size()); EXPECT_EQ(1U, removes.size()); EXPECT_TRUE(removes[0]); - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); EXPECT_EQ(2U, cookies.size()); EXPECT_EQ(2U, removes.size()); EXPECT_FALSE(removes[1]); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, NoNotifyOnNoChange) { std::vector<net::CanonicalCookie> cookies; std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); EXPECT_EQ(1U, cookies.size()); - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); EXPECT_EQ(1U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, MultipleNotifies) { @@ -337,88 +338,88 @@ std::vector<net::CanonicalCookie> cookies4; std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle2 = store_->AddCallbackForCookie( - kTestCookieURL2, "abc", + kTestCookieURLFooBaz, "abc", base::Bind(&RecordCookieChanges, &cookies2, nullptr)); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle3 = store_->AddCallbackForCookie( - kTestCookieURL3, "abc", + kTestCookieURLFoo, "abc", base::Bind(&RecordCookieChanges, &cookies3, nullptr)); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle4 = store_->AddCallbackForCookie( - kTestCookieURL4, "abc", + kTestCookieURLBarBar, "abc", base::Bind(&RecordCookieChanges, &cookies4, nullptr)); - SetSystemCookie(kTestCookieURL, "abc", "def"); - SetSystemCookie(kTestCookieURL2, "abc", "def"); - SetSystemCookie(kTestCookieURL3, "abc", "def"); - SetSystemCookie(kTestCookieURL4, "abc", "def"); - EXPECT_EQ(1U, cookies.size()); - EXPECT_EQ(1U, cookies2.size()); - EXPECT_EQ(0U, cookies3.size()); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBaz, "abc", "def"); + SetSystemCookie(kTestCookieURLFoo, "abc", "def"); + SetSystemCookie(kTestCookieURLBarBar, "abc", "def"); + EXPECT_EQ(2U, cookies.size()); + EXPECT_EQ(2U, cookies2.size()); + EXPECT_EQ(1U, cookies3.size()); EXPECT_EQ(1U, cookies4.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); - DeleteSystemCookie(kTestCookieURL2, "abc"); - DeleteSystemCookie(kTestCookieURL3, "abc"); - DeleteSystemCookie(kTestCookieURL4, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); + DeleteSystemCookie(kTestCookieURLFooBaz, "abc"); + DeleteSystemCookie(kTestCookieURLFoo, "abc"); + DeleteSystemCookie(kTestCookieURLBarBar, "abc"); } TEST_F(CookieStoreIOSTest, LessSpecificNestedCookie) { std::vector<net::CanonicalCookie> cookies; - SetSystemCookie(kTestCookieURL2, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBaz, "abc", "def"); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL2, "abc", + kTestCookieURLFooBaz, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL3, "abc", "ghi"); + SetSystemCookie(kTestCookieURLFoo, "abc", "ghi"); EXPECT_EQ(1U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, MoreSpecificNestedCookie) { std::vector<net::CanonicalCookie> cookies; - SetSystemCookie(kTestCookieURL3, "abc", "def"); + SetSystemCookie(kTestCookieURLFoo, "abc", "def"); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL2, "abc", + kTestCookieURLFooBaz, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL2, "abc", "ghi"); - EXPECT_EQ(2U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + SetSystemCookie(kTestCookieURLFooBaz, "abc", "ghi"); + EXPECT_EQ(1U, cookies.size()); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, MoreSpecificNestedCookieWithSameValue) { std::vector<net::CanonicalCookie> cookies; - SetSystemCookie(kTestCookieURL3, "abc", "def"); + SetSystemCookie(kTestCookieURLFoo, "abc", "def"); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL2, "abc", + kTestCookieURLFooBaz, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL2, "abc", "def"); - EXPECT_EQ(2U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + SetSystemCookie(kTestCookieURLFooBaz, "abc", "def"); + EXPECT_EQ(1U, cookies.size()); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } TEST_F(CookieStoreIOSTest, RemoveCallback) { std::vector<net::CanonicalCookie> cookies; - SetSystemCookie(kTestCookieURL, "abc", "def"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); std::unique_ptr<net::CookieStore::CookieChangedSubscription> handle = store_->AddCallbackForCookie( - kTestCookieURL, "abc", + kTestCookieURLFooBar, "abc", base::Bind(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); - SetSystemCookie(kTestCookieURL, "abc", "ghi"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "ghi"); EXPECT_EQ(2U, cookies.size()); // this deletes the callback handle.reset(); - SetSystemCookie(kTestCookieURL, "abc", "jkl"); + SetSystemCookie(kTestCookieURLFooBar, "abc", "jkl"); EXPECT_EQ(2U, cookies.size()); - DeleteSystemCookie(kTestCookieURL, "abc"); + DeleteSystemCookie(kTestCookieURLFooBar, "abc"); } } // namespace net
diff --git a/ios/showcase/payments/sc_payments_editor_egtest.mm b/ios/showcase/payments/sc_payments_editor_egtest.mm index b9279dcd..838c38c 100644 --- a/ios/showcase/payments/sc_payments_editor_egtest.mm +++ b/ios/showcase/payments/sc_payments_editor_egtest.mm
@@ -80,22 +80,15 @@ grey_sufficientlyVisible(), nil); } -// Matcher for the return key on the keyboard. -id<GREYMatcher> KeyboardReturnKey(NSString* accessibilityID) { - return grey_allOf(grey_accessibilityID(accessibilityID), +// Matcher for the next key on the keyboard. +id<GREYMatcher> KeyboardNextKey() { + return grey_allOf(grey_anyOf(grey_accessibilityID(@"Next"), + grey_accessibilityID(@"Next:"), nil), grey_accessibilityTrait(UIAccessibilityTraitButton), grey_accessibilityTrait(UIAccessibilityTraitKeyboardKey), grey_sufficientlyVisible(), nil); } -id<GREYMatcher> KeyboardNextKey() { - if (@available(iOS 10, *)) { - return KeyboardReturnKey(@"Next:"); - } else { - return KeyboardReturnKey(@"Next"); - } -} - } // namespace // Tests for the payment request editor view controller. @@ -303,13 +296,6 @@ // get focus except for the last textfield in which case causes the focus to go // away from the textfield. - (void)testNavigationByTappingReturn { -// TODO(crbug.com/769464): Re-enable this test on iPad devices. -#if !TARGET_IPHONE_SIMULATOR - if (IsIPadIdiom()) { - EARL_GREY_TEST_DISABLED(@"Test disabled on device."); - } -#endif - // Tap the name textfield. [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Name_textField")] performAction:grey_tap()]; @@ -326,9 +312,9 @@ @"City/Province_textField"); // The standard keyboard does not display for the province field. Instead, tap - // the address textfield. + // the postal code textfield. id<GREYMatcher> matcher = - grey_allOf(grey_accessibilityID(@"Address_textField"), + grey_allOf(grey_accessibilityID(@"Postal Code_textField"), grey_interactable(), grey_sufficientlyVisible(), nil); [[[EarlGrey selectElementWithMatcher:matcher] usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 50) @@ -337,21 +323,6 @@ @"kPaymentRequestEditCollectionViewAccessibilityID")] performAction:grey_tap()]; - // Assert the address textfield is focused. - AssertTextFieldWithAccessibilityIDIsFirstResponder(@"Address_textField"); - - // Press the return key. - [[EarlGrey selectElementWithMatcher:KeyboardNextKey()] - performAction:grey_tap()]; - - if (IsIPadIdiom()) { - // Disable EarlGrey's synchronization. - // TODO(crbug.com/768864): Investigate why synchronization gets blocked. - [[GREYConfiguration sharedInstance] - setValue:@NO - forConfigKey:kGREYConfigKeySynchronizationEnabled]; - } - // Assert the postal code textfield is focused. AssertTextFieldWithAccessibilityIDIsFirstResponder(@"Postal Code_textField"); @@ -365,13 +336,6 @@ GREYAssertFalse([firstResponder isKindOfClass:[UITextField class]], @"Expected first responder not to be of kind %@.", [UITextField class]); - - if (IsIPadIdiom()) { - // Reenable synchronization. - [[GREYConfiguration sharedInstance] - setValue:@YES - forConfigKey:kGREYConfigKeySynchronizationEnabled]; - } } @end
diff --git a/media/gpu/android/media_codec_video_decoder_unittest.cc b/media/gpu/android/media_codec_video_decoder_unittest.cc index 3c96617d..47314b5 100644 --- a/media/gpu/android/media_codec_video_decoder_unittest.cc +++ b/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -101,8 +101,9 @@ auto surface_chooser = base::MakeUnique<NiceMock<FakeSurfaceChooser>>(); surface_chooser_ = surface_chooser.get(); - auto surface_texture = make_scoped_refptr( - new NiceMock<MockSurfaceTextureGLOwner>(0, nullptr, nullptr)); + auto surface_texture = + base::MakeRefCounted<NiceMock<MockSurfaceTextureGLOwner>>(0, nullptr, + nullptr); surface_texture_ = surface_texture.get(); auto video_frame_factory =
diff --git a/media/gpu/android/video_frame_factory_impl.cc b/media/gpu/android/video_frame_factory_impl.cc index 393b4d8..cda7208 100644 --- a/media/gpu/android/video_frame_factory_impl.cc +++ b/media/gpu/android/video_frame_factory_impl.cc
@@ -171,10 +171,10 @@ GL_UNSIGNED_BYTE); // Create a new CodecImage to back the texture and try to render it early. - auto image = make_scoped_refptr( - new CodecImage(std::move(output_buffer), surface_texture, - base::Bind(&GpuVideoFrameFactory::OnImageDestructed, - weak_factory_.GetWeakPtr()))); + auto image = base::MakeRefCounted<CodecImage>( + std::move(output_buffer), surface_texture, + base::Bind(&GpuVideoFrameFactory::OnImageDestructed, + weak_factory_.GetWeakPtr())); images_.push_back(image.get()); internal::MaybeRenderEarly(&images_);
diff --git a/media/gpu/d3d11_h264_accelerator.cc b/media/gpu/d3d11_h264_accelerator.cc index 3fa890e..ab5046d9 100644 --- a/media/gpu/d3d11_h264_accelerator.cc +++ b/media/gpu/d3d11_h264_accelerator.cc
@@ -143,8 +143,8 @@ return nullptr; } picture->set_in_picture_use(true); - return make_scoped_refptr( - new D3D11H264Picture(picture, client_->input_buffer_id())); + return base::MakeRefCounted<D3D11H264Picture>(picture, + client_->input_buffer_id()); } bool D3D11H264Accelerator::SubmitFrameMetadata(
diff --git a/mojo/edk/system/ports/node.cc b/mojo/edk/system/ports/node.cc index 68620d1..76787aaa 100644 --- a/mojo/edk/system/ports/node.cc +++ b/mojo/edk/system/ports/node.cc
@@ -993,9 +993,9 @@ int Node::AcceptPort(const PortName& port_name, const Event::PortDescriptor& port_descriptor) { - scoped_refptr<Port> port = make_scoped_refptr( - new Port(port_descriptor.next_sequence_num_to_send, - port_descriptor.next_sequence_num_to_receive)); + scoped_refptr<Port> port = + base::MakeRefCounted<Port>(port_descriptor.next_sequence_num_to_send, + port_descriptor.next_sequence_num_to_receive); port->state = Port::kReceiving; port->peer_node_name = port_descriptor.peer_node_name; port->peer_port_name = port_descriptor.peer_port_name;
diff --git a/mojo/public/cpp/bindings/tests/test_native_types.h b/mojo/public/cpp/bindings/tests/test_native_types.h index f16bf2b..9ef2f902 100644 --- a/mojo/public/cpp/bindings/tests/test_native_types.h +++ b/mojo/public/cpp/bindings/tests/test_native_types.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_NATIVE_TYPES_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_NATIVE_TYPES_H_ + #include <string> #include "base/macros.h" @@ -82,3 +85,5 @@ }; } // namespace IPC + +#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_NATIVE_TYPES_H_
diff --git a/mojo/public/tools/bindings/chromium_bindings_configuration.gni b/mojo/public/tools/bindings/chromium_bindings_configuration.gni index 3b1791efe..b9ba9d6b 100644 --- a/mojo/public/tools/bindings/chromium_bindings_configuration.gni +++ b/mojo/public/tools/bindings/chromium_bindings_configuration.gni
@@ -28,10 +28,12 @@ "//mojo/common/typemaps.gni", "//mojo/public/cpp/bindings/tests/chromium_typemaps.gni", "//net/interfaces/typemaps.gni", + "//sandbox/mac/mojom/typemaps.gni", "//services/device/public/interfaces/typemaps.gni", "//services/identity/public/cpp/typemaps.gni", "//services/network/public/cpp/typemaps.gni", "//services/preferences/public/cpp/typemaps.gni", + "//services/proxy_resolver/public/cpp/typemaps.gni", "//services/resource_coordinator/public/cpp/typemaps.gni", "//services/service_manager/public/cpp/typemaps.gni", "//services/ui/gpu/interfaces/typemaps.gni",
diff --git a/net/BUILD.gn b/net/BUILD.gn index d2b2c06..31be654 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -36,7 +36,6 @@ use_v8_in_net = !is_ios && !is_proto_quic enable_built_in_dns = !is_ios && !is_proto_quic -enable_net_mojo = !is_ios && !is_proto_quic # Unix sockets are not supported on iOS, Fuchsia or NaCl. enable_unix_sockets = is_posix && !is_ios && !is_fuchsia && !is_nacl @@ -2709,13 +2708,6 @@ sources = [ "dns/mojo_host_resolver_impl.cc", "dns/mojo_host_resolver_impl.h", - "proxy/mojo_proxy_resolver_factory.h", - "proxy/proxy_resolver_factory_mojo.cc", - "proxy/proxy_resolver_factory_mojo.h", - "proxy/proxy_service_mojo.cc", - "proxy/proxy_service_mojo.h", - "url_request/url_request_context_builder_mojo.cc", - "url_request/url_request_context_builder_mojo.h", ] public_deps = [ @@ -2730,11 +2722,6 @@ sources = [ "dns/host_resolver_mojo.cc", "dns/host_resolver_mojo.h", - "proxy/mojo_proxy_resolver_factory_impl.cc", - "proxy/mojo_proxy_resolver_factory_impl.h", - "proxy/mojo_proxy_resolver_impl.cc", - "proxy/mojo_proxy_resolver_impl.h", - "proxy/mojo_proxy_resolver_v8_tracing_bindings.h", ] deps = [ @@ -4921,8 +4908,6 @@ "proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc", "proxy/dhcp_proxy_script_fetcher_factory_unittest.cc", "proxy/dhcp_proxy_script_fetcher_win_unittest.cc", - "proxy/mojo_proxy_resolver_factory_impl_unittest.cc", - "proxy/mojo_proxy_resolver_impl_unittest.cc", "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc", "proxy/multi_threaded_proxy_resolver_unittest.cc", "proxy/network_delegate_error_observer_unittest.cc", @@ -4933,17 +4918,13 @@ "proxy/proxy_config_unittest.cc", "proxy/proxy_info_unittest.cc", "proxy/proxy_list_unittest.cc", - "proxy/proxy_resolver_factory_mojo_unittest.cc", "proxy/proxy_resolver_v8_tracing_unittest.cc", "proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc", "proxy/proxy_resolver_v8_unittest.cc", "proxy/proxy_script_decider_unittest.cc", "proxy/proxy_script_fetcher_impl_unittest.cc", "proxy/proxy_server_unittest.cc", - "proxy/proxy_service_mojo_unittest.cc", "proxy/proxy_service_unittest.cc", - "proxy/test_mojo_proxy_resolver_factory.cc", - "proxy/test_mojo_proxy_resolver_factory.h", "quic/chromium/bidirectional_stream_quic_impl_unittest.cc", "quic/chromium/crypto/proof_test_chromium.cc", "quic/chromium/crypto/proof_verifier_chromium_test.cc", @@ -5175,7 +5156,6 @@ "url_request/report_sender_unittest.cc", "url_request/url_fetcher_impl_unittest.cc", "url_request/url_fetcher_response_writer_unittest.cc", - "url_request/url_request_context_builder_mojo_unittest.cc", "url_request/url_request_context_builder_unittest.cc", "url_request/url_request_context_unittest.cc", "url_request/url_request_data_job_unittest.cc", @@ -5472,14 +5452,7 @@ sources -= [ "dns/host_resolver_mojo_unittest.cc", "dns/mojo_host_resolver_impl_unittest.cc", - "proxy/mojo_proxy_resolver_factory_impl_unittest.cc", - "proxy/mojo_proxy_resolver_impl_unittest.cc", "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc", - "proxy/proxy_resolver_factory_mojo_unittest.cc", - "proxy/proxy_service_mojo_unittest.cc", - "proxy/test_mojo_proxy_resolver_factory.cc", - "proxy/test_mojo_proxy_resolver_factory.h", - "url_request/url_request_context_builder_mojo_unittest.cc", ] }
diff --git a/net/features.gni b/net/features.gni index c54da53..aaac9aa 100644 --- a/net/features.gni +++ b/net/features.gni
@@ -40,3 +40,7 @@ # connections use HTTPS. include_transport_security_state_preload_list = true } + +declare_args() { + enable_net_mojo = !is_ios && !is_proto_quic +}
diff --git a/net/interfaces/BUILD.gn b/net/interfaces/BUILD.gn index f90c1439..cbccdbc 100644 --- a/net/interfaces/BUILD.gn +++ b/net/interfaces/BUILD.gn
@@ -9,7 +9,6 @@ "host_resolver_service.mojom", "ip_address.mojom", "ip_endpoint.mojom", - "proxy_resolver_service.mojom", ] public_deps = [ "//url/mojo:url_mojom_gurl",
diff --git a/net/interfaces/proxy_resolver.typemap b/net/interfaces/proxy_resolver.typemap deleted file mode 100644 index d46fe38..0000000 --- a/net/interfaces/proxy_resolver.typemap +++ /dev/null
@@ -1,21 +0,0 @@ -# Copyright 2016 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. - -mojom = "//net/interfaces/proxy_resolver_service.mojom" -public_headers = [ - "//net/proxy/proxy_server.h", - "//net/proxy/proxy_info.h", -] -traits_headers = [ "//net/proxy/mojo_proxy_struct_traits.h" ] -sources = [ - "//net/proxy/mojo_proxy_struct_traits.cc", -] -type_mappings = [ - "net.interfaces.ProxyInfo=net::ProxyInfo", - "net.interfaces.ProxyServer=net::ProxyServer", - "net.interfaces.ProxyServer::Scheme=net::ProxyScheme", -] -public_deps = [ - "//net", -]
diff --git a/net/interfaces/typemaps.gni b/net/interfaces/typemaps.gni index 2b0ac817..4932e71 100644 --- a/net/interfaces/typemaps.gni +++ b/net/interfaces/typemaps.gni
@@ -6,5 +6,4 @@ "//net/interfaces/host_resolver.typemap", "//net/interfaces/ip_address.typemap", "//net/interfaces/ip_endpoint.typemap", - "//net/interfaces/proxy_resolver.typemap", ]
diff --git a/net/log/trace_net_log_observer.cc b/net/log/trace_net_log_observer.cc index e27cc3a..4349c3c 100644 --- a/net/log/trace_net_log_observer.cc +++ b/net/log/trace_net_log_observer.cc
@@ -48,8 +48,8 @@ } // namespace -TraceNetLogObserver::TraceNetLogObserver() : net_log_to_watch_(NULL) { -} +TraceNetLogObserver::TraceNetLogObserver() + : net_log_to_watch_(nullptr), weak_factory_(this) {} TraceNetLogObserver::~TraceNetLogObserver() { DCHECK(!net_log_to_watch_); @@ -94,13 +94,15 @@ // startup tracing. if (base::trace_event::TraceLog::GetInstance()->IsEnabled()) OnTraceLogEnabled(); - base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this); + base::trace_event::TraceLog::GetInstance()->AddAsyncEnabledStateObserver( + weak_factory_.GetWeakPtr()); } void TraceNetLogObserver::StopWatchForTraceStart() { // Should only stop if is currently watching. DCHECK(net_log_to_watch_); - base::trace_event::TraceLog::GetInstance()->RemoveEnabledStateObserver(this); + base::trace_event::TraceLog::GetInstance()->RemoveAsyncEnabledStateObserver( + this); // net_log() != nullptr iff NetLog::AddObserver() has been called. // This implies that if the netlog category wasn't enabled, then // NetLog::RemoveObserver() will not get called, and there won't be
diff --git a/net/log/trace_net_log_observer.h b/net/log/trace_net_log_observer.h index 4c8b572c..0d7d8567 100644 --- a/net/log/trace_net_log_observer.h +++ b/net/log/trace_net_log_observer.h
@@ -6,6 +6,7 @@ #define NET_LOG_TRACE_NET_LOG_OBSERVER_H_ #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "base/trace_event/trace_log.h" #include "net/base/net_export.h" #include "net/log/net_log.h" @@ -16,7 +17,7 @@ // events to TraceLog if it is enabled. class NET_EXPORT TraceNetLogObserver : public NetLog::ThreadSafeObserver, - public base::trace_event::TraceLog::EnabledStateObserver { + public base::trace_event::TraceLog::AsyncEnabledStateObserver { public: TraceNetLogObserver(); ~TraceNetLogObserver() override; @@ -40,6 +41,7 @@ private: NetLog* net_log_to_watch_; + base::WeakPtrFactory<TraceNetLogObserver> weak_factory_; DISALLOW_COPY_AND_ASSIGN(TraceNetLogObserver); };
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index 1b92f0d3..a9e938a 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc
@@ -10,6 +10,7 @@ #include "base/json/json_reader.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/memory/ref_counted_memory.h" #include "base/run_loop.h" @@ -54,6 +55,31 @@ return info; } +void EnableTraceLog(base::StringPiece category) { + TraceLog::GetInstance()->SetEnabled( + base::trace_event::TraceConfig(category, ""), TraceLog::RECORDING_MODE); + // AsyncEnabledStateObserver will receive enabled notification one message + // loop iteration later. + base::RunLoop().RunUntilIdle(); +} + +void DisableTraceLog() { + TraceLog::GetInstance()->SetDisabled(); + // AsyncEnabledStateObserver will receive disabled notification one message + // loop iteration later. + base::RunLoop().RunUntilIdle(); +} + +void EnableTraceLogWithNetLog() { + EnableTraceLog(kNetLogTracingCategory); +} + +void EnableTraceLogWithoutNetLog() { + std::string disabled_netlog_category = + std::string("-") + kNetLogTracingCategory; + EnableTraceLog(disabled_netlog_category); +} + class TraceNetLogObserverTest : public testing::Test { public: TraceNetLogObserverTest() { @@ -83,7 +109,7 @@ base::JSONReader::Read(json_output_.json_output, base::JSON_PARSE_RFC); ASSERT_TRUE(trace_value) << json_output_.json_output; - base::ListValue* trace_events = NULL; + base::ListValue* trace_events = nullptr; ASSERT_TRUE(trace_value->GetAsList(&trace_events)); trace_events_ = FilterNetLogTraceEvents(*trace_events); @@ -92,15 +118,9 @@ run_loop->Quit(); } - static void EnableTraceLog() { - TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(kNetLogTracingCategory, ""), - TraceLog::RECORDING_MODE); - } - void EndTraceAndFlush() { + DisableTraceLog(); base::RunLoop run_loop; - TraceLog::GetInstance()->SetDisabled(); TraceLog::GetInstance()->Flush( base::Bind(&TraceNetLogObserverTest::OnTraceDataCollected, base::Unretained(this), base::Unretained(&run_loop))); @@ -116,7 +136,7 @@ std::unique_ptr<base::ListValue> filtered_trace_events( new base::ListValue()); for (size_t i = 0; i < trace_events.GetSize(); i++) { - const base::DictionaryValue* dict = NULL; + const base::DictionaryValue* dict = nullptr; if (!trace_events.GetDictionary(i, &dict)) { ADD_FAILURE() << "Unexpected non-dictionary event in trace_events"; continue; @@ -160,13 +180,34 @@ EXPECT_EQ(0u, trace_events()->GetSize()); } +// This test will result in a deadlock if EnabledStateObserver instead +// of AsyncEnabledStateObserver is used. Regression test for crbug.com/760817. +TEST_F(TraceNetLogObserverTest, TracingDisabledDuringOnAddEntry) { + trace_net_log_observer()->WatchForTraceStart(net_log()); + TraceLog* trace_log = TraceLog::GetInstance(); + trace_log->SetTraceBufferForTesting(base::WrapUnique( + base::trace_event::TraceBuffer::CreateTraceBufferVectorOfSize(1))); + EnableTraceLogWithNetLog(); + // TraceLog will disable itself when an event makes the TraceBuffer full. + while (!trace_log->BufferIsFull()) { + net_log()->AddGlobalEntry(NetLogEventType::REQUEST_ALIVE); + } + + base::RunLoop().RunUntilIdle(); + ASSERT_FALSE(trace_log->IsEnabled()); + ASSERT_FALSE(trace_net_log_observer()->net_log()); + trace_net_log_observer()->StopWatchForTraceStart(); + // Flush now so that TraceLog's buffer is empty in the next test. + EndTraceAndFlush(); +} + TEST_F(TraceNetLogObserverTest, TraceEventCaptured) { TestNetLogEntry::List entries; net_log()->GetEntries(&entries); EXPECT_TRUE(entries.empty()); trace_net_log_observer()->WatchForTraceStart(net_log()); - EnableTraceLog(); + EnableTraceLogWithNetLog(); NetLogWithSource net_log_with_source = NetLogWithSource::Make(net_log(), net::NetLogSourceType::NONE); net_log()->AddGlobalEntry(NetLogEventType::CANCELLED); @@ -178,11 +219,11 @@ EndTraceAndFlush(); trace_net_log_observer()->StopWatchForTraceStart(); EXPECT_EQ(3u, trace_events()->GetSize()); - const base::DictionaryValue* item1 = NULL; + const base::DictionaryValue* item1 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(0, &item1)); - const base::DictionaryValue* item2 = NULL; + const base::DictionaryValue* item2 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(1, &item2)); - const base::DictionaryValue* item3 = NULL; + const base::DictionaryValue* item3 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(2, &item3)); TraceEntryInfo actual_item1 = GetTraceEntryInfoFromValue(*item1); @@ -218,11 +259,11 @@ TEST_F(TraceNetLogObserverTest, EnableAndDisableTracing) { trace_net_log_observer()->WatchForTraceStart(net_log()); - EnableTraceLog(); + EnableTraceLogWithNetLog(); net_log()->AddGlobalEntry(NetLogEventType::CANCELLED); - TraceLog::GetInstance()->SetDisabled(); + DisableTraceLog(); net_log()->AddGlobalEntry(NetLogEventType::REQUEST_ALIVE); - EnableTraceLog(); + EnableTraceLogWithNetLog(); net_log()->AddGlobalEntry(NetLogEventType::URL_REQUEST_START_JOB); EndTraceAndFlush(); @@ -232,9 +273,9 @@ net_log()->GetEntries(&entries); EXPECT_EQ(3u, entries.size()); EXPECT_EQ(2u, trace_events()->GetSize()); - const base::DictionaryValue* item1 = NULL; + const base::DictionaryValue* item1 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(0, &item1)); - const base::DictionaryValue* item2 = NULL; + const base::DictionaryValue* item2 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(1, &item2)); TraceEntryInfo actual_item1 = GetTraceEntryInfoFromValue(*item1); @@ -260,10 +301,10 @@ TEST_F(TraceNetLogObserverTest, DestroyObserverWhileTracing) { trace_net_log_observer()->WatchForTraceStart(net_log()); - EnableTraceLog(); + EnableTraceLogWithNetLog(); net_log()->AddGlobalEntry(NetLogEventType::CANCELLED); trace_net_log_observer()->StopWatchForTraceStart(); - set_trace_net_log_observer(NULL); + set_trace_net_log_observer(nullptr); net_log()->AddGlobalEntry(NetLogEventType::REQUEST_ALIVE); EndTraceAndFlush(); @@ -273,7 +314,7 @@ EXPECT_EQ(2u, entries.size()); EXPECT_EQ(1u, trace_events()->GetSize()); - const base::DictionaryValue* item1 = NULL; + const base::DictionaryValue* item1 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(0, &item1)); TraceEntryInfo actual_item1 = GetTraceEntryInfoFromValue(*item1); @@ -291,7 +332,7 @@ trace_net_log_observer()->WatchForTraceStart(net_log()); net_log()->AddGlobalEntry(NetLogEventType::CANCELLED); trace_net_log_observer()->StopWatchForTraceStart(); - set_trace_net_log_observer(NULL); + set_trace_net_log_observer(nullptr); net_log()->AddGlobalEntry(NetLogEventType::REQUEST_ALIVE); net_log()->AddGlobalEntry(NetLogEventType::URL_REQUEST_START_JOB); @@ -304,8 +345,8 @@ } TEST_F(TraceNetLogObserverTest, CreateObserverAfterTracingStarts) { - set_trace_net_log_observer(NULL); - EnableTraceLog(); + set_trace_net_log_observer(nullptr); + EnableTraceLogWithNetLog(); set_trace_net_log_observer(new TraceNetLogObserver()); trace_net_log_observer()->WatchForTraceStart(net_log()); net_log()->AddGlobalEntry(NetLogEventType::CANCELLED); @@ -325,11 +366,7 @@ CreateObserverAfterTracingStartsDisabledCategory) { set_trace_net_log_observer(nullptr); - std::string disabled_netlog_category = - std::string("-") + kNetLogTracingCategory; - TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(disabled_netlog_category, ""), - TraceLog::RECORDING_MODE); + EnableTraceLogWithoutNetLog(); set_trace_net_log_observer(new TraceNetLogObserver()); trace_net_log_observer()->WatchForTraceStart(net_log()); @@ -348,7 +385,7 @@ TEST_F(TraceNetLogObserverTest, EventsWithAndWithoutParameters) { trace_net_log_observer()->WatchForTraceStart(net_log()); - EnableTraceLog(); + EnableTraceLogWithNetLog(); NetLogParametersCallback net_log_callback; std::string param = "bar"; net_log_callback = NetLog::StringCallback("foo", ¶m); @@ -363,9 +400,9 @@ net_log()->GetEntries(&entries); EXPECT_EQ(2u, entries.size()); EXPECT_EQ(2u, trace_events()->GetSize()); - const base::DictionaryValue* item1 = NULL; + const base::DictionaryValue* item1 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(0, &item1)); - const base::DictionaryValue* item2 = NULL; + const base::DictionaryValue* item2 = nullptr; ASSERT_TRUE(trace_events()->GetDictionary(1, &item2)); TraceEntryInfo actual_item1 = GetTraceEntryInfoFromValue(*item1); @@ -404,17 +441,13 @@ EXPECT_FALSE(net_log.IsCapturing()); - std::string disabled_netlog_category = - std::string("-") + kNetLogTracingCategory; - TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(disabled_netlog_category, ""), - TraceLog::RECORDING_MODE); + EnableTraceLogWithoutNetLog(); EXPECT_FALSE(net_log.IsCapturing()); observer.StopWatchForTraceStart(); EXPECT_FALSE(net_log.IsCapturing()); - TraceLog::GetInstance()->SetDisabled(); + DisableTraceLog(); } TEST(TraceNetLogObserverCategoryTest, EnabledCategory) { @@ -424,15 +457,13 @@ EXPECT_FALSE(net_log.IsCapturing()); - TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(kNetLogTracingCategory, ""), - TraceLog::RECORDING_MODE); + EnableTraceLogWithNetLog(); EXPECT_TRUE(net_log.IsCapturing()); observer.StopWatchForTraceStart(); EXPECT_FALSE(net_log.IsCapturing()); - TraceLog::GetInstance()->SetDisabled(); + DisableTraceLog(); } } // namespace
diff --git a/net/proxy/mojo_proxy_resolver_factory_impl.h b/net/proxy/mojo_proxy_resolver_factory_impl.h deleted file mode 100644 index ca29f425..0000000 --- a/net/proxy/mojo_proxy_resolver_factory_impl.h +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2015 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 NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_ -#define NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_ - -#include <map> - -#include "base/callback.h" -#include "base/macros.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" - -namespace net { -class ProxyResolverV8TracingFactory; - -class MojoProxyResolverFactoryImpl : public interfaces::ProxyResolverFactory { - public: - MojoProxyResolverFactoryImpl(); - explicit MojoProxyResolverFactoryImpl( - std::unique_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory); - - ~MojoProxyResolverFactoryImpl() override; - - private: - class Job; - - // interfaces::ProxyResolverFactory override. - void CreateResolver( - const std::string& pac_script, - interfaces::ProxyResolverRequest request, - interfaces::ProxyResolverFactoryRequestClientPtr client) override; - - void RemoveJob(Job* job); - - const std::unique_ptr<ProxyResolverV8TracingFactory> - proxy_resolver_impl_factory_; - - std::map<Job*, std::unique_ptr<Job>> jobs_; - - DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverFactoryImpl); -}; - -} // namespace net - -#endif // NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_
diff --git a/net/proxy/mojo_proxy_resolver_impl.h b/net/proxy/mojo_proxy_resolver_impl.h deleted file mode 100644 index a7982ddb..0000000 --- a/net/proxy/mojo_proxy_resolver_impl.h +++ /dev/null
@@ -1,44 +0,0 @@ -// Copyright 2015 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 NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ -#define NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ - -#include <map> -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" -#include "net/proxy/proxy_resolver.h" - -namespace net { -class ProxyResolverV8Tracing; - -class MojoProxyResolverImpl : public interfaces::ProxyResolver { - public: - explicit MojoProxyResolverImpl( - std::unique_ptr<ProxyResolverV8Tracing> resolver); - - ~MojoProxyResolverImpl() override; - - private: - class Job; - - // interfaces::ProxyResolver overrides. - void GetProxyForUrl( - const GURL& url, - interfaces::ProxyResolverRequestClientPtr client) override; - - void DeleteJob(Job* job); - - std::unique_ptr<ProxyResolverV8Tracing> resolver_; - std::map<Job*, std::unique_ptr<Job>> resolve_jobs_; - - DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); -}; - -} // namespace net - -#endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_
diff --git a/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h b/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h index e5308f2..8a424fe 100644 --- a/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h +++ b/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h
@@ -10,7 +10,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_checker.h" #include "net/dns/host_resolver_mojo.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" #include "net/log/net_log_with_source.h" #include "net/proxy/proxy_resolver_v8_tracing.h"
diff --git a/net/proxy/mojo_proxy_struct_traits.cc b/net/proxy/mojo_proxy_struct_traits.cc deleted file mode 100644 index f4af60d..0000000 --- a/net/proxy/mojo_proxy_struct_traits.cc +++ /dev/null
@@ -1,124 +0,0 @@ -// Copyright 2015 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 "net/proxy/mojo_proxy_struct_traits.h" - -#include "base/logging.h" -#include "net/base/host_port_pair.h" -#include "net/proxy/proxy_info.h" -#include "net/proxy/proxy_server.h" - -namespace mojo { - -net::interfaces::ProxyScheme -EnumTraits<net::interfaces::ProxyScheme, net::ProxyServer::Scheme>::ToMojom( - net::ProxyServer::Scheme scheme) { - using net::ProxyServer; - switch (scheme) { - case ProxyServer::SCHEME_INVALID: - return net::interfaces::ProxyScheme::INVALID; - case ProxyServer::SCHEME_DIRECT: - return net::interfaces::ProxyScheme::DIRECT; - case ProxyServer::SCHEME_HTTP: - return net::interfaces::ProxyScheme::HTTP; - case ProxyServer::SCHEME_SOCKS4: - return net::interfaces::ProxyScheme::SOCKS4; - case ProxyServer::SCHEME_SOCKS5: - return net::interfaces::ProxyScheme::SOCKS5; - case ProxyServer::SCHEME_HTTPS: - return net::interfaces::ProxyScheme::HTTPS; - case ProxyServer::SCHEME_QUIC: - return net::interfaces::ProxyScheme::QUIC; - } - NOTREACHED(); - return net::interfaces::ProxyScheme::INVALID; -} - -bool EnumTraits<net::interfaces::ProxyScheme, net::ProxyServer::Scheme>:: - FromMojom(net::interfaces::ProxyScheme scheme, - net::ProxyServer::Scheme* out) { - using net::ProxyServer; - switch (scheme) { - case net::interfaces::ProxyScheme::INVALID: - *out = ProxyServer::SCHEME_INVALID; - return true; - case net::interfaces::ProxyScheme::DIRECT: - *out = ProxyServer::SCHEME_DIRECT; - return true; - case net::interfaces::ProxyScheme::HTTP: - *out = ProxyServer::SCHEME_HTTP; - return true; - case net::interfaces::ProxyScheme::SOCKS4: - *out = ProxyServer::SCHEME_SOCKS4; - return true; - case net::interfaces::ProxyScheme::SOCKS5: - *out = ProxyServer::SCHEME_SOCKS5; - return true; - case net::interfaces::ProxyScheme::HTTPS: - *out = ProxyServer::SCHEME_HTTPS; - return true; - case net::interfaces::ProxyScheme::QUIC: - *out = ProxyServer::SCHEME_QUIC; - return true; - } - return false; -} - -base::StringPiece -StructTraits<net::interfaces::ProxyServerDataView, net::ProxyServer>::host( - const net::ProxyServer& s) { - if (s.scheme() == net::ProxyServer::SCHEME_DIRECT || - s.scheme() == net::ProxyServer::SCHEME_INVALID) { - return base::StringPiece(); - } - return s.host_port_pair().host(); -} - -uint16_t StructTraits<net::interfaces::ProxyServerDataView, - net::ProxyServer>::port(const net::ProxyServer& s) { - if (s.scheme() == net::ProxyServer::SCHEME_DIRECT || - s.scheme() == net::ProxyServer::SCHEME_INVALID) { - return 0; - } - return s.host_port_pair().port(); -} - -bool StructTraits<net::interfaces::ProxyServerDataView, net::ProxyServer>::Read( - net::interfaces::ProxyServerDataView data, - net::ProxyServer* out) { - net::ProxyServer::Scheme scheme; - if (!data.ReadScheme(&scheme)) - return false; - - base::StringPiece host; - if (!data.ReadHost(&host)) - return false; - - if ((scheme == net::ProxyServer::SCHEME_DIRECT || - scheme == net::ProxyServer::SCHEME_INVALID) && - (!host.empty() || data.port())) { - return false; - } - - *out = net::ProxyServer(scheme, - net::HostPortPair(host.as_string(), data.port())); - return true; -} - -bool StructTraits<net::interfaces::ProxyInfoDataView, net::ProxyInfo>::Read( - net::interfaces::ProxyInfoDataView data, - net::ProxyInfo* out) { - std::vector<net::ProxyServer> proxy_servers; - if (!data.ReadProxyServers(&proxy_servers)) - return false; - - net::ProxyList proxy_list; - for (const auto& server : proxy_servers) - proxy_list.AddProxyServer(server); - - out->UseProxyList(proxy_list); - return true; -} - -} // namespace mojo
diff --git a/net/proxy/mojo_proxy_struct_traits.h b/net/proxy/mojo_proxy_struct_traits.h deleted file mode 100644 index 061a272..0000000 --- a/net/proxy/mojo_proxy_struct_traits.h +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2015 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 NET_PROXY_MOJO_PROXY_STRUCT_TRAITS_H_ -#define NET_PROXY_MOJO_PROXY_STRUCT_TRAITS_H_ - -#include "base/strings/string_piece.h" -#include "mojo/public/cpp/bindings/enum_traits.h" -#include "mojo/public/cpp/bindings/struct_traits.h" -#include "net/base/host_port_pair.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" -#include "net/proxy/proxy_info.h" -#include "net/proxy/proxy_list.h" -#include "net/proxy/proxy_server.h" - -namespace net { -class ProxyInfo; -class ProxyServer; -} - -namespace mojo { - -template <> -struct EnumTraits<net::interfaces::ProxyScheme, net::ProxyServer::Scheme> { - static net::interfaces::ProxyScheme ToMojom(net::ProxyServer::Scheme scheme); - static bool FromMojom(net::interfaces::ProxyScheme scheme, - net::ProxyServer::Scheme* out); -}; - -template <> -struct StructTraits<net::interfaces::ProxyServerDataView, net::ProxyServer> { - static net::ProxyServer::Scheme scheme(const net::ProxyServer& s) { - return s.scheme(); - } - - static base::StringPiece host(const net::ProxyServer& s); - static uint16_t port(const net::ProxyServer& s); - - static bool Read(net::interfaces::ProxyServerDataView data, - net::ProxyServer* out); -}; - -template <> -struct StructTraits<net::interfaces::ProxyInfoDataView, net::ProxyInfo> { - static const std::vector<net::ProxyServer>& proxy_servers( - const net::ProxyInfo& info) { - return info.proxy_list().GetAll(); - } - - static bool Read(net::interfaces::ProxyInfoDataView data, - net::ProxyInfo* out); -}; - -} // namespace mojo - -#endif // NET_PROXY_MOJO_PROXY_STRUCT_TRAITS_H_
diff --git a/net/proxy/proxy_resolver_factory_mojo.h b/net/proxy/proxy_resolver_factory_mojo.h deleted file mode 100644 index f50d0e6d..0000000 --- a/net/proxy/proxy_resolver_factory_mojo.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2015 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 NET_PROXY_PROXY_RESOLVER_FACTORY_MOJO_H_ -#define NET_PROXY_PROXY_RESOLVER_FACTORY_MOJO_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "mojo/public/cpp/bindings/binding.h" -#include "net/base/completion_callback.h" -#include "net/proxy/proxy_resolver_factory.h" - -namespace net { -class HostResolver; -class MojoProxyResolverFactory; -class NetLog; -class ProxyResolverErrorObserver; -class ProxyResolverScriptData; - -// Implementation of ProxyResolverFactory that connects to a Mojo service to -// create implementations of a Mojo proxy resolver to back a ProxyResolverMojo. -class ProxyResolverFactoryMojo : public ProxyResolverFactory { - public: - ProxyResolverFactoryMojo( - MojoProxyResolverFactory* mojo_proxy_factory, - HostResolver* host_resolver, - const base::Callback<std::unique_ptr<ProxyResolverErrorObserver>()>& - error_observer_factory, - NetLog* net_log); - ~ProxyResolverFactoryMojo() override; - - // ProxyResolverFactory override. - int CreateProxyResolver( - const scoped_refptr<ProxyResolverScriptData>& pac_script, - std::unique_ptr<ProxyResolver>* resolver, - const CompletionCallback& callback, - std::unique_ptr<Request>* request) override; - - private: - class Job; - - MojoProxyResolverFactory* const mojo_proxy_factory_; - HostResolver* const host_resolver_; - const base::Callback<std::unique_ptr<ProxyResolverErrorObserver>()> - error_observer_factory_; - NetLog* const net_log_; - - DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryMojo); -}; - -} // namespace net - -#endif // NET_PROXY_PROXY_RESOLVER_FACTORY_MOJO_H_
diff --git a/net/proxy/proxy_service_mojo.cc b/net/proxy/proxy_service_mojo.cc deleted file mode 100644 index 3443f18..0000000 --- a/net/proxy/proxy_service_mojo.cc +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2015 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 "net/proxy/proxy_service_mojo.h" - -#include <memory> -#include <utility> - -#include "base/logging.h" -#include "base/memory/ptr_util.h" -#include "base/threading/thread_task_runner_handle.h" -#include "net/dns/mojo_host_resolver_impl.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" -#include "net/proxy/network_delegate_error_observer.h" -#include "net/proxy/proxy_resolver_factory.h" -#include "net/proxy/proxy_resolver_factory_mojo.h" -#include "net/proxy/proxy_service.h" - -namespace net { - -std::unique_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( - MojoProxyResolverFactory* mojo_proxy_factory, - std::unique_ptr<ProxyConfigService> proxy_config_service, - ProxyScriptFetcher* proxy_script_fetcher, - std::unique_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher, - HostResolver* host_resolver, - NetLog* net_log, - NetworkDelegate* network_delegate) { - DCHECK(proxy_config_service); - DCHECK(proxy_script_fetcher); - DCHECK(dhcp_proxy_script_fetcher); - DCHECK(host_resolver); - - std::unique_ptr<ProxyService> proxy_service(new ProxyService( - std::move(proxy_config_service), - std::make_unique<ProxyResolverFactoryMojo>( - mojo_proxy_factory, host_resolver, - base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate, - base::ThreadTaskRunnerHandle::Get()), - net_log), - net_log)); - - // Configure fetchers to use for PAC script downloads and auto-detect. - proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, - std::move(dhcp_proxy_script_fetcher)); - - return proxy_service; -} - -} // namespace net
diff --git a/net/proxy/test_mojo_proxy_resolver_factory.h b/net/proxy/test_mojo_proxy_resolver_factory.h deleted file mode 100644 index 7be0be4..0000000 --- a/net/proxy/test_mojo_proxy_resolver_factory.h +++ /dev/null
@@ -1,52 +0,0 @@ -// 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 NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ -#define NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ - -#include <memory> -#include <string> - -#include "base/macros.h" -#include "base/memory/singleton.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" - -namespace net { - -// MojoProxyResolverFactory that runs PAC scripts in-process, for tests. -class TestMojoProxyResolverFactory : public MojoProxyResolverFactory { - public: - static TestMojoProxyResolverFactory* GetInstance(); - - // Returns true if CreateResolver was called. - bool resolver_created() { return resolver_created_; } - - // Sets the value returned by resolver_created. Since this is a singleton, - // Serves to avoid with test fixture reuse. - void set_resolver_created(bool resolver_created) { - resolver_created_ = resolver_created; - } - - // Overridden from MojoProxyResolverFactory: - std::unique_ptr<base::ScopedClosureRunner> CreateResolver( - const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> req, - interfaces::ProxyResolverFactoryRequestClientPtr client) override; - - private: - TestMojoProxyResolverFactory(); - ~TestMojoProxyResolverFactory() override; - - friend struct base::DefaultSingletonTraits<TestMojoProxyResolverFactory>; - - interfaces::ProxyResolverFactoryPtr factory_; - - bool resolver_created_ = false; - - DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory); -}; - -} // namespace net - -#endif // NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
diff --git a/net/ssl/ssl_platform_key_mac.cc b/net/ssl/ssl_platform_key_mac.cc index 41be562..feb82c9f 100644 --- a/net/ssl/ssl_platform_key_mac.cc +++ b/net/ssl/ssl_platform_key_mac.cc
@@ -356,10 +356,10 @@ return nullptr; if (__builtin_available(macOS 10.12, *)) { - return make_scoped_refptr( - new ThreadedSSLPrivateKey(std::make_unique<SSLPlatformKeySecKey>( - key_type, max_length, private_key), - GetSSLPlatformKeyTaskRunner())); + return base::MakeRefCounted<ThreadedSSLPrivateKey>( + std::make_unique<SSLPlatformKeySecKey>(key_type, max_length, + private_key), + GetSSLPlatformKeyTaskRunner()); } const CSSM_KEY* cssm_key;
diff --git a/net/url_request/url_request_context_builder_mojo.cc b/net/url_request/url_request_context_builder_mojo.cc deleted file mode 100644 index e968301b..0000000 --- a/net/url_request/url_request_context_builder_mojo.cc +++ /dev/null
@@ -1,45 +0,0 @@ -// 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 "net/url_request/url_request_context_builder_mojo.h" - -#include "base/logging.h" -#include "build/build_config.h" -#include "net/proxy/proxy_config_service.h" -#include "net/proxy/proxy_script_fetcher_impl.h" -#include "net/proxy/proxy_service_mojo.h" - -namespace net { - -URLRequestContextBuilderMojo::URLRequestContextBuilderMojo() - : dhcp_fetcher_factory_(new DhcpProxyScriptFetcherFactory()) {} - -URLRequestContextBuilderMojo::~URLRequestContextBuilderMojo() = default; - -std::unique_ptr<ProxyService> URLRequestContextBuilderMojo::CreateProxyService( - std::unique_ptr<ProxyConfigService> proxy_config_service, - URLRequestContext* url_request_context, - HostResolver* host_resolver, - NetworkDelegate* network_delegate, - NetLog* net_log) { - DCHECK(url_request_context); - DCHECK(host_resolver); - - if (!mojo_proxy_resolver_factory_) { - return URLRequestContextBuilder::CreateProxyService( - std::move(proxy_config_service), url_request_context, host_resolver, - network_delegate, net_log); - } - - std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher = - dhcp_fetcher_factory_->Create(url_request_context); - std::unique_ptr<net::ProxyScriptFetcher> proxy_script_fetcher = - std::make_unique<ProxyScriptFetcherImpl>(url_request_context); - return CreateProxyServiceUsingMojoFactory( - mojo_proxy_resolver_factory_, std::move(proxy_config_service), - proxy_script_fetcher.release(), std::move(dhcp_proxy_script_fetcher), - host_resolver, net_log, network_delegate); -} - -} // namespace net
diff --git a/net/url_request/url_request_context_builder_mojo.h b/net/url_request/url_request_context_builder_mojo.h deleted file mode 100644 index 29c9595..0000000 --- a/net/url_request/url_request_context_builder_mojo.h +++ /dev/null
@@ -1,65 +0,0 @@ -// 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 NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_ -#define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_ - -#include <memory> - -#include "base/macros.h" -#include "build/build_config.h" -#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" -#include "net/url_request/url_request_context_builder.h" - -namespace net { - -class HostResolver; -class NetLog; -class NetworkDelegate; -class MojoProxyResolverFactory; -class ProxyService; -class URLRequestContext; - -// Specialization of URLRequestContextBuilder that can create a ProxyService -// that uses a Mojo ProxyResolver. The consumer is responsible for providing -// the MojoProxyResolverFactory. If a PoxyService is set directly via the -// URLRequestContextBuilder API, it will be used instead. -class URLRequestContextBuilderMojo : public URLRequestContextBuilder { - public: - URLRequestContextBuilderMojo(); - ~URLRequestContextBuilderMojo() override; - - // Overrides default DhcpProxyScriptFetcherFactory. Ignored if no - // MojoProxyResolverFactory is provided. - void set_dhcp_fetcher_factory( - std::unique_ptr<DhcpProxyScriptFetcherFactory> dhcp_fetcher_factory) { - dhcp_fetcher_factory_ = std::move(dhcp_fetcher_factory); - } - - // Sets Mojo factory used to create ProxyResolvers. If not set, falls back to - // URLRequestContext's default behavior. The passed in factory must outlive - // the URLRequestContext the builder creates. - void set_mojo_proxy_resolver_factory( - MojoProxyResolverFactory* mojo_proxy_resolver_factory) { - mojo_proxy_resolver_factory_ = mojo_proxy_resolver_factory; - } - - private: - std::unique_ptr<ProxyService> CreateProxyService( - std::unique_ptr<ProxyConfigService> proxy_config_service, - URLRequestContext* url_request_context, - HostResolver* host_resolver, - NetworkDelegate* network_delegate, - NetLog* net_log) override; - - std::unique_ptr<DhcpProxyScriptFetcherFactory> dhcp_fetcher_factory_; - - MojoProxyResolverFactory* mojo_proxy_resolver_factory_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilderMojo); -}; - -} // namespace net - -#endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_
diff --git a/net/url_request/url_request_context_builder_mojo_unittest.cc b/net/url_request/url_request_context_builder_mojo_unittest.cc deleted file mode 100644 index 4f5e1a06..0000000 --- a/net/url_request/url_request_context_builder_mojo_unittest.cc +++ /dev/null
@@ -1,113 +0,0 @@ -// 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 "net/url_request/url_request_context_builder_mojo.h" - -#include "base/run_loop.h" -#include "base/strings/stringprintf.h" -#include "net/base/host_port_pair.h" -#include "net/proxy/proxy_config.h" -#include "net/proxy/proxy_config_service_fixed.h" -#include "net/proxy/test_mojo_proxy_resolver_factory.h" -#include "net/test/embedded_test_server/embedded_test_server.h" -#include "net/test/embedded_test_server/http_request.h" -#include "net/test/embedded_test_server/http_response.h" -#include "net/test/embedded_test_server/simple_connection_listener.h" -#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" -#include "net/url_request/url_request.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_test_util.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" -#include "url/gurl.h" - -namespace net { - -namespace { - -const char kPacPath[] = "/super.pac"; - -// When kPacPath is requested, returns a PAC script that uses the test server -// itself as the proxy. -std::unique_ptr<test_server::HttpResponse> HandlePacRequest( - const test_server::HttpRequest& request) { - if (request.relative_url != kPacPath) - return nullptr; - std::unique_ptr<test_server::BasicHttpResponse> response = - std::make_unique<test_server::BasicHttpResponse>(); - response->set_content(base::StringPrintf( - "function FindProxyForURL(url, host) { return 'PROXY %s;'; }", - HostPortPair::FromURL(request.base_url).ToString().c_str())); - response->set_content_type("text/html"); - return std::move(response); -} - -class URLRequestContextBuilderMojoTest : public PlatformTest { - protected: - URLRequestContextBuilderMojoTest() { - test_server_.RegisterRequestHandler(base::Bind(&HandlePacRequest)); - test_server_.AddDefaultHandlers( - base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); - } - - EmbeddedTestServer test_server_; - URLRequestContextBuilderMojo builder_; -}; - -TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) { - EXPECT_TRUE(test_server_.Start()); - TestMojoProxyResolverFactory::GetInstance()->set_resolver_created(false); - - builder_.set_proxy_config_service(std::make_unique<ProxyConfigServiceFixed>( - ProxyConfig::CreateFromCustomPacURL(test_server_.GetURL(kPacPath)))); - builder_.set_mojo_proxy_resolver_factory( - TestMojoProxyResolverFactory::GetInstance()); - - std::unique_ptr<URLRequestContext> context(builder_.Build()); - TestDelegate delegate; - std::unique_ptr<URLRequest> request(context->CreateRequest( - GURL("http://hats:12345/echoheader?Foo"), DEFAULT_PRIORITY, &delegate, - TRAFFIC_ANNOTATION_FOR_TESTS)); - request->SetExtraRequestHeaderByName("Foo", "Bar", false); - request->Start(); - base::RunLoop().Run(); - EXPECT_EQ("Bar", delegate.data_received()); - - // Make sure that the Mojo factory was used. - EXPECT_TRUE(TestMojoProxyResolverFactory::GetInstance()->resolver_created()); -} - -// Makes sure that pending PAC requests are correctly shut down during teardown. -TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) { - test_server::SimpleConnectionListener connection_listener( - 1, test_server::SimpleConnectionListener::FAIL_ON_ADDITIONAL_CONNECTIONS); - test_server_.SetConnectionListener(&connection_listener); - EXPECT_TRUE(test_server_.Start()); - - builder_.set_proxy_config_service(std::make_unique<ProxyConfigServiceFixed>( - ProxyConfig::CreateFromCustomPacURL(test_server_.GetURL("/hung")))); - builder_.set_mojo_proxy_resolver_factory( - TestMojoProxyResolverFactory::GetInstance()); - - std::unique_ptr<URLRequestContext> context(builder_.Build()); - TestDelegate delegate; - std::unique_ptr<URLRequest> request(context->CreateRequest( - GURL("http://hats:12345/echoheader?Foo"), DEFAULT_PRIORITY, &delegate, - TRAFFIC_ANNOTATION_FOR_TESTS)); - request->Start(); - connection_listener.WaitForConnections(); - - // Tearing down the URLRequestContext should not cause an AssertNoURLRequests - // failure. - request.reset(); - context.reset(); - - // Have to shut down the test server before |connection_listener| falls out of - // scope. - EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); -} - -} // namespace - -} // namespace net
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc index dea2800a..7389381 100644 --- a/remoting/host/chromoting_host_context.cc +++ b/remoting/host/chromoting_host_context.cc
@@ -131,8 +131,8 @@ network_task_runner, AutoThread::Create("ChromotingCaptureThread", ui_task_runner), AutoThread::Create("ChromotingEncodeThread", ui_task_runner), - make_scoped_refptr( - new URLRequestContextGetter(network_task_runner, file_task_runner)), + base::MakeRefCounted<URLRequestContextGetter>(network_task_runner, + file_task_runner), nullptr)); }
diff --git a/remoting/ios/app/pin_entry_view.mm b/remoting/ios/app/pin_entry_view.mm index 14c1af23..b687969d 100644 --- a/remoting/ios/app/pin_entry_view.mm +++ b/remoting/ios/app/pin_entry_view.mm
@@ -21,6 +21,7 @@ static const int kMinPinLength = 6; @interface PinEntryView ()<UITextFieldDelegate> { + UIView* _pairingView; UISwitch* _pairingSwitch; UILabel* _pairingLabel; MDCFloatingButton* _pinButton; @@ -38,6 +39,11 @@ if (self) { self.backgroundColor = [UIColor clearColor]; + // A view to enlarge the touch area to toggle the |_pairingSwitch|. + _pairingView = [[UIView alloc] initWithFrame:CGRectZero]; + _pairingView.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:_pairingView]; + NSString* rememberPinText = l10n_util::GetNSString(IDS_REMEMBER_PIN_ON_THIS_DEVICE); _pairingSwitch = [[UISwitch alloc] init]; @@ -45,23 +51,25 @@ _pairingSwitch.transform = CGAffineTransformMakeScale(0.5, 0.5); _pairingSwitch.accessibilityLabel = rememberPinText; _pairingSwitch.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:_pairingSwitch]; + [_pairingView addSubview:_pairingSwitch]; _pairingLabel = [[UILabel alloc] init]; _pairingLabel.textColor = RemotingTheme.pinEntryPairingColor; _pairingLabel.font = [UIFont systemFontOfSize:12.f]; _pairingLabel.text = rememberPinText; _pairingLabel.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:_pairingLabel]; + [_pairingView addSubview:_pairingLabel]; - // Allow toggling the switch by tapping the label. + // Allow toggling the switch by tapping the pairing view. Note that the + // gesture recognizer will handle the toggling logic and block tap gesture + // forwarding towards |_pairingSwitch|. UITapGestureRecognizer* tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(didTapPairingLabel)]; + action:@selector(didTapPairingView)]; tapGestureRecognizer.numberOfTapsRequired = 1; - [_pairingLabel addGestureRecognizer:tapGestureRecognizer]; - _pairingLabel.userInteractionEnabled = YES; + [_pairingView addGestureRecognizer:tapGestureRecognizer]; + _pairingView.userInteractionEnabled = YES; _pinButton = [MDCFloatingButton floatingButtonWithShape:MDCFloatingButtonShapeMini]; @@ -95,10 +103,7 @@ _pinEntry.delegate = self; [self addSubview:_pinEntry]; - [self - initializeLayoutConstraintsWithViews:NSDictionaryOfVariableBindings( - _pairingSwitch, _pairingLabel, - _pinButton, _pinEntry)]; + [self initializeLayoutConstraints]; _supportsPairing = YES; @@ -107,10 +112,11 @@ return self; } -- (void)initializeLayoutConstraintsWithViews:(NSDictionary*)views { +- (void)initializeLayoutConstraints { + NSDictionary* views = + NSDictionaryOfVariableBindings(_pairingView, _pinButton, _pinEntry); // Metrics to use in visual format strings. NSDictionary* layoutMetrics = @{ - @"margin" : @(kMargin), @"padding" : @(kPadding), @"lineSpace" : @(kLineSpace), }; @@ -123,20 +129,34 @@ metrics:layoutMetrics views:views]]; - [self addConstraints: - [NSLayoutConstraint - constraintsWithVisualFormat: - @"H:|-[_pairingSwitch]-(padding)-[_pairingLabel]-|" - options:NSLayoutFormatAlignAllCenterY - metrics:layoutMetrics - views:views]]; - [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat: - @"V:|-[_pinButton]-(lineSpace)-[_pairingSwitch]" + @"V:|-[_pinButton]-(lineSpace)-[_pairingView]" options:0 metrics:layoutMetrics views:views]]; + + [NSLayoutConstraint activateConstraints:@[ + [_pairingSwitch.centerYAnchor + constraintEqualToAnchor:_pairingView.centerYAnchor], + [_pairingLabel.centerYAnchor + constraintEqualToAnchor:_pairingView.centerYAnchor], + [_pairingLabel.leadingAnchor + constraintEqualToAnchor:_pairingSwitch.trailingAnchor + constant:kPadding], + + [_pairingView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor], + [_pairingView.heightAnchor + constraintEqualToAnchor:_pairingLabel.heightAnchor + constant:kMargin], + [_pairingView.leadingAnchor + constraintEqualToAnchor:_pairingSwitch.leadingAnchor + constant:-kMargin], + [_pairingView.trailingAnchor + constraintEqualToAnchor:_pairingLabel.trailingAnchor + constant:kMargin], + ]]; + [self setNeedsUpdateConstraints]; } @@ -199,7 +219,7 @@ [_pinEntry endEditing:YES]; } -- (void)didTapPairingLabel { +- (void)didTapPairingView { [_pairingSwitch setOn:!_pairingSwitch.isOn animated:YES]; }
diff --git a/sandbox/BUILD.gn b/sandbox/BUILD.gn index 82b42e86..af35b739 100644 --- a/sandbox/BUILD.gn +++ b/sandbox/BUILD.gn
@@ -22,6 +22,8 @@ } else if (is_mac) { public_deps = [ "//sandbox/mac:seatbelt", + "//sandbox/mac:seatbelt_extension", + "//sandbox/mac/mojom", ] } else if (is_linux || is_android) { public_deps = [
diff --git a/sandbox/mac/BUILD.gn b/sandbox/mac/BUILD.gn index e3f264c..d9787ca5 100644 --- a/sandbox/mac/BUILD.gn +++ b/sandbox/mac/BUILD.gn
@@ -34,11 +34,27 @@ defines = [ "SEATBELT_IMPLEMENTATION" ] } +component("seatbelt_extension") { + sources = [ + "seatbelt_extension.cc", + "seatbelt_extension.h", + "seatbelt_extension_token.cc", + "seatbelt_extension_token.h", + ] + libs = [ "sandbox" ] + public_deps = [ + "//base", + ] + defines = [ "SEATBELT_IMPLEMENTATION" ] +} + test("sandbox_mac_unittests") { sources = [ + "mojom/struct_traits_unittest.cc", "sandbox_mac_compiler_unittest.mm", "sandbox_mac_compiler_v2_unittest.mm", "sandbox_mac_seatbelt_exec_unittest.cc", + "seatbelt_extension_unittest.cc", ] libs = [ @@ -48,9 +64,11 @@ deps = [ ":seatbelt", + ":seatbelt_extension", ":seatbelt_proto", + "mojom:test_interfaces", "//base", - "//base/test:run_all_unittests", + "//mojo/edk/test:run_all_unittests", "//testing/gtest", ] }
diff --git a/sandbox/mac/mojom/BUILD.gn b/sandbox/mac/mojom/BUILD.gn new file mode 100644 index 0000000..30e0949 --- /dev/null +++ b/sandbox/mac/mojom/BUILD.gn
@@ -0,0 +1,20 @@ +# 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. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ + "seatbelt_extension_token.mojom", + ] +} + +mojom("test_interfaces") { + sources = [ + "traits_test_service.mojom", + ] + public_deps = [ + ":mojom", + ] +}
diff --git a/sandbox/mac/mojom/DEPS b/sandbox/mac/mojom/DEPS new file mode 100644 index 0000000..ef8ad28 --- /dev/null +++ b/sandbox/mac/mojom/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+mojo/public", +]
diff --git a/sandbox/mac/mojom/OWNERS b/sandbox/mac/mojom/OWNERS new file mode 100644 index 0000000..fc57672d --- /dev/null +++ b/sandbox/mac/mojom/OWNERS
@@ -0,0 +1,6 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS +per-file *_struct_traits*.*=set noparent +per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS \ No newline at end of file
diff --git a/sandbox/mac/mojom/seatbelt_extension_token.mojom b/sandbox/mac/mojom/seatbelt_extension_token.mojom new file mode 100644 index 0000000..dafdaeba --- /dev/null +++ b/sandbox/mac/mojom/seatbelt_extension_token.mojom
@@ -0,0 +1,12 @@ +// 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. + +module sandbox.mac.mojom; + +// A SeatbeltExtensionToken allows for dynamically expanding the macOS sandbox +// restrictions. See //sandbox/mac/seatbelt_extension.h. This struct is +// typemapped. +struct SeatbeltExtensionToken { + string token; +};
diff --git a/sandbox/mac/mojom/seatbelt_extension_token.typemap b/sandbox/mac/mojom/seatbelt_extension_token.typemap new file mode 100644 index 0000000..430faeb7 --- /dev/null +++ b/sandbox/mac/mojom/seatbelt_extension_token.typemap
@@ -0,0 +1,15 @@ +# 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. + +mojom = "//sandbox/mac/mojom/seatbelt_extension_token.mojom" +public_headers = [ "//sandbox/mac/seatbelt_extension_token.h" ] +traits_headers = + [ "//sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h" ] +sources = [ + "//sandbox/mac/mojom/seatbelt_extension_token_struct_traits.cc", +] +deps = [ + "//sandbox/mac:seatbelt_extension", +] +type_mappings = [ "sandbox.mac.mojom.SeatbeltExtensionToken=sandbox::SeatbeltExtensionToken[move_only]" ]
diff --git a/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.cc b/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.cc new file mode 100644 index 0000000..ae2a1174 --- /dev/null +++ b/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.cc
@@ -0,0 +1,22 @@ +// 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 "sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h" + +namespace mojo { + +// static +bool StructTraits<sandbox::mac::mojom::SeatbeltExtensionTokenDataView, + sandbox::SeatbeltExtensionToken>:: + Read(sandbox::mac::mojom::SeatbeltExtensionTokenDataView data, + sandbox::SeatbeltExtensionToken* out) { + std::string token; + if (!data.ReadToken(&token)) + return false; + + out->set_token(token); + return true; +} + +} // namespace mojo
diff --git a/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h b/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h new file mode 100644 index 0000000..71480264 --- /dev/null +++ b/sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h
@@ -0,0 +1,27 @@ +// 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 SANDBOX_MAC_MOJOM_SEATBELT_EXTENSION_TOKEN_STRUCT_TRAITS_H_ +#define SANDBOX_MAC_MOJOM_SEATBELT_EXTENSION_TOKEN_STRUCT_TRAITS_H_ + +#include <string> + +#include "sandbox/mac/mojom/seatbelt_extension_token.mojom-shared.h" +#include "sandbox/mac/seatbelt_extension_token.h" + +namespace mojo { + +template <> +struct StructTraits<sandbox::mac::mojom::SeatbeltExtensionTokenDataView, + sandbox::SeatbeltExtensionToken> { + static const std::string& token(const sandbox::SeatbeltExtensionToken& t) { + return t.token(); + } + static bool Read(sandbox::mac::mojom::SeatbeltExtensionTokenDataView data, + sandbox::SeatbeltExtensionToken* out); +}; + +} // namespace mojo + +#endif // SANDBOX_MAC_MOJOM_SEATBELT_EXTENSION_TOKEN_STRUCT_TRAITS_H_
diff --git a/sandbox/mac/mojom/struct_traits_unittest.cc b/sandbox/mac/mojom/struct_traits_unittest.cc new file mode 100644 index 0000000..ace9c32b --- /dev/null +++ b/sandbox/mac/mojom/struct_traits_unittest.cc
@@ -0,0 +1,48 @@ +// 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 "base/test/scoped_task_environment.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "sandbox/mac/mojom/seatbelt_extension_token_struct_traits.h" +#include "sandbox/mac/mojom/traits_test_service.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace sandbox { +namespace { + +class StructTraitsTest : public testing::Test, + public sandbox::mac::mojom::TraitsTestService { + public: + StructTraitsTest() + : interface_ptr_(), binding_(this, mojo::MakeRequest(&interface_ptr_)) {} + + sandbox::mac::mojom::TraitsTestService* interface() { + return interface_ptr_.get(); + } + + private: + // TraitsTestService: + void EchoSeatbeltExtensionToken( + sandbox::SeatbeltExtensionToken token, + EchoSeatbeltExtensionTokenCallback callback) override { + std::move(callback).Run(std::move(token)); + } + + base::test::ScopedTaskEnvironment task_environment_; + + sandbox::mac::mojom::TraitsTestServicePtr interface_ptr_; + mojo::Binding<sandbox::mac::mojom::TraitsTestService> binding_; +}; + +TEST_F(StructTraitsTest, SeatbeltExtensionToken) { + auto input = sandbox::SeatbeltExtensionToken::CreateForTesting("hello world"); + sandbox::SeatbeltExtensionToken output; + + interface()->EchoSeatbeltExtensionToken(std::move(input), &output); + EXPECT_EQ("hello world", output.token()); + EXPECT_TRUE(input.token().empty()); +} + +} // namespace +} // namespace sandbox
diff --git a/sandbox/mac/mojom/traits_test_service.mojom b/sandbox/mac/mojom/traits_test_service.mojom new file mode 100644 index 0000000..8bf15c7 --- /dev/null +++ b/sandbox/mac/mojom/traits_test_service.mojom
@@ -0,0 +1,14 @@ +// 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. + +module sandbox.mac.mojom; + +import "sandbox/mac/mojom/seatbelt_extension_token.mojom"; + +// Interface for unittesting StructTraits. +interface TraitsTestService { + [Sync] + EchoSeatbeltExtensionToken(SeatbeltExtensionToken in) + => (SeatbeltExtensionToken out); +};
diff --git a/sandbox/mac/mojom/typemaps.gni b/sandbox/mac/mojom/typemaps.gni new file mode 100644 index 0000000..2c1fb3c --- /dev/null +++ b/sandbox/mac/mojom/typemaps.gni
@@ -0,0 +1,5 @@ +# 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. + +typemaps = [ "//sandbox/mac/mojom/seatbelt_extension_token.typemap" ]
diff --git a/sandbox/mac/seatbelt_extension.cc b/sandbox/mac/seatbelt_extension.cc new file mode 100644 index 0000000..492f44a --- /dev/null +++ b/sandbox/mac/seatbelt_extension.cc
@@ -0,0 +1,88 @@ +// 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 "sandbox/mac/seatbelt_extension.h" + +#include "base/logging.h" +#include "base/memory/ptr_util.h" +#include "sandbox/mac/seatbelt_extension_token.h" + +// libsandbox private API. +extern "C" { +extern const char* APP_SANDBOX_READ; + +int64_t sandbox_extension_consume(const char* token); +int sandbox_extension_release(int64_t handle); +char* sandbox_extension_issue_file(const char* type, + const char* path, + uint32_t flags); +} + +namespace sandbox { + +SeatbeltExtension::~SeatbeltExtension() { + DCHECK(token_.empty() && handle_ == 0) + << "A SeatbeltExtension must be consumed or revoked."; +} + +// static +std::unique_ptr<SeatbeltExtensionToken> SeatbeltExtension::Issue( + SeatbeltExtension::Type type, + const std::string& resource) { + char* token = IssueToken(type, resource); + if (!token) + return nullptr; + return base::WrapUnique(new SeatbeltExtensionToken(token)); +} + +// static +std::unique_ptr<SeatbeltExtension> SeatbeltExtension::FromToken( + SeatbeltExtensionToken token) { + if (token.token_.empty()) + return nullptr; + return base::WrapUnique(new SeatbeltExtension(token.token_)); +} + +bool SeatbeltExtension::Consume() { + DCHECK(!token_.empty()); + handle_ = sandbox_extension_consume(token_.c_str()); + return handle_ > 0; +} + +bool SeatbeltExtension::ConsumePermanently() { + bool rv = Consume(); + handle_ = 0; + token_.clear(); + return rv; +} + +bool SeatbeltExtension::Revoke() { + int rv = sandbox_extension_release(handle_); + handle_ = 0; + token_.clear(); + return rv == 0; +} + +SeatbeltExtension::SeatbeltExtension(const std::string& token) + : token_(token), handle_(0) {} + +// static +// The token returned by libsandbox is an opaque string generated by the kernel. +// The string contains all the information about the extension (class and +// resource), which is then SHA1 hashed with a salt only known to the kernel. +// In this way, the kernel does not track issued tokens, it merely validates +// them on consumption. +char* SeatbeltExtension::IssueToken(SeatbeltExtension::Type type, + const std::string& resource) { + switch (type) { + case FILE_READ: + return sandbox_extension_issue_file(APP_SANDBOX_READ, resource.c_str(), + 0); + default: + NOTREACHED(); + return nullptr; + } +} + +} // namespace sandbox
diff --git a/sandbox/mac/seatbelt_extension.h b/sandbox/mac/seatbelt_extension.h new file mode 100644 index 0000000..f0b8eda --- /dev/null +++ b/sandbox/mac/seatbelt_extension.h
@@ -0,0 +1,86 @@ +// 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 SANDBOX_MAC_SEATBELT_EXTENSION_H_ +#define SANDBOX_MAC_SEATBELT_EXTENSION_H_ + +#include "base/macros.h" +#include "sandbox/mac/seatbelt_export.h" + +#include <stddef.h> + +#include <memory> +#include <string> + +namespace sandbox { + +class SeatbeltExtensionToken; + +// A SeatbeltExtension allows one process with access to resources to provide +// fine-grained extensions/allowances to another process' sandbox policy at +// run time. An extension can be issued by the privileged process, generating +// a token that can be sent over IPC. The receiving process can then consume +// this token to be given access to the extension resource. +class SEATBELT_EXPORT SeatbeltExtension { + public: + enum Type { + FILE_READ, + // TODO(rsesek): Potentially support FILE_READ_WRITE, MACH and GENERIC + // extension types. + }; + + // Before an extension is destroyed, it must be consumed or explicitly + // revoked. + ~SeatbeltExtension(); + + // Issues a sandbox extension of the specified |type|, to grant access to + // the |resource| of that class. This returns the resulting token that can + // be used to construct an extension object for consumption, or null if + // issuing the token failed. + static std::unique_ptr<SeatbeltExtensionToken> Issue( + Type type, + const std::string& resource); + + // Constructs a sandbox extension from a token object. The token can then + // be consumed or revoked. + static std::unique_ptr<SeatbeltExtension> FromToken( + SeatbeltExtensionToken token); + + // Consumes the sandbox extension, giving the calling process access to the + // resource for which the extension was issued. Returns true if the + // extension was consumed and the resource access is now permitted, and + // false on error with the resource still denied. The extension can be + // revoked by the calling process. + bool Consume(); + + // Like Consume(), but makes it so that the extension cannot be revoked. + bool ConsumePermanently(); + + // Revokes access to the extension and the resource for which it was issued. + // Returns true if the extension was revoked and false if not. + // + // A consuming process can revoke an extension at any time. Once an + // extension is revoked, it can be re-acquired by creating a new extension + // object from the token object. + bool Revoke(); + + private: + explicit SeatbeltExtension(const std::string& token); + + // Creates the token for the sandbox extension type and resource. + static char* IssueToken(Type type, const std::string& resource); + + // The extension token, empty if the extension has been consumed permanetly + // or revoked. + std::string token_; + + // An opaque reference to a consumed extension, 0 if revoked or not consumed. + int64_t handle_; + + DISALLOW_COPY_AND_ASSIGN(SeatbeltExtension); +}; + +} // namespace sandbox + +#endif // SANDBOX_MAC_SEATBELT_EXTENSION_H_
diff --git a/sandbox/mac/seatbelt_extension_token.cc b/sandbox/mac/seatbelt_extension_token.cc new file mode 100644 index 0000000..ad6acbbe --- /dev/null +++ b/sandbox/mac/seatbelt_extension_token.cc
@@ -0,0 +1,28 @@ +// 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 "sandbox/mac/seatbelt_extension_token.h" + +namespace sandbox { + +SeatbeltExtensionToken::SeatbeltExtensionToken() {} + +SeatbeltExtensionToken::SeatbeltExtensionToken(SeatbeltExtensionToken&& other) = + default; + +SeatbeltExtensionToken::~SeatbeltExtensionToken() {} + +SeatbeltExtensionToken& SeatbeltExtensionToken::operator=( + SeatbeltExtensionToken&&) = default; + +// static +SeatbeltExtensionToken SeatbeltExtensionToken::CreateForTesting( + const std::string& fake_token) { + return SeatbeltExtensionToken(fake_token); +} + +SeatbeltExtensionToken::SeatbeltExtensionToken(const std::string& token) + : token_(token) {} + +} // namespace sandbox
diff --git a/sandbox/mac/seatbelt_extension_token.h b/sandbox/mac/seatbelt_extension_token.h new file mode 100644 index 0000000..733b0049 --- /dev/null +++ b/sandbox/mac/seatbelt_extension_token.h
@@ -0,0 +1,64 @@ +// 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 SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_ +#define SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_ + +#include "base/macros.h" +#include "sandbox/mac/seatbelt_export.h" + +#include <memory> +#include <string> + +namespace mojo { +template <typename, typename> +struct StructTraits; +} + +namespace sandbox { + +namespace mac { +namespace mojom { +class SeatbeltExtensionTokenDataView; +} +} // namespace mac + +class SeatbeltExtension; + +// A SeatbeltExtensionToken is used to pass a sandbox extension between +// processes using IPC. A token object can be constructed by issuing an +// extension in one process, sent across IPC, and then used to create a new +// extension object on the other side. +class SEATBELT_EXPORT SeatbeltExtensionToken { + public: + SeatbeltExtensionToken(); + ~SeatbeltExtensionToken(); + + // Token objects are move-only types. + SeatbeltExtensionToken(SeatbeltExtensionToken&& other); + SeatbeltExtensionToken& operator=(SeatbeltExtensionToken&&); + + const std::string& token() const { return token_; } + + // Creates a fake token for testing. + static SeatbeltExtensionToken CreateForTesting(const std::string& fake_token); + + protected: + friend class SeatbeltExtension; + friend struct mojo::StructTraits<mac::mojom::SeatbeltExtensionTokenDataView, + SeatbeltExtensionToken>; + + explicit SeatbeltExtensionToken(const std::string& token); + + void set_token(const std::string& token) { token_ = token; } + + private: + std::string token_; + + DISALLOW_COPY_AND_ASSIGN(SeatbeltExtensionToken); +}; + +} // namespace sandbox + +#endif // SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_
diff --git a/sandbox/mac/seatbelt_extension_unittest.cc b/sandbox/mac/seatbelt_extension_unittest.cc new file mode 100644 index 0000000..c9e52306 --- /dev/null +++ b/sandbox/mac/seatbelt_extension_unittest.cc
@@ -0,0 +1,139 @@ +// 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 "sandbox/mac/seatbelt_extension.h" + +#include <unistd.h> + +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_file.h" +#include "base/files/scoped_temp_dir.h" +#include "base/test/multiprocess_test.h" +#include "base/test/test_timeouts.h" +#include "sandbox/mac/sandbox_compiler.h" +#include "sandbox/mac/seatbelt_extension_token.h" +#include "testing/multiprocess_func_list.h" + +namespace sandbox { +namespace { + +const char kSandboxProfile[] = + "(version 1)\n" + "(deny default (with no-log))\n" + "(allow file-read* (extension \"com.apple.app-sandbox.read\"))"; + +const char kTestData[] = "hello world"; +constexpr int kTestDataLen = arraysize(kTestData); + +const char kSwitchFile[] = "test-file"; +const char kSwitchExtension[] = "test-extension"; + +class SeatbeltExtensionTest : public base::MultiProcessTest { + public: + void SetUp() override { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + file_path_ = temp_dir_.GetPath().AppendASCII("sbox.test"); + + ASSERT_EQ(kTestDataLen, + base::WriteFile(file_path_, kTestData, kTestDataLen)); + } + + base::FilePath file_path() { return file_path_; } + + private: + base::ScopedTempDir temp_dir_; + base::FilePath file_path_; +}; + +TEST_F(SeatbeltExtensionTest, FileReadAccess) { + base::CommandLine command_line( + base::GetMultiProcessTestChildBaseCommandLine()); + + auto token = sandbox::SeatbeltExtension::Issue( + sandbox::SeatbeltExtension::FILE_READ, file_path().value()); + ASSERT_TRUE(token.get()); + + // Ensure any symlinks in the path are canonicalized. + base::FilePath path = base::MakeAbsoluteFilePath(file_path()); + ASSERT_FALSE(path.empty()); + + command_line.AppendSwitchPath(kSwitchFile, path); + command_line.AppendSwitchASCII(kSwitchExtension, token->token()); + + base::Process test_child = base::SpawnMultiProcessTestChild( + "FileReadAccess", command_line, base::LaunchOptions()); + + int exit_code = 42; + test_child.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(), + &exit_code); + EXPECT_EQ(0, exit_code); +} + +MULTIPROCESS_TEST_MAIN(FileReadAccess) { + sandbox::SandboxCompiler compiler(kSandboxProfile); + std::string error; + CHECK(compiler.CompileAndApplyProfile(&error)) << error; + + auto* command_line = base::CommandLine::ForCurrentProcess(); + + base::FilePath file_path = command_line->GetSwitchValuePath(kSwitchFile); + CHECK(!file_path.empty()); + const char* path = file_path.value().c_str(); + + std::string token_str = command_line->GetSwitchValueASCII(kSwitchExtension); + CHECK(!token_str.empty()); + + auto token = sandbox::SeatbeltExtensionToken::CreateForTesting(token_str); + auto extension = sandbox::SeatbeltExtension::FromToken(std::move(token)); + CHECK(extension); + CHECK(token.token().empty()); + + // Without consuming the extension, file access is denied. + errno = 0; + base::ScopedFD fd(open(path, O_RDONLY)); + CHECK_EQ(-1, fd.get()); + CHECK_EQ(EPERM, errno); + + CHECK(extension->Consume()); + + // After consuming the extension, file access is still denied for writing. + errno = 0; + fd.reset(open(path, O_RDWR)); + CHECK_EQ(-1, fd.get()); + CHECK_EQ(EPERM, errno); + + // ... but it is allowed to read. + errno = 0; + fd.reset(open(path, O_RDONLY)); + PCHECK(fd.get() > 0); + + // Close the file and revoke the extension. + fd.reset(); + extension->Revoke(); + + // File access is denied again. + errno = 0; + fd.reset(open(path, O_RDONLY)); + CHECK_EQ(-1, fd.get()); + CHECK_EQ(EPERM, errno); + + // Re-acquire the access by using the token, but this time consume it + // permanetly. + token = sandbox::SeatbeltExtensionToken::CreateForTesting(token_str); + extension = sandbox::SeatbeltExtension::FromToken(std::move(token)); + CHECK(extension); + CHECK(extension->ConsumePermanently()); + + // Check that reading still works. + errno = 0; + fd.reset(open(path, O_RDONLY)); + PCHECK(fd.get() > 0); + + return 0; +}; + +} // namespace +} // namespace sandbox
diff --git a/sandbox/win/src/nt_internals.h b/sandbox/win/src/nt_internals.h index b50ab51..3c6bc27 100644 --- a/sandbox/win/src/nt_internals.h +++ b/sandbox/win/src/nt_internals.h
@@ -409,6 +409,33 @@ // ----------------------------------------------------------------------- // Registry +typedef enum _KEY_INFORMATION_CLASS { + KeyBasicInformation = 0, + KeyFullInformation = 2 +} KEY_INFORMATION_CLASS, + *PKEY_INFORMATION_CLASS; + +typedef struct _KEY_BASIC_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG NameLength; + WCHAR Name[1]; +} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION; + +typedef struct _KEY_FULL_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG SubKeys; + ULONG MaxNameLen; + ULONG MaxClassLen; + ULONG Values; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + WCHAR Class[1]; +} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION; + typedef enum _KEY_VALUE_INFORMATION_CLASS { KeyValueFullInformation = 1 } KEY_VALUE_INFORMATION_CLASS, @@ -449,6 +476,21 @@ typedef NTSTATUS(WINAPI* RtlFormatCurrentUserKeyPathFunction)( OUT PUNICODE_STRING RegistryPath); +typedef NTSTATUS(WINAPI* NtQueryKeyFunction)(IN HANDLE KeyHandle, + IN KEY_INFORMATION_CLASS + KeyInformationClass, + OUT PVOID KeyInformation, + IN ULONG Length, + OUT PULONG ResultLength); + +typedef NTSTATUS(WINAPI* NtEnumerateKeyFunction)(IN HANDLE KeyHandle, + IN ULONG Index, + IN KEY_INFORMATION_CLASS + KeyInformationClass, + OUT PVOID KeyInformation, + IN ULONG Length, + OUT PULONG ResultLength); + typedef NTSTATUS(WINAPI* NtQueryValueKeyFunction)(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS
diff --git a/services/BUILD.gn b/services/BUILD.gn index 5832943..471cda3 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn
@@ -31,6 +31,7 @@ "//services/data_decoder:tests", "//services/device:tests", "//services/preferences:tests", + "//services/proxy_resolver:tests", "//services/resource_coordinator:tests", "//services/shape_detection:tests", "//services/viz/privileged/interfaces:unit_tests",
diff --git a/services/device/BUILD.gn b/services/device/BUILD.gn index a1347ad..4687f2f8 100644 --- a/services/device/BUILD.gn +++ b/services/device/BUILD.gn
@@ -27,7 +27,6 @@ deps = [ "//base", - "//device/hid", "//device/sensors", "//device/sensors/public/interfaces", "//services/device/fingerprint", @@ -46,6 +45,7 @@ deps += [ ":device_service_jni_headers" ] } else { deps += [ + "//device/hid", "//services/device/battery", "//services/device/vibration", ]
diff --git a/services/device/device_service.cc b/services/device/device_service.cc index 3de8e1c..1c5c189 100644 --- a/services/device/device_service.cc +++ b/services/device/device_service.cc
@@ -12,7 +12,6 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" -#include "device/hid/hid_manager_impl.h" #include "device/sensors/device_sensor_host.h" #include "mojo/public/cpp/system/message_pipe.h" #include "services/device/fingerprint/fingerprint.h" @@ -30,6 +29,7 @@ #include "jni/InterfaceRegistrar_jni.h" #include "services/device/screen_orientation/screen_orientation_listener_android.h" #else +#include "device/hid/hid_manager_impl.h" // nogncheck #include "services/device/battery/battery_monitor_impl.h" #include "services/device/battery/battery_status_service.h" #include "services/device/vibration/vibration_manager_impl.h" @@ -85,8 +85,6 @@ void DeviceService::OnStart() { registry_.AddInterface<mojom::Fingerprint>(base::Bind( &DeviceService::BindFingerprintRequest, base::Unretained(this))); - registry_.AddInterface<mojom::HidManager>(base::Bind( - &DeviceService::BindHidManagerRequest, base::Unretained(this))); registry_.AddInterface<mojom::OrientationSensor>(base::Bind( &DeviceService::BindOrientationSensorRequest, base::Unretained(this))); registry_.AddInterface<mojom::OrientationAbsoluteSensor>( @@ -120,6 +118,8 @@ #else registry_.AddInterface<mojom::BatteryMonitor>(base::Bind( &DeviceService::BindBatteryMonitorRequest, base::Unretained(this))); + registry_.AddInterface<mojom::HidManager>(base::Bind( + &DeviceService::BindHidManagerRequest, base::Unretained(this))); registry_.AddInterface<mojom::NFCProvider>(base::Bind( &DeviceService::BindNFCProviderRequest, base::Unretained(this))); registry_.AddInterface<mojom::VibrationManager>(base::Bind( @@ -140,6 +140,12 @@ BatteryMonitorImpl::Create(std::move(request)); } +void DeviceService::BindHidManagerRequest(mojom::HidManagerRequest request) { + if (!hid_manager_) + hid_manager_ = base::MakeUnique<HidManagerImpl>(); + hid_manager_->AddBinding(std::move(request)); +} + void DeviceService::BindNFCProviderRequest(mojom::NFCProviderRequest request) { LOG(ERROR) << "NFC is only supported on Android"; NOTREACHED(); @@ -151,12 +157,6 @@ } #endif -void DeviceService::BindHidManagerRequest(mojom::HidManagerRequest request) { - if (!hid_manager_) - hid_manager_ = base::MakeUnique<HidManagerImpl>(); - hid_manager_->AddBinding(std::move(request)); -} - void DeviceService::BindFingerprintRequest(mojom::FingerprintRequest request) { Fingerprint::Create(std::move(request)); }
diff --git a/services/device/device_service.h b/services/device/device_service.h index a4b8088..dea54487 100644 --- a/services/device/device_service.h +++ b/services/device/device_service.h
@@ -6,7 +6,6 @@ #define SERVICES_DEVICE_DEVICE_SERVICE_H_ #include "base/memory/ref_counted.h" -#include "device/hid/public/interfaces/hid.mojom.h" #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h" #include "device/sensors/public/interfaces/orientation.mojom.h" #include "mojo/public/cpp/bindings/binding_set.h" @@ -26,6 +25,8 @@ #if defined(OS_ANDROID) #include "base/android/scoped_java_ref.h" +#else +#include "device/hid/public/interfaces/hid.mojom.h" #endif namespace base { @@ -75,8 +76,6 @@ void BindFingerprintRequest(mojom::FingerprintRequest request); - void BindHidManagerRequest(mojom::HidManagerRequest request); - void BindOrientationSensorRequest(mojom::OrientationSensorRequest request); void BindOrientationAbsoluteSensorRequest( @@ -84,6 +83,7 @@ #if !defined(OS_ANDROID) void BindBatteryMonitorRequest(mojom::BatteryMonitorRequest request); + void BindHidManagerRequest(mojom::HidManagerRequest request); void BindNFCProviderRequest(mojom::NFCProviderRequest request); void BindVibrationManagerRequest(mojom::VibrationManagerRequest request); #endif @@ -104,7 +104,6 @@ void BindSerialIoHandlerRequest(mojom::SerialIoHandlerRequest request); - std::unique_ptr<HidManagerImpl> hid_manager_; std::unique_ptr<PowerMonitorMessageBroadcaster> power_monitor_message_broadcaster_; std::unique_ptr<TimeZoneMonitor> time_zone_monitor_; @@ -124,6 +123,8 @@ bool java_interface_provider_initialized_; base::android::ScopedJavaGlobalRef<jobject> java_nfc_delegate_; +#else + std::unique_ptr<HidManagerImpl> hid_manager_; #endif service_manager::BinderRegistry registry_;
diff --git a/services/preferences/pref_store_impl_unittest.cc b/services/preferences/pref_store_impl_unittest.cc index 80bdb70..a85de6d 100644 --- a/services/preferences/pref_store_impl_unittest.cc +++ b/services/preferences/pref_store_impl_unittest.cc
@@ -115,8 +115,8 @@ if (observed_prefs.empty()) observed_prefs.insert(observed_prefs.end(), {kKey, kOtherKey}); - pref_store_ = make_scoped_refptr( - new PrefStoreClient(impl_->AddObserver(observed_prefs))); + pref_store_ = base::MakeRefCounted<PrefStoreClient>( + impl_->AddObserver(observed_prefs)); } PrefStore* pref_store() { return pref_store_.get(); }
diff --git a/services/preferences/public/cpp/pref_service_factory.cc b/services/preferences/public/cpp/pref_service_factory.cc index 108d0686..f0a18fd6 100644 --- a/services/preferences/public/cpp/pref_service_factory.cc +++ b/services/preferences/public/cpp/pref_service_factory.cc
@@ -146,8 +146,8 @@ void ConnectToPrefService(mojom::PrefStoreConnectorPtr connector, scoped_refptr<PrefRegistry> pref_registry, ConnectCallback callback) { - auto connector_ptr = make_scoped_refptr( - new RefCountedInterfacePtr<mojom::PrefStoreConnector>()); + auto connector_ptr = + base::MakeRefCounted<RefCountedInterfacePtr<mojom::PrefStoreConnector>>(); connector_ptr->get() = std::move(connector); connector_ptr->get().set_connection_error_handler(base::Bind( &OnConnectError, connector_ptr, base::Passed(ConnectCallback{callback})));
diff --git a/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc b/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc index f832a83..76964b4 100644 --- a/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc +++ b/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc
@@ -38,13 +38,14 @@ void SetUp() override { mojom::PersistentPrefStorePtr store_proxy; binding_.Bind(mojo::MakeRequest(&store_proxy)); - auto persistent_pref_store_client = make_scoped_refptr( - new PersistentPrefStoreClient(mojom::PersistentPrefStoreConnection::New( - mojom::PrefStoreConnection::New( - mojom::PrefStoreObserverRequest(), - base::MakeUnique<base::DictionaryValue>(), true), - std::move(store_proxy), ::PersistentPrefStore::PREF_READ_ERROR_NONE, - false))); + auto persistent_pref_store_client = + base::MakeRefCounted<PersistentPrefStoreClient>( + mojom::PersistentPrefStoreConnection::New( + mojom::PrefStoreConnection::New( + mojom::PrefStoreObserverRequest(), + base::MakeUnique<base::DictionaryValue>(), true), + std::move(store_proxy), + ::PersistentPrefStore::PREF_READ_ERROR_NONE, false)); auto pref_registry = base::MakeRefCounted<PrefRegistrySimple>(); pref_registry->RegisterDictionaryPref(kDictionaryKey); pref_registry->RegisterDictionaryPref(kUninitializedDictionaryKey);
diff --git a/services/proxy_resolver/BUILD.gn b/services/proxy_resolver/BUILD.gn new file mode 100644 index 0000000..521bd008 --- /dev/null +++ b/services/proxy_resolver/BUILD.gn
@@ -0,0 +1,71 @@ +# 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. + +import("//services/service_manager/public/cpp/service.gni") +import("//services/service_manager/public/service_manifest.gni") + +source_set("lib_browser") { + sources = [ + "proxy_resolver_factory_mojo.cc", + "proxy_resolver_factory_mojo.h", + ] + + deps = [ + "//base", + "//mojo/public/cpp/bindings", + "//net", + "//net:net_browser_services", + ] + + public_deps = [ + "//services/proxy_resolver/public/interfaces", + "//services/service_manager/public/cpp", + ] +} + +source_set("lib_utility") { + sources = [ + "mojo_proxy_resolver_impl.cc", + "mojo_proxy_resolver_impl.h", + ] + + deps = [ + "//base", + "//mojo/public/cpp/bindings", + "//net", + "//net:net_utility_services", + "//net:net_with_v8", + ] + + public_deps = [ + "//services/proxy_resolver/public/interfaces", + "//services/service_manager/public/cpp", + ] +} + +source_set("tests") { + testonly = true + + sources = [ + "mojo_proxy_resolver_factory_impl_unittest.cc", + "mojo_proxy_resolver_impl_unittest.cc", + "proxy_resolver_factory_mojo_unittest.cc", + "proxy_service_mojo_unittest.cc", + ] + + deps = [ + ":lib_browser", + ":lib_utility", + "//base", + "//base/test:test_support", + "//net:net_browser_services", + "//net:test_support", + "//services/proxy_resolver/public/cpp:cpp_browser", + "//services/proxy_resolver/public/cpp:cpp_utility", + "//testing/gmock", + "//testing/gtest", + ] + + configs += [ "//v8:external_startup_data" ] +}
diff --git a/services/proxy_resolver/DEPS b/services/proxy_resolver/DEPS new file mode 100644 index 0000000..a6458e30 --- /dev/null +++ b/services/proxy_resolver/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+net", +]
diff --git a/services/proxy_resolver/OWNERS b/services/proxy_resolver/OWNERS new file mode 100644 index 0000000..716b2b1 --- /dev/null +++ b/services/proxy_resolver/OWNERS
@@ -0,0 +1 @@ +file://content/network/OWNERS
diff --git a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc b/services/proxy_resolver/mojo_proxy_resolver_factory_impl_unittest.cc similarity index 73% rename from net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc rename to services/proxy_resolver/mojo_proxy_resolver_factory_impl_unittest.cc index 3acf427d..1cfba9b9 100644 --- a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc +++ b/services/proxy_resolver/mojo_proxy_resolver_factory_impl_unittest.cc
@@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h" #include <utility> #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "net/base/test_completion_callback.h" @@ -21,12 +22,12 @@ using net::test::IsError; using net::test::IsOk; -namespace net { +namespace proxy_resolver { namespace { const char kScriptData[] = "FooBarBaz"; -class FakeProxyResolver : public ProxyResolverV8Tracing { +class FakeProxyResolver : public net::ProxyResolverV8Tracing { public: explicit FakeProxyResolver(const base::Closure& on_destruction) : on_destruction_(on_destruction) {} @@ -34,11 +35,11 @@ ~FakeProxyResolver() override { on_destruction_.Run(); } private: - // ProxyResolverV8Tracing overrides. + // net::ProxyResolverV8Tracing overrides. void GetProxyForURL(const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolver::Request>* request, + net::ProxyInfo* results, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolver::Request>* request, std::unique_ptr<Bindings> bindings) override {} const base::Closure on_destruction_; @@ -51,22 +52,22 @@ RESOLVER_DESTROYED, }; -class TestProxyResolverFactory : public ProxyResolverV8TracingFactory { +class TestProxyResolverFactory : public net::ProxyResolverV8TracingFactory { public: struct PendingRequest { - std::unique_ptr<ProxyResolverV8Tracing>* resolver; - CompletionCallback callback; + std::unique_ptr<net::ProxyResolverV8Tracing>* resolver; + net::CompletionCallback callback; }; - explicit TestProxyResolverFactory(EventWaiter<Event>* waiter) + explicit TestProxyResolverFactory(net::EventWaiter<Event>* waiter) : waiter_(waiter) {} void CreateProxyResolverV8Tracing( - const scoped_refptr<ProxyResolverScriptData>& pac_script, - std::unique_ptr<ProxyResolverV8Tracing::Bindings> bindings, - std::unique_ptr<ProxyResolverV8Tracing>* resolver, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolverFactory::Request>* request) override { + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + std::unique_ptr<net::ProxyResolverV8Tracing::Bindings> bindings, + std::unique_ptr<net::ProxyResolverV8Tracing>* resolver, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolverFactory::Request>* request) override { requests_handled_++; waiter_->NotifyEvent(RESOLVER_CREATED); EXPECT_EQ(base::ASCIIToUTF16(kScriptData), pac_script->utf16()); @@ -86,7 +87,7 @@ const PendingRequest* pending_request() { return pending_request_.get(); } private: - EventWaiter<Event>* waiter_; + net::EventWaiter<Event>* waiter_; size_t requests_handled_ = 0; std::unique_ptr<PendingRequest> pending_request_; }; @@ -95,7 +96,7 @@ class MojoProxyResolverFactoryImplTest : public testing::Test, - public interfaces::ProxyResolverFactoryRequestClient { + public mojom::ProxyResolverFactoryRequestClient { public: void SetUp() override { mock_factory_ = new TestProxyResolverFactory(&waiter_); @@ -117,23 +118,25 @@ void OnError(int32_t line_number, const std::string& message) override {} - void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info, - interfaces::HostResolverRequestClientPtr client) override {} + void ResolveDns( + std::unique_ptr<net::HostResolver::RequestInfo> request_info, + net::interfaces::HostResolverRequestClientPtr client) override {} protected: + base::test::ScopedTaskEnvironment task_environment_; std::unique_ptr<TestProxyResolverFactory> mock_factory_owner_; TestProxyResolverFactory* mock_factory_; - interfaces::ProxyResolverFactoryPtr factory_; + mojom::ProxyResolverFactoryPtr factory_; int instances_destroyed_ = 0; - CompletionCallback create_callback_; + net::CompletionCallback create_callback_; - EventWaiter<Event> waiter_; + net::EventWaiter<Event> waiter_; }; TEST_F(MojoProxyResolverFactoryImplTest, DisconnectProxyResolverClient) { - interfaces::ProxyResolverPtr proxy_resolver; - interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; + mojom::ProxyResolverPtr proxy_resolver; + mojom::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::MakeRequest(&client_ptr)); factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), @@ -144,14 +147,14 @@ waiter_.WaitForEvent(RESOLVER_CREATED); EXPECT_EQ(0, instances_destroyed_); ASSERT_EQ(1u, mock_factory_->requests_handled()); - TestCompletionCallback create_callback; + net::TestCompletionCallback create_callback; create_callback_ = create_callback.callback(); ASSERT_TRUE(mock_factory_->pending_request()); mock_factory_->pending_request()->resolver->reset( new FakeProxyResolver(base::Bind( &MojoProxyResolverFactoryImplTest::OnFakeProxyInstanceDestroyed, base::Unretained(this)))); - mock_factory_->pending_request()->callback.Run(OK); + mock_factory_->pending_request()->callback.Run(net::OK); EXPECT_THAT(create_callback.WaitForResult(), IsOk()); proxy_resolver.reset(); waiter_.WaitForEvent(RESOLVER_DESTROYED); @@ -159,8 +162,8 @@ } TEST_F(MojoProxyResolverFactoryImplTest, Error) { - interfaces::ProxyResolverPtr proxy_resolver; - interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; + mojom::ProxyResolverPtr proxy_resolver; + mojom::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::MakeRequest(&client_ptr)); factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), @@ -171,17 +174,18 @@ waiter_.WaitForEvent(RESOLVER_CREATED); EXPECT_EQ(0, instances_destroyed_); ASSERT_EQ(1u, mock_factory_->requests_handled()); - TestCompletionCallback create_callback; + net::TestCompletionCallback create_callback; create_callback_ = create_callback.callback(); ASSERT_TRUE(mock_factory_->pending_request()); - mock_factory_->pending_request()->callback.Run(ERR_PAC_SCRIPT_FAILED); - EXPECT_THAT(create_callback.WaitForResult(), IsError(ERR_PAC_SCRIPT_FAILED)); + mock_factory_->pending_request()->callback.Run(net::ERR_PAC_SCRIPT_FAILED); + EXPECT_THAT(create_callback.WaitForResult(), + IsError(net::ERR_PAC_SCRIPT_FAILED)); } TEST_F(MojoProxyResolverFactoryImplTest, DisconnectClientDuringResolverCreation) { - interfaces::ProxyResolverPtr proxy_resolver; - interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; + mojom::ProxyResolverPtr proxy_resolver; + mojom::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::MakeRequest(&client_ptr)); factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), @@ -198,8 +202,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, DisconnectFactoryDuringResolverCreation) { - interfaces::ProxyResolverPtr proxy_resolver; - interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; + mojom::ProxyResolverPtr proxy_resolver; + mojom::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::MakeRequest(&client_ptr)); factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), @@ -217,4 +221,4 @@ waiter_.WaitForEvent(CONNECTION_ERROR); } -} // namespace net +} // namespace proxy_resolver
diff --git a/net/proxy/mojo_proxy_resolver_impl.cc b/services/proxy_resolver/mojo_proxy_resolver_impl.cc similarity index 75% rename from net/proxy/mojo_proxy_resolver_impl.cc rename to services/proxy_resolver/mojo_proxy_resolver_impl.cc index a52cb768..3fa6b1a 100644 --- a/net/proxy/mojo_proxy_resolver_impl.cc +++ b/services/proxy_resolver/mojo_proxy_resolver_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/mojo_proxy_resolver_impl.h" +#include "services/proxy_resolver/mojo_proxy_resolver_impl.h" #include <utility> @@ -14,11 +14,11 @@ #include "net/proxy/proxy_resolver_script_data.h" #include "net/proxy/proxy_resolver_v8_tracing.h" -namespace net { +namespace proxy_resolver { class MojoProxyResolverImpl::Job { public: - Job(interfaces::ProxyResolverRequestClientPtr client, + Job(mojom::ProxyResolverRequestClientPtr client, MojoProxyResolverImpl* resolver, const GURL& url); ~Job(); @@ -34,8 +34,8 @@ MojoProxyResolverImpl* resolver_; - interfaces::ProxyResolverRequestClientPtr client_; - ProxyInfo result_; + mojom::ProxyResolverRequestClientPtr client_; + net::ProxyInfo result_; GURL url_; std::unique_ptr<net::ProxyResolver::Request> request_; bool done_; @@ -44,15 +44,14 @@ }; MojoProxyResolverImpl::MojoProxyResolverImpl( - std::unique_ptr<ProxyResolverV8Tracing> resolver) + std::unique_ptr<net::ProxyResolverV8Tracing> resolver) : resolver_(std::move(resolver)) {} -MojoProxyResolverImpl::~MojoProxyResolverImpl() { -} +MojoProxyResolverImpl::~MojoProxyResolverImpl() {} void MojoProxyResolverImpl::GetProxyForUrl( const GURL& url, - interfaces::ProxyResolverRequestClientPtr client) { + mojom::ProxyResolverRequestClientPtr client) { DVLOG(1) << "GetProxyForUrl(" << url << ")"; std::unique_ptr<Job> job = std::make_unique<Job>(std::move(client), this, url); @@ -67,10 +66,9 @@ resolve_jobs_.erase(it); } -MojoProxyResolverImpl::Job::Job( - interfaces::ProxyResolverRequestClientPtr client, - MojoProxyResolverImpl* resolver, - const GURL& url) +MojoProxyResolverImpl::Job::Job(mojom::ProxyResolverRequestClientPtr client, + MojoProxyResolverImpl* resolver, + const GURL& url) : resolver_(resolver), client_(std::move(client)), url_(url), @@ -82,8 +80,8 @@ resolver_->resolver_->GetProxyForURL( url_, &result_, base::Bind(&Job::GetProxyDone, base::Unretained(this)), &request_, - std::make_unique<MojoProxyResolverV8TracingBindings< - interfaces::ProxyResolverRequestClient>>(client_.get())); + std::make_unique<net::MojoProxyResolverV8TracingBindings< + mojom::ProxyResolverRequestClient>>(client_.get())); client_.set_connection_error_handler(base::Bind( &MojoProxyResolverImpl::Job::OnConnectionError, base::Unretained(this))); } @@ -95,10 +93,10 @@ for (const auto& proxy : result_.proxy_list().GetAll()) { DVLOG(1) << proxy.ToURI(); } - if (error == OK) + if (error == net::OK) client_->ReportResult(error, result_); else - client_->ReportResult(error, ProxyInfo()); + client_->ReportResult(error, net::ProxyInfo()); resolver_->DeleteJob(this); } @@ -107,4 +105,4 @@ resolver_->DeleteJob(this); } -} // namespace net +} // namespace proxy_resolver
diff --git a/services/proxy_resolver/mojo_proxy_resolver_impl.h b/services/proxy_resolver/mojo_proxy_resolver_impl.h new file mode 100644 index 0000000..6f3934a --- /dev/null +++ b/services/proxy_resolver/mojo_proxy_resolver_impl.h
@@ -0,0 +1,46 @@ +// Copyright 2015 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 SERVICES_PROXY_RESOLVER_MOJO_PROXY_RESOLVER_IMPL_H_ +#define SERVICES_PROXY_RESOLVER_MOJO_PROXY_RESOLVER_IMPL_H_ + +#include <map> +#include <memory> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "net/proxy/proxy_resolver.h" +#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" + +namespace net { +class ProxyResolverV8Tracing; +} // namespace net + +namespace proxy_resolver { + +class MojoProxyResolverImpl : public mojom::ProxyResolver { + public: + explicit MojoProxyResolverImpl( + std::unique_ptr<net::ProxyResolverV8Tracing> resolver); + + ~MojoProxyResolverImpl() override; + + private: + class Job; + + // mojom::ProxyResolver overrides. + void GetProxyForUrl(const GURL& url, + mojom::ProxyResolverRequestClientPtr client) override; + + void DeleteJob(Job* job); + + std::unique_ptr<net::ProxyResolverV8Tracing> resolver_; + std::map<Job*, std::unique_ptr<Job>> resolve_jobs_; + + DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); +}; + +} // namespace proxy_resolver + +#endif // SERVICES_PROXY_RESOLVER_MOJO_PROXY_RESOLVER_IMPL_H_
diff --git a/net/proxy/mojo_proxy_resolver_impl_unittest.cc b/services/proxy_resolver/mojo_proxy_resolver_impl_unittest.cc similarity index 71% rename from net/proxy/mojo_proxy_resolver_impl_unittest.cc rename to services/proxy_resolver/mojo_proxy_resolver_impl_unittest.cc index 0565a1a..7ee9f57 100644 --- a/net/proxy/mojo_proxy_resolver_impl_unittest.cc +++ b/services/proxy_resolver/mojo_proxy_resolver_impl_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/mojo_proxy_resolver_impl.h" +#include "services/proxy_resolver/mojo_proxy_resolver_impl.h" #include <string> #include <utility> @@ -10,6 +10,7 @@ #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/base/net_errors.h" #include "net/proxy/mock_proxy_resolver.h" @@ -24,10 +25,10 @@ using net::test::IsError; using net::test::IsOk; -namespace net { +namespace proxy_resolver { namespace { -class TestRequestClient : public interfaces::ProxyResolverRequestClient { +class TestRequestClient : public mojom::ProxyResolverRequestClient { public: enum Event { RESULT_RECEIVED, @@ -35,36 +36,37 @@ }; explicit TestRequestClient( - mojo::InterfaceRequest<interfaces::ProxyResolverRequestClient> request); + mojo::InterfaceRequest<mojom::ProxyResolverRequestClient> request); void WaitForResult(); - Error error() { return error_; } - const ProxyInfo& results() { return results_; } - EventWaiter<Event>& event_waiter() { return event_waiter_; } + net::Error error() { return error_; } + const net::ProxyInfo& results() { return results_; } + net::EventWaiter<Event>& event_waiter() { return event_waiter_; } private: - // interfaces::ProxyResolverRequestClient override. - void ReportResult(int32_t error, const ProxyInfo& results) override; + // mojom::ProxyResolverRequestClient override. + void ReportResult(int32_t error, const net::ProxyInfo& results) override; void Alert(const std::string& message) override; void OnError(int32_t line_number, const std::string& message) override; - void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info, - interfaces::HostResolverRequestClientPtr client) override; + void ResolveDns( + std::unique_ptr<net::HostResolver::RequestInfo> request_info, + net::interfaces::HostResolverRequestClientPtr client) override; // Mojo error handler. void OnConnectionError(); bool done_ = false; - Error error_ = ERR_FAILED; - ProxyInfo results_; + net::Error error_ = net::ERR_FAILED; + net::ProxyInfo results_; - mojo::Binding<interfaces::ProxyResolverRequestClient> binding_; + mojo::Binding<mojom::ProxyResolverRequestClient> binding_; - EventWaiter<Event> event_waiter_; + net::EventWaiter<Event> event_waiter_; }; TestRequestClient::TestRequestClient( - mojo::InterfaceRequest<interfaces::ProxyResolverRequestClient> request) + mojo::InterfaceRequest<mojom::ProxyResolverRequestClient> request) : binding_(this, std::move(request)) { binding_.set_connection_error_handler(base::Bind( &TestRequestClient::OnConnectionError, base::Unretained(this))); @@ -78,10 +80,11 @@ ASSERT_TRUE(done_); } -void TestRequestClient::ReportResult(int32_t error, const ProxyInfo& results) { +void TestRequestClient::ReportResult(int32_t error, + const net::ProxyInfo& results) { event_waiter_.NotifyEvent(RESULT_RECEIVED); ASSERT_FALSE(done_); - error_ = static_cast<Error>(error); + error_ = static_cast<net::Error>(error); results_ = results; done_ = true; } @@ -92,18 +95,18 @@ const std::string& message) {} void TestRequestClient::ResolveDns( - std::unique_ptr<HostResolver::RequestInfo> request_info, - interfaces::HostResolverRequestClientPtr client) {} + std::unique_ptr<net::HostResolver::RequestInfo> request_info, + net::interfaces::HostResolverRequestClientPtr client) {} void TestRequestClient::OnConnectionError() { event_waiter_.NotifyEvent(CONNECTION_ERROR); } -class MockProxyResolverV8Tracing : public ProxyResolverV8Tracing { +class MockProxyResolverV8Tracing : public net::ProxyResolverV8Tracing { public: struct Job { GURL url; - ProxyInfo* results; + net::ProxyInfo* results; bool cancelled = false; void Complete(int result) { DCHECK(!callback_.is_null()); @@ -113,13 +116,13 @@ bool WasCompleted() { return callback_.is_null(); } - void SetCallback(CompletionCallback callback) { callback_ = callback; } + void SetCallback(net::CompletionCallback callback) { callback_ = callback; } private: - CompletionCallback callback_; + net::CompletionCallback callback_; }; - class RequestImpl : public ProxyResolver::Request { + class RequestImpl : public net::ProxyResolver::Request { public: RequestImpl(Job* job, MockProxyResolverV8Tracing* resolver) : job_(job), resolver_(resolver) {} @@ -134,8 +137,8 @@ } } - LoadState GetLoadState() override { - return LOAD_STATE_RESOLVING_PROXY_FOR_URL; + net::LoadState GetLoadState() override { + return net::LOAD_STATE_RESOLVING_PROXY_FOR_URL; } private: @@ -147,9 +150,9 @@ // ProxyResolverV8Tracing overrides. void GetProxyForURL(const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolver::Request>* request, + net::ProxyInfo* results, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolver::Request>* request, std::unique_ptr<Bindings> bindings) override; void WaitForCancel(); @@ -165,9 +168,9 @@ void MockProxyResolverV8Tracing::GetProxyForURL( const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolver::Request>* request, + net::ProxyInfo* results, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolver::Request>* request, std::unique_ptr<Bindings> bindings) { pending_jobs_.push_back(base::WrapUnique(new Job())); auto* pending_job = pending_jobs_.back().get(); @@ -177,7 +180,6 @@ request->reset(new RequestImpl(pending_job, this)); } - void MockProxyResolverV8Tracing::WaitForCancel() { while (std::find_if(pending_jobs_.begin(), pending_jobs_.end(), [](const std::unique_ptr<Job>& job) { @@ -201,14 +203,15 @@ resolver_ = resolver_impl_.get(); } + base::test::ScopedTaskEnvironment task_environment_; MockProxyResolverV8Tracing* mock_proxy_resolver_; std::unique_ptr<MojoProxyResolverImpl> resolver_impl_; - interfaces::ProxyResolver* resolver_; + mojom::ProxyResolver* resolver_; }; TEST_F(MojoProxyResolverImplTest, GetProxyForUrl) { - interfaces::ProxyResolverRequestClientPtr client_ptr; + mojom::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL(GURL("http://example.com")), @@ -225,37 +228,38 @@ "HTTPS https.example.com:4; " "QUIC quic.example.com:65000; " "DIRECT"); - job->Complete(OK); + job->Complete(net::OK); client.WaitForResult(); EXPECT_THAT(client.error(), IsOk()); - std::vector<ProxyServer> servers = client.results().proxy_list().GetAll(); + std::vector<net::ProxyServer> servers = + client.results().proxy_list().GetAll(); ASSERT_EQ(6u, servers.size()); - EXPECT_EQ(ProxyServer::SCHEME_HTTP, servers[0].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_HTTP, servers[0].scheme()); EXPECT_EQ("proxy.example.com", servers[0].host_port_pair().host()); EXPECT_EQ(1, servers[0].host_port_pair().port()); - EXPECT_EQ(ProxyServer::SCHEME_SOCKS4, servers[1].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_SOCKS4, servers[1].scheme()); EXPECT_EQ("socks4.example.com", servers[1].host_port_pair().host()); EXPECT_EQ(2, servers[1].host_port_pair().port()); - EXPECT_EQ(ProxyServer::SCHEME_SOCKS5, servers[2].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_SOCKS5, servers[2].scheme()); EXPECT_EQ("socks5.example.com", servers[2].host_port_pair().host()); EXPECT_EQ(3, servers[2].host_port_pair().port()); - EXPECT_EQ(ProxyServer::SCHEME_HTTPS, servers[3].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_HTTPS, servers[3].scheme()); EXPECT_EQ("https.example.com", servers[3].host_port_pair().host()); EXPECT_EQ(4, servers[3].host_port_pair().port()); - EXPECT_EQ(ProxyServer::SCHEME_QUIC, servers[4].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_QUIC, servers[4].scheme()); EXPECT_EQ("quic.example.com", servers[4].host_port_pair().host()); EXPECT_EQ(65000, servers[4].host_port_pair().port()); - EXPECT_EQ(ProxyServer::SCHEME_DIRECT, servers[5].scheme()); + EXPECT_EQ(net::ProxyServer::SCHEME_DIRECT, servers[5].scheme()); } TEST_F(MojoProxyResolverImplTest, GetProxyForUrlFailure) { - interfaces::ProxyResolverRequestClientPtr client_ptr; + mojom::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); @@ -263,19 +267,19 @@ MockProxyResolverV8Tracing::Job* job = mock_proxy_resolver_->pending_jobs()[0].get(); EXPECT_EQ(GURL(GURL("http://example.com")), job->url); - job->Complete(ERR_FAILED); + job->Complete(net::ERR_FAILED); client.WaitForResult(); - EXPECT_THAT(client.error(), IsError(ERR_FAILED)); - std::vector<ProxyServer> proxy_servers = + EXPECT_THAT(client.error(), IsError(net::ERR_FAILED)); + std::vector<net::ProxyServer> proxy_servers = client.results().proxy_list().GetAll(); EXPECT_TRUE(proxy_servers.empty()); } TEST_F(MojoProxyResolverImplTest, GetProxyForUrlMultiple) { - interfaces::ProxyResolverRequestClientPtr client_ptr1; + mojom::ProxyResolverRequestClientPtr client_ptr1; TestRequestClient client1(mojo::MakeRequest(&client_ptr1)); - interfaces::ProxyResolverRequestClientPtr client_ptr2; + mojom::ProxyResolverRequestClientPtr client_ptr2; TestRequestClient client2(mojo::MakeRequest(&client_ptr2)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr1)); @@ -289,33 +293,33 @@ mock_proxy_resolver_->pending_jobs()[1].get(); EXPECT_EQ(GURL("https://example.com"), job2->url); job1->results->UsePacString("HTTPS proxy.example.com:12345"); - job1->Complete(OK); + job1->Complete(net::OK); job2->results->UsePacString("SOCKS5 another-proxy.example.com:6789"); - job2->Complete(OK); + job2->Complete(net::OK); client1.WaitForResult(); client2.WaitForResult(); EXPECT_THAT(client1.error(), IsOk()); - std::vector<ProxyServer> proxy_servers1 = + std::vector<net::ProxyServer> proxy_servers1 = client1.results().proxy_list().GetAll(); ASSERT_EQ(1u, proxy_servers1.size()); - ProxyServer& server1 = proxy_servers1[0]; - EXPECT_EQ(ProxyServer::SCHEME_HTTPS, server1.scheme()); + net::ProxyServer& server1 = proxy_servers1[0]; + EXPECT_EQ(net::ProxyServer::SCHEME_HTTPS, server1.scheme()); EXPECT_EQ("proxy.example.com", server1.host_port_pair().host()); EXPECT_EQ(12345, server1.host_port_pair().port()); EXPECT_THAT(client2.error(), IsOk()); - std::vector<ProxyServer> proxy_servers2 = + std::vector<net::ProxyServer> proxy_servers2 = client2.results().proxy_list().GetAll(); ASSERT_EQ(1u, proxy_servers1.size()); - ProxyServer& server2 = proxy_servers2[0]; - EXPECT_EQ(ProxyServer::SCHEME_SOCKS5, server2.scheme()); + net::ProxyServer& server2 = proxy_servers2[0]; + EXPECT_EQ(net::ProxyServer::SCHEME_SOCKS5, server2.scheme()); EXPECT_EQ("another-proxy.example.com", server2.host_port_pair().host()); EXPECT_EQ(6789, server2.host_port_pair().port()); } TEST_F(MojoProxyResolverImplTest, DestroyClient) { - interfaces::ProxyResolverRequestClientPtr client_ptr; + mojom::ProxyResolverRequestClientPtr client_ptr; std::unique_ptr<TestRequestClient> client( new TestRequestClient(mojo::MakeRequest(&client_ptr))); @@ -330,7 +334,7 @@ } TEST_F(MojoProxyResolverImplTest, DestroyService) { - interfaces::ProxyResolverRequestClientPtr client_ptr; + mojom::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); @@ -339,4 +343,4 @@ client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); } -} // namespace net +} // namespace proxy_resolver
diff --git a/net/proxy/proxy_resolver_factory_mojo.cc b/services/proxy_resolver/proxy_resolver_factory_mojo.cc similarity index 62% rename from net/proxy/proxy_resolver_factory_mojo.cc rename to services/proxy_resolver/proxy_resolver_factory_mojo.cc index 145ea01..773ee80 100644 --- a/net/proxy/proxy_resolver_factory_mojo.cc +++ b/services/proxy_resolver/proxy_resolver_factory_mojo.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/proxy_resolver_factory_mojo.h" +#include "services/proxy_resolver/proxy_resolver_factory_mojo.h" #include <set> #include <utility> @@ -12,34 +12,33 @@ #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/sequence_checker.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/threading/thread_checker.h" #include "base/values.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/base/load_states.h" #include "net/base/net_errors.h" #include "net/dns/mojo_host_resolver_impl.h" #include "net/interfaces/host_resolver_service.mojom.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" #include "net/log/net_log.h" #include "net/log/net_log_capture_mode.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_with_source.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_resolver_error_observer.h" #include "net/proxy/proxy_resolver_script_data.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" // nogncheck -namespace net { +namespace proxy_resolver { namespace { std::unique_ptr<base::Value> NetLogErrorCallback( int line_number, const std::string* message, - NetLogCaptureMode /* capture_mode */) { + net::NetLogCaptureMode /* capture_mode */) { std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("line_number", line_number); dict->SetString("message", *message); @@ -52,10 +51,10 @@ template <typename ClientInterface> class ClientMixin : public ClientInterface { public: - ClientMixin(HostResolver* host_resolver, - ProxyResolverErrorObserver* error_observer, - NetLog* net_log, - const NetLogWithSource& net_log_with_source) + ClientMixin(net::HostResolver* host_resolver, + net::ProxyResolverErrorObserver* error_observer, + net::NetLog* net_log, + const net::NetLogWithSource& net_log_with_source) : host_resolver_(host_resolver, net_log_with_source), error_observer_(error_observer), net_log_(net_log), @@ -63,27 +62,30 @@ // Overridden from ClientInterface: void Alert(const std::string& message) override { - auto callback = NetLog::StringCallback("message", &message); - net_log_with_source_.AddEvent(NetLogEventType::PAC_JAVASCRIPT_ALERT, + auto callback = net::NetLog::StringCallback("message", &message); + net_log_with_source_.AddEvent(net::NetLogEventType::PAC_JAVASCRIPT_ALERT, callback); if (net_log_) - net_log_->AddGlobalEntry(NetLogEventType::PAC_JAVASCRIPT_ALERT, callback); + net_log_->AddGlobalEntry(net::NetLogEventType::PAC_JAVASCRIPT_ALERT, + callback); } void OnError(int32_t line_number, const std::string& message) override { auto callback = base::Bind(&NetLogErrorCallback, line_number, &message); - net_log_with_source_.AddEvent(NetLogEventType::PAC_JAVASCRIPT_ERROR, + net_log_with_source_.AddEvent(net::NetLogEventType::PAC_JAVASCRIPT_ERROR, callback); if (net_log_) - net_log_->AddGlobalEntry(NetLogEventType::PAC_JAVASCRIPT_ERROR, callback); + net_log_->AddGlobalEntry(net::NetLogEventType::PAC_JAVASCRIPT_ERROR, + callback); if (error_observer_) { error_observer_->OnPACScriptError(line_number, base::UTF8ToUTF16(message)); } } - void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info, - interfaces::HostResolverRequestClientPtr client) override { + void ResolveDns( + std::unique_ptr<net::HostResolver::RequestInfo> request_info, + net::interfaces::HostResolverRequestClientPtr client) override { host_resolver_.Resolve(std::move(request_info), std::move(client)); } @@ -93,10 +95,10 @@ } private: - MojoHostResolverImpl host_resolver_; - ProxyResolverErrorObserver* const error_observer_; - NetLog* const net_log_; - const NetLogWithSource net_log_with_source_; + net::MojoHostResolverImpl host_resolver_; + net::ProxyResolverErrorObserver* const error_observer_; + net::NetLog* const net_log_; + const net::NetLogWithSource net_log_with_source_; }; // Implementation of ProxyResolver that connects to a Mojo service to evaluate @@ -106,7 +108,7 @@ // This implementation reports disconnections from the Mojo service (i.e. if the // service is out-of-process and that process crashes) using the error code // ERR_PAC_SCRIPT_TERMINATED. -class ProxyResolverMojo : public ProxyResolver { +class ProxyResolverMojo : public net::ProxyResolver { public: // Constructs a ProxyResolverMojo that connects to a mojo proxy resolver // implementation using |resolver_ptr|. The implementation uses @@ -114,36 +116,36 @@ // communicate with it. When deleted, the closure contained within // |on_delete_callback_runner| will be run. ProxyResolverMojo( - interfaces::ProxyResolverPtr resolver_ptr, - HostResolver* host_resolver, + mojom::ProxyResolverPtr resolver_ptr, + net::HostResolver* host_resolver, std::unique_ptr<base::ScopedClosureRunner> on_delete_callback_runner, - std::unique_ptr<ProxyResolverErrorObserver> error_observer, - NetLog* net_log); + std::unique_ptr<net::ProxyResolverErrorObserver> error_observer, + net::NetLog* net_log); ~ProxyResolverMojo() override; // ProxyResolver implementation: int GetProxyForURL(const GURL& url, - ProxyInfo* results, + net::ProxyInfo* results, const net::CompletionCallback& callback, std::unique_ptr<Request>* request, - const NetLogWithSource& net_log) override; + const net::NetLogWithSource& net_log) override; private: class Job; - base::ThreadChecker thread_checker_; + SEQUENCE_CHECKER(sequence_checker_); // Mojo error handler. void OnConnectionError(); // Connection to the Mojo proxy resolver. - interfaces::ProxyResolverPtr mojo_proxy_resolver_ptr_; + mojom::ProxyResolverPtr mojo_proxy_resolver_ptr_; - HostResolver* host_resolver_; + net::HostResolver* host_resolver_; - std::unique_ptr<ProxyResolverErrorObserver> error_observer_; + std::unique_ptr<net::ProxyResolverErrorObserver> error_observer_; - NetLog* net_log_; + net::NetLog* net_log_; std::unique_ptr<base::ScopedClosureRunner> on_delete_callback_runner_; @@ -152,44 +154,44 @@ class ProxyResolverMojo::Job : public ProxyResolver::Request, - public ClientMixin<interfaces::ProxyResolverRequestClient> { + public ClientMixin<mojom::ProxyResolverRequestClient> { public: Job(ProxyResolverMojo* resolver, const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - const NetLogWithSource& net_log); + net::ProxyInfo* results, + const net::CompletionCallback& callback, + const net::NetLogWithSource& net_log); ~Job() override; // Returns the LoadState of this job. - LoadState GetLoadState() override; + net::LoadState GetLoadState() override; private: // Mojo error handler. void OnConnectionError(); - // Overridden from interfaces::ProxyResolverRequestClient: + // Overridden from mojom::ProxyResolverRequestClient: void ReportResult(int32_t error, const net::ProxyInfo& proxy_info) override; // Completes a request with a result code. void CompleteRequest(int result); const GURL url_; - ProxyInfo* results_; - CompletionCallback callback_; + net::ProxyInfo* results_; + net::CompletionCallback callback_; - base::ThreadChecker thread_checker_; - mojo::Binding<interfaces::ProxyResolverRequestClient> binding_; + SEQUENCE_CHECKER(sequence_checker_); + mojo::Binding<mojom::ProxyResolverRequestClient> binding_; DISALLOW_COPY_AND_ASSIGN(Job); }; ProxyResolverMojo::Job::Job(ProxyResolverMojo* resolver, const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - const NetLogWithSource& net_log) - : ClientMixin<interfaces::ProxyResolverRequestClient>( + net::ProxyInfo* results, + const net::CompletionCallback& callback, + const net::NetLogWithSource& net_log) + : ClientMixin<mojom::ProxyResolverRequestClient>( resolver->host_resolver_, resolver->error_observer_.get(), resolver->net_log_, @@ -198,7 +200,7 @@ results_(results), callback_(callback), binding_(this) { - interfaces::ProxyResolverRequestClientPtr client; + mojom::ProxyResolverRequestClientPtr client; binding_.Bind(mojo::MakeRequest(&client)); resolver->mojo_proxy_resolver_ptr_->GetProxyForUrl(url_, std::move(client)); binding_.set_connection_error_handler(base::Bind( @@ -207,30 +209,31 @@ ProxyResolverMojo::Job::~Job() {} -LoadState ProxyResolverMojo::Job::GetLoadState() { - return dns_request_in_progress() ? LOAD_STATE_RESOLVING_HOST_IN_PROXY_SCRIPT - : LOAD_STATE_RESOLVING_PROXY_FOR_URL; +net::LoadState ProxyResolverMojo::Job::GetLoadState() { + return dns_request_in_progress() + ? net::LOAD_STATE_RESOLVING_HOST_IN_PROXY_SCRIPT + : net::LOAD_STATE_RESOLVING_PROXY_FOR_URL; } void ProxyResolverMojo::Job::OnConnectionError() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(1) << "ProxyResolverMojo::Job::OnConnectionError"; - CompleteRequest(ERR_PAC_SCRIPT_TERMINATED); + CompleteRequest(net::ERR_PAC_SCRIPT_TERMINATED); } void ProxyResolverMojo::Job::CompleteRequest(int result) { - DCHECK(thread_checker_.CalledOnValidThread()); - CompletionCallback callback = base::ResetAndReturn(&callback_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + net::CompletionCallback callback = base::ResetAndReturn(&callback_); binding_.Close(); callback.Run(result); } void ProxyResolverMojo::Job::ReportResult(int32_t error, - const ProxyInfo& proxy_info) { - DCHECK(thread_checker_.CalledOnValidThread()); + const net::ProxyInfo& proxy_info) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(1) << "ProxyResolverMojo::Job::ReportResult: " << error; - if (error == OK) { + if (error == net::OK) { *results_ = proxy_info; DVLOG(1) << "Servers: " << results_->ToPacString(); } @@ -239,11 +242,11 @@ } ProxyResolverMojo::ProxyResolverMojo( - interfaces::ProxyResolverPtr resolver_ptr, - HostResolver* host_resolver, + mojom::ProxyResolverPtr resolver_ptr, + net::HostResolver* host_resolver, std::unique_ptr<base::ScopedClosureRunner> on_delete_callback_runner, - std::unique_ptr<ProxyResolverErrorObserver> error_observer, - NetLog* net_log) + std::unique_ptr<net::ProxyResolverErrorObserver> error_observer, + net::NetLog* net_log) : mojo_proxy_resolver_ptr_(std::move(resolver_ptr)), host_resolver_(host_resolver), error_observer_(std::move(error_observer)), @@ -254,11 +257,11 @@ } ProxyResolverMojo::~ProxyResolverMojo() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void ProxyResolverMojo::OnConnectionError() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(1) << "ProxyResolverMojo::OnConnectionError"; // Disconnect from the Mojo proxy resolver service. @@ -266,18 +269,18 @@ } int ProxyResolverMojo::GetProxyForURL(const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, + net::ProxyInfo* results, + const net::CompletionCallback& callback, std::unique_ptr<Request>* request, - const NetLogWithSource& net_log) { - DCHECK(thread_checker_.CalledOnValidThread()); + const net::NetLogWithSource& net_log) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!mojo_proxy_resolver_ptr_) - return ERR_PAC_SCRIPT_TERMINATED; + return net::ERR_PAC_SCRIPT_TERMINATED; *request = std::make_unique<Job>(this, url, results, callback, net_log); - return ERR_IO_PENDING; + return net::ERR_IO_PENDING; } } // namespace @@ -288,25 +291,25 @@ // there is no per-request logging to be done (any netlog events are only sent // globally) so this always uses an empty NetLogWithSource. class ProxyResolverFactoryMojo::Job - : public ClientMixin<interfaces::ProxyResolverFactoryRequestClient>, + : public ClientMixin<mojom::ProxyResolverFactoryRequestClient>, public ProxyResolverFactory::Request { public: Job(ProxyResolverFactoryMojo* factory, - const scoped_refptr<ProxyResolverScriptData>& pac_script, - std::unique_ptr<ProxyResolver>* resolver, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolverErrorObserver> error_observer) - : ClientMixin<interfaces::ProxyResolverFactoryRequestClient>( + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + std::unique_ptr<net::ProxyResolver>* resolver, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolverErrorObserver> error_observer) + : ClientMixin<mojom::ProxyResolverFactoryRequestClient>( factory->host_resolver_, error_observer.get(), factory->net_log_, - NetLogWithSource()), + net::NetLogWithSource()), factory_(factory), resolver_(resolver), callback_(callback), binding_(this), error_observer_(std::move(error_observer)) { - interfaces::ProxyResolverFactoryRequestClientPtr client; + mojom::ProxyResolverFactoryRequestClientPtr client; binding_.Bind(mojo::MakeRequest(&client)); on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver( base::UTF16ToUTF8(pac_script->utf16()), @@ -319,13 +322,13 @@ base::Unretained(this))); } - void OnConnectionError() { ReportResult(ERR_PAC_SCRIPT_TERMINATED); } + void OnConnectionError() { ReportResult(net::ERR_PAC_SCRIPT_TERMINATED); } private: void ReportResult(int32_t error) override { resolver_ptr_.set_connection_error_handler(base::Closure()); binding_.set_connection_error_handler(base::Closure()); - if (error == OK) { + if (error == net::OK) { resolver_->reset(new ProxyResolverMojo( std::move(resolver_ptr_), factory_->host_resolver_, std::move(on_delete_callback_runner_), std::move(error_observer_), @@ -336,20 +339,20 @@ } ProxyResolverFactoryMojo* const factory_; - std::unique_ptr<ProxyResolver>* resolver_; - const CompletionCallback callback_; - interfaces::ProxyResolverPtr resolver_ptr_; - mojo::Binding<interfaces::ProxyResolverFactoryRequestClient> binding_; + std::unique_ptr<net::ProxyResolver>* resolver_; + const net::CompletionCallback callback_; + mojom::ProxyResolverPtr resolver_ptr_; + mojo::Binding<mojom::ProxyResolverFactoryRequestClient> binding_; std::unique_ptr<base::ScopedClosureRunner> on_delete_callback_runner_; - std::unique_ptr<ProxyResolverErrorObserver> error_observer_; + std::unique_ptr<net::ProxyResolverErrorObserver> error_observer_; }; ProxyResolverFactoryMojo::ProxyResolverFactoryMojo( MojoProxyResolverFactory* mojo_proxy_factory, - HostResolver* host_resolver, - const base::Callback<std::unique_ptr<ProxyResolverErrorObserver>()>& + net::HostResolver* host_resolver, + const base::Callback<std::unique_ptr<net::ProxyResolverErrorObserver>()>& error_observer_factory, - NetLog* net_log) + net::NetLog* net_log) : ProxyResolverFactory(true), mojo_proxy_factory_(mojo_proxy_factory), host_resolver_(host_resolver), @@ -359,21 +362,22 @@ ProxyResolverFactoryMojo::~ProxyResolverFactoryMojo() = default; int ProxyResolverFactoryMojo::CreateProxyResolver( - const scoped_refptr<ProxyResolverScriptData>& pac_script, - std::unique_ptr<ProxyResolver>* resolver, - const CompletionCallback& callback, - std::unique_ptr<ProxyResolverFactory::Request>* request) { + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + std::unique_ptr<net::ProxyResolver>* resolver, + const net::CompletionCallback& callback, + std::unique_ptr<net::ProxyResolverFactory::Request>* request) { DCHECK(resolver); DCHECK(request); - if (pac_script->type() != ProxyResolverScriptData::TYPE_SCRIPT_CONTENTS || + if (pac_script->type() != + net::ProxyResolverScriptData::TYPE_SCRIPT_CONTENTS || pac_script->utf16().empty()) { - return ERR_PAC_SCRIPT_FAILED; + return net::ERR_PAC_SCRIPT_FAILED; } request->reset(new Job(this, pac_script, resolver, callback, error_observer_factory_.is_null() ? nullptr : error_observer_factory_.Run())); - return ERR_IO_PENDING; + return net::ERR_IO_PENDING; } -} // namespace net +} // namespace proxy_resolver
diff --git a/services/proxy_resolver/proxy_resolver_factory_mojo.h b/services/proxy_resolver/proxy_resolver_factory_mojo.h new file mode 100644 index 0000000..d3a84dd3 --- /dev/null +++ b/services/proxy_resolver/proxy_resolver_factory_mojo.h
@@ -0,0 +1,60 @@ +// Copyright 2015 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 SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_FACTORY_MOJO_H_ +#define SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_FACTORY_MOJO_H_ + +#include <memory> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "net/base/completion_callback.h" +#include "net/proxy/proxy_resolver_factory.h" + +namespace net { +class HostResolver; +class NetLog; +class ProxyResolverErrorObserver; +class ProxyResolverScriptData; +} // namespace net + +namespace proxy_resolver { + +class MojoProxyResolverFactory; + +// Implementation of ProxyResolverFactory that connects to a Mojo service to +// create implementations of a Mojo proxy resolver to back a ProxyResolverMojo. +class ProxyResolverFactoryMojo : public net::ProxyResolverFactory { + public: + ProxyResolverFactoryMojo( + MojoProxyResolverFactory* mojo_proxy_factory, + net::HostResolver* host_resolver, + const base::Callback<std::unique_ptr<net::ProxyResolverErrorObserver>()>& + error_observer_factory, + net::NetLog* net_log); + ~ProxyResolverFactoryMojo() override; + + // ProxyResolverFactory override. + int CreateProxyResolver( + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + std::unique_ptr<net::ProxyResolver>* resolver, + const net::CompletionCallback& callback, + std::unique_ptr<Request>* request) override; + + private: + class Job; + + MojoProxyResolverFactory* const mojo_proxy_factory_; + net::HostResolver* const host_resolver_; + const base::Callback<std::unique_ptr<net::ProxyResolverErrorObserver>()> + error_observer_factory_; + net::NetLog* const net_log_; + + DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryMojo); +}; + +} // namespace proxy_resolver + +#endif // SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_FACTORY_MOJO_H_
diff --git a/net/proxy/proxy_resolver_factory_mojo_unittest.cc b/services/proxy_resolver/proxy_resolver_factory_mojo_unittest.cc similarity index 69% rename from net/proxy/proxy_resolver_factory_mojo_unittest.cc rename to services/proxy_resolver/proxy_resolver_factory_mojo_unittest.cc index a038a01..0181d25 100644 --- a/net/proxy/proxy_resolver_factory_mojo_unittest.cc +++ b/services/proxy_resolver/proxy_resolver_factory_mojo_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/proxy_resolver_factory_mojo.h" +#include "services/proxy_resolver/proxy_resolver_factory_mojo.h" #include <list> #include <map> @@ -17,6 +17,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/stl_util.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/base/load_states.h" @@ -26,13 +27,14 @@ #include "net/log/net_log_event_type.h" #include "net/log/net_log_with_source.h" #include "net/log/test_net_log.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_resolver_error_observer.h" +#include "net/proxy/proxy_resolver_factory.h" #include "net/proxy/proxy_resolver_script_data.h" #include "net/test/event_waiter.h" #include "net/test/gtest_util.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -40,7 +42,7 @@ using net::test::IsError; using net::test::IsOk; -namespace net { +namespace proxy_resolver { namespace { @@ -59,7 +61,7 @@ static CreateProxyResolverAction ReturnResult( const std::string& expected_pac_script, - Error error) { + net::Error error) { CreateProxyResolverAction result; result.expected_pac_script = expected_pac_script; result.error = error; @@ -108,7 +110,7 @@ std::string expected_pac_script; Action action = COMPLETE; - Error error = OK; + net::Error error = net::OK; }; struct GetProxyForUrlAction { @@ -127,7 +129,7 @@ GetProxyForUrlAction() {} GetProxyForUrlAction(const GetProxyForUrlAction& other) = default; - static GetProxyForUrlAction ReturnError(const GURL& url, Error error) { + static GetProxyForUrlAction ReturnError(const GURL& url, net::Error error) { GetProxyForUrlAction result; result.expected_url = url; result.error = error; @@ -135,7 +137,7 @@ } static GetProxyForUrlAction ReturnServers(const GURL& url, - const ProxyInfo& proxy_info) { + const net::ProxyInfo& proxy_info) { GetProxyForUrlAction result; result.expected_url = url; result.proxy_info = proxy_info; @@ -171,12 +173,12 @@ } Action action = COMPLETE; - Error error = OK; - ProxyInfo proxy_info; + net::Error error = net::OK; + net::ProxyInfo proxy_info; GURL expected_url; }; -class MockMojoProxyResolver : public interfaces::ProxyResolver { +class MockMojoProxyResolver : public mojom::ProxyResolver { public: MockMojoProxyResolver(); ~MockMojoProxyResolver() override; @@ -187,13 +189,12 @@ void ClearBlockedClients(); - void AddConnection(mojo::InterfaceRequest<interfaces::ProxyResolver> req); + void AddConnection(mojo::InterfaceRequest<mojom::ProxyResolver> req); private: - // Overridden from interfaces::ProxyResolver: - void GetProxyForUrl( - const GURL& url, - interfaces::ProxyResolverRequestClientPtr client) override; + // Overridden from mojom::ProxyResolver: + void GetProxyForUrl(const GURL& url, + mojom::ProxyResolverRequestClientPtr client) override; void WakeWaiter(); @@ -203,9 +204,9 @@ base::Closure quit_closure_; - std::vector<std::unique_ptr<interfaces::ProxyResolverRequestClientPtr>> + std::vector<std::unique_ptr<mojom::ProxyResolverRequestClientPtr>> blocked_clients_; - mojo::Binding<interfaces::ProxyResolver> binding_; + mojo::Binding<mojom::ProxyResolver> binding_; }; MockMojoProxyResolver::~MockMojoProxyResolver() { @@ -213,8 +214,7 @@ << "Actions remaining: " << get_proxy_actions_.size(); } -MockMojoProxyResolver::MockMojoProxyResolver() : binding_(this) { -} +MockMojoProxyResolver::MockMojoProxyResolver() : binding_(this) {} void MockMojoProxyResolver::AddGetProxyAction(GetProxyForUrlAction action) { get_proxy_actions_.push(action); @@ -237,7 +237,7 @@ } void MockMojoProxyResolver::AddConnection( - mojo::InterfaceRequest<interfaces::ProxyResolver> req) { + mojo::InterfaceRequest<mojom::ProxyResolver> req) { if (binding_.is_bound()) binding_.Close(); binding_.Bind(std::move(req)); @@ -245,7 +245,7 @@ void MockMojoProxyResolver::GetProxyForUrl( const GURL& url, - interfaces::ProxyResolverRequestClientPtr client) { + mojom::ProxyResolverRequestClientPtr client) { ASSERT_FALSE(get_proxy_actions_.empty()); GetProxyForUrlAction action = get_proxy_actions_.front(); get_proxy_actions_.pop(); @@ -276,13 +276,13 @@ break; } case GetProxyForUrlAction::MAKE_DNS_REQUEST: { - auto request = std::make_unique<HostResolver::RequestInfo>( - HostPortPair(url.spec(), 12345)); - interfaces::HostResolverRequestClientPtr dns_client; + auto request = std::make_unique<net::HostResolver::RequestInfo>( + net::HostPortPair(url.spec(), 12345)); + net::interfaces::HostResolverRequestClientPtr dns_client; mojo::MakeRequest(&dns_client); client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( - std::make_unique<interfaces::ProxyResolverRequestClientPtr>( + std::make_unique<mojom::ProxyResolverRequestClientPtr>( std::move(client))); break; } @@ -292,30 +292,29 @@ class Request { public: - Request(ProxyResolver* resolver, const GURL& url); + Request(net::ProxyResolver* resolver, const GURL& url); int Resolve(); void Cancel(); int WaitForResult(); - const ProxyInfo& results() const { return results_; } - LoadState load_state() { return request_->GetLoadState(); } - BoundTestNetLog& net_log() { return net_log_; } - const TestCompletionCallback& callback() const { return callback_; } + const net::ProxyInfo& results() const { return results_; } + net::LoadState load_state() { return request_->GetLoadState(); } + net::BoundTestNetLog& net_log() { return net_log_; } + const net::TestCompletionCallback& callback() const { return callback_; } private: - ProxyResolver* resolver_; + net::ProxyResolver* resolver_; const GURL url_; - ProxyInfo results_; - std::unique_ptr<ProxyResolver::Request> request_; + net::ProxyInfo results_; + std::unique_ptr<net::ProxyResolver::Request> request_; int error_; - TestCompletionCallback callback_; - BoundTestNetLog net_log_; + net::TestCompletionCallback callback_; + net::BoundTestNetLog net_log_; }; -Request::Request(ProxyResolver* resolver, const GURL& url) - : resolver_(resolver), url_(url), error_(0) { -} +Request::Request(net::ProxyResolver* resolver, const GURL& url) + : resolver_(resolver), url_(url), error_(0) {} int Request::Resolve() { error_ = resolver_->GetProxyForURL(url_, &results_, callback_.callback(), @@ -332,11 +331,11 @@ return error_; } -class MockMojoProxyResolverFactory : public interfaces::ProxyResolverFactory { +class MockMojoProxyResolverFactory : public mojom::ProxyResolverFactory { public: MockMojoProxyResolverFactory( MockMojoProxyResolver* resolver, - mojo::InterfaceRequest<interfaces::ProxyResolverFactory> req); + mojo::InterfaceRequest<mojom::ProxyResolverFactory> req); ~MockMojoProxyResolverFactory() override; void AddCreateProxyResolverAction(CreateProxyResolverAction action); @@ -346,11 +345,11 @@ void ClearBlockedClients(); private: - // Overridden from interfaces::ProxyResolver: + // Overridden from mojom::ProxyResolver: void CreateResolver( const std::string& pac_url, - mojo::InterfaceRequest<interfaces::ProxyResolver> request, - interfaces::ProxyResolverFactoryRequestClientPtr client) override; + mojo::InterfaceRequest<mojom::ProxyResolver> request, + mojom::ProxyResolverFactoryRequestClientPtr client) override; void WakeWaiter(); @@ -359,17 +358,16 @@ base::Closure quit_closure_; - std::vector<std::unique_ptr<interfaces::ProxyResolverFactoryRequestClientPtr>> + std::vector<std::unique_ptr<mojom::ProxyResolverFactoryRequestClientPtr>> blocked_clients_; - std::vector< - std::unique_ptr<mojo::InterfaceRequest<interfaces::ProxyResolver>>> + std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ProxyResolver>>> blocked_resolver_requests_; - mojo::Binding<interfaces::ProxyResolverFactory> binding_; + mojo::Binding<mojom::ProxyResolverFactory> binding_; }; MockMojoProxyResolverFactory::MockMojoProxyResolverFactory( MockMojoProxyResolver* resolver, - mojo::InterfaceRequest<interfaces::ProxyResolverFactory> req) + mojo::InterfaceRequest<mojom::ProxyResolverFactory> req) : resolver_(resolver), binding_(this, std::move(req)) {} MockMojoProxyResolverFactory::~MockMojoProxyResolverFactory() { @@ -400,8 +398,8 @@ void MockMojoProxyResolverFactory::CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> request, - interfaces::ProxyResolverFactoryRequestClientPtr client) { + mojo::InterfaceRequest<mojom::ProxyResolver> request, + mojom::ProxyResolverFactoryRequestClientPtr client) { ASSERT_FALSE(create_resolver_actions_.empty()); CreateProxyResolverAction action = create_resolver_actions_.front(); create_resolver_actions_.pop(); @@ -411,7 +409,7 @@ client->OnError(12345, pac_script); switch (action.action) { case CreateProxyResolverAction::COMPLETE: { - if (action.error == OK) + if (action.error == net::OK) resolver_->AddConnection(std::move(request)); client->ReportResult(action.error); break; @@ -419,14 +417,14 @@ case CreateProxyResolverAction::DROP_CLIENT: { // Save |request| so its pipe isn't closed. blocked_resolver_requests_.push_back( - std::make_unique<mojo::InterfaceRequest<interfaces::ProxyResolver>>( + std::make_unique<mojo::InterfaceRequest<mojom::ProxyResolver>>( std::move(request))); break; } case CreateProxyResolverAction::DROP_RESOLVER: { // Save |client| so its pipe isn't closed. blocked_clients_.push_back( - std::make_unique<interfaces::ProxyResolverFactoryRequestClientPtr>( + std::make_unique<mojom::ProxyResolverFactoryRequestClientPtr>( std::move(client))); break; } @@ -444,13 +442,13 @@ break; } case CreateProxyResolverAction::MAKE_DNS_REQUEST: { - auto request = std::make_unique<HostResolver::RequestInfo>( - HostPortPair(pac_script, 12345)); - interfaces::HostResolverRequestClientPtr dns_client; + auto request = std::make_unique<net::HostResolver::RequestInfo>( + net::HostPortPair(pac_script, 12345)); + net::interfaces::HostResolverRequestClientPtr dns_client; mojo::MakeRequest(&dns_client); client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( - std::make_unique<interfaces::ProxyResolverFactoryRequestClientPtr>( + std::make_unique<mojom::ProxyResolverFactoryRequestClientPtr>( std::move(client))); break; } @@ -459,8 +457,8 @@ } void DeleteResolverFactoryRequestCallback( - std::unique_ptr<ProxyResolverFactory::Request>* request, - const CompletionCallback& callback, + std::unique_ptr<net::ProxyResolverFactory::Request>* request, + const net::CompletionCallback& callback, int result) { ASSERT_TRUE(request); EXPECT_TRUE(request->get()); @@ -468,47 +466,47 @@ callback.Run(result); } -class MockHostResolver : public HostResolver { +class MockHostResolver : public net::HostResolver { public: enum Event { DNS_REQUEST, }; - // HostResolver overrides. + // net::HostResolver overrides. int Resolve(const RequestInfo& info, - RequestPriority priority, - AddressList* addresses, - const CompletionCallback& callback, + net::RequestPriority priority, + net::AddressList* addresses, + const net::CompletionCallback& callback, std::unique_ptr<Request>* request, - const NetLogWithSource& source_net_log) override { + const net::NetLogWithSource& source_net_log) override { waiter_.NotifyEvent(DNS_REQUEST); - return ERR_IO_PENDING; + return net::ERR_IO_PENDING; } int ResolveFromCache(const RequestInfo& info, - AddressList* addresses, - const NetLogWithSource& source_net_log) override { - return ERR_DNS_CACHE_MISS; + net::AddressList* addresses, + const net::NetLogWithSource& source_net_log) override { + return net::ERR_DNS_CACHE_MISS; } - HostCache* GetHostCache() override { return nullptr; } + net::HostCache* GetHostCache() override { return nullptr; } - EventWaiter<Event>& waiter() { return waiter_; } + net::EventWaiter<Event>& waiter() { return waiter_; } private: - EventWaiter<Event> waiter_; + net::EventWaiter<Event> waiter_; }; void CheckCapturedNetLogEntries(const std::string& expected_string, - const TestNetLogEntry::List& entries) { + const net::TestNetLogEntry::List& entries) { ASSERT_EQ(2u, entries.size()); - EXPECT_EQ(NetLogEventType::PAC_JAVASCRIPT_ALERT, entries[0].type); + EXPECT_EQ(net::NetLogEventType::PAC_JAVASCRIPT_ALERT, entries[0].type); std::string message; ASSERT_TRUE(entries[0].GetStringValue("message", &message)); EXPECT_EQ(expected_string, message); ASSERT_FALSE(entries[0].params->HasKey("line_number")); message.clear(); - EXPECT_EQ(NetLogEventType::PAC_JAVASCRIPT_ERROR, entries[1].type); + EXPECT_EQ(net::NetLogEventType::PAC_JAVASCRIPT_ERROR, entries[1].type); ASSERT_TRUE(entries[1].GetStringValue("message", &message)); EXPECT_EQ(expected_string, message); int line_number = 0; @@ -526,7 +524,7 @@ &mock_proxy_resolver_, mojo::MakeRequest(&factory_ptr_))); proxy_resolver_factory_mojo_.reset(new ProxyResolverFactoryMojo( this, &host_resolver_, - base::Callback<std::unique_ptr<ProxyResolverErrorObserver>()>(), + base::Callback<std::unique_ptr<net::ProxyResolverErrorObserver>()>(), &net_log_)); } @@ -536,77 +534,78 @@ std::unique_ptr<base::ScopedClosureRunner> CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> req, - interfaces::ProxyResolverFactoryRequestClientPtr client) override { + mojo::InterfaceRequest<mojom::ProxyResolver> req, + mojom::ProxyResolverFactoryRequestClientPtr client) override { factory_ptr_->CreateResolver(pac_script, std::move(req), std::move(client)); return std::make_unique<base::ScopedClosureRunner>( on_delete_callback_.closure()); } - ProxyInfo ProxyServersFromPacString(const std::string& pac_string) { - ProxyInfo proxy_info; + net::ProxyInfo ProxyServersFromPacString(const std::string& pac_string) { + net::ProxyInfo proxy_info; proxy_info.UsePacString(pac_string); return proxy_info; } void CreateProxyResolver() { mock_proxy_resolver_factory_->AddCreateProxyResolverAction( - CreateProxyResolverAction::ReturnResult(kScriptData, OK)); - TestCompletionCallback callback; - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; + CreateProxyResolverAction::ReturnResult(kScriptData, net::OK)); + net::TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; ASSERT_EQ( - OK, + net::OK, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_TRUE(request); ASSERT_TRUE(proxy_resolver_mojo_); } - void DeleteProxyResolverCallback(const CompletionCallback& callback, + void DeleteProxyResolverCallback(const net::CompletionCallback& callback, int result) { proxy_resolver_mojo_.reset(); callback.Run(result); } + base::test::ScopedTaskEnvironment task_environment_; MockHostResolver host_resolver_; - TestNetLog net_log_; + net::TestNetLog net_log_; std::unique_ptr<MockMojoProxyResolverFactory> mock_proxy_resolver_factory_; - interfaces::ProxyResolverFactoryPtr factory_ptr_; - std::unique_ptr<ProxyResolverFactory> proxy_resolver_factory_mojo_; + mojom::ProxyResolverFactoryPtr factory_ptr_; + std::unique_ptr<net::ProxyResolverFactory> proxy_resolver_factory_mojo_; MockMojoProxyResolver mock_proxy_resolver_; - TestClosure on_delete_callback_; - std::unique_ptr<ProxyResolver> proxy_resolver_mojo_; + net::TestClosure on_delete_callback_; + std::unique_ptr<net::ProxyResolver> proxy_resolver_mojo_; }; TEST_F(ProxyResolverFactoryMojoTest, CreateProxyResolver) { CreateProxyResolver(); - TestNetLogEntry::List entries; + net::TestNetLogEntry::List entries; net_log_.GetEntries(&entries); CheckCapturedNetLogEntries(kScriptData, entries); } TEST_F(ProxyResolverFactoryMojoTest, CreateProxyResolver_Empty) { - TestCompletionCallback callback; - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8("")); - std::unique_ptr<ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8("")); + std::unique_ptr<net::ProxyResolverFactory::Request> request; EXPECT_EQ( - ERR_PAC_SCRIPT_FAILED, + net::ERR_PAC_SCRIPT_FAILED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_FALSE(request); } TEST_F(ProxyResolverFactoryMojoTest, CreateProxyResolver_Url) { - TestCompletionCallback callback; - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromURL(GURL(kExampleUrl))); - std::unique_ptr<ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromURL(GURL(kExampleUrl))); + std::unique_ptr<net::ProxyResolverFactory::Request> request; EXPECT_EQ( - ERR_PAC_SCRIPT_FAILED, + net::ERR_PAC_SCRIPT_FAILED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_FALSE(request); @@ -615,14 +614,14 @@ TEST_F(ProxyResolverFactoryMojoTest, CreateProxyResolver_Failed) { mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::ReturnResult(kScriptData, - ERR_PAC_STATUS_NOT_OK)); + net::ERR_PAC_STATUS_NOT_OK)); - TestCompletionCallback callback; - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; EXPECT_EQ( - ERR_PAC_STATUS_NOT_OK, + net::ERR_PAC_STATUS_NOT_OK, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_TRUE(request); @@ -636,12 +635,12 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::DropBoth(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; EXPECT_EQ( - ERR_PAC_SCRIPT_TERMINATED, + net::ERR_PAC_SCRIPT_TERMINATED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_TRUE(request); @@ -651,12 +650,12 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::DropClient(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; EXPECT_EQ( - ERR_PAC_SCRIPT_TERMINATED, + net::ERR_PAC_SCRIPT_TERMINATED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_TRUE(request); @@ -666,12 +665,12 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::DropResolver(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; EXPECT_EQ( - ERR_PAC_SCRIPT_TERMINATED, + net::ERR_PAC_SCRIPT_TERMINATED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, callback.callback(), &request))); EXPECT_TRUE(request); @@ -683,12 +682,12 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::DropResolver(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; EXPECT_EQ( - ERR_PAC_SCRIPT_TERMINATED, + net::ERR_PAC_SCRIPT_TERMINATED, callback.GetResult(proxy_resolver_factory_mojo_->CreateProxyResolver( pac_script, &proxy_resolver_mojo_, base::Bind(&DeleteResolverFactoryRequestCallback, &request, @@ -701,13 +700,14 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::WaitForClientDisconnect(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; - EXPECT_EQ(ERR_IO_PENDING, proxy_resolver_factory_mojo_->CreateProxyResolver( - pac_script, &proxy_resolver_mojo_, - callback.callback(), &request)); + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; + EXPECT_EQ( + net::ERR_IO_PENDING, + proxy_resolver_factory_mojo_->CreateProxyResolver( + pac_script, &proxy_resolver_mojo_, callback.callback(), &request)); ASSERT_TRUE(request); request.reset(); @@ -720,13 +720,14 @@ mock_proxy_resolver_factory_->AddCreateProxyResolverAction( CreateProxyResolverAction::MakeDnsRequest(kScriptData)); - scoped_refptr<ProxyResolverScriptData> pac_script( - ProxyResolverScriptData::FromUTF8(kScriptData)); - std::unique_ptr<ProxyResolverFactory::Request> request; - TestCompletionCallback callback; - EXPECT_EQ(ERR_IO_PENDING, proxy_resolver_factory_mojo_->CreateProxyResolver( - pac_script, &proxy_resolver_mojo_, - callback.callback(), &request)); + scoped_refptr<net::ProxyResolverScriptData> pac_script( + net::ProxyResolverScriptData::FromUTF8(kScriptData)); + std::unique_ptr<net::ProxyResolverFactory::Request> request; + net::TestCompletionCallback callback; + EXPECT_EQ( + net::ERR_IO_PENDING, + proxy_resolver_factory_mojo_->CreateProxyResolver( + pac_script, &proxy_resolver_mojo_, callback.callback(), &request)); ASSERT_TRUE(request); host_resolver_.waiter().WaitForEvent(MockHostResolver::DNS_REQUEST); mock_proxy_resolver_factory_->ClearBlockedClients(); @@ -741,12 +742,12 @@ net_log_.Clear(); std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); EXPECT_THAT(request->WaitForResult(), IsOk()); EXPECT_EQ("DIRECT", request->results().ToPacString()); - TestNetLogEntry::List entries; + net::TestNetLogEntry::List entries; net_log_.GetEntries(&entries); CheckCapturedNetLogEntries(url.spec(), entries); entries.clear(); @@ -763,20 +764,20 @@ CreateProxyResolver(); std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); EXPECT_THAT(request->WaitForResult(), IsOk()); EXPECT_EQ(kPacString, request->results().ToPacString()); } TEST_F(ProxyResolverFactoryMojoTest, GetProxyForURL_Error) { - mock_proxy_resolver_.AddGetProxyAction( - GetProxyForUrlAction::ReturnError(GURL(kExampleUrl), ERR_UNEXPECTED)); + mock_proxy_resolver_.AddGetProxyAction(GetProxyForUrlAction::ReturnError( + GURL(kExampleUrl), net::ERR_UNEXPECTED)); CreateProxyResolver(); std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); - EXPECT_THAT(request->WaitForResult(), IsError(ERR_UNEXPECTED)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); + EXPECT_THAT(request->WaitForResult(), IsError(net::ERR_UNEXPECTED)); EXPECT_TRUE(request->results().is_empty()); } @@ -787,7 +788,7 @@ CreateProxyResolver(); std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); request->Cancel(); EXPECT_FALSE(request->callback().have_result()); @@ -804,10 +805,10 @@ CreateProxyResolver(); std::unique_ptr<Request> request1(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request1->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request1->Resolve(), IsError(net::ERR_IO_PENDING)); std::unique_ptr<Request> request2( MakeRequest(GURL("https://www.chromium.org"))); - EXPECT_THAT(request2->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request2->Resolve(), IsError(net::ERR_IO_PENDING)); EXPECT_THAT(request1->WaitForResult(), IsOk()); EXPECT_THAT(request2->WaitForResult(), IsOk()); @@ -822,8 +823,9 @@ CreateProxyResolver(); { std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); - EXPECT_THAT(request->WaitForResult(), IsError(ERR_PAC_SCRIPT_TERMINATED)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); + EXPECT_THAT(request->WaitForResult(), + IsError(net::ERR_PAC_SCRIPT_TERMINATED)); EXPECT_TRUE(request->results().is_empty()); } @@ -833,7 +835,7 @@ { // Calling GetProxyForURL after a disconnect should fail. std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_PAC_SCRIPT_TERMINATED)); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_PAC_SCRIPT_TERMINATED)); } } @@ -843,9 +845,10 @@ CreateProxyResolver(); std::unique_ptr<Request> request1(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request1->Resolve(), IsError(ERR_IO_PENDING)); + EXPECT_THAT(request1->Resolve(), IsError(net::ERR_IO_PENDING)); - EXPECT_THAT(request1->WaitForResult(), IsError(ERR_PAC_SCRIPT_TERMINATED)); + EXPECT_THAT(request1->WaitForResult(), + IsError(net::ERR_PAC_SCRIPT_TERMINATED)); } TEST_F(ProxyResolverFactoryMojoTest, GetProxyForURL_DeleteInCallback) { @@ -853,12 +856,12 @@ GURL(kExampleUrl), ProxyServersFromPacString("DIRECT"))); CreateProxyResolver(); - ProxyInfo results; - TestCompletionCallback callback; - std::unique_ptr<ProxyResolver::Request> request; - NetLogWithSource net_log; + net::ProxyInfo results; + net::TestCompletionCallback callback; + std::unique_ptr<net::ProxyResolver::Request> request; + net::NetLogWithSource net_log; EXPECT_EQ( - OK, + net::OK, callback.GetResult(proxy_resolver_mojo_->GetProxyForURL( GURL(kExampleUrl), &results, base::Bind(&ProxyResolverFactoryMojoTest::DeleteProxyResolverCallback, @@ -873,12 +876,12 @@ GetProxyForUrlAction::Disconnect(GURL(kExampleUrl))); CreateProxyResolver(); - ProxyInfo results; - TestCompletionCallback callback; - std::unique_ptr<ProxyResolver::Request> request; - NetLogWithSource net_log; + net::ProxyInfo results; + net::TestCompletionCallback callback; + std::unique_ptr<net::ProxyResolver::Request> request; + net::NetLogWithSource net_log; EXPECT_EQ( - ERR_PAC_SCRIPT_TERMINATED, + net::ERR_PAC_SCRIPT_TERMINATED, callback.GetResult(proxy_resolver_mojo_->GetProxyForURL( GURL(kExampleUrl), &results, base::Bind(&ProxyResolverFactoryMojoTest::DeleteProxyResolverCallback, @@ -893,11 +896,12 @@ CreateProxyResolver(); std::unique_ptr<Request> request(MakeRequest(GURL(kExampleUrl))); - EXPECT_THAT(request->Resolve(), IsError(ERR_IO_PENDING)); - EXPECT_EQ(LOAD_STATE_RESOLVING_PROXY_FOR_URL, request->load_state()); + EXPECT_THAT(request->Resolve(), IsError(net::ERR_IO_PENDING)); + EXPECT_EQ(net::LOAD_STATE_RESOLVING_PROXY_FOR_URL, request->load_state()); host_resolver_.waiter().WaitForEvent(MockHostResolver::DNS_REQUEST); - EXPECT_EQ(LOAD_STATE_RESOLVING_HOST_IN_PROXY_SCRIPT, request->load_state()); + EXPECT_EQ(net::LOAD_STATE_RESOLVING_HOST_IN_PROXY_SCRIPT, + request->load_state()); mock_proxy_resolver_.ClearBlockedClients(); request->WaitForResult(); } @@ -907,4 +911,4 @@ proxy_resolver_mojo_.reset(); on_delete_callback_.WaitForResult(); } -} // namespace net +} // namespace proxy_resolver
diff --git a/net/proxy/proxy_service_mojo_unittest.cc b/services/proxy_resolver/proxy_service_mojo_unittest.cc similarity index 64% rename from net/proxy/proxy_service_mojo_unittest.cc rename to services/proxy_resolver/proxy_service_mojo_unittest.cc index be263c6..4d906fe 100644 --- a/net/proxy/proxy_service_mojo_unittest.cc +++ b/services/proxy_resolver/proxy_service_mojo_unittest.cc
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/proxy_service_mojo.h" - #include <algorithm> #include <memory> #include <string> @@ -12,7 +10,9 @@ #include "base/callback_helpers.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" +#include "build/build_config.h" #include "net/base/network_delegate_impl.h" #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" @@ -22,19 +22,21 @@ #include "net/log/test_net_log_entry.h" #include "net/proxy/dhcp_proxy_script_fetcher.h" #include "net/proxy/mock_proxy_script_fetcher.h" -#include "net/proxy/mojo_proxy_resolver_factory.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" -#include "net/proxy/test_mojo_proxy_resolver_factory.h" #include "net/test/event_waiter.h" #include "net/test/gtest_util.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" +#include "services/proxy_resolver/public/cpp/proxy_service_mojo.h" +#include "services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h" +#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" using net::test::IsOk; -namespace net { +namespace content { namespace { @@ -59,18 +61,18 @@ "alert('alert: foo');\n" "throw new Error('error: http://foo');"; -class TestNetworkDelegate : public NetworkDelegateImpl { +class TestNetworkDelegate : public net::NetworkDelegateImpl { public: enum Event { PAC_SCRIPT_ERROR, }; - EventWaiter<Event>& event_waiter() { return event_waiter_; } + net::EventWaiter<Event>& event_waiter() { return event_waiter_; } void OnPACScriptError(int line_number, const base::string16& error) override; private: - EventWaiter<Event> event_waiter_; + net::EventWaiter<Event> event_waiter_; }; void TestNetworkDelegate::OnPACScriptError(int line_number, @@ -81,13 +83,13 @@ std::string::npos); } -void CheckCapturedNetLogEntries(const TestNetLogEntry::List& entries) { +void CheckCapturedNetLogEntries(const net::TestNetLogEntry::List& entries) { ASSERT_GT(entries.size(), 2u); size_t i = 0; // ProxyService records its own NetLog entries, so skip forward until the // expected event type. while (i < entries.size() && - entries[i].type != NetLogEventType::PAC_JAVASCRIPT_ALERT) { + entries[i].type != net::NetLogEventType::PAC_JAVASCRIPT_ALERT) { i++; } ASSERT_LT(i, entries.size()); @@ -97,7 +99,7 @@ ASSERT_FALSE(entries[i].params->HasKey("line_number")); while (i < entries.size() && - entries[i].type != NetLogEventType::PAC_JAVASCRIPT_ERROR) { + entries[i].type != net::NetLogEventType::PAC_JAVASCRIPT_ERROR) { i++; } message.clear(); @@ -108,68 +110,72 @@ EXPECT_EQ(3, line_number); } -class LoggingMockHostResolver : public MockHostResolver { +class LoggingMockHostResolver : public net::MockHostResolver { public: int Resolve(const RequestInfo& info, - RequestPriority priority, - AddressList* addresses, - const CompletionCallback& callback, + net::RequestPriority priority, + net::AddressList* addresses, + const net::CompletionCallback& callback, std::unique_ptr<Request>* out_req, - const NetLogWithSource& net_log) override { - net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_JOB); - return MockHostResolver::Resolve(info, priority, addresses, callback, - out_req, net_log); + const net::NetLogWithSource& net_log) override { + net_log.AddEvent(net::NetLogEventType::HOST_RESOLVER_IMPL_JOB); + return net::MockHostResolver::Resolve(info, priority, addresses, callback, + out_req, net_log); } }; } // namespace class ProxyServiceMojoTest : public testing::Test, - public MojoProxyResolverFactory { + public proxy_resolver::MojoProxyResolverFactory { protected: void SetUp() override { mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4"); - fetcher_ = new MockProxyScriptFetcher; - proxy_service_ = CreateProxyServiceUsingMojoFactory( + fetcher_ = new net::MockProxyScriptFetcher; + proxy_service_ = proxy_resolver::CreateProxyServiceUsingMojoFactory( this, - std::make_unique<ProxyConfigServiceFixed>( - ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl))), - fetcher_, std::make_unique<DoNothingDhcpProxyScriptFetcher>(), + std::make_unique<net::ProxyConfigServiceFixed>( + net::ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl))), + fetcher_, std::make_unique<net::DoNothingDhcpProxyScriptFetcher>(), &mock_host_resolver_, &net_log_, &network_delegate_); } std::unique_ptr<base::ScopedClosureRunner> CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> req, - interfaces::ProxyResolverFactoryRequestClientPtr client) override { - TestMojoProxyResolverFactory::GetInstance()->CreateResolver( - pac_script, std::move(req), std::move(client)); + mojo::InterfaceRequest<proxy_resolver::mojom::ProxyResolver> req, + proxy_resolver::mojom::ProxyResolverFactoryRequestClientPtr client) + override { + test_mojo_proxy_resolver_factory_.CreateResolver(pac_script, std::move(req), + std::move(client)); return std::make_unique<base::ScopedClosureRunner>( on_delete_closure_.closure()); } + base::test::ScopedTaskEnvironment task_environment_; + proxy_resolver::TestMojoProxyResolverFactory + test_mojo_proxy_resolver_factory_; TestNetworkDelegate network_delegate_; LoggingMockHostResolver mock_host_resolver_; - MockProxyScriptFetcher* fetcher_; // Owned by |proxy_service_|. - TestNetLog net_log_; - TestClosure on_delete_closure_; - std::unique_ptr<ProxyService> proxy_service_; + net::MockProxyScriptFetcher* fetcher_; // Owned by |proxy_service_|. + net::TestNetLog net_log_; + net::TestClosure on_delete_closure_; + std::unique_ptr<net::ProxyService> proxy_service_; }; TEST_F(ProxyServiceMojoTest, Basic) { - ProxyInfo info; - TestCompletionCallback callback; - EXPECT_EQ(ERR_IO_PENDING, + net::ProxyInfo info; + net::TestCompletionCallback callback; + EXPECT_EQ(net::ERR_IO_PENDING, proxy_service_->ResolveProxy(GURL("http://foo"), std::string(), &info, callback.callback(), nullptr, - nullptr, NetLogWithSource())); + nullptr, net::NetLogWithSource())); // Proxy script fetcher should have a fetch triggered by the first // |ResolveProxy()| request. EXPECT_TRUE(fetcher_->has_pending_request()); EXPECT_EQ(GURL(kPacUrl), fetcher_->pending_request_url()); - fetcher_->NotifyFetchCompletion(OK, kSimplePacScript); + fetcher_->NotifyFetchCompletion(net::OK, kSimplePacScript); EXPECT_THAT(callback.WaitForResult(), IsOk()); EXPECT_EQ("PROXY foo:1234", info.ToPacString()); @@ -179,10 +185,10 @@ } TEST_F(ProxyServiceMojoTest, DnsResolution) { - ProxyInfo info; - TestCompletionCallback callback; - BoundTestNetLog test_net_log; - EXPECT_EQ(ERR_IO_PENDING, + net::ProxyInfo info; + net::TestCompletionCallback callback; + net::BoundTestNetLog test_net_log; + EXPECT_EQ(net::ERR_IO_PENDING, proxy_service_->ResolveProxy(GURL("http://foo"), std::string(), &info, callback.callback(), nullptr, nullptr, test_net_log.bound())); @@ -191,7 +197,8 @@ // |ResolveProxy()| request. EXPECT_TRUE(fetcher_->has_pending_request()); EXPECT_EQ(GURL(kPacUrl), fetcher_->pending_request_url()); - fetcher_->NotifyFetchCompletion(OK, kDnsResolvePacScript); + + fetcher_->NotifyFetchCompletion(net::OK, kDnsResolvePacScript); EXPECT_THAT(callback.WaitForResult(), IsOk()); EXPECT_EQ("QUIC bar:4321", info.ToPacString()); @@ -199,21 +206,22 @@ proxy_service_.reset(); on_delete_closure_.WaitForResult(); - TestNetLogEntry::List entries; + net::TestNetLogEntry::List entries; test_net_log.GetEntries(&entries); // There should be one entry with type TYPE_HOST_RESOLVER_IMPL_JOB. - EXPECT_EQ(1, std::count_if(entries.begin(), entries.end(), - [](const TestNetLogEntry& entry) { - return entry.type == - NetLogEventType::HOST_RESOLVER_IMPL_JOB; - })); + EXPECT_EQ(1, + std::count_if(entries.begin(), entries.end(), + [](const net::TestNetLogEntry& entry) { + return entry.type == + net::NetLogEventType::HOST_RESOLVER_IMPL_JOB; + })); } TEST_F(ProxyServiceMojoTest, Error) { - ProxyInfo info; - TestCompletionCallback callback; - BoundTestNetLog test_net_log; - EXPECT_EQ(ERR_IO_PENDING, + net::ProxyInfo info; + net::TestCompletionCallback callback; + net::BoundTestNetLog test_net_log; + EXPECT_EQ(net::ERR_IO_PENDING, proxy_service_->ResolveProxy(GURL("http://foo"), std::string(), &info, callback.callback(), nullptr, nullptr, test_net_log.bound())); @@ -222,7 +230,7 @@ // |ResolveProxy()| request. EXPECT_TRUE(fetcher_->has_pending_request()); EXPECT_EQ(GURL(kPacUrl), fetcher_->pending_request_url()); - fetcher_->NotifyFetchCompletion(OK, kThrowingPacScript); + fetcher_->NotifyFetchCompletion(net::OK, kThrowingPacScript); network_delegate_.event_waiter().WaitForEvent( TestNetworkDelegate::PAC_SCRIPT_ERROR); @@ -231,7 +239,7 @@ EXPECT_EQ("DIRECT", info.ToPacString()); EXPECT_EQ(0u, mock_host_resolver_.num_resolve()); - TestNetLogEntry::List entries; + net::TestNetLogEntry::List entries; test_net_log.GetEntries(&entries); CheckCapturedNetLogEntries(entries); entries.clear(); @@ -240,18 +248,18 @@ } TEST_F(ProxyServiceMojoTest, ErrorOnInitialization) { - ProxyInfo info; - TestCompletionCallback callback; - EXPECT_EQ(ERR_IO_PENDING, + net::ProxyInfo info; + net::TestCompletionCallback callback; + EXPECT_EQ(net::ERR_IO_PENDING, proxy_service_->ResolveProxy(GURL("http://foo"), std::string(), &info, callback.callback(), nullptr, - nullptr, NetLogWithSource())); + nullptr, net::NetLogWithSource())); // Proxy script fetcher should have a fetch triggered by the first // |ResolveProxy()| request. EXPECT_TRUE(fetcher_->has_pending_request()); EXPECT_EQ(GURL(kPacUrl), fetcher_->pending_request_url()); - fetcher_->NotifyFetchCompletion(OK, kThrowingOnLoadPacScript); + fetcher_->NotifyFetchCompletion(net::OK, kThrowingOnLoadPacScript); network_delegate_.event_waiter().WaitForEvent( TestNetworkDelegate::PAC_SCRIPT_ERROR); @@ -260,9 +268,9 @@ EXPECT_EQ("DIRECT", info.ToPacString()); EXPECT_EQ(0u, mock_host_resolver_.num_resolve()); - TestNetLogEntry::List entries; + net::TestNetLogEntry::List entries; net_log_.GetEntries(&entries); CheckCapturedNetLogEntries(entries); } -} // namespace net +} // namespace content
diff --git a/services/proxy_resolver/public/cpp/BUILD.gn b/services/proxy_resolver/public/cpp/BUILD.gn new file mode 100644 index 0000000..a71fcb80 --- /dev/null +++ b/services/proxy_resolver/public/cpp/BUILD.gn
@@ -0,0 +1,40 @@ +# 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. + +import("//mojo/public/tools/bindings/mojom.gni") + +source_set("cpp_browser") { + sources = [ + "mojo_proxy_resolver_factory.h", + "proxy_service_mojo.cc", + "proxy_service_mojo.h", + ] + + public_deps = [ + "//services/proxy_resolver/public/interfaces", + "//services/service_manager/public/cpp", + ] + + deps = [ + "//net:net_browser_services", + "//services/proxy_resolver:lib_browser", + ] +} + +source_set("cpp_utility") { + sources = [ + # TODO(jcivelli): move these files to services/proxy_resolver once + # servicification is done and they don't need to be exposed. + "mojo_proxy_resolver_factory_impl.cc", + "mojo_proxy_resolver_factory_impl.h", + "test_mojo_proxy_resolver_factory.cc", + "test_mojo_proxy_resolver_factory.h", + ] + + deps = [ + ":cpp_browser", + "//net:net_with_v8", + "//services/proxy_resolver:lib_utility", + ] +}
diff --git a/services/proxy_resolver/public/cpp/DEPS b/services/proxy_resolver/public/cpp/DEPS new file mode 100644 index 0000000..595e9c04 --- /dev/null +++ b/services/proxy_resolver/public/cpp/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+net", +] \ No newline at end of file
diff --git a/services/proxy_resolver/public/cpp/OWNERS b/services/proxy_resolver/public/cpp/OWNERS new file mode 100644 index 0000000..22a9c64 --- /dev/null +++ b/services/proxy_resolver/public/cpp/OWNERS
@@ -0,0 +1,4 @@ +per-file *_struct_traits*.*=set noparent +per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS
diff --git a/net/proxy/mojo_proxy_resolver_factory.h b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h similarity index 63% rename from net/proxy/mojo_proxy_resolver_factory.h rename to services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h index ef92426..2ec4d7b5 100644 --- a/net/proxy/mojo_proxy_resolver_factory.h +++ b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h
@@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_H_ -#define NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_H_ +#ifndef SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_H_ +#define SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_H_ +#include <map> #include <memory> +#include <string> #include "base/callback_helpers.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "net/interfaces/host_resolver_service.mojom.h" -#include "net/interfaces/proxy_resolver_service.mojom.h" +#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" -namespace net { +namespace proxy_resolver { // Factory for connecting to Mojo ProxyResolver services. class MojoProxyResolverFactory { @@ -23,13 +25,13 @@ // Note: The connection request |req| may be resolved asynchronously. virtual std::unique_ptr<base::ScopedClosureRunner> CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> req, - interfaces::ProxyResolverFactoryRequestClientPtr client) = 0; + mojo::InterfaceRequest<mojom::ProxyResolver> req, + mojom::ProxyResolverFactoryRequestClientPtr client) = 0; protected: virtual ~MojoProxyResolverFactory() = default; }; -} // namespace net +} // namespace proxy_resolver -#endif // NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_H_ +#endif // SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_H_
diff --git a/net/proxy/mojo_proxy_resolver_factory_impl.cc b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.cc similarity index 60% rename from net/proxy/mojo_proxy_resolver_factory_impl.cc rename to services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.cc index c663011..c99a4ad 100644 --- a/net/proxy/mojo_proxy_resolver_factory_impl.cc +++ b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h" #include <string> #include <utility> @@ -11,20 +11,20 @@ #include "base/memory/ptr_util.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "net/base/net_errors.h" -#include "net/proxy/mojo_proxy_resolver_impl.h" #include "net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h" #include "net/proxy/proxy_resolver_factory.h" #include "net/proxy/proxy_resolver_v8_tracing.h" +#include "services/proxy_resolver/mojo_proxy_resolver_impl.h" -namespace net { +namespace proxy_resolver { class MojoProxyResolverFactoryImpl::Job { public: Job(MojoProxyResolverFactoryImpl* parent, - const scoped_refptr<ProxyResolverScriptData>& pac_script, - ProxyResolverV8TracingFactory* proxy_resolver_factory, - mojo::InterfaceRequest<interfaces::ProxyResolver> request, - interfaces::ProxyResolverFactoryRequestClientPtr client); + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + net::ProxyResolverV8TracingFactory* proxy_resolver_factory, + mojo::InterfaceRequest<mojom::ProxyResolver> request, + mojom::ProxyResolverFactoryRequestClientPtr client); ~Job(); private: @@ -34,21 +34,21 @@ void OnProxyResolverCreated(int error); MojoProxyResolverFactoryImpl* const parent_; - std::unique_ptr<ProxyResolverV8Tracing> proxy_resolver_impl_; - mojo::InterfaceRequest<interfaces::ProxyResolver> proxy_request_; - ProxyResolverV8TracingFactory* factory_; + std::unique_ptr<net::ProxyResolverV8Tracing> proxy_resolver_impl_; + mojo::InterfaceRequest<mojom::ProxyResolver> proxy_request_; + net::ProxyResolverV8TracingFactory* factory_; std::unique_ptr<net::ProxyResolverFactory::Request> request_; - interfaces::ProxyResolverFactoryRequestClientPtr client_ptr_; + mojom::ProxyResolverFactoryRequestClientPtr client_ptr_; DISALLOW_COPY_AND_ASSIGN(Job); }; MojoProxyResolverFactoryImpl::Job::Job( MojoProxyResolverFactoryImpl* factory, - const scoped_refptr<ProxyResolverScriptData>& pac_script, - ProxyResolverV8TracingFactory* proxy_resolver_factory, - mojo::InterfaceRequest<interfaces::ProxyResolver> request, - interfaces::ProxyResolverFactoryRequestClientPtr client) + const scoped_refptr<net::ProxyResolverScriptData>& pac_script, + net::ProxyResolverV8TracingFactory* proxy_resolver_factory, + mojo::InterfaceRequest<mojom::ProxyResolver> request, + mojom::ProxyResolverFactoryRequestClientPtr client) : parent_(factory), proxy_request_(std::move(request)), factory_(proxy_resolver_factory), @@ -58,8 +58,8 @@ base::Unretained(this))); factory_->CreateProxyResolverV8Tracing( pac_script, - std::make_unique<MojoProxyResolverV8TracingBindings< - interfaces::ProxyResolverFactoryRequestClient>>(client_ptr_.get()), + std::make_unique<net::MojoProxyResolverV8TracingBindings< + mojom::ProxyResolverFactoryRequestClient>>(client_ptr_.get()), &proxy_resolver_impl_, base::Bind(&MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated, base::Unretained(this)), @@ -69,12 +69,12 @@ MojoProxyResolverFactoryImpl::Job::~Job() = default; void MojoProxyResolverFactoryImpl::Job::OnConnectionError() { - client_ptr_->ReportResult(ERR_PAC_SCRIPT_TERMINATED); + client_ptr_->ReportResult(net::ERR_PAC_SCRIPT_TERMINATED); parent_->RemoveJob(this); } void MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { - if (error == OK) { + if (error == net::OK) { mojo::MakeStrongBinding(std::make_unique<MojoProxyResolverImpl>( std::move(proxy_resolver_impl_)), std::move(proxy_request_)); @@ -84,25 +84,25 @@ } MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( - std::unique_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory) + std::unique_ptr<net::ProxyResolverV8TracingFactory> proxy_resolver_factory) : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)) {} MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl() - : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create()) {} + : MojoProxyResolverFactoryImpl( + net::ProxyResolverV8TracingFactory::Create()) {} -MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { -} +MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() {} void MojoProxyResolverFactoryImpl::CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> request, - interfaces::ProxyResolverFactoryRequestClientPtr client) { + mojo::InterfaceRequest<mojom::ProxyResolver> request, + mojom::ProxyResolverFactoryRequestClientPtr client) { // The Job will call RemoveJob on |this| when either the create request // finishes or |request| or |client| encounters a connection error. - std::unique_ptr<Job> job = - std::make_unique<Job>(this, ProxyResolverScriptData::FromUTF8(pac_script), - proxy_resolver_impl_factory_.get(), - std::move(request), std::move(client)); + std::unique_ptr<Job> job = std::make_unique<Job>( + this, net::ProxyResolverScriptData::FromUTF8(pac_script), + proxy_resolver_impl_factory_.get(), std::move(request), + std::move(client)); Job* job_ptr = job.get(); jobs_[job_ptr] = std::move(job); } @@ -113,4 +113,4 @@ jobs_.erase(it); } -} // namespace net +} // namespace proxy_resolver
diff --git a/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h new file mode 100644 index 0000000..06fac3f --- /dev/null +++ b/services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h
@@ -0,0 +1,50 @@ +// Copyright 2015 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 SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_ +#define SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_ + +#include <map> + +#include "base/callback.h" +#include "base/macros.h" +#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" + +namespace net { +class ProxyResolverV8TracingFactory; +} // namespace net + +namespace proxy_resolver { + +class MojoProxyResolverFactoryImpl : public mojom::ProxyResolverFactory { + public: + MojoProxyResolverFactoryImpl(); + explicit MojoProxyResolverFactoryImpl( + std::unique_ptr<net::ProxyResolverV8TracingFactory> + proxy_resolver_factory); + + ~MojoProxyResolverFactoryImpl() override; + + // mojom::ProxyResolverFactory override. + void CreateResolver( + const std::string& pac_script, + mojom::ProxyResolverRequest request, + mojom::ProxyResolverFactoryRequestClientPtr client) override; + + private: + class Job; + + void RemoveJob(Job* job); + + const std::unique_ptr<net::ProxyResolverV8TracingFactory> + proxy_resolver_impl_factory_; + + std::map<Job*, std::unique_ptr<Job>> jobs_; + + DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverFactoryImpl); +}; + +} // namespace proxy_resolver + +#endif // SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver.typemap b/services/proxy_resolver/public/cpp/proxy_resolver.typemap new file mode 100644 index 0000000..c1c3be4 --- /dev/null +++ b/services/proxy_resolver/public/cpp/proxy_resolver.typemap
@@ -0,0 +1,22 @@ +# Copyright 2016 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. + +mojom = "//services/proxy_resolver/public/interfaces/proxy_resolver.mojom" +public_headers = [ + "//net/proxy/proxy_server.h", + "//net/proxy/proxy_info.h", +] +traits_headers = + [ "//services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.h" ] +sources = [ + "//services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.cc", +] +type_mappings = [ + "proxy_resolver.mojom.ProxyInfo=net::ProxyInfo", + "proxy_resolver.mojom.ProxyServer=net::ProxyServer", + "proxy_resolver.mojom.ProxyServer::Scheme=net::ProxyScheme", +] +public_deps = [ + "//net", +]
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.cc b/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.cc new file mode 100644 index 0000000..8f1a5fb --- /dev/null +++ b/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.cc
@@ -0,0 +1,124 @@ +// Copyright 2015 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 "services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.h" + +#include "base/logging.h" +#include "net/base/host_port_pair.h" +#include "net/proxy/proxy_info.h" +#include "net/proxy/proxy_server.h" + +namespace mojo { + +proxy_resolver::mojom::ProxyScheme +EnumTraits<proxy_resolver::mojom::ProxyScheme, + net::ProxyServer::Scheme>::ToMojom(net::ProxyServer::Scheme scheme) { + using net::ProxyServer; + switch (scheme) { + case ProxyServer::SCHEME_INVALID: + return proxy_resolver::mojom::ProxyScheme::INVALID; + case ProxyServer::SCHEME_DIRECT: + return proxy_resolver::mojom::ProxyScheme::DIRECT; + case ProxyServer::SCHEME_HTTP: + return proxy_resolver::mojom::ProxyScheme::HTTP; + case ProxyServer::SCHEME_SOCKS4: + return proxy_resolver::mojom::ProxyScheme::SOCKS4; + case ProxyServer::SCHEME_SOCKS5: + return proxy_resolver::mojom::ProxyScheme::SOCKS5; + case ProxyServer::SCHEME_HTTPS: + return proxy_resolver::mojom::ProxyScheme::HTTPS; + case ProxyServer::SCHEME_QUIC: + return proxy_resolver::mojom::ProxyScheme::QUIC; + } + NOTREACHED(); + return proxy_resolver::mojom::ProxyScheme::INVALID; +} + +bool EnumTraits<proxy_resolver::mojom::ProxyScheme, net::ProxyServer::Scheme>:: + FromMojom(proxy_resolver::mojom::ProxyScheme scheme, + net::ProxyServer::Scheme* out) { + using net::ProxyServer; + switch (scheme) { + case proxy_resolver::mojom::ProxyScheme::INVALID: + *out = ProxyServer::SCHEME_INVALID; + return true; + case proxy_resolver::mojom::ProxyScheme::DIRECT: + *out = ProxyServer::SCHEME_DIRECT; + return true; + case proxy_resolver::mojom::ProxyScheme::HTTP: + *out = ProxyServer::SCHEME_HTTP; + return true; + case proxy_resolver::mojom::ProxyScheme::SOCKS4: + *out = ProxyServer::SCHEME_SOCKS4; + return true; + case proxy_resolver::mojom::ProxyScheme::SOCKS5: + *out = ProxyServer::SCHEME_SOCKS5; + return true; + case proxy_resolver::mojom::ProxyScheme::HTTPS: + *out = ProxyServer::SCHEME_HTTPS; + return true; + case proxy_resolver::mojom::ProxyScheme::QUIC: + *out = ProxyServer::SCHEME_QUIC; + return true; + } + return false; +} + +base::StringPiece +StructTraits<proxy_resolver::mojom::ProxyServerDataView, + net::ProxyServer>::host(const net::ProxyServer& s) { + if (s.scheme() == net::ProxyServer::SCHEME_DIRECT || + s.scheme() == net::ProxyServer::SCHEME_INVALID) { + return base::StringPiece(); + } + return s.host_port_pair().host(); +} + +uint16_t StructTraits<proxy_resolver::mojom::ProxyServerDataView, + net::ProxyServer>::port(const net::ProxyServer& s) { + if (s.scheme() == net::ProxyServer::SCHEME_DIRECT || + s.scheme() == net::ProxyServer::SCHEME_INVALID) { + return 0; + } + return s.host_port_pair().port(); +} + +bool StructTraits< + proxy_resolver::mojom::ProxyServerDataView, + net::ProxyServer>::Read(proxy_resolver::mojom::ProxyServerDataView data, + net::ProxyServer* out) { + net::ProxyServer::Scheme scheme; + if (!data.ReadScheme(&scheme)) + return false; + + base::StringPiece host; + if (!data.ReadHost(&host)) + return false; + + if ((scheme == net::ProxyServer::SCHEME_DIRECT || + scheme == net::ProxyServer::SCHEME_INVALID) && + (!host.empty() || data.port())) { + return false; + } + + *out = net::ProxyServer(scheme, + net::HostPortPair(host.as_string(), data.port())); + return true; +} + +bool StructTraits<proxy_resolver::mojom::ProxyInfoDataView, net::ProxyInfo>:: + Read(proxy_resolver::mojom::ProxyInfoDataView data, net::ProxyInfo* out) { + std::vector<net::ProxyServer> proxy_servers; + if (!data.ReadProxyServers(&proxy_servers)) + return false; + + net::ProxyList proxy_list; + for (const auto& server : proxy_servers) + proxy_list.AddProxyServer(server); + + out->UseProxyList(proxy_list); + return true; +} + +} // namespace mojo
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.h b/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.h new file mode 100644 index 0000000..f9000922 --- /dev/null +++ b/services/proxy_resolver/public/cpp/proxy_resolver_struct_traits.h
@@ -0,0 +1,60 @@ +// Copyright 2015 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 SERVICES_PROXY_RESOLVER_PUBLIC_CPP_PROXY_RESOLVER_STRUCT_TRAITS_H_ +#define SERVICES_PROXY_RESOLVER_PUBLIC_CPP_PROXY_RESOLVER_STRUCT_TRAITS_H_ + +#include "base/strings/string_piece.h" +#include "mojo/public/cpp/bindings/enum_traits.h" +#include "mojo/public/cpp/bindings/struct_traits.h" +#include "net/base/host_port_pair.h" +#include "net/proxy/proxy_info.h" +#include "net/proxy/proxy_list.h" +#include "net/proxy/proxy_server.h" +#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" + +namespace net { +class ProxyInfo; +class ProxyServer; +} // namespace net + +namespace mojo { + +template <> +struct EnumTraits<proxy_resolver::mojom::ProxyScheme, + net::ProxyServer::Scheme> { + static proxy_resolver::mojom::ProxyScheme ToMojom( + net::ProxyServer::Scheme scheme); + static bool FromMojom(proxy_resolver::mojom::ProxyScheme scheme, + net::ProxyServer::Scheme* out); +}; + +template <> +struct StructTraits<proxy_resolver::mojom::ProxyServerDataView, + net::ProxyServer> { + static net::ProxyServer::Scheme scheme(const net::ProxyServer& s) { + return s.scheme(); + } + + static base::StringPiece host(const net::ProxyServer& s); + static uint16_t port(const net::ProxyServer& s); + + static bool Read(proxy_resolver::mojom::ProxyServerDataView data, + net::ProxyServer* out); +}; + +template <> +struct StructTraits<proxy_resolver::mojom::ProxyInfoDataView, net::ProxyInfo> { + static const std::vector<net::ProxyServer>& proxy_servers( + const net::ProxyInfo& info) { + return info.proxy_list().GetAll(); + } + + static bool Read(proxy_resolver::mojom::ProxyInfoDataView data, + net::ProxyInfo* out); +}; + +} // namespace mojo + +#endif // SERVICES_PROXY_RESOLVER_PUBLIC_CPP_PROXY_RESOLVER_STRUCT_TRAITS_H_
diff --git a/services/proxy_resolver/public/cpp/proxy_service_mojo.cc b/services/proxy_resolver/public/cpp/proxy_service_mojo.cc new file mode 100644 index 0000000..a6ee8ab --- /dev/null +++ b/services/proxy_resolver/public/cpp/proxy_service_mojo.cc
@@ -0,0 +1,51 @@ +// Copyright 2015 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 "services/proxy_resolver/public/cpp/proxy_service_mojo.h" + +#include <memory> +#include <utility> + +#include "base/logging.h" +#include "base/memory/ptr_util.h" +#include "base/threading/thread_task_runner_handle.h" +#include "net/dns/mojo_host_resolver_impl.h" +#include "net/proxy/network_delegate_error_observer.h" +#include "net/proxy/proxy_resolver_factory.h" +#include "net/proxy/proxy_service.h" +#include "services/proxy_resolver/proxy_resolver_factory_mojo.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" + +namespace proxy_resolver { + +std::unique_ptr<net::ProxyService> CreateProxyServiceUsingMojoFactory( + MojoProxyResolverFactory* mojo_proxy_factory, + std::unique_ptr<net::ProxyConfigService> proxy_config_service, + net::ProxyScriptFetcher* proxy_script_fetcher, + std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher, + net::HostResolver* host_resolver, + net::NetLog* net_log, + net::NetworkDelegate* network_delegate) { + DCHECK(proxy_config_service); + DCHECK(proxy_script_fetcher); + DCHECK(dhcp_proxy_script_fetcher); + DCHECK(host_resolver); + + std::unique_ptr<net::ProxyService> proxy_service(new net::ProxyService( + std::move(proxy_config_service), + std::make_unique<ProxyResolverFactoryMojo>( + mojo_proxy_factory, host_resolver, + base::Bind(&net::NetworkDelegateErrorObserver::Create, + network_delegate, base::ThreadTaskRunnerHandle::Get()), + net_log), + net_log)); + + // Configure fetchers to use for PAC script downloads and auto-detect. + proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, + std::move(dhcp_proxy_script_fetcher)); + + return proxy_service; +} + +} // namespace proxy_resolver
diff --git a/net/proxy/proxy_service_mojo.h b/services/proxy_resolver/public/cpp/proxy_service_mojo.h similarity index 65% rename from net/proxy/proxy_service_mojo.h rename to services/proxy_resolver/public/cpp/proxy_service_mojo.h index 403b9de..2887fdb 100644 --- a/net/proxy/proxy_service_mojo.h +++ b/services/proxy_resolver/public/cpp/proxy_service_mojo.h
@@ -2,22 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_PROXY_PROXY_SERVICE_MOJO_H_ -#define NET_PROXY_PROXY_SERVICE_MOJO_H_ +#ifndef SERVICES_PROX_RESOLVER_PUBLIC_CPP_PROXY_SERVICE_MOJO_H_ +#define SERVICES_PROX_RESOLVER_PUBLIC_CPP_PROXY_SERVICE_MOJO_H_ #include <memory> #include "net/proxy/dhcp_proxy_script_fetcher.h" namespace net { - class HostResolver; -class MojoProxyResolverFactory; class NetLog; class NetworkDelegate; class ProxyConfigService; class ProxyScriptFetcher; class ProxyService; +} // namespace net + +namespace proxy_resolver { + +class MojoProxyResolverFactory; // Creates a proxy service that uses |mojo_proxy_factory| to create and connect // to a Mojo proxy resolver service. This proxy service polls @@ -32,15 +35,15 @@ // |host_resolver| points to the host resolving dependency the PAC script // should use for any DNS queries. It must remain valid throughout the // lifetime of the ProxyService. -std::unique_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( +std::unique_ptr<net::ProxyService> CreateProxyServiceUsingMojoFactory( MojoProxyResolverFactory* mojo_proxy_factory, - std::unique_ptr<ProxyConfigService> proxy_config_service, - ProxyScriptFetcher* proxy_script_fetcher, - std::unique_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher, - HostResolver* host_resolver, - NetLog* net_log, - NetworkDelegate* network_delegate); + std::unique_ptr<net::ProxyConfigService> proxy_config_service, + net::ProxyScriptFetcher* proxy_script_fetcher, + std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher, + net::HostResolver* host_resolver, + net::NetLog* net_log, + net::NetworkDelegate* network_delegate); -} // namespace net +} // namespace proxy_resolver -#endif // NET_PROXY_PROXY_SERVICE_MOJO_H_ +#endif // SERVICES_PROX_RESOLVER_PUBLIC_CPP_PROXY_SERVICE_MOJO_H_
diff --git a/net/proxy/test_mojo_proxy_resolver_factory.cc b/services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.cc similarity index 65% rename from net/proxy/test_mojo_proxy_resolver_factory.cc rename to services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.cc index 0d83277..04b84a88 100644 --- a/net/proxy/test_mojo_proxy_resolver_factory.cc +++ b/services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.cc
@@ -2,23 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/proxy/test_mojo_proxy_resolver_factory.h" +#include "services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h" #include "base/memory/ptr_util.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory_impl.h" -namespace net { - -TestMojoProxyResolverFactory* TestMojoProxyResolverFactory::GetInstance() { - return base::Singleton<TestMojoProxyResolverFactory>::get(); -} +namespace proxy_resolver { std::unique_ptr<base::ScopedClosureRunner> TestMojoProxyResolverFactory::CreateResolver( const std::string& pac_script, - mojo::InterfaceRequest<interfaces::ProxyResolver> req, - interfaces::ProxyResolverFactoryRequestClientPtr client) { + mojo::InterfaceRequest<mojom::ProxyResolver> req, + mojom::ProxyResolverFactoryRequestClientPtr client) { resolver_created_ = true; factory_->CreateResolver(pac_script, std::move(req), std::move(client)); return nullptr; @@ -31,4 +27,4 @@ TestMojoProxyResolverFactory::~TestMojoProxyResolverFactory() = default; -} // namespace net +} // namespace proxy_resolver
diff --git a/services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h b/services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h new file mode 100644 index 0000000..d7c045d --- /dev/null +++ b/services/proxy_resolver/public/cpp/test_mojo_proxy_resolver_factory.h
@@ -0,0 +1,41 @@ +// 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 SERVICES_PROXY_RESOLVER_PUBLIC_CPP_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ +#define SERVICES_PROXY_RESOLVER_PUBLIC_CPP_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ + +#include <memory> +#include <string> + +#include "base/macros.h" +#include "services/proxy_resolver/public/cpp/mojo_proxy_resolver_factory.h" + +namespace proxy_resolver { + +// MojoProxyResolverFactory that runs PAC scripts in-process, for tests. +class TestMojoProxyResolverFactory : public MojoProxyResolverFactory { + public: + TestMojoProxyResolverFactory(); + ~TestMojoProxyResolverFactory() override; + + // Returns true if CreateResolver was called. + bool resolver_created() const { return resolver_created_; } + + // Overridden from MojoProxyResolverFactory: + std::unique_ptr<base::ScopedClosureRunner> CreateResolver( + const std::string& pac_script, + mojo::InterfaceRequest<mojom::ProxyResolver> req, + mojom::ProxyResolverFactoryRequestClientPtr client) override; + + private: + mojom::ProxyResolverFactoryPtr factory_; + + bool resolver_created_ = false; + + DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory); +}; + +} // namespace proxy_resolver + +#endif // SERVICES_PROXY_RESOLVER_PUBLIC_CPP_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
diff --git a/services/proxy_resolver/public/cpp/typemaps.gni b/services/proxy_resolver/public/cpp/typemaps.gni new file mode 100644 index 0000000..babbad44 --- /dev/null +++ b/services/proxy_resolver/public/cpp/typemaps.gni
@@ -0,0 +1,5 @@ +# 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. + +typemaps = [ "//services/proxy_resolver/public/cpp/proxy_resolver.typemap" ]
diff --git a/services/proxy_resolver/public/interfaces/BUILD.gn b/services/proxy_resolver/public/interfaces/BUILD.gn new file mode 100644 index 0000000..e1e610e --- /dev/null +++ b/services/proxy_resolver/public/interfaces/BUILD.gn
@@ -0,0 +1,16 @@ +# 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. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("interfaces") { + sources = [ + "proxy_resolver.mojom", + ] + deps = [ + "//mojo/common:common_custom_types", + "//net/interfaces", + "//url/mojo:url_mojom_gurl", + ] +}
diff --git a/services/proxy_resolver/public/interfaces/OWNERS b/services/proxy_resolver/public/interfaces/OWNERS new file mode 100644 index 0000000..065863ca --- /dev/null +++ b/services/proxy_resolver/public/interfaces/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/net/interfaces/proxy_resolver_service.mojom b/services/proxy_resolver/public/interfaces/proxy_resolver.mojom similarity index 80% rename from net/interfaces/proxy_resolver_service.mojom rename to services/proxy_resolver/public/interfaces/proxy_resolver.mojom index ff343de9..39919b6ac 100644 --- a/net/interfaces/proxy_resolver_service.mojom +++ b/services/proxy_resolver/public/interfaces/proxy_resolver.mojom
@@ -5,9 +5,9 @@ // Put Mojo definitions into their own namespace to avoid collisions with C++ // definitions. // TODO(amistry): Resolve the conflict between these two sets of definitions. -module net.interfaces; +module proxy_resolver.mojom; -import "host_resolver_service.mojom"; +import "net/interfaces/host_resolver_service.mojom"; import "url/mojo/url.mojom"; // Mirror of net::ProxyServer::Scheme. @@ -46,8 +46,8 @@ Alert(string error); OnError(int32 line_number, string error); - ResolveDns(HostResolverRequestInfo request_info, - HostResolverRequestClient client); + ResolveDns(net.interfaces.HostResolverRequestInfo request_info, + net.interfaces.HostResolverRequestClient client); }; interface ProxyResolverFactory { @@ -62,6 +62,6 @@ Alert(string error); OnError(int32 line_number, string error); - ResolveDns(HostResolverRequestInfo request_info, - HostResolverRequestClient client); + ResolveDns(net.interfaces.HostResolverRequestInfo request_info, + net.interfaces.HostResolverRequestClient client); };
diff --git a/testing/libfuzzer/coverage.py b/testing/libfuzzer/coverage.py index b0e7e703..b9a20d1c 100755 --- a/testing/libfuzzer/coverage.py +++ b/testing/libfuzzer/coverage.py
@@ -12,6 +12,9 @@ import subprocess import sys +import SimpleHTTPServer +import SocketServer + HELP_MESSAGE = """ This script helps to generate code coverage report. It uses Clang Source-based Code coverage (https://clang.llvm.org/docs/SourceBasedCodeCoverage.html). @@ -67,6 +70,9 @@ ZERO_FUNCTION_FILE_TEXT = 'Files which contain no functions' +HTTP_PORT = 9000 +COVERAGE_REPORT_LINK = 'http://127.0.0.1:%d/report.html' % HTTP_PORT + def CheckBuildInstrumentation(executable_path): """Verify that the given file has been built with coverage instrumentation.""" @@ -300,6 +306,22 @@ file_handle.write(report) +def ServeReportOnHTTP(output_directory): + """Serve report directory on HTTP.""" + os.chdir(output_directory) + + SocketServer.TCPServer.allow_reuse_address = True + httpd = SocketServer.TCPServer(('', HTTP_PORT), + SimpleHTTPServer.SimpleHTTPRequestHandler) + print('Load coverage report using %s. Press Ctrl+C to exit.' % + COVERAGE_REPORT_LINK) + + try: + httpd.serve_forever() + except KeyboardInterrupt: + httpd.server_close() + + def ProcessCoverageDump(profile_file, coverage_file): """Process and convert raw LLVM profile data into coverage data format.""" print('Processing coverage dump and generating visualization.') @@ -370,6 +392,7 @@ args = parser.parse_args() executable_path = args.command.split()[0] + CheckBuildInstrumentation(executable_path) DownloadCoverageToolsIfNeeded() @@ -384,9 +407,9 @@ GenerateSummary(executable_path, args.output, coverage_file) GenerateSources(executable_path, args.output, args.source, coverage_file) - print('Done. The next steps would be:\n' - '1. cd %s && python -m SimpleHTTPServer\n' - '2. open http://127.0.0.1:8000/report.html' % args.output) + ServeReportOnHTTP(args.output) + + print('Done.') if __name__ == '__main__':
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 9b0e2a5..ab7b979f 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -5045,41 +5045,6 @@ crbug.com/591099 fast/lists/anonymous-items.html [ Crash Failure ] crbug.com/591099 fast/lists/big-list-marker.html [ Crash Failure ] crbug.com/591099 fast/lists/calc-width-with-space.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-052.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-053.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-054.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-055.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-056.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-057.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-058.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-059.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-060.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-061.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-062.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-063.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-064.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-065.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-066.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-071.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-072.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-073.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-074.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-075.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-076.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-077.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-078.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-079.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-080.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-081.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-082.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-083.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-084.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-085.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-086.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-087.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-088.html [ Failure Pass ] -crbug.com/591099 fast/lists/css3-counter-styles-089.html [ Failure Pass ] -crbug.com/591099 fast/lists/decimal-leading-zero.html [ Failure Pass ] crbug.com/591099 fast/lists/drag-into-marker.html [ Failure ] crbug.com/591099 fast/lists/dynamic-marker-crash.html [ Crash Failure ] crbug.com/591099 fast/lists/inline-before-content-after-list-marker.html [ Failure ] @@ -5087,7 +5052,6 @@ crbug.com/591099 fast/lists/item-not-in-list-line-wrapping.html [ Failure Pass ] crbug.com/591099 fast/lists/li-br.html [ Crash Failure ] crbug.com/591099 fast/lists/li-style-alpha-huge-value-crash.html [ Crash Failure ] -crbug.com/591099 fast/lists/li-values.html [ Failure Pass ] crbug.com/591099 fast/lists/list-color-change-no-layout.html [ Failure Pass ] crbug.com/591099 fast/lists/list-item-line-height.html [ Failure ] crbug.com/591099 fast/lists/list-marker-before-content-table.html [ Failure ] @@ -5098,19 +5062,16 @@ crbug.com/591099 fast/lists/list-marker-padding-overflow-hidden-rtl.html [ Failure ] crbug.com/591099 fast/lists/list-marker-padding-overflow-hidden.html [ Failure ] crbug.com/591099 fast/lists/list-marker-with-line-height.html [ Crash Failure ] -crbug.com/591099 fast/lists/list-style-type-dynamic-change.html [ Failure Pass ] crbug.com/591099 fast/lists/marker-before-empty-inline.html [ Crash Failure ] crbug.com/591099 fast/lists/marker-image-error.html [ Crash Failure ] crbug.com/591099 fast/lists/marker-preferred-margins.html [ Failure Pass ] crbug.com/591099 fast/lists/markers-in-selection.html [ Crash Failure ] crbug.com/591099 fast/lists/numeric-markers-outside-list.html [ Failure ] crbug.com/591099 fast/lists/ol-display-types.html [ Crash Failure ] -crbug.com/591099 fast/lists/ol-nested-items-dynamic-insert.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-nested-items-dynamic-remove.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-nested-items.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-nested-list-dynamic-insert.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-nested-list-dynamic-remove.html [ Failure Pass ] -crbug.com/591099 fast/lists/ol-nested-list.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-reversed-dynamic-simple.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-reversed-dynamic.html [ Failure Pass ] crbug.com/591099 fast/lists/ol-reversed-nested-items.html [ Failure Pass ] @@ -5121,13 +5082,10 @@ crbug.com/591099 fast/lists/ol-start-parsing.html [ Failure ] crbug.com/591099 fast/lists/olstart.html [ Failure ] crbug.com/591099 fast/lists/ordered-list-with-no-ol-tag.html [ Crash Failure ] -crbug.com/591099 fast/lists/positioned-count-crash.html [ Failure Pass ] crbug.com/591099 fast/lists/scrolled-marker-paint.html [ Failure Pass ] crbug.com/591099 fast/lists/w3-css3-list-styles-alphabetic.html [ Failure Pass Timeout ] crbug.com/591099 fast/lists/w3-css3-list-styles-fallback-style.html [ Failure Pass ] crbug.com/591099 fast/lists/w3-css3-list-styles-numeric.html [ Failure Pass Timeout ] -crbug.com/591099 fast/lists/w3-css3-lower-armenian.html [ Failure Pass ] -crbug.com/591099 fast/lists/w3-css3-upper-armenian.html [ Failure Pass ] crbug.com/591099 fast/lists/w3-list-styles.html [ Failure Pass ] crbug.com/591099 fast/loader/child-frame-add-after-back-forward.html [ Failure Timeout ] crbug.com/591099 fast/loader/frame-creation-removal.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService index 194cccf..399753f 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
@@ -95,8 +95,6 @@ Bug(none) external/wpt/service-workers/service-worker/invalid-header.https.html [ Crash ] Bug(none) external/wpt/service-workers/service-worker/iso-latin1-header.https.html [ Crash ] crbug.com/771118 external/wpt/service-workers/service-worker/mime-sniffing.https.html [ Failure ] -Bug(none) external/wpt/service-workers/service-worker/navigation-redirect-to-http.https.html [ Failure ] -Bug(none) external/wpt/service-workers/service-worker/navigation-redirect.https.html [ Timeout ] Bug(none) external/wpt/service-workers/service-worker/opaque-response-preloaded.https.html [ Failure ] Bug(none) external/wpt/service-workers/service-worker/redirected-response.https.html [ Failure ] Bug(none) external/wpt/service-workers/service-worker/register-link-header.https.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 index 10246923..ba60c22 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
@@ -1113,6 +1113,7 @@ Bug(none) paint/invalidation/compositing/overlap-test-with-filter.html [ Failure ] Bug(none) paint/invalidation/compositing/should-not-repaint-composited-descendants.html [ Failure ] Bug(none) paint/invalidation/filter-repaint-accelerated-child-with-filter-child.html [ Failure ] +Bug(none) paint/invalidation/video-paint-invalidation.html [ Failure ] # Raster invalidation for background on scrolling contents layer. crbug.com/732611 paint/invalidation/overflow-scroll-local-background-text-color-change.html [ Failure ] @@ -1289,7 +1290,6 @@ crbug.com/768102 compositing/overflow/reparented-overlay-scrollbars-should-respect-ancestor-clip.html [ Crash ] crbug.com/644358 fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html [ Failure ] -crbug.com/644358 paint/invalidation/video-paint-invalidation.html [ Crash ] Bug(none) compositing/layer-creation/main-thread-scrolling-for-non-composited-fixed-position-if-overflow-hidden.html [ Failure ] Bug(none) compositing/layer-creation/main-thread-scrolling-for-non-composited-fixed-position.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index ddd4f0c..d0d53e48 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1535,7 +1535,6 @@ crbug.com/610464 [ Linux Win7 Debug ] http/tests/devtools/components/throttler.html [ Failure Pass ] crbug.com/667560 [ Linux Win7 Debug ] virtual/mojo-loading/http/tests/devtools/components/throttler.html [ Failure Pass ] -crbug.com/654477 paint/invalidation/video-paint-invalidation.html [ Failure Crash ] crbug.com/654477 [ Win ] compositing/video/video-controls-layer-creation.html [ Pass Failure ] crbug.com/654477 fast/hidpi/video-controls-in-hidpi.html [ Failure ] crbug.com/654477 fast/layers/video-layer.html [ Failure ] @@ -2446,6 +2445,7 @@ crbug.com/670024 external/wpt/webmessaging/broadcastchannel/sandbox.html [ Failure ] crbug.com/660384 external/wpt/webmessaging/with-ports/001.html [ Failure ] crbug.com/660384 external/wpt/webmessaging/without-ports/001.html [ Failure ] +crbug.com/673526 external/wpt/webmessaging/message-channels/close.html [ Failure ] # Added 2016-12-12 crbug.com/610835 http/tests/security/XFrameOptions/x-frame-options-deny-multiple-clients.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html index ffbb923..e91f4d6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => Promise.all([ service.getCharacteristic('temperature_measurement'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-characteristic-is-removed.html index 5a5f48a..a4f80124 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-characteristic-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-blocklisted.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-blocklisted.html index 5e775e3..c161263 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-blocklisted.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-blocklisted.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-before.html index 2b7a188..41579b2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-error.html index f8ad4e9..cd92b26 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-success.html index 13d714e..dca12e4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-before.html index 59ab7ef..8fed0a5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-error.html index eb722199..d98ed16 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-success.html index 4a3a2fc3..b5b7397 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-error.html index 345b104..c6960a61 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-success.html index 7c2b585..d23deff 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html index b72e66e..a4cf9f6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getMeasurementIntervalCharacteristic() .then(({characteristic}) => Promise.all([ characteristic.getDescriptor(user_description.alias),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-invalid-name.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-invalid-name.html index 7eec2c2..30074cd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-invalid-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-invalid-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-device-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-device-out-of-range.html index b8cf4823..9818e27 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-device-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-device-out-of-range.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-service-is-removed.html index b07fbc4..cbcd19a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-service-is-removed.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed-with-uuid.html index 010c43d..e462b2e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed.html index 12def36..df766a3e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-blocklisted.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-blocklisted.html index e86d3ba..09e5a18 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-blocklisted.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-blocklisted.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before-with-uuid.html index 82d7d31..e0e80c7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before.html index 6554c33e..88c917f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error-with-uuid.html index 4077589..1eb24bfe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error.html index e5bb627c..31fe60c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success-with-uuid.html index c38c309..9aedbc6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success.html index 5deed54..244fc1dd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before-with-uuid.html index d2a57489..0645311 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before.html index 83e5d36..b166e95c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error-with-uuid.html index 92aad9f..e15fbbb7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error.html index 6b12d65..24873ac8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success-with-uuid.html index f9d1411b..22a7df7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success.html index f830182..a4dc4d0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error-with-uuid.html index accbc406..f5dba26 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error.html index 1dfee88..042f0fe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success-with-uuid.html index 0beee57..f35c075 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success.html index e836870..b34adcb3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-get-same-object.html index be92299..c6e95ab 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getMeasurementIntervalCharacteristic() .then(({characteristic}) => Promise.all([ characteristic.getDescriptors(user_description.alias),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-invalid-name.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-invalid-name.html index 29e16ef0..64c7421 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-invalid-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-descriptor-invalid-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range-with-uuid.html index def99fb..fab6d73 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range-with-uuid.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range.html index d35adf4..7d082f9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-device-out-of-range.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed-with-uuid.html index e426af9..edef28a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed-with-uuid.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed.html index e426af9..edef28a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/gen-service-is-removed.html
@@ -3,12 +3,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-characteristic-is-removed.html index ed145985..605b843 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-characteristic-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-before.html index 2494e258..1cbc58e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-error.html index 384488b..ccc7660 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-success.html index 7d687e2..83a545b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-error.html index 3130160..5575f8e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringFailureGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-success.html index 59d9cc5..3c801cba 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-device-reconnects-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringSuccessGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-before.html index 32d61ba..d9272d0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-error.html index 0c9e648..9a2d8c8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-success.html index b16fe18..510a3ffb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-error.html index 5376d4a4..bda30148 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-success.html index 8252acd..30cb918 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-error.html index bdbb069..8c2c575 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationFailsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-success.html index 146e8e9..eecdb12f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/gen-gatt-op-reconnect-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationSucceedsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-from-2-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-from-2-characteristics.html index 98abc5e1..1180c07 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-from-2-characteristics.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-from-2-characteristics.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-object.html index 9027464..635347af 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/service-same-object.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-characteristic-is-removed.html index c963e0e5..5a9de24 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-characteristic-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-before.html index a8559011..bcb7c15 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-error.html index 83581d3..4743cc050 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-success.html index 2685881..ff53dc28 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-error.html index 286601e..27684f6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringFailureGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-success.html index 92b3525..92adf35 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-device-reconnects-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringSuccessGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-before.html index b920f94..8098232f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-error.html index c0a7326..ccaba043 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-success.html index 8592e38..4a61cef 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-error.html index 32e5d9e..7ad544d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-success.html index 56623b5..ab315030 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-error.html index c4f8fc5..d3a9dc1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationFailsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-success.html index 5584dcf7..7d87e6730 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/startNotifications/gen-gatt-op-reconnect-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationSucceedsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-before.html index f37122a..d9be7f3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-during-success.html index f45d216..11f19cf 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-before.html index 8f5e94c..1bc535a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-during-success.html index 3afc0e1..03a03d2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-garbage-collection-ran-during-success.html index 0bed95de..22359eaf 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/gen-gatt-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-characteristic-is-removed.html index 0ac4b8bb..db26108 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-characteristic-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-before.html index f7eea07..186efea 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-error.html index d588061..4dc3edf0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-success.html index c4f6fb8..63845c3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-error.html index 0199364..6a8deae1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringFailureGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-success.html index aae2709f..2cc1633 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-device-reconnects-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringSuccessGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-before.html index 316cf2d..b6022d4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-error.html index 9f224833..966ee98 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-success.html index f56a6b1..bdcba7cd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-error.html index 6271337..99218ba5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-success.html index d79b3ee..d51023d4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-error.html index d29214bf..71b622d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationFailsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-success.html index 0a56b383..d8bf916dc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/gen-gatt-op-reconnect-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationSucceedsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-from-2-descriptors.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-from-2-descriptors.html index fe0222a..56c6bbb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-from-2-descriptors.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-from-2-descriptors.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-object.html index e2815a8a..58ea019b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/characteristic-same-object.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-descriptor-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-descriptor-is-removed.html index 624273901..655ca69 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-descriptor-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-descriptor-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-device-goes-out-of-range.html index a84de5bcd..be52854 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-device-goes-out-of-range.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then( () => requestDeviceWithKeyDown(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-before.html index bc75923..2ce4b08 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-error.html index 39d7c26..84b65d61 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-success.html index 1b26a8a..fca601f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-error.html index bf0b4e4..e0d748f2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-success.html index f512790..0235629 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-device-reconnects-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-before.html index 6aa9e89c..1113afa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-error.html index 6b861674..df14168 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-success.html index d1db6ba..508cb1f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-fails.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-fails.html index 505702b..526860b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-fails.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-error.html index 42fdb3e..c3f11469 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-success.html index 831fbc9..8a79dcdb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-error.html index 2ecbfe54..66b2ff0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-success.html index 30f5afb8..95f272a8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-io-op-reconnect-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-service-is-removed.html index 1b88b4c5..3971c3a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/gen-service-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-descriptor-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-descriptor-is-removed.html index b76c53f..e684225 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-descriptor-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-descriptor-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-before.html index 7ab7345..0298ef2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-error.html index ccb9b93..acb8b4c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-success.html index df10b36..8869a2b5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-error.html index 8ffced0..85ff3b0b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-success.html index 5780d862..c81613a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-device-reconnects-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-before.html index d9e1fed..7748345 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-error.html index 4a11cbe..352c91759 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-success.html index 5f882fe..eb93a1c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-fails.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-fails.html index d2ff1e91..254a6a6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-fails.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-error.html index 7b9e4c4..4866d42 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-success.html index cecb93ad..d214dff 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-error.html index 72f48679..69b9163a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-error.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-success.html index be7e5e5..3bbc215 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-io-op-reconnect-during-success.html
@@ -3,10 +3,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-service-is-removed.html index 242912e..6815c7d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/gen-service-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html b/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html index 34198a4..5d8aefa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html +++ b/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html
@@ -2,8 +2,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; const test_desc_idl = 'BluetoothDevice IDL test.'; @@ -16,7 +14,7 @@ const test_desc_attr = 'BluetoothDevice attributes.'; let device; -promise_test(() => getHealthThermometerDevice() +bluetooth_test(() => getHealthThermometerDevice() .then(_ => ({device} = _)) .then(() => { assert_equals(device.constructor.name, 'BluetoothDevice');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-filter.html index 842f01b..5c61f0d1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-filter.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setUpPreconnectedDevice({ knownServiceUUIDs: ['human_interface_device']}) .then(() => assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html index 2b9fef68..c658ddc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/blocklisted-service-in-optionalServices.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/consumes-user-gesture.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/consumes-user-gesture.html index 33ff28f..5a405f7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/consumes-user-gesture.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/consumes-user-gesture.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setUpHealthThermometerAndHeartRateDevices() .then(() => callWithKeyDown(() => { var first = navigator.bluetooth.requestDevice({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/correct-filters.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/correct-filters.html index 2ce5791..77784dd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/correct-filters.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/correct-filters.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { // The work of this test is done in the ScanFilterCheckingAdapter. It asserts // that this requestDevice() call tells the platform to scan for only devices // that include the Battery, Glucose, or Heart Rate services.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html index 3d3f657..ba44261 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('FailStartDiscoveryAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-succeeds.html index c6ae4d1..4d22952 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-succeeds.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let devices = []; let push = device => devices.push(device); // We can't use Promise.all() because Chrome will always close
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html index df73a9c4..b6d97a33 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html
@@ -83,7 +83,7 @@ }] }]; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => { let test_promises = Promise.resolve();
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html index 7df8590..f84d8c8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html
@@ -46,7 +46,7 @@ }] }]; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => { let test_promises = Promise.resolve();
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/le-not-supported.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/le-not-supported.html index aaf9289c..417d9d5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/le-not-supported.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/le-not-supported.html
@@ -1,12 +1,10 @@ <!DOCTYPE html> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> -<script src="../../resources/mojo-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return navigator.bluetooth.test.setLESupported(false) .then(() => promise_rejects(t, 'NotFoundError', requestDeviceWithKeyDown({acceptAllDevices: true})));
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-empty-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-empty-filter.html index 8e417f0c..cd3e5d7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-empty-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-empty-filter.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/mojo-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setUpPreconnectedDevice({name: ''}) .then(() => requestDeviceWithKeyDown({filters: [{name: ''}]})) .then(device => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-prefix-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-prefix-filter.html index a70e9307..a687243 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-prefix-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-prefix-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-wrong-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-wrong-filter.html index c2aae5592..c535c2c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-wrong-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-name-wrong-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-service-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-service-filter.html index c08a30b..474c8ab 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-service-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-device-from-service-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-filter.html index 0cfd7ef..90cbf55ef6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-empty-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-empty-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-empty-filter.html index 0bbdfe8..13d6016 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-empty-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-empty-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('NoNameHeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-prefix-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-prefix-filter.html index f3972a62..5949d050 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-prefix-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-prefix-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('NoNameHeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-wrong-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-wrong-filter.html index aadf8c6..c4eb406 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-wrong-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-name-wrong-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('NoNameHeartRateAdapter') .then(() => promise_rejects( t, 'NotFoundError', requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-service-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-service-filter.html index 288502a..ba72d22a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-service-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/name-missing-device-from-service-filter.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('NoNameHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/no-devices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/no-devices.html index ab898e2..7d80ba9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/no-devices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/no-devices.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('EmptyAdapter') .then(() => assert_promise_rejects_with_message( requestDeviceWithKeyDown({filters: [{services: ['generic_access']}]}),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/not-processing-user-gesture.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/not-processing-user-gesture.html index 4eab362e..5314abba 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/not-processing-user-gesture.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/not-processing-user-gesture.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setUpHealthThermometerAndHeartRateDevices() .then(() => promise_rejects( t, 'SecurityError', navigator.bluetooth.requestDevice({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-not-present.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-not-present.html index bc40f589..2017c93 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-not-present.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-not-present.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/mojo-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return navigator.bluetooth.test.simulateCentral({state: 'absent'}) .then(() => assert_promise_rejects_with_message( requestDeviceWithKeyDown({filters: [{services: ['generic_access']}]}),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-off.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-off.html index 6fe0caa..508068b2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-off.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/radio-off.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/mojo-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { setBluetoothManualChooser(true); let requestDevicePromise = navigator.bluetooth.test.simulateCentral({state: 'powered-off'})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/request-from-iframe.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/request-from-iframe.html index 83ca1ced..06a3e925 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/request-from-iframe.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/request-from-iframe.html
@@ -2,8 +2,6 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; const test_desc = 'Concurrent requestDevice calls in iframes work.'; @@ -12,7 +10,7 @@ iframes.push(document.createElement('iframe')); } -promise_test(() => setUpHealthThermometerAndHeartRateDevices() +bluetooth_test(() => setUpHealthThermometerAndHeartRateDevices() // 1. Load the iframes. .then(() => new Promise(resolve => { let numMessages = 0;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/same-device.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/same-device.html index 4b464539..0248257 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/same-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/same-device.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let devices = []; let push = device => devices.push(device);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-single-service.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-single-service.html index 0647036..082ad24 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-single-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-single-service.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setUpHealthThermometerAndHeartRateDevices() .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-fails.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-fails.html index 5f20fab..a7e2cf71 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-fails.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { // Both devices support the Heart Rate service, but things need to // support both services to pass the filter, and neither has a Battery // service.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-succeeds.html index bf375dd..671dc2d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/single-filter-two-services-succeeds.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['glucose', 'tx_power']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/two-filters.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/two-filters.html index abfb36d4..ff53193 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/two-filters.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/two-filters.html
@@ -4,7 +4,7 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['battery_service']},
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/base_test_template.html b/third_party/WebKit/LayoutTests/bluetooth/script-tests/base_test_template.html index 4f52e63c..e4a3ad2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/base_test_template.html +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/base_test_template.html
@@ -3,8 +3,6 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> TEST </script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/characteristic-is-removed.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/characteristic-is-removed.js index 33b19043..7c4ba75 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/characteristic-is-removed.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/characteristic-is-removed.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let fake_peripheral, characteristic, fake_characteristic; return getMeasurementIntervalCharacteristic() .then(_ => ({fake_peripheral, characteristic, fake_characteristic} = _))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-blocklisted.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-blocklisted.js index ef6232f..d023076 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-blocklisted.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-blocklisted.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-before.js index 5aae9be..5a414a7a4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-error.js index 8538ac93..a928dfae 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-success.js index 65c85cd..da5adb58 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-device-disconnects-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-before.js index fce3bec..fde6ce5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-error.js index 13b4015..6b0acf2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-success.js index 3fa30d0..784330d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-disconnect-called-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-error.js index 8b27f1b7..7f86bad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-success.js index f81df1a..7674a55 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-garbage-collection-ran-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js index 247fd17..a8777cd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getMeasurementIntervalCharacteristic() .then(({characteristic}) => Promise.all([ characteristic.CALLS([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-invalid-name.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-invalid-name.js index 9c25ecd..49404266 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-invalid-name.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-invalid-name.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/device-out-of-range.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/device-out-of-range.js index 83d9ac4..1f957bc3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/device-out-of-range.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/device-out-of-range.js
@@ -1,6 +1,6 @@ // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-before.js index 29f1689f9..6f5f40b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-error.js index 019373f..2c99a32 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-success.js index 026f2a7b9..b95cfe10 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-disconnects-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-error.js index c597253..93454eb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-error.js
@@ -1,4 +1,4 @@ -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringFailureGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-success.js index 8f27c2c..11b5026 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-device-reconnects-during-success.js
@@ -1,4 +1,4 @@ -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringSuccessGATTOperationAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-before.js index 6b347c2..c156b4a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-error.js index 0e4428a7..8969e444 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-success.js index ac26b9ef..4fb63ec 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-disconnect-called-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-error.js index 82c4a6b..6955a30 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-success.js index 57340d4..9847c4c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-garbage-collection-ran-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-error.js index fe48ddf..9a1e9288 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-error.js
@@ -1,4 +1,4 @@ -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationFailsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-success.js index 5885178..a2f8026 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/gatt-op-reconnect-during-success.js
@@ -1,4 +1,4 @@ -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('GATTOperationSucceedsAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/service-is-removed.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/service-is-removed.js index 55cea43..9ef01ff6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/service-is-removed.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/service-is-removed.js
@@ -1,6 +1,6 @@ // TODO(672127) Use this test case to test the rest of characteristic functions. 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/descriptor-is-removed.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/descriptor-is-removed.js index 968115be..2fc2ae3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/descriptor-is-removed.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/descriptor-is-removed.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/device-goes-out-of-range.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/device-goes-out-of-range.js index ea193f02..aa16a80 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/device-goes-out-of-range.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/device-goes-out-of-range.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then( () => requestDeviceWithKeyDown(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-before.js index 9502f94..1e6b897 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-error.js index a207141..6b39b29 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-success.js index 0a800aa..057b497 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-disconnects-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-error.js index 3cf6fe7..03859a7af 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-error.js
@@ -1,4 +1,4 @@ -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-success.js index 2a000181..090f01d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-device-reconnects-during-success.js
@@ -1,4 +1,4 @@ -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-before.js index 2c1cb53..879e71dc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-error.js index be299a0f..b1f75a70 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-success.js index c702a63..814a8ad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-disconnect-called-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-fails.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-fails.js index f9121af61..a7071f9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-fails.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-fails.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-error.js index dc5155d5..258c9ed 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-success.js index c231842..5d1797bc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-garbage-collection-ran-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); let promise;
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-error.js index e7803f7..09e696fd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-error.js
@@ -1,4 +1,4 @@ -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-success.js index 4bb793e..dffdb4f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/io-op-reconnect-during-success.js
@@ -1,4 +1,4 @@ -promise_test( +bluetooth_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/service-is-removed.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/service-is-removed.js index d3486db..95b76d1e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/service-is-removed.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor/service-is-removed.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-no-permission-present-service.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-no-permission-present-service.js index 304bd65..2d3be033 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-no-permission-present-service.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-no-permission-present-service.js
@@ -4,7 +4,7 @@ '\'optionalServices\' in requestDevice() ' + 'options. https://goo.gl/HxfxSQ', 'SecurityError'); -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-service-found.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-service-found.js index ffd187e..7445f81 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-service-found.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/delayed-discovery-service-found.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-before.js index d38ca4a..c04b5e98 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-error.js index d28f1f88..09519f4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-success.js index c464ca5..3e39d00 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during.js index b9de628..2bca47b9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-during.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-invalidates-objects.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-invalidates-objects.js index 6bc6b1d..810196a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-invalidates-objects.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-invalidates-objects.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-goes-out-of-range.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-goes-out-of-range.js index 3ade940e..577feaf3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-goes-out-of-range.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-goes-out-of-range.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-error.js index 0a706261..8413ed01 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-success.js index fbb0e8a..137d8fe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-reconnects-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-before.js index 1c93f99..0bf2b07 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-error.js index 4dafb7b0..5771a40 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerDevice() .then(({device}) => { let promise = assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-success.js index 722a04b..9702328 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-called-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-invalidates-objects.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-invalidates-objects.js index 3367d92..8513e340 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-invalidates-objects.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-invalidates-objects.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnected-device.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnected-device.js index e1d66cb..0eb8be36 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnected-device.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnected-device.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-no-permission-absent-service.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-no-permission-absent-service.js index cba08269..529432a0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-no-permission-absent-service.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-no-permission-absent-service.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-service-not-found.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-service-not-found.js index 39f8376..bdf66b31 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-service-not-found.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/discovery-complete-service-not-found.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-error.js index 7ae3837..73e75426 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getEmptyHealthThermometerDevice() .then(({device}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-success.js index f03a204..37c7c38 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/garbage-collection-ran-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-different-service-after-reconnection.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-different-service-after-reconnection.js index e18bc2aa..49c27ac 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-different-service-after-reconnection.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-different-service-after-reconnection.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-same-object.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-same-object.js index 10d440f..f3a5ce0ac 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-same-object.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/get-same-object.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/invalid-service-name.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/invalid-service-name.js index 5205b5c..e09988e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/invalid-service-name.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/invalid-service-name.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice() .then(({device}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-absent-service.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-absent-service.js index 061ff09..98001e3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-absent-service.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-absent-service.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-for-any-service.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-for-any-service.js index 41286232..59c3580 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-for-any-service.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-for-any-service.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({acceptAllDevices: true}) .then(({device}) => assert_promise_rejects_with_message( device.gatt.CALLS([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-present-service.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-present-service.js index eb9dc48c1..d3c98841 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-present-service.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/no-permission-present-service.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-error.js index e512e23..f5c0519a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-error.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-success.js index bab0e4e2..cc2719c0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/reconnect-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/service-not-found.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/service-not-found.js index 888aee2..78edfa3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/service-not-found.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/server/service-not-found.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/blocklisted-characteristic.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/blocklisted-characteristic.js index c4de902bf..49de0165 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/blocklisted-characteristic.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/blocklisted-characteristic.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHIDDevice({filters: [{services: ['device_information']}]}) .then(({device}) => device.gatt.getPrimaryService('device_information')) .then(service => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/characteristic-not-found.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/characteristic-not-found.js index 4bbb3db..99fff39 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/characteristic-not-found.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/characteristic-not-found.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerService() .then(({service}) => assert_promise_rejects_with_message( service.CALLS([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-before.js index b83d2471..f5fa3f5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-during.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-during.js index 0fe50a5d..c571dd2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-during.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-during.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-invalidates-objects.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-invalidates-objects.js index 666fb54..c9727ac 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-invalidates-objects.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-disconnects-invalidates-objects.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-goes-out-of-range.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-goes-out-of-range.js index 361d003..1b3f552 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-goes-out-of-range.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/device-goes-out-of-range.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-before.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-before.js index c69428746..7542ebe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-before.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-before.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-during.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-during.js index 9a805a5..f197bad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-during.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-called-during.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-invalidates-objects.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-invalidates-objects.js index 10061f10..78cde8c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-invalidates-objects.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/disconnect-invalidates-objects.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-error.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-error.js index 4bd88a5d2..5431603 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-error.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-error.js
@@ -2,7 +2,7 @@ let test_desc = 'Garbage Collection ran during FUNCTION_NAME call that ' + 'fails. Should not crash'; let func_promise; -promise_test(() => getHealthThermometerService() +bluetooth_test(() => getHealthThermometerService() .then(({service}) => { func_promise = assert_promise_rejects_with_message( service.CALLS([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-success.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-success.js index 46e7b63f..01b30bb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-success.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/garbage-collection-ran-during-success.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/get-same-object.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/get-same-object.js index c33952e..2c965cd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/get-same-object.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/get-same-object.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => Promise.all([ service.CALLS([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/invalid-characteristic-name.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/invalid-characteristic-name.js index 74c1e9db..6bf7faa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/invalid-characteristic-name.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/invalid-characteristic-name.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/reconnect-during.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/reconnect-during.js index 21e824f..122ef9fe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/reconnect-during.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/reconnect-during.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { let device, service; return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: [health_thermometer.name]}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/service-is-removed.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/service-is-removed.js index 7a76d533..319d08b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/service-is-removed.js +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service/service-is-removed.js
@@ -1,5 +1,5 @@ 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-succeeds.html index 78067cb6..cd16463a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-succeeds.html
@@ -2,11 +2,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/device-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/server/device-same-object.html index f1aa39cc..f7235c0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/device-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/device-same-object.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-no-permission-present-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-no-permission-present-service.html index a69fa9f..e2edddeb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-no-permission-present-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-no-permission-present-service.html
@@ -3,8 +3,6 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let expected = new DOMException('Origin is not allowed to access the ' + @@ -12,7 +10,7 @@ '\'optionalServices\' in requestDevice() ' + 'options. https://goo.gl/HxfxSQ', 'SecurityError'); -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-service-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-service-found.html index abc2b4c..7a79664 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-service-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-delayed-discovery-service-found.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-before.html index 2267c42..28c3f72 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-error.html index f58f55d..e60628e1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-success.html index 5d8acf4d..cea3ac6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during.html index ca0ea53..3f22b40 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-invalidates-objects.html index 394681d..bdae76c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-disconnects-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-goes-out-of-range.html index ba048df8..b49791ff 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-goes-out-of-range.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-error.html index c75d6a8..ca07b48 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-success.html index 1d50247..4e5c5d1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-device-reconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-before.html index 86e704f..156bceff 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-error.html index b4fbe18..7468698 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerDevice() .then(({device}) => { let promise = assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-success.html index 9adb4ca6..74f51d4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-invalidates-objects.html index eb20948..8db1ffe 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnect-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnected-device.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnected-device.html index 938b159b..80947fe1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnected-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-disconnected-device.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-no-permission-absent-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-no-permission-absent-service.html index 1659be5..19d0801 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-no-permission-absent-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-no-permission-absent-service.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-service-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-service-not-found.html index 962c713..65f5978 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-service-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-discovery-complete-service-not-found.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-error.html index ae48249..aa3eb06d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getEmptyHealthThermometerDevice() .then(({device}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-success.html index d275cea..20dbaad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-different-service-after-reconnection.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-different-service-after-reconnection.html index 69411a5b..a6b7df99 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-different-service-after-reconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-different-service-after-reconnection.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-same-object.html index 3783693f2..007e95e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-invalid-service-name.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-invalid-service-name.html index 722be1a..802ae1b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-invalid-service-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-invalid-service-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice() .then(({device}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-absent-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-absent-service.html index 88362fe..104f1b2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-absent-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-absent-service.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-for-any-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-for-any-service.html index 7301f20..25909669 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-for-any-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-for-any-service.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({acceptAllDevices: true}) .then(({device}) => assert_promise_rejects_with_message( device.gatt.getPrimaryService('heart_rate'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-present-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-present-service.html index d5e841c..ff63a9a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-present-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-no-permission-present-service.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-error.html index e405627..3bae9206 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-success.html index f9fcb0e1..e0a1b332 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-reconnect-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-service-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-service-not-found.html index d7290ba..b629accb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-service-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/gen-service-not-found.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-no-permission-present-service-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-no-permission-present-service-with-uuid.html index da6061e..df946943 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-no-permission-present-service-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-no-permission-present-service-with-uuid.html
@@ -3,8 +3,6 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let expected = new DOMException('Origin is not allowed to access the ' + @@ -12,7 +10,7 @@ '\'optionalServices\' in requestDevice() ' + 'options. https://goo.gl/HxfxSQ', 'SecurityError'); -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found-with-uuid.html index 54cf8121..f9b839aa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found.html index 154f3bd..cad9958 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-delayed-discovery-service-found.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before-with-uuid.html index 814105f..876980b1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before.html index 1494385..9863c66 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-error-with-uuid.html index cce8d22..8059a24 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success-with-uuid.html index 47214136..a45c78a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success.html index e86d053..550478a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(t => { +bluetooth_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-with-uuid.html index 751d2f36..d329a5f3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during.html index 72ac2a4b..196576d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects-with-uuid.html index fdc9876..6ed303a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects.html index 63dd666..144c659b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-disconnects-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range-with-uuid.html index 7848521..ad169955 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range.html index 3f49a3203..014d9d2a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-goes-out-of-range.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-error-with-uuid.html index 02349bd..12cd378 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success-with-uuid.html index 88560a7..58fed68b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success.html index ea72327..88034c6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-device-reconnects-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingDuringServiceRetrievalAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before-with-uuid.html index f5354b89..8e4bce9a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before.html index 2c19bda2..5f4ccfd8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error-with-uuid.html index 01017a2..03c4a1e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerDevice() .then(({device}) => { let promise = assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error.html index 1e11f89..2972d6ab 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerDevice() .then(({device}) => { let promise = assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success-with-uuid.html index a6c7211..28f258e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success.html index 523c668..06e7dc2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-called-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects-with-uuid.html index 26b6589f..f5661c2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects.html index 62a1165..ebd2752 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnect-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device-with-uuid.html index 202df7ec..14149c48 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device.html index e327868..5da2b68c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-disconnected-device.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getDiscoveredHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-no-permission-absent-service-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-no-permission-absent-service-with-uuid.html index 2d341428..dc9bfb5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-no-permission-absent-service-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-no-permission-absent-service-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-service-not-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-service-not-found-with-uuid.html index 84e5bcef..ce7db1af7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-service-not-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-discovery-complete-service-not-found-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error-with-uuid.html index ae626b2..5aaa7f74 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getEmptyHealthThermometerDevice() .then(({device}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error.html index 4d50a5c..567cd427 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-error.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getEmptyHealthThermometerDevice() .then(({device}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success-with-uuid.html index 58f9f534..5a14b846 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success.html index 05983aa..cdaa0f0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection-with-uuid.html index 6bb3339..4e58415 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection.html index 230c7485..748f1292 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-different-service-after-reconnection.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object-with-uuid.html index 5f56fe0..72ceacf 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object.html index 1685f6f..802c77dd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-invalid-service-name.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-invalid-service-name.html index ce17288..fabd6caa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-invalid-service-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-invalid-service-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice() .then(({device}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-absent-service-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-absent-service-with-uuid.html index ce19ff45..dfbb3732 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-absent-service-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-absent-service-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service-with-uuid.html index e6e5be02..2c26275 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({acceptAllDevices: true}) .then(({device}) => assert_promise_rejects_with_message( device.gatt.getPrimaryServices('heart_rate'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service.html index 45306589..a23f108 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-for-any-service.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({acceptAllDevices: true}) .then(({device}) => assert_promise_rejects_with_message( device.gatt.getPrimaryServices(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-present-service-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-present-service-with-uuid.html index 622bdaf..89d94ae 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-present-service-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-no-permission-present-service-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let expected = new DOMException('Origin is not allowed to access the ' + 'service. Tip: Add the service UUID to ' + '\'optionalServices\' in requestDevice() ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-error-with-uuid.html index 64f21d1..a18ab31 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-error-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success-with-uuid.html index 9790fe4..3e02dd3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success.html index 017f5bc5..3df69ee 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-reconnect-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('ServicesDiscoveredAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-service-not-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-service-not-found-with-uuid.html index 79c7d89..c66ce1d2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-service-not-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/gen-service-not-found-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['glucose']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/device-same-from-2-services.html b/third_party/WebKit/LayoutTests/bluetooth/service/device-same-from-2-services.html index d1ef99d6..b611fb9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/device-same-from-2-services.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/device-same-from-2-services.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getTwoHealthThermometerServicesDevice({ filters: [{services: ['health_thermometer']}]}) .then(({device}) => device.gatt.getPrimaryServices('health_thermometer'))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/device-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/service/device-same-object.html index d3f4808..da5f9b6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/device-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/device-same-object.html
@@ -2,11 +2,9 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}]}) .then(({device}) => device.gatt.getPrimaryService('health_thermometer'))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.html index b712dd53..61d572f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHIDDevice({filters: [{services: ['device_information']}]}) .then(({device}) => device.gatt.getPrimaryService('device_information')) .then(service => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-characteristic-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-characteristic-not-found.html index 6f35b9d..c5a8ce4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-characteristic-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-characteristic-not-found.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerService() .then(({service}) => assert_promise_rejects_with_message( service.getCharacteristic('battery_level'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-before.html index 552d963c..03f906b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-during.html index 93d746e..7fad1ab9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-invalidates-objects.html index 7f3c6181..14aaad0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-disconnects-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-goes-out-of-range.html index 0f4e55ab..d07c70a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-device-goes-out-of-range.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-before.html index 8d0b806..31d81747 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-during.html index 7cab30f..2845ad1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-called-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-invalidates-objects.html index 6658708..38a391b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-disconnect-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-error.html index ec1a4c3..84bd8b0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-error.html
@@ -3,14 +3,12 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'Garbage Collection ran during getCharacteristic call that ' + 'fails. Should not crash'; let func_promise; -promise_test(() => getHealthThermometerService() +bluetooth_test(() => getHealthThermometerService() .then(({service}) => { func_promise = assert_promise_rejects_with_message( service.getCharacteristic('measurement_interval'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-success.html index 55ba1c5..9446986a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-get-same-object.html index fe50b84dd..5b62cad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => Promise.all([ service.getCharacteristic('measurement_interval'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-invalid-characteristic-name.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-invalid-characteristic-name.html index 7cf635b..e9bdbbd9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-invalid-characteristic-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-invalid-characteristic-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-reconnect-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-reconnect-during.html index 660f94a..cbc0899 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-reconnect-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-reconnect-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let device, service; return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: [health_thermometer.name]}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-service-is-removed.html index 054cc6b..e76bd65a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/gen-service-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.html index f1118b6..b431834 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHIDDevice({filters: [{services: ['device_information']}]}) .then(({device}) => device.gatt.getPrimaryService('device_information')) .then(service => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-characteristic-not-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-characteristic-not-found-with-uuid.html index 450ffc35..46fd7c7b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-characteristic-not-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-characteristic-not-found-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getEmptyHealthThermometerService() .then(({service}) => assert_promise_rejects_with_message( service.getCharacteristics('battery_level'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before-with-uuid.html index 7ac9238..ff81ce61 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before.html index bd5ef78..de48235 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during-with-uuid.html index fb26653..f7f91224 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during.html index d8d2125..bebb1d1 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects-with-uuid.html index 14feb007..539494c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects.html index 556ee5ff..72b2659 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-disconnects-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range-with-uuid.html index f68a44d18..915a4a09 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range.html index 3d46c24..b2eac42 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-device-goes-out-of-range.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before-with-uuid.html index f989ea1..cb5d8352 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before.html index 00a84496..515a4c3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-before.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during-with-uuid.html index 1f2057c8..ee3eb15 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during.html index f54b2c1..7d67aad0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-called-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects-with-uuid.html index aaec32b5..dc97481b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects.html index a644971a..65465b7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-disconnect-invalidates-objects.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error-with-uuid.html index 23ef191..11607ebf 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error-with-uuid.html
@@ -3,14 +3,12 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'Garbage Collection ran during getCharacteristics call that ' + 'fails. Should not crash'; let func_promise; -promise_test(() => getHealthThermometerService() +bluetooth_test(() => getHealthThermometerService() .then(({service}) => { func_promise = assert_promise_rejects_with_message( service.getCharacteristics('measurement_interval'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error.html index a50f12f0..cf64e97 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-error.html
@@ -3,14 +3,12 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'Garbage Collection ran during getCharacteristics call that ' + 'fails. Should not crash'; let func_promise; -promise_test(() => getHealthThermometerService() +bluetooth_test(() => getHealthThermometerService() .then(({service}) => { func_promise = assert_promise_rejects_with_message( service.getCharacteristics(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success-with-uuid.html index 7501579..1faa843 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success.html index 33ac184..6e70381 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-garbage-collection-ran-during-success.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let promise; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object-with-uuid.html index bb5fb548..07fe8d7d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => Promise.all([ service.getCharacteristics('measurement_interval'),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object.html index 202ac30f9..3ec2e2a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-get-same-object.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => Promise.all([ service.getCharacteristics(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-invalid-characteristic-name.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-invalid-characteristic-name.html index 47d6e498..52bd88a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-invalid-characteristic-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-invalid-characteristic-name.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return getHealthThermometerService() .then(({service}) => { return assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during-with-uuid.html index 55fdc91..0116908 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let device, service; return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: [health_thermometer.name]}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during.html index dff2cab..b812d3a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-reconnect-during.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { let device, service; return getHealthThermometerDeviceWithServicesDiscovered({ filters: [{services: [health_thermometer.name]}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed-with-uuid.html index 02164968..b19a7757 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed-with-uuid.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed.html index e2f4567b..4400c13 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/gen-service-is-removed.html
@@ -3,11 +3,9 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> -<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> -<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +bluetooth_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init-expected.txt new file mode 100644 index 0000000..4594f38b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init-expected.txt
@@ -0,0 +1,7 @@ +This is a testharness.js-based test. +FAIL Call initUIEvent without parameters assert_throws: function "function () { eventType.prototype[initFunction].call(event) }" did not throw +FAIL Call initMouseEvent without parameters assert_throws: function "function () { eventType.prototype[initFunction].call(event) }" did not throw +PASS Call initKeyboardEvent without parameters +FAIL Call initCompositionEvent without parameters assert_throws: function "function () { eventType.prototype[initFunction].call(event) }" did not throw +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init.html b/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init.html new file mode 100644 index 0000000..b41a134 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/uievents/legacy/Event-subclasses-init.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +'use strict'; + +for (let eventType of [UIEvent, MouseEvent, KeyboardEvent, CompositionEvent]) { + test(function() { + let event = new eventType('test'); + assert_equals(eventType.length, 1); + let initFunction = "init" + eventType.prototype.constructor.name; + assert_throws(new TypeError(), function() { eventType.prototype[initFunction].call(event) }); + }, `Call init${eventType.prototype.constructor.name} without parameters`); +} +</script>
diff --git a/third_party/WebKit/LayoutTests/media/media-document-audio-repaint.html b/third_party/WebKit/LayoutTests/media/media-document-audio-repaint.html index a43b445..cb5f185e 100644 --- a/third_party/WebKit/LayoutTests/media/media-document-audio-repaint.html +++ b/third_party/WebKit/LayoutTests/media/media-document-audio-repaint.html
@@ -1,10 +1,5 @@ <script src="../resources/run-after-layout-and-paint.js"></script> <script> - // Disable under-invalidation checking because we allow short period of - // under-invalidation of buffered ranges. - if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - if (window.testRunner) testRunner.waitUntilDone(); @@ -38,4 +33,4 @@ <iframe src="content/silence.wav" id="fr" width=380 height=330 onload="frameLoaded()"></iframe> <script>// To produce the same layout as before iframe was moved down to avoid rebaselines of different platforms. // https://bugs.webkit.org/show_bug.cgi?id=54942 -</script> \ No newline at end of file +</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-offscreen.html index d4c082d..9c7af3a5 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-offscreen.html
@@ -7,11 +7,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen gif animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage); @@ -30,4 +25,4 @@ targetImage.onload = targetImageOnload; targetImage.src = "../../fast/backgrounds/resources/red-green-animated.gif"; } -</script> \ No newline at end of file +</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-transformed-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-transformed-offscreen.html index 4b3a8d80..d9decb059 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-transformed-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/animated-gif-transformed-offscreen.html
@@ -7,11 +7,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen gif animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage); @@ -29,4 +24,4 @@ targetImage.onload = targetImageOnload; targetImage.src="../../fast/backgrounds/resources/red-green-animated.gif"; } -</script> \ No newline at end of file +</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/animated-png-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/animated-png-offscreen.html index e671fca..e1781b7 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/animated-png-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/animated-png-offscreen.html
@@ -7,11 +7,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen apng animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage);
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/animated-webp-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/animated-webp-offscreen.html index cc5a2b4..30a4f34e 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/animated-webp-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/animated-webp-offscreen.html
@@ -7,11 +7,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen webp animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage);
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-background-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-background-offscreen.html index 0d1e822..8756686 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-background-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-background-offscreen.html
@@ -3,11 +3,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen SVG animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(testTarget);
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-offscreen.html index d827cfa2..3108203 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-offscreen.html
@@ -3,11 +3,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen SVG animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage);
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html index cf74fdb..f2ee4db 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html
@@ -3,11 +3,6 @@ <script> window.testIsAsync = true; -// Disable under-invalidation checking because the "under-invalidation" of -// offscreen SVG animation is intentional. -if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - function repaintTest() { if (window.internals) internals.advanceImageAnimation(targetImage);
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint.html b/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint.html index 95c6e57..20bff96 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint.html
@@ -10,11 +10,6 @@ </video> <script> - // Disable under-invalidation checking because we allow short period of - // under-invalidation of buffered ranges. - if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - window.testIsAsync = true; var video = document.getElementById("v");
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/video-paint-invalidation-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/video-paint-invalidation-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win/paint/invalidation/video-paint-invalidation-expected.txt rename to third_party/WebKit/LayoutTests/paint/invalidation/video-paint-invalidation-expected.txt
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint.html b/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint.html index f6856e4..a8dd824 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint.html +++ b/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint.html
@@ -12,11 +12,6 @@ <p>This tests that we repaint the mute button when we change the volume</p> <script> - // Disable under-invalidation checking because we allow short period of - // under-invalidation of buffered ranges. - if (window.internals) - internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false; - window.testIsAsync = true; var video = document.getElementById("v");
diff --git a/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/video-paint-invalidation-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/video-paint-invalidation-expected.txt deleted file mode 100644 index 9fa92010..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/video-paint-invalidation-expected.txt +++ /dev/null
@@ -1,38 +0,0 @@ -{ - "layers": [ - { - "name": "LayoutView #document", - "bounds": [800, 600], - "contentsOpaque": true, - "drawsContent": true - }, - { - "name": "LayoutVideo VIDEO id='video'", - "position": [8, 8], - "bounds": [320, 240] - }, - { - "name": "Squashing Containment Layer", - "shouldFlattenTransform": false - }, - { - "name": "LayoutFlexibleBox (relative positioned) DIV", - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true - }, - { - "name": "Squashing Layer (first squashed layer: LayoutFlexibleBox (relative positioned) DIV)", - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true - } - ], - "objectPaintInvalidations": [ - { - "object": "LayoutVideo VIDEO id='video'", - "reason": "full" - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/video-paint-invalidation-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/video-paint-invalidation-expected.txt deleted file mode 100644 index f20935ae..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/video-paint-invalidation-expected.txt +++ /dev/null
@@ -1,91 +0,0 @@ -{ - "bounds": [800, 600], - "children": [ - { - "bounds": [800, 600], - "contentsOpaque": true, - "drawsContent": true, - "children": [ - { - "position": [8, 8], - "bounds": [320, 240] - }, - { - "shouldFlattenTransform": false, - "children": [ - { - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true - }, - { - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true, - "paintInvalidations": [ - { - "object": "LayoutSlider INPUT", - "rect": [108, 223, 70, 2], - "reason": "full" - }, - { - "object": "LayoutFlexibleBox DIV", - "rect": [108, 223, 69, 2], - "reason": "forced by layout" - }, - { - "object": "LayoutBlockFlow DIV id='thumb'", - "rect": [90, 208, 37, 32], - "reason": "full" - }, - { - "object": "LayoutBlockFlow DIV id='thumb'", - "rect": [159, 208, 36, 32], - "reason": "full" - }, - { - "object": "LayoutButton INPUT", - "rect": [195, 208, 32, 32], - "reason": "full" - }, - { - "object": "LayoutButton INPUT", - "rect": [0, 208, 32, 32], - "reason": "full" - }, - { - "object": "LayoutSlider INPUT", - "rect": [245, 223, 25, 2], - "reason": "full" - }, - { - "object": "LayoutBlockFlow (anonymous)", - "rect": [32, 208, 24, 23], - "reason": "invalidate paint rectangle" - }, - { - "object": "LayoutText #text", - "rect": [32, 217, 24, 14], - "reason": "full" - }, - { - "object": "InlineTextBox ''", - "reason": "full" - }, - { - "object": "InlineTextBox '0:00'", - "reason": "full" - }, - { - "object": "RootInlineBox", - "reason": "full" - } - ] - } - ] - } - ] - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/video-paint-invalidation-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/video-paint-invalidation-expected.txt deleted file mode 100644 index 71bb46e4..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/video-paint-invalidation-expected.txt +++ /dev/null
@@ -1,91 +0,0 @@ -{ - "bounds": [800, 600], - "children": [ - { - "bounds": [800, 600], - "contentsOpaque": true, - "drawsContent": true, - "children": [ - { - "position": [8, 8], - "bounds": [320, 240] - }, - { - "shouldFlattenTransform": false, - "children": [ - { - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true - }, - { - "position": [8, 8], - "bounds": [320, 240], - "drawsContent": true, - "paintInvalidations": [ - { - "object": "LayoutFlexibleBox DIV", - "rect": [96, 223, 81, 2], - "reason": "forced by layout" - }, - { - "object": "LayoutSlider INPUT", - "rect": [96, 223, 81, 2], - "reason": "full" - }, - { - "object": "LayoutBlockFlow DIV id='thumb'", - "rect": [159, 208, 36, 32], - "reason": "full" - }, - { - "object": "LayoutBlockFlow DIV id='thumb'", - "rect": [78, 208, 36, 32], - "reason": "full" - }, - { - "object": "LayoutButton INPUT", - "rect": [195, 208, 32, 32], - "reason": "full" - }, - { - "object": "LayoutButton INPUT", - "rect": [0, 208, 32, 32], - "reason": "full" - }, - { - "object": "LayoutSlider INPUT", - "rect": [245, 223, 25, 2], - "reason": "full" - }, - { - "object": "LayoutBlockFlow (anonymous)", - "rect": [32, 208, 18, 23], - "reason": "invalidate paint rectangle" - }, - { - "object": "LayoutText #text", - "rect": [32, 217, 18, 14], - "reason": "full" - }, - { - "object": "InlineTextBox ''", - "reason": "full" - }, - { - "object": "InlineTextBox '0:00'", - "reason": "full" - }, - { - "object": "RootInlineBox", - "reason": "full" - } - ] - } - ] - } - ] - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js index 437dc45..eb3d6d8f 100644 --- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -1,5 +1,43 @@ 'use strict'; +function loadScript(path) { + let script = document.createElement('script'); + let promise = new Promise(resolve => script.onload = resolve); + script.src = path; + script.async = false; + document.head.appendChild(script); + return promise; +} + +function loadScripts(paths) { + let chain = Promise.resolve(); + for (let path of paths) { + chain = chain.then(() => loadScript(path)); + } + return chain; +} + +function loadChromiumResources() { + let root = window.location.pathname.match(/.*LayoutTests/); + let resource_prefix = `${root}/resources`; + return loadScripts([ + `${resource_prefix}/mojo-helpers.js`, + `${resource_prefix}/bluetooth/web-bluetooth-test.js`, + ]); +} + +// These tests rely on the User Agent providing an implementation of the +// Web Bluetooth Testing API. +// https://docs.google.com/document/d/1Nhv_oVDCodd1pEH_jj9k8gF4rPGb_84VYaZ9IG8M_WY/edit?ts=59b6d823#heading=h.7nki9mck5t64 +function bluetooth_test(func, name, properties) { + Promise.resolve() + .then(() => { + // Chromium Testing API + if (window.chrome !== undefined) return loadChromiumResources(); + }) + .then(() => promise_test(func, name, properties)); +} + // HCI Error Codes. Used for simulateGATT[Dis]ConnectionResponse. // For a complete list of possible error codes see // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes.
diff --git a/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d-expected.html b/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d-expected.html new file mode 100644 index 0000000..f718ea6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d-expected.html
@@ -0,0 +1,2 @@ +<!DOCTYPE html> +<div style="width: 100px; height: 100px; background-color: green"></div>
diff --git a/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d.html b/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d.html new file mode 100644 index 0000000..d528db68 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-ancestor-transform-3d.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<script src="../../resources/run-after-layout-and-paint.js"></script> +<svg width="100" height="100" viewBox="10 10 80 80" + style="transform: translate3d(0, 0, 0) scale(0.0001, 0.0001)"> + <rect width="100" height="100" fill="green" stroke="red" stroke-width="10" + vector-effect="non-scaling-stroke"/> +</svg> +<script> +runAfterLayoutAndPaint(function() { + document.querySelector('svg').style.transform = "translate3d(0, 0, 0)"; +}, true); +</script>
diff --git a/third_party/WebKit/Source/core/css/StylePropertySet.h b/third_party/WebKit/Source/core/css/StylePropertySet.h index d7f8440..077cbe5 100644 --- a/third_party/WebKit/Source/core/css/StylePropertySet.h +++ b/third_party/WebKit/Source/core/css/StylePropertySet.h
@@ -21,7 +21,6 @@ #ifndef StylePropertySet_h #define StylePropertySet_h -#include <algorithm> #include "core/CSSPropertyNames.h" #include "core/CoreExport.h" #include "core/css/CSSPrimitiveValue.h" @@ -145,9 +144,14 @@ : css_parser_mode_(css_parser_mode), is_mutable_(true), array_size_(0) {} StylePropertySet(CSSParserMode css_parser_mode, unsigned immutable_array_size) - : css_parser_mode_(css_parser_mode), - is_mutable_(false), - array_size_(std::min(immutable_array_size, unsigned(kMaxArraySize))) {} + : css_parser_mode_(css_parser_mode), is_mutable_(false) { + // Avoid min()/max() from std here in the header, because that would require + // inclusion of <algorithm>, which is slow to compile. + if (immutable_array_size < unsigned(kMaxArraySize)) + array_size_ = immutable_array_size; + else + array_size_ = unsigned(kMaxArraySize); + } unsigned css_parser_mode_ : 3; mutable unsigned is_mutable_ : 1;
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.cpp b/third_party/WebKit/Source/core/dom/MessagePort.cpp index e975c2e..eb7ab6a 100644 --- a/third_party/WebKit/Source/core/dom/MessagePort.cpp +++ b/third_party/WebKit/Source/core/dom/MessagePort.cpp
@@ -126,10 +126,9 @@ } void MessagePort::close() { - // A closed port should not be neutered, so rather than merely disconnecting - // from the mojo message pipe, also entangle with a new dangling message pipe. - if (IsEntangled()) - channel_ = MessagePortChannel(mojo::MessagePipe().handle0); + // A closed port should not be neutered, so don't disconnect the message pipe. + // TODO(crbug.com/673526): Make sure that transfering a closed port keeps the + // port closed. closed_ = true; }
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.idl b/third_party/WebKit/Source/core/events/KeyboardEvent.idl index 5df5614..c9d23ec 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.idl +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.idl
@@ -41,17 +41,16 @@ boolean getModifierState(DOMString keyArg); // https://w3c.github.io/uievents/#idl-interface-KeyboardEvent-initializers - // FIXME: this does not match the version in the spec. - [CallWith=ScriptState, Measure] void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean bubbles, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional Window? view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long location, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + [CallWith=ScriptState, Measure] void initKeyboardEvent(DOMString type, + optional boolean bubbles = false, + optional boolean cancelable = false, + optional Window? view = null, + optional DOMString keyIdentifier = "", + optional unsigned long location = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false); // https://w3c.github.io/uievents/#KeyboardEvent-supplemental-interface readonly attribute long charCode;
diff --git a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.cpp b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.cpp index ac77ec24..a35a7c1 100644 --- a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.cpp +++ b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.cpp
@@ -30,6 +30,7 @@ #include "core/frame/PageScaleConstraintsSet.h" +#include <algorithm> #include "platform/Length.h" #include "platform/wtf/Assertions.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp index d149869..39accabf 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
@@ -46,6 +46,7 @@ #include "core/layout/LayoutView.h" #include "core/layout/api/LayoutViewItem.h" #include "core/layout/line/InlineTextBox.h" +#include "core/layout/ng/layout_ng_list_item.h" #include "core/layout/svg/LayoutSVGGradientStop.h" #include "core/layout/svg/LayoutSVGImage.h" #include "core/layout/svg/LayoutSVGInline.h" @@ -888,10 +889,13 @@ element->GetDocument().UpdateStyleAndLayout(); LayoutObject* layout_object = element->GetLayoutObject(); - if (!layout_object || !layout_object->IsListItem()) - return String(); - - return ToLayoutListItem(layout_object)->MarkerText(); + if (layout_object) { + if (layout_object->IsListItem()) + return ToLayoutListItem(layout_object)->MarkerText(); + if (layout_object->IsLayoutNGListItem()) + return ToLayoutNGListItem(layout_object)->MarkerTextWithoutSuffix(); + } + return String(); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/TextDecorationOffsetBase.cpp b/third_party/WebKit/Source/core/layout/TextDecorationOffsetBase.cpp index 3bfaaea2..b825b6a 100644 --- a/third_party/WebKit/Source/core/layout/TextDecorationOffsetBase.cpp +++ b/third_party/WebKit/Source/core/layout/TextDecorationOffsetBase.cpp
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "core/layout/TextDecorationOffsetBase.h" + +#include <algorithm> #include "core/layout/line/LineVerticalPositionType.h" #include "core/paint/DecorationInfo.h" #include "platform/fonts/FontMetrics.h"
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.cc b/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.cc index bb94be6..f918e65 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.cc +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.cc
@@ -54,7 +54,7 @@ void LayoutNGListItem::UpdateMarkerText(LayoutText* text) { DCHECK(text); StringBuilder marker_text_builder; - MarkerText(&marker_text_builder); + MarkerText(&marker_text_builder, kWithSuffix); text->SetText(marker_text_builder.ToString().ReleaseImpl()); } @@ -100,7 +100,8 @@ return ordinal_.Value(*GetNode()); } -void LayoutNGListItem::MarkerText(StringBuilder* text) const { +void LayoutNGListItem::MarkerText(StringBuilder* text, + MarkerTextFormat format) const { const ComputedStyle& style = StyleRef(); switch (style.ListStyleType()) { case EListStyleType::kNone: @@ -110,7 +111,8 @@ case EListStyleType::kSquare: // value is ignored for these types text->Append(ListMarkerText::GetText(Style()->ListStyleType(), 0)); - text->Append(' '); + if (format == kWithSuffix) + text->Append(' '); break; case EListStyleType::kArabicIndic: case EListStyleType::kArmenian: @@ -166,11 +168,19 @@ case EListStyleType::kUrdu: { int value = Value(); text->Append(ListMarkerText::GetText(Style()->ListStyleType(), value)); - text->Append(ListMarkerText::Suffix(Style()->ListStyleType(), value)); - text->Append(' '); + if (format == kWithSuffix) { + text->Append(ListMarkerText::Suffix(Style()->ListStyleType(), value)); + text->Append(' '); + } break; } } } +String LayoutNGListItem::MarkerTextWithoutSuffix() const { + StringBuilder text; + MarkerText(&text, kWithoutSuffix); + return text.ToString(); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.h b/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.h index 8aebad125..79f776b 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.h +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_list_item.h
@@ -19,6 +19,7 @@ ListItemOrdinal& Ordinal() { return ordinal_; } int Value() const; + String MarkerTextWithoutSuffix() const; void OrdinalValueChanged(); @@ -32,7 +33,8 @@ void WillBeRemovedFromTree() override; void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; - void MarkerText(StringBuilder*) const; + enum MarkerTextFormat { kWithSuffix, kWithoutSuffix }; + void MarkerText(StringBuilder*, MarkerTextFormat) const; void UpdateMarkerText(LayoutText*); void UpdateMarker();
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp index 2d65770a..26301b3 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -31,6 +31,7 @@ #include "core/layout/LayoutAnalyzer.h" #include "core/layout/PointerEventsHitRules.h" #include "core/layout/svg/LayoutSVGResourcePaintServer.h" +#include "core/layout/svg/LayoutSVGRoot.h" #include "core/layout/svg/SVGLayoutSupport.h" #include "core/layout/svg/SVGResources.h" #include "core/layout/svg/SVGResourcesCache.h" @@ -214,8 +215,15 @@ } AffineTransform LayoutSVGShape::NonScalingStrokeTransform() const { - AffineTransform t = - ToSVGGraphicsElement(GetElement())->ComputeCTM(SVGElement::kScreenScope); + // Compute the CTM to the SVG root. This should probably be the CTM all the + // way to the "canvas" of the page ("host" coordinate system), but with our + // current approach of applying/painting non-scaling-stroke, that can break in + // unpleasant ways (see crbug.com/747708 for an example.) Maybe it would be + // better to apply this effect during rasterization? + const LayoutSVGRoot* svg_root = SVGLayoutSupport::FindTreeRootObject(this); + AffineTransform t; + t.Scale(1 / StyleRef().EffectiveZoom()) + .Multiply(LocalToAncestorTransform(svg_root).ToAffineTransform()); // Width of non-scaling stroke is independent of translation, so zero it out // here. t.SetE(0);
diff --git a/third_party/WebKit/Source/core/style/BorderValue.h b/third_party/WebKit/Source/core/style/BorderValue.h index 0bf898f6..fb69ba99 100644 --- a/third_party/WebKit/Source/core/style/BorderValue.h +++ b/third_party/WebKit/Source/core/style/BorderValue.h
@@ -25,7 +25,6 @@ #ifndef BorderValue_h #define BorderValue_h -#include <algorithm> #include "core/css/StyleColor.h" #include "core/style/ComputedStyleConstants.h" #include "platform/graphics/Color.h" @@ -120,8 +119,11 @@ protected: static unsigned WidthToFixedPoint(float width) { DCHECK_GE(width, 0); - return static_cast<unsigned>(std::min<float>(width, kMaxForBorderWidth) * - kBorderWidthDenominator); + // Avoid min()/max() from std here in the header, because that would require + // inclusion of <algorithm>, which is slow to compile. + if (width > float(kMaxForBorderWidth)) + width = float(kMaxForBorderWidth); + return static_cast<unsigned>(width * kBorderWidthDenominator); } Color color_;
diff --git a/third_party/WebKit/Source/core/style/GridArea.h b/third_party/WebKit/Source/core/style/GridArea.h index b1cf4bc..0d465972 100644 --- a/third_party/WebKit/Source/core/style/GridArea.h +++ b/third_party/WebKit/Source/core/style/GridArea.h
@@ -31,7 +31,6 @@ #ifndef GridArea_h #define GridArea_h -#include <algorithm> #include "core/style/GridPositionsResolver.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/HashMap.h"
diff --git a/third_party/WebKit/Source/platform/animation/AnimationUtilities.h b/third_party/WebKit/Source/platform/animation/AnimationUtilities.h index 5205fb9..e6149a3 100644 --- a/third_party/WebKit/Source/platform/animation/AnimationUtilities.h +++ b/third_party/WebKit/Source/platform/animation/AnimationUtilities.h
@@ -33,7 +33,6 @@ #include "platform/wtf/MathExtras.h" #include "ui/gfx/geometry/cubic_bezier.h" -#include <algorithm> #include <type_traits> namespace blink { @@ -80,8 +79,11 @@ // Calculates the accuracy for evaluating a timing function for an animation // with the specified duration. inline double AccuracyForDuration(double duration) { - return std::max(1.0 / (200.0 * duration), - gfx::CubicBezier::GetDefaultEpsilon()); + double accuracy = 1.0 / (200.0 * duration); + double default_epsilon = gfx::CubicBezier::GetDefaultEpsilon(); + // Avoid min()/max() from std here in the header, because that would require + // inclusion of <algorithm>, which is slow to compile. + return accuracy > default_epsilon ? accuracy : default_epsilon; } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp index 192c643e..1bbe04f 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp
@@ -78,6 +78,28 @@ isWithinIntRange(MaxX()) && isWithinIntRange(MaxY()); } +void FloatRect::ShiftXEdgeTo(float edge) { + float delta = edge - X(); + SetX(edge); + SetWidth(std::max(0.0f, Width() - delta)); +} + +void FloatRect::ShiftMaxXEdgeTo(float edge) { + float delta = edge - MaxX(); + SetWidth(std::max(0.0f, Width() + delta)); +} + +void FloatRect::ShiftYEdgeTo(float edge) { + float delta = edge - Y(); + SetY(edge); + SetHeight(std::max(0.0f, Height() - delta)); +} + +void FloatRect::ShiftMaxYEdgeTo(float edge) { + float delta = edge - MaxY(); + SetHeight(std::max(0.0f, Height() + delta)); +} + bool FloatRect::Intersects(const FloatRect& other) const { // Checking emptiness handles negative widths as well as zero. return !IsEmpty() && !other.IsEmpty() && X() < other.MaxX() &&
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRect.h b/third_party/WebKit/Source/platform/geometry/FloatRect.h index 9d0585dc..d0f5c4d 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatRect.h +++ b/third_party/WebKit/Source/platform/geometry/FloatRect.h
@@ -118,24 +118,10 @@ void Contract(const FloatSize& size) { size_ -= size; } void Contract(float dw, float dh) { size_.Expand(-dw, -dh); } - void ShiftXEdgeTo(float edge) { - float delta = edge - X(); - SetX(edge); - SetWidth(std::max(0.0f, Width() - delta)); - } - void ShiftMaxXEdgeTo(float edge) { - float delta = edge - MaxX(); - SetWidth(std::max(0.0f, Width() + delta)); - } - void ShiftYEdgeTo(float edge) { - float delta = edge - Y(); - SetY(edge); - SetHeight(std::max(0.0f, Height() - delta)); - } - void ShiftMaxYEdgeTo(float edge) { - float delta = edge - MaxY(); - SetHeight(std::max(0.0f, Height() + delta)); - } + void ShiftXEdgeTo(float); + void ShiftMaxXEdgeTo(float); + void ShiftYEdgeTo(float); + void ShiftMaxYEdgeTo(float); FloatPoint MinXMinYCorner() const { return location_; } // typically topLeft FloatPoint MaxXMinYCorner() const {
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp index bd8bd59..dc666a5 100644 --- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp +++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -209,9 +209,11 @@ PaintImage::ContentId DecodingImageGenerator::GetContentIdForFrame( size_t frame_index) const { + DCHECK_LT(frame_index, GetFrameMetadata().size()); + // If we have all the data for the image, or this particular frame, we can // consider the decoded frame constant. - if (all_data_received_ || GetFrameMetadata()[frame_index].complete) + if (all_data_received_ || GetFrameMetadata().at(frame_index).complete) return complete_frame_content_id_; return PaintImageGenerator::GetContentIdForFrame(frame_index);
diff --git a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp b/third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp index bca81ca..633928c 100644 --- a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp +++ b/third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp
@@ -590,8 +590,8 @@ return item->GetJSONObject("params"); } -LoggingCanvas::LoggingCanvas(int width, int height) - : InterceptingCanvasBase(width, height), log_(JSONArray::Create()) {} +LoggingCanvas::LoggingCanvas() + : InterceptingCanvasBase(0, 0), log_(JSONArray::Create()) {} void LoggingCanvas::onDrawPaint(const SkPaint& paint) { AutoLogger logger(this); @@ -914,18 +914,18 @@ } #ifndef NDEBUG -String RecordAsDebugString(const PaintRecord* record, const SkRect& bounds) { - const SkIRect enclosing_bounds = bounds.roundOut(); - LoggingCanvas canvas(enclosing_bounds.width(), enclosing_bounds.height()); - record->Playback(&canvas); - std::unique_ptr<JSONObject> record_as_json = JSONObject::Create(); - record_as_json->SetObject("cullRect", ObjectForSkRect(bounds)); - record_as_json->SetArray("operations", canvas.Log()); - return record_as_json->ToPrettyJSONString(); +std::unique_ptr<JSONArray> RecordAsJSON(const PaintRecord& record) { + LoggingCanvas canvas; + record.Playback(&canvas); + return canvas.Log(); } -void ShowPaintRecord(const PaintRecord* record, const SkRect& bounds) { - DLOG(INFO) << RecordAsDebugString(record, bounds).Utf8().data(); +String RecordAsDebugString(const PaintRecord& record) { + return RecordAsJSON(record)->ToPrettyJSONString(); +} + +void ShowPaintRecord(const PaintRecord& record) { + DLOG(INFO) << RecordAsDebugString(record).Utf8().data(); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.h b/third_party/WebKit/Source/platform/graphics/LoggingCanvas.h index 31b545d..671bce97 100644 --- a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.h +++ b/third_party/WebKit/Source/platform/graphics/LoggingCanvas.h
@@ -39,7 +39,7 @@ class LoggingCanvas : public InterceptingCanvasBase { public: - LoggingCanvas(int width, int height); + LoggingCanvas(); // Returns a snapshot of the current log data. std::unique_ptr<JSONArray> Log(); @@ -120,8 +120,9 @@ }; #ifndef NDEBUG -String RecordAsDebugString(const PaintRecord*, const SkRect& bounds); -void ShowPaintRecord(const PaintRecord*, const SkRect& bounds); +std::unique_ptr<JSONArray> RecordAsJSON(const PaintRecord&); +String RecordAsDebugString(const PaintRecord&); +void ShowPaintRecord(const PaintRecord&); #endif } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp index 64b94b4..20eaaafa 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -198,8 +198,7 @@ } std::unique_ptr<JSONArray> PictureSnapshot::SnapshotCommandLog() const { - const SkIRect bounds = picture_->cullRect().roundOut(); - LoggingCanvas canvas(bounds.width(), bounds.height()); + LoggingCanvas canvas; picture_->playback(&canvas); return canvas.Log(); }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp index fdadeded..b298e9c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp
@@ -46,12 +46,9 @@ } #ifndef NDEBUG -void ClipDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format( - ", clipRect: [%d,%d,%d,%d]", clip_rect_.X(), clip_rect_.Y(), - clip_rect_.Width(), clip_rect_.Height())); +void ClipDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetString("clipRect", clip_rect_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h index 5f81796b..49fb0548 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h
@@ -38,7 +38,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.cpp index 43cb14a..c920230 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.cpp
@@ -34,14 +34,14 @@ } #ifndef NDEBUG -void BeginClipPathDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format( - ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", - clip_path_.countVerbs(), clip_path_.countPoints(), - clip_path_.getFillType() == SkPath::kWinding_FillType ? "nonzero" - : "evenodd")); +void BeginClipPathDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetInteger("pathVerbs", clip_path_.countVerbs()); + json.SetInteger("pathPoints", clip_path_.countPoints()); + json.SetString("windRule", + clip_path_.getFillType() == SkPath::kWinding_FillType + ? "nonzero" + : "evenodd"); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h index 0df5dd28..f830525d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h
@@ -26,7 +26,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp index 4dce065..1dbd8dde 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp
@@ -26,17 +26,12 @@ } #ifndef NDEBUG -void BeginCompositingDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format( - ", xferMode: %d, opacity: %f", static_cast<int>(xfer_mode_), opacity_)); - if (has_bounds_) { - string_builder.Append( - WTF::String::Format(", bounds: [%f, %f, %f, %f]", - bounds_.Location().X(), bounds_.Location().Y(), - bounds_.Size().Width(), bounds_.Size().Height())); - } +void BeginCompositingDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetInteger("xferMode", static_cast<int>(xfer_mode_)); + json.SetDouble("opacity", opacity_); + if (has_bounds_) + json.SetString("bounds", bounds_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h index fac95da..629d6b5 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h
@@ -38,7 +38,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp index 6a939631..a72c0453 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
@@ -219,39 +219,29 @@ } WTF::String DisplayItem::AsDebugString() const { - WTF::StringBuilder string_builder; - string_builder.Append('{'); - DumpPropertiesAsDebugString(string_builder); - string_builder.Append('}'); - return string_builder.ToString(); + auto json = JSONObject::Create(); + PropertiesAsJSON(*json); + return json->ToPrettyJSONString(); } -void DisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { +void DisplayItem::PropertiesAsJSON(JSONObject& json) const { if (!HasValidClient()) { - string_builder.Append("validClient: false, originalDebugString: "); - // This is the original debug string which is in json format. - string_builder.Append(ClientDebugString()); + json.SetBoolean("validClient", false); + json.SetString("originalDebugString", ClientDebugString()); return; } - string_builder.Append(String::Format("client: \"%p", &Client())); - if (!ClientDebugString().IsEmpty()) { - string_builder.Append(' '); - string_builder.Append(ClientDebugString()); - } - string_builder.Append("\", visualRect: \""); - string_builder.Append(VisualRect().ToString()); - string_builder.Append("\", "); - if (OutsetForRasterEffects()) { - string_builder.Append( - String::Format("outset: %f, ", OutsetForRasterEffects().ToFloat())); - } - string_builder.Append("type: \""); - string_builder.Append(TypeAsDebugString(GetType())); - string_builder.Append('"'); + json.SetString("client", + ClientDebugString().IsEmpty() + ? String::Format("%p", &Client()) + : String::Format("%p %s", &Client(), + ClientDebugString().Utf8().data())); + json.SetString("visualRect", VisualRect().ToString()); + if (OutsetForRasterEffects()) + json.SetDouble("outset", OutsetForRasterEffects().ToDouble()); + json.SetString("type", TypeAsDebugString(GetType())); if (skipped_cache_) - string_builder.Append(", skippedCache: true"); + json.SetBoolean("skippedCache", true); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h index f3d5d5f2..b7b44316 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -14,7 +14,7 @@ #include "platform/wtf/Noncopyable.h" #ifndef NDEBUG -#include "platform/wtf/text/StringBuilder.h" +#include "platform/json/JSONValues.h" #include "platform/wtf/text/WTFString.h" #endif @@ -343,7 +343,7 @@ const WTF::String ClientDebugString() const { return client_debug_string_; } void SetClientDebugString(const WTF::String& s) { client_debug_string_ = s; } WTF::String AsDebugString() const; - virtual void DumpPropertiesAsDebugString(WTF::StringBuilder&) const; + virtual void PropertiesAsJSON(JSONObject&) const; #endif private:
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp index 279bd0b..5bfea9d4 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
@@ -59,30 +59,25 @@ #endif #ifdef NDEBUG - // This is for NDEBUG only because DisplayItem::DumpPropertiesAsDebugString - // will output these information. + // This is for NDEBUG only because DisplayItem::PropertiesAsJSON will output + // these information. if (show_client_debug_name) json->SetString("clientDebugName", display_item.Client().DebugName()); json->SetInteger("type", static_cast<int>(display_item.GetType())); json->SetString("visualRect", display_item.VisualRect().ToString()); #else - StringBuilder string_builder; - display_item.DumpPropertiesAsDebugString(string_builder); - if (options & kShownOnlyDisplayItemTypes) { json->SetString("type", DisplayItem::TypeAsDebugString(display_item.GetType())); } else { - json->SetString("properties", string_builder.ToString()); + display_item.PropertiesAsJSON(*json); } if ((options & kShowPaintRecords) && display_item.IsDrawing()) { const auto& item = static_cast<const DrawingDisplayItem&>(display_item); - if (const PaintRecord* record = item.GetPaintRecord().get()) { - json->SetString( - "record", RecordAsDebugString(record, item.GetPaintRecordBounds())); - } + if (const auto* record = item.GetPaintRecord().get()) + json->SetArray("record", RecordAsJSON(*record)); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp index 4bb5eaa..f36eb35 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
@@ -35,15 +35,10 @@ } #ifndef NDEBUG -void DrawingDisplayItem::DumpPropertiesAsDebugString( - StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - if (record_) { - string_builder.Append(String::Format( - ", rect: [%f,%f %fx%f], opaque: %s", record_bounds_.X(), - record_bounds_.Y(), record_bounds_.Width(), record_bounds_.Height(), - known_to_be_opaque_ ? "true" : "false")); - } +void DrawingDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetString("rect", record_bounds_.ToString()); + json.SetBoolean("opaque", known_to_be_opaque_); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h index 313ab30..fc5c6bf3 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h
@@ -58,7 +58,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final;
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.cpp index d3c2e8b..b55c6f08 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.cpp
@@ -33,12 +33,9 @@ } #ifndef NDEBUG -void BeginFilterDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format(", filter bounds: [%f,%f,%f,%f]", - bounds_.X(), bounds_.Y(), - bounds_.Width(), bounds_.Height())); +void BeginFilterDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetString("filterBounds", bounds_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h index 7bc31247..c28bed2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h
@@ -37,7 +37,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final { if (!DisplayItem::Equals(other))
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.cpp index 9b56646..90abc3b 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.cpp
@@ -32,14 +32,10 @@ } #ifndef NDEBUG -void FloatClipDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format( - ", floatClipRect: [%f,%f,%f,%f]}", clip_rect_.X(), clip_rect_.Y(), - clip_rect_.Width(), clip_rect_.Height())); +void FloatClipDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetString("floatClipRect", clip_rect_.ToString()); } - #endif } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h index 1e2ca3a..ec61067 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h
@@ -28,7 +28,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp index 49c0e9f..9c95db4e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp
@@ -50,10 +50,9 @@ } #ifndef NDEBUG -void ForeignLayerDisplayItem::DumpPropertiesAsDebugString( - StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(String::Format(", layer: %d", layer_->id())); +void ForeignLayerDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetInteger("layer", layer_->id()); } #endif // NDEBUG
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h index f0cae5f..7f94bdb 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h
@@ -44,7 +44,7 @@ bool DrawsContent() const override; bool Equals(const DisplayItem&) const override; #ifndef NDEBUG - void DumpPropertiesAsDebugString(StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif private:
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index 28d0297..2fd0087f 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -178,18 +178,17 @@ if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && IsCheckingUnderInvalidation()) { SubsequenceMarkers* markers = GetSubsequenceMarkers(client); - if (!markers) { + if (!markers && start != end) { ShowSequenceUnderInvalidationError( "under-invalidation : unexpected subsequence", client, start, end); CHECK(false); } - if (markers->end - markers->start != end - start) { + if (markers && markers->end - markers->start != end - start) { ShowSequenceUnderInvalidationError( "under-invalidation: new subsequence wrong length", client, start, end); CHECK(false); } - under_invalidation_checking_end_ = 0; } if (start == end) { @@ -988,10 +987,7 @@ #else LOG(ERROR) << "Run debug build to get more details."; #endif - LOG(ERROR) << "See http://crbug.com/619103. For media layout tests, this " - "could fail due to change in buffered range. In that case, set " - "internals.runtimeFlags.paintUnderInvalidationCheckingEnabled " - "to false in layout test."; + LOG(ERROR) << "See http://crbug.com/619103."; #ifndef NDEBUG const PaintRecord* new_record = nullptr; @@ -1012,10 +1008,10 @@ static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecordBounds(); } LOG(INFO) << "new record:\n" - << (new_record ? RecordAsDebugString(new_record, new_bounds) + << (new_record ? RecordAsDebugString(*new_record).Utf8().data() : "None"); LOG(INFO) << "old record:\n" - << (old_record ? RecordAsDebugString(old_record, old_bounds) + << (old_record ? RecordAsDebugString(*old_record).Utf8().data() : "None"); ShowDebugData(); @@ -1044,6 +1040,16 @@ return; const DisplayItem& new_item = new_display_item_list_.Last(); + if (new_item.SkippedCache()) { + // We allow cache skipping and temporary under-invalidation in cached + // subsequences. See the usage of DisplayItemCacheSkipper in BoxPainter. + under_invalidation_checking_end_ = 0; + // Match the remaining display items in the subsequence normally. + next_item_to_match_ = next_item_to_index_ = + under_invalidation_checking_begin_; + return; + } + size_t old_item_index = under_invalidation_checking_begin_ + skipped_probable_under_invalidation_count_; DisplayItem* old_item =
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index 1626dfd..49f1a73 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -11,6 +11,7 @@ #include "platform/graphics/paint/ClipPathRecorder.h" #include "platform/graphics/paint/ClipRecorder.h" #include "platform/graphics/paint/CompositingRecorder.h" +#include "platform/graphics/paint/DisplayItemCacheSkipper.h" #include "platform/graphics/paint/DrawingDisplayItem.h" #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/SubsequenceRecorder.h" @@ -2064,7 +2065,10 @@ .GetPaintRecord()); } -TEST_F(PaintControllerTestBase, OptimizeNoopPairs) { +TEST_P(PaintControllerTest, OptimizeNoopPairs) { + if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) + return; + FakeDisplayItemClient first("first"); FakeDisplayItemClient second("second"); FakeDisplayItemClient third("third"); @@ -2118,7 +2122,7 @@ TestControllerDisplayItem(third, kBackgroundDrawingType)); } -TEST_F(PaintControllerTestBase, SmallPaintControllerHasOnePaintChunk) { +TEST_P(PaintControllerTest, SmallPaintControllerHasOnePaintChunk) { ScopedSlimmingPaintV2ForTest enable_s_pv2(true); FakeDisplayItemClient client("test client"); @@ -2158,7 +2162,7 @@ context.DrawPath(path, flags); } -TEST_F(PaintControllerTestBase, BeginAndEndFrame) { +TEST_P(PaintControllerTest, BeginAndEndFrame) { class FakeFrame {}; // PaintController should have one null frame in the stack since beginning. @@ -2551,6 +2555,69 @@ EXPECT_DEATH(TestSubsequenceBecomesEmpty(), ""); } +TEST_F(PaintControllerUnderInvalidationTest, SkipCacheInSubsequence) { + FakeDisplayItemClient container("container"); + FakeDisplayItemClient content("content"); + GraphicsContext context(GetPaintController()); + + { + SubsequenceRecorder r(context, container); + { + DisplayItemCacheSkipper cache_skipper(context); + DrawRect(context, content, kBackgroundDrawingType, + FloatRect(100, 100, 300, 300)); + } + DrawRect(context, content, kForegroundDrawingType, + FloatRect(200, 200, 400, 400)); + } + GetPaintController().CommitNewDisplayItems(); + + { + EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( + context, container)); + SubsequenceRecorder r(context, container); + { + DisplayItemCacheSkipper cache_skipper(context); + DrawRect(context, content, kBackgroundDrawingType, + FloatRect(200, 200, 400, 400)); + } + DrawRect(context, content, kForegroundDrawingType, + FloatRect(200, 200, 400, 400)); + } + GetPaintController().CommitNewDisplayItems(); +} + +TEST_F(PaintControllerUnderInvalidationTest, + EmptySubsequenceInCachedSubsequence) { + FakeDisplayItemClient container("container"); + FakeDisplayItemClient content("content"); + GraphicsContext context(GetPaintController()); + + { + SubsequenceRecorder r(context, container); + DrawRect(context, container, kBackgroundDrawingType, + FloatRect(100, 100, 300, 300)); + { SubsequenceRecorder r1(context, content); } + DrawRect(context, container, kForegroundDrawingType, + FloatRect(100, 100, 300, 300)); + } + GetPaintController().CommitNewDisplayItems(); + + { + EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( + context, container)); + SubsequenceRecorder r(context, container); + DrawRect(context, container, kBackgroundDrawingType, + FloatRect(100, 100, 300, 300)); + EXPECT_FALSE( + SubsequenceRecorder::UseCachedSubsequenceIfPossible(context, content)); + { SubsequenceRecorder r1(context, content); } + DrawRect(context, container, kForegroundDrawingType, + FloatRect(100, 100, 300, 300)); + } + GetPaintController().CommitNewDisplayItems(); +} + #endif // defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.cpp index cfc9feb0..0979149 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.cpp
@@ -23,12 +23,9 @@ } #ifndef NDEBUG -void BeginScrollDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - PairedBeginDisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format(", currentOffset: [%d,%d]", - current_offset_.Width(), - current_offset_.Height())); +void BeginScrollDisplayItem::PropertiesAsJSON(JSONObject& json) const { + PairedBeginDisplayItem::PropertiesAsJSON(json); + json.SetString("currentOffset", current_offset_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h index d09bead..11ad2516 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h
@@ -30,7 +30,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const final; + void PropertiesAsJSON(JSONObject&) const final; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.cpp index f089754..dd81e2f3 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.cpp
@@ -41,9 +41,10 @@ } #ifndef NDEBUG -void ScrollHitTestDisplayItem::DumpPropertiesAsDebugString( - StringBuilder& string_builder) const { - DisplayItem::DumpPropertiesAsDebugString(string_builder); +void ScrollHitTestDisplayItem::PropertiesAsJSON(JSONObject& json) const { + DisplayItem::PropertiesAsJSON(json); + json.SetString("scrollOffsetNode", + String::Format("%p", scroll_offset_node_.get())); } #endif // NDEBUG
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h index 69911cf9..b2992f2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h
@@ -40,7 +40,7 @@ WebDisplayItemList*) const override; bool Equals(const DisplayItem&) const override; #ifndef NDEBUG - void DumpPropertiesAsDebugString(StringBuilder&) const override; + void PropertiesAsJSON(JSONObject&) const override; #endif // Create and append a ScrollHitTestDisplayItem onto the context. This is
diff --git a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.cpp index ef3a619..b206ac1e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.cpp
@@ -27,27 +27,10 @@ } #ifndef NDEBUG -void BeginTransform3DDisplayItem::DumpPropertiesAsDebugString( - StringBuilder& string_builder) const { - PairedBeginDisplayItem::DumpPropertiesAsDebugString(string_builder); - TransformationMatrix::DecomposedType decomposition; - if (transform_.Decompose(decomposition)) { - string_builder.Append(String::Format( - ", translate: [%lf,%lf,%lf], scale: [%lf,%lf,%lf], skew: " - "[%lf,%lf,%lf], quaternion: [%lf,%lf,%lf,%lf], perspective: " - "[%lf,%lf,%lf,%lf]", - decomposition.translate_x, decomposition.translate_y, - decomposition.translate_z, decomposition.scale_x, decomposition.scale_y, - decomposition.scale_z, decomposition.skew_xy, decomposition.skew_xz, - decomposition.skew_yz, decomposition.quaternion_x, - decomposition.quaternion_y, decomposition.quaternion_z, - decomposition.quaternion_w, decomposition.perspective_x, - decomposition.perspective_y, decomposition.perspective_z, - decomposition.perspective_w)); - } - string_builder.Append( - String::Format(", transformOrigin: [%f,%f,%f]", transform_origin_.X(), - transform_origin_.Y(), transform_origin_.Z())); +void BeginTransform3DDisplayItem::PropertiesAsJSON(JSONObject& json) const { + PairedBeginDisplayItem::PropertiesAsJSON(json); + json.SetString("transform", transform_.ToString()); + json.SetString("origin", transform_origin_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h index d090671c..3f82381 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h
@@ -34,7 +34,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const final; + void PropertiesAsJSON(JSONObject&) const final; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.cpp index c839a3ab..bde21f0 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.cpp
@@ -22,12 +22,9 @@ } #ifndef NDEBUG -void BeginTransformDisplayItem::DumpPropertiesAsDebugString( - WTF::StringBuilder& string_builder) const { - PairedBeginDisplayItem::DumpPropertiesAsDebugString(string_builder); - string_builder.Append(WTF::String::Format( - ", transform: [%lf,%lf,%lf,%lf,%lf,%lf]", transform_.A(), transform_.B(), - transform_.C(), transform_.D(), transform_.E(), transform_.F())); +void BeginTransformDisplayItem::PropertiesAsJSON(JSONObject& json) const { + PairedBeginDisplayItem::PropertiesAsJSON(json); + json.SetString("transform", transform_.ToString()); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h index c6c670d0c..bdc0724c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h
@@ -26,7 +26,7 @@ private: #ifndef NDEBUG - void DumpPropertiesAsDebugString(WTF::StringBuilder&) const final; + void PropertiesAsJSON(JSONObject&) const final; #endif bool Equals(const DisplayItem& other) const final { return DisplayItem::Equals(other) &&
diff --git a/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc b/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc index fc2e0c0..d3424090 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc
@@ -43,8 +43,8 @@ // an idle task runner with the semantics we want for the compositor thread // which runs them after the current frame has been drawn before the next // vsync. https://crbug.com/609532 - return make_scoped_refptr( - new SingleThreadIdleTaskRunner(thread_->task_runner(), this)); + return base::MakeRefCounted<SingleThreadIdleTaskRunner>( + thread_->task_runner(), this); } bool CompositorWorkerScheduler::CanExceedIdleDeadlineIfRequired() const {
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc index 1961f3c..22fbe8a 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc
@@ -30,8 +30,8 @@ clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); test_time_source_.reset(new TestTimeSource(clock_.get())); - mock_task_runner_ = make_scoped_refptr( - new cc::OrderedSimpleTaskRunner(clock_.get(), false)); + mock_task_runner_ = + base::MakeRefCounted<cc::OrderedSimpleTaskRunner>(clock_.get(), false); main_task_runner_ = SchedulerTqmDelegateForTest::Create( mock_task_runner_, std::make_unique<TestTimeSource>(clock_.get()));
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/idle_time_estimator_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/idle_time_estimator_unittest.cc index 30a3728..2e9bf6bd 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/idle_time_estimator_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/idle_time_estimator_unittest.cc
@@ -44,8 +44,8 @@ clock_.reset(new base::SimpleTestTickClock()); clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); test_time_source_.reset(new TestTimeSource(clock_.get())); - mock_task_runner_ = make_scoped_refptr( - new cc::OrderedSimpleTaskRunner(clock_.get(), false)); + mock_task_runner_ = + base::MakeRefCounted<cc::OrderedSimpleTaskRunner>(clock_.get(), false); main_task_runner_ = SchedulerTqmDelegateForTest::Create( mock_task_runner_, std::make_unique<TestTimeSource>(clock_.get())); manager_ = std::make_unique<TaskQueueManager>(main_task_runner_);
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc index 5e1cb2f..9f2a296 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -293,8 +293,8 @@ main_task_runner_ = SchedulerTqmDelegateImpl::Create( message_loop_.get(), std::make_unique<TestTimeSource>(clock_.get())); } else { - mock_task_runner_ = make_scoped_refptr( - new cc::OrderedSimpleTaskRunner(clock_.get(), false)); + mock_task_runner_ = base::MakeRefCounted<cc::OrderedSimpleTaskRunner>( + clock_.get(), false); main_task_runner_ = SchedulerTqmDelegateForTest::Create( mock_task_runner_, std::make_unique<TestTimeSource>(clock_.get())); } @@ -1851,8 +1851,8 @@ : public RendererSchedulerImplTest { public: void SetUp() override { - mock_task_runner_ = make_scoped_refptr( - new cc::OrderedSimpleTaskRunner(clock_.get(), false)); + mock_task_runner_ = + base::MakeRefCounted<cc::OrderedSimpleTaskRunner>(clock_.get(), false); main_task_runner_ = SchedulerTqmDelegateForTest::Create( mock_task_runner_, std::make_unique<TestTimeSource>(clock_.get())); mock_scheduler_ = new RendererSchedulerImplForTest(main_task_runner_);
diff --git a/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc b/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc index bf485c70..9690865 100644 --- a/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc +++ b/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc
@@ -4,6 +4,7 @@ #include "platform/scheduler/test/fake_web_task_runner.h" +#include <algorithm> #include <deque> #include <utility>
diff --git a/third_party/WebKit/Source/platform/wtf/RefPtr.h b/third_party/WebKit/Source/platform/wtf/RefPtr.h index 2ae3cd6..3453d81d 100644 --- a/third_party/WebKit/Source/platform/wtf/RefPtr.h +++ b/third_party/WebKit/Source/platform/wtf/RefPtr.h
@@ -25,7 +25,6 @@ #include "platform/wtf/Allocator.h" #include "platform/wtf/HashTableDeletedValueType.h" #include "platform/wtf/allocator/PartitionAllocator.h" -#include <algorithm> #include <utility> namespace WTF {
diff --git a/third_party/WebKit/Source/platform/wtf/text/WTFString.h b/third_party/WebKit/Source/platform/wtf/text/WTFString.h index cb9957f1..b35e31a 100644 --- a/third_party/WebKit/Source/platform/wtf/text/WTFString.h +++ b/third_party/WebKit/Source/platform/wtf/text/WTFString.h
@@ -33,7 +33,6 @@ #include "platform/wtf/text/ASCIIFastPath.h" #include "platform/wtf/text/StringImpl.h" #include "platform/wtf/text/StringView.h" -#include <algorithm> #include <iosfwd> #ifdef __OBJC__
diff --git a/third_party/binutils/README.chromium b/third_party/binutils/README.chromium index b9eeb7d7..5ecc4f6 100644 --- a/third_party/binutils/README.chromium +++ b/third_party/binutils/README.chromium
@@ -1,6 +1,6 @@ Name: binutils URL: http://www.gnu.org/software/binutils/ -Version: 2.26 +Version: 2.28 License: GPL v2 License File: NOT_SHIPPED Security Critical: no @@ -9,27 +9,15 @@ This directory contains i386 and amd64 binaries of the binutils tools (including gold linker). -They were built from binutils-2.26 using the "build-all.sh" script on a +They were built from binutils-2.28 using the "build-all.sh" script on a Ubuntu Trusty. The script creates chroots for 32bit and 64bit Ubuntu Precise and then builds binutils inside the roots. -Version 2.26 was released on Mon, 25 Jan 2016 +Version 2.28 was released on Thu, 02 Mar 2017 Local patches: - * long-plt.patch for http://crbug.com/554017 from upstream change - https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=ce3e49806d505721e0875e704de0b6fcba7660ed - (Landed upstream Thu, 17 Dec 2015 - should be in 2.27) - * icf-rel.patch for https://sourceware.org/bugzilla/show_bug.cgi?id=19047 - from upstream change - https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=d114b830426300f80302ca03ff4322942f63c615 - (Landed upstream on 2.26 branch Thu, 5 May 2016, - and on trunk Fri, 5 Feb 2016 - will be in 2.27) - * icf-align.patch for https://sourceware.org/bugzilla/show_bug.cgi?id=17704 - from upstream change - https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=ac423761af22f7858a1413cda5df3e1d5e88d4e4 - (Landed upstream Fri, 21 Oct 2016 - is in 2.28) * (build-all.sh|build-one.sh|upload.sh) scripts for building the binutils binaries and uploading them to Google storage.
diff --git a/third_party/binutils/build-all.sh b/third_party/binutils/build-all.sh index ee64a45..015d78dd 100755 --- a/third_party/binutils/build-all.sh +++ b/third_party/binutils/build-all.sh
@@ -22,7 +22,7 @@ fi # Download the source -VERSION=2.26 +VERSION=2.28 wget -c http://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.bz2 # Verify the signature @@ -31,7 +31,7 @@ echo "GPG Signature failed to verify." echo "" echo "You may need to import the vendor GPG key with:" - echo "# gpg --keyserver pgp.mit.edu --recv-key 4AE55E93" + echo "# gpg --keyserver hkp://pgp.mit.edu:80 --recv-key 4AE55E93" exit 1 fi @@ -39,26 +39,6 @@ rm -rf binutils-$VERSION tar jxf binutils-$VERSION.tar.bz2 -# Patch the source -( - cd binutils-$VERSION - echo "long-plt.patch" - echo "==================================" - patch -p1 < ../long-plt.patch - echo "----------------------------------" - echo - echo "icf-rel.patch" - echo "==================================" - patch -p1 < ../icf-rel.patch - echo "----------------------------------" - echo - echo "icf-align.patch" - echo "==================================" - patch -p1 < ../icf-align.patch - echo "----------------------------------" - echo -) - for ARCH in i386 amd64; do if [ ! -d precise-chroot-$ARCH ]; then # Refresh sudo credentials
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index cfcdf39..2202e4a 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -23225,6 +23225,7 @@ <int value="-1962588488" label="SpeculativePreconnect:disabled"/> <int value="-1961648833" label="show_summary"/> <int value="-1960567385" label="KeepPrefetchedContentSuggestions:enabled"/> + <int value="-1957328398" label="MacSystemShareMenu:disabled"/> <int value="-1956349722" label="disable-smooth-scrolling"/> <int value="-1948540128" label="disable-webrtc-hw-encoding (deprecated)"/> <int value="-1946595906" label="enable-push-api-background-mode"/> @@ -23718,6 +23719,7 @@ <int value="-508143738" label="disable-accelerated-fixed-root-background"/> <int value="-506706655" label="respect-autocomplete-off-autofill"/> <int value="-505679399" label="FontCacheScaling:enabled"/> + <int value="-498463128" label="MacSystemShareMenu:enabled"/> <int value="-495585885" label="enable-spdy-proxy-dev-auth-origin"/> <int value="-494722408" label="ContentSuggestionsLargeThumbnail:enabled"/> <int value="-493551777" label="StaleWhileRevalidate2:disabled"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 92a8952..9929cd3 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -70640,7 +70640,7 @@ <summary>The elapsed time to upload a safe browsing incident report.</summary> </histogram> -<histogram name="SBIRS.StateStoreInitResult" enum="StateStoreInitResult"> +<histogram name="SBIRS.StateStoreInit" enum="StateStoreInitResult"> <owner>proberge@google.com</owner> <summary> The result of initializing the state store and comparing the preferences to
diff --git a/ui/app_list/app_list_constants.cc b/ui/app_list/app_list_constants.cc index af3a715..cf4bc95 100644 --- a/ui/app_list/app_list_constants.cc +++ b/ui/app_list/app_list_constants.cc
@@ -143,9 +143,9 @@ const int kAppsGridPadding = 24; // The left and right side padding of the apps grid in fullscreen mode. The -// space is used for page switcher on the right side. Left side should have the -// same space to keep the apps grid horizontally centered. -const int kAppsGridLeftRightPaddingFullscreen = 28; +// space is used for page switcher and its padding on the right side. Left side +// should have the same space to keep the apps grid horizontally centered. +const int kAppsGridLeftRightPaddingFullscreen = 40; // The left and right padding from the folder name bottom separator to the edge // of the left or right edge of the left most and right most app item.
diff --git a/ui/app_list/views/app_list_folder_view.cc b/ui/app_list/views/app_list_folder_view.cc index 13717ae..ab7313f 100644 --- a/ui/app_list/views/app_list_folder_view.cc +++ b/ui/app_list/views/app_list_folder_view.cc
@@ -31,6 +31,10 @@ namespace { +// The preferred width/height for AppListFolderView. +constexpr int kAppsFolderPreferredWidth = 576; +constexpr int kAppsFolderPreferredHeight = 504; + // Indexes of interesting views in ViewModel of AppListFolderView. const int kIndexFolderHeader = 0; const int kIndexChildItems = 1; @@ -52,6 +56,7 @@ model_(model), folder_item_(NULL), hide_for_reparent_(false), + is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()), is_app_list_focus_enabled_(features::IsAppListFocusEnabled()) { AddChildView(folder_header_view_); view_model_->Add(folder_header_view_, kIndexFolderHeader); @@ -117,6 +122,9 @@ } gfx::Size AppListFolderView::CalculatePreferredSize() const { + if (is_fullscreen_app_list_enabled_) + return gfx::Size(kAppsFolderPreferredWidth, kAppsFolderPreferredHeight); + const gfx::Size header_size = folder_header_view_->GetPreferredSize(); const gfx::Size grid_size = items_grid_view_->GetPreferredSize(); int width = std::max(header_size.width(), grid_size.width());
diff --git a/ui/app_list/views/app_list_folder_view.h b/ui/app_list/views/app_list_folder_view.h index 7698cec..e923d31 100644 --- a/ui/app_list/views/app_list_folder_view.h +++ b/ui/app_list/views/app_list_folder_view.h
@@ -122,6 +122,8 @@ base::string16 accessible_name_; + const bool is_fullscreen_app_list_enabled_; + // Whether the app list focus is enabled. const bool is_app_list_focus_enabled_;
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc index e86043e7..eca82d4 100644 --- a/ui/app_list/views/apps_grid_view.cc +++ b/ui/app_list/views/apps_grid_view.cc
@@ -56,6 +56,16 @@ namespace { +// The preferred width/height for apps grid. For page #01, it includes the +// top/bottom 24px padding. For page #02 and all the followings, it includes top +// 24px padding and bottom 56px padding. +constexpr int kAppsGridPreferredWidth = 576; +constexpr int kAppsGridPreferredHeight = 623; + +// 32px page break space adjustment needed to keep 48px page break space due to +// the fact that page #02 and all the followings have bottom 56px padding. +constexpr int kPageBreakSpaceAdjustment = 32; + // Distance a drag needs to be from the app grid to be considered 'outside', at // which point we rearrange the apps to their pre-drag configuration, as a drop // then would be canceled. We have a buffer to make it easier to drag apps to @@ -65,9 +75,6 @@ // Padding space in pixels between pages. constexpr int kPagePadding = 40; -// Padding space in pixels between pages for fullscreen launcher. -constexpr int kPagePaddingFullscreen = 48; - // Preferred tile size when showing in fixed layout. constexpr int kPreferredTileWidth = 100; constexpr int kPreferredTileHeight = 100; @@ -810,18 +817,21 @@ } gfx::Size AppsGridView::CalculatePreferredSize() const { - const gfx::Insets insets(GetInsets()); - gfx::Size size = GetTileGridSize(); if (is_fullscreen_app_list_enabled_) { + gfx::Size size = + gfx::Size(kAppsGridPreferredWidth, kAppsGridPreferredHeight); // Add padding to both side of the apps grid to keep it horizontally - // centered. + // centered since we place page switcher on the right side. size.Enlarge(kAppsGridLeftRightPaddingFullscreen * 2, 0); - } else { - // If we are in a folder, ignore the page switcher for height calculations. - int page_switcher_height = - folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height(); - size.Enlarge(insets.width(), insets.height() + page_switcher_height); + return size; } + + gfx::Size size = GetTileGridSize(); + const gfx::Insets insets(GetInsets()); + // If we are in a folder, ignore the page switcher for height calculations. + int page_switcher_height = + folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height(); + size.Enlarge(insets.width(), insets.height() + page_switcher_height); return size; } @@ -1470,7 +1480,7 @@ } } } else { - const int page_height = grid_size.height() + kPagePaddingFullscreen; + const int page_height = grid_size.height(); if (page_of_view < current_page) y_offset = -page_height; else if (page_of_view > current_page) @@ -1482,6 +1492,13 @@ y_offset += transition.progress * page_height * dir; } } + + // Adjust pages with bottom 56px spaces to have 48px page break space, but + // do not over adjust for ideal offset. + if (page_of_view > current_page && current_page >= 1) + y_offset = std::max(y_offset - kPageBreakSpaceAdjustment, 0); + else if (page_of_view < current_page && page_of_view >= 1) + y_offset = std::min(y_offset + kPageBreakSpaceAdjustment, 0); } return gfx::Vector2d(x_offset, y_offset); @@ -1503,28 +1520,8 @@ view_index = GetIndexFromModelIndex(slot_index); } - const int row = view_index.slot / cols_; - const int col = view_index.slot % cols_; - gfx::Rect tile_slot = GetExpectedTileBounds(row, col); - gfx::Vector2d offset = CalculateTransitionOffset(view_index.page); - if (is_fullscreen_app_list_enabled_) { - // For |current_page|'s neighbor pages, do adjustments to ensure page - // break space. - const int current_page = pagination_model_.selected_page(); - if (view_index.page == current_page - 1) { - if (view_index.page == 0) { - offset.set_y(offset.y() + GetHeightOnTopOfAllAppsTiles(0) - - GetHeightOnTopOfAllAppsTiles(1)); - } else { - offset.set_y(offset.y() + GetHeightOnTopOfAllAppsTiles(current_page) + - 2 * kTileVerticalPadding); - } - } else if (view_index.page == current_page + 1) { - offset.set_y(offset.y() - GetHeightOnTopOfAllAppsTiles(current_page) - - 2 * kTileVerticalPadding); - } - } - tile_slot.Offset(offset.x(), offset.y()); + gfx::Rect tile_slot = GetExpectedTileBounds(view_index); + tile_slot.Offset(CalculateTransitionOffset(view_index.page)); if (i < view_model_.view_size()) { view_model_.set_ideal_bounds(i, tile_slot); } else { @@ -1667,7 +1664,7 @@ } int distance_to_tile_center = - (point - GetExpectedTileBounds(nearest_tile_index.slot).CenterPoint()) + (point - GetExpectedTileBounds(nearest_tile_index).CenterPoint()) .Length(); if (distance_to_tile_center > kFolderDroppingCircleRadius) return false; @@ -1699,7 +1696,7 @@ gfx::Rect bounds = GetContentsBounds(); Index grid_index = GetNearestTileIndexForPoint(point); gfx::Point reorder_placeholder_center = - GetExpectedTileBounds(reorder_placeholder_.slot).CenterPoint(); + GetExpectedTileBounds(reorder_placeholder_).CenterPoint(); int x_offset_direction = 0; if (grid_index == reorder_placeholder_) { @@ -2555,13 +2552,11 @@ } gfx::Size AppsGridView::GetTileGridSize() const { - gfx::Rect bounds = GetExpectedTileBounds(0, 0); - const int current_page = pagination_model_.selected_page(); - bool show_suggested_apps = - is_fullscreen_app_list_enabled_ && current_page == 0; - bounds.Union(GetExpectedTileBounds( - rows_per_page_ - (show_suggested_apps ? 2 : 1), cols_ - 1)); - bounds.Inset(0, -GetHeightOnTopOfAllAppsTiles(current_page), 0, 0); + if (is_fullscreen_app_list_enabled_) + return gfx::Size(kAppsGridPreferredWidth, kAppsGridPreferredHeight); + + gfx::Rect bounds = GetExpectedTileBounds(Index(0, 0)); + bounds.Union(GetExpectedTileBounds(Index(0, rows_per_page_ * cols_ - 1))); bounds.Inset(GetTilePadding()); return bounds.size(); } @@ -2580,20 +2575,19 @@ return kSearchBoxFullscreenBottomPadding - kTileVerticalPadding; } -gfx::Rect AppsGridView::GetExpectedTileBounds(int slot) const { - return GetExpectedTileBounds(slot / cols_, slot % cols_); -} - -gfx::Rect AppsGridView::GetExpectedTileBounds(int row, int col) const { +gfx::Rect AppsGridView::GetExpectedTileBounds(const Index& index) const { gfx::Rect bounds(GetContentsBounds()); - bounds.Inset( - 0, GetHeightOnTopOfAllAppsTiles(pagination_model_.selected_page()), 0, 0); + if (is_fullscreen_app_list_enabled_) { + bounds.Offset(kAppsGridLeftRightPaddingFullscreen - kTileHorizontalPadding, + 0); + } + bounds.Inset(0, GetHeightOnTopOfAllAppsTiles(index.page), 0, 0); + int row = index.slot / cols_; + int col = index.slot % cols_; const gfx::Size total_tile_size = GetTotalTileSize(); gfx::Rect tile_bounds(gfx::Point(bounds.x() + col * total_tile_size.width(), bounds.y() + row * total_tile_size.height()), total_tile_size); - if (is_fullscreen_app_list_enabled_) - tile_bounds.Offset(kAppsGridLeftRightPaddingFullscreen, 0); tile_bounds.Inset(-GetTilePadding()); return tile_bounds; } @@ -2604,9 +2598,8 @@ return nullptr; // Calculate the original bound of the tile at |index|. - int row = slot / cols_; - int col = slot % cols_; - gfx::Rect tile_rect = GetExpectedTileBounds(row, col); + gfx::Rect tile_rect = + GetExpectedTileBounds(Index(pagination_model_.selected_page(), slot)); for (int i = 0; i < view_model_.view_size(); ++i) { AppListItemView* view = GetItemViewAt(i);
diff --git a/ui/app_list/views/apps_grid_view.h b/ui/app_list/views/apps_grid_view.h index d908a86a..00df9704 100644 --- a/ui/app_list/views/apps_grid_view.h +++ b/ui/app_list/views/apps_grid_view.h
@@ -472,11 +472,9 @@ // Gets height on top of the all apps tiles for |page|. int GetHeightOnTopOfAllAppsTiles(int page) const; - // Gets the bounds of the tile located at |slot| on the current page. - gfx::Rect GetExpectedTileBounds(int slot) const; - - // Gets the bounds of the tile located at |row| and |col| on the current page. - gfx::Rect GetExpectedTileBounds(int row, int col) const; + // Gets the bounds of the tile located at |index|, where |index| contains the + // page/slot info. + gfx::Rect GetExpectedTileBounds(const Index& index) const; // Gets the item view currently displayed at |slot| on the current page. If // there is no item displayed at |slot|, returns NULL. Note that this finds an
diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc index a744398..4b3cd9a9 100644 --- a/ui/app_list/views/apps_grid_view_unittest.cc +++ b/ui/app_list/views/apps_grid_view_unittest.cc
@@ -179,9 +179,9 @@ return nullptr; } - gfx::Rect GetItemTileRectAt(int row, int col) const { + gfx::Rect GetItemRectOnCurrentPageAt(int row, int col) const { DCHECK_GT(model_->top_level_item_list()->item_count(), 0u); - return test_api_->GetItemTileRectAt(row, col); + return test_api_->GetItemTileRectOnCurrentPageAt(row, col); } int GetTilesPerPage(int page) const { return test_api_->TilesPerPage(page); } @@ -372,8 +372,8 @@ EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), model_->GetModelContent()); - gfx::Point from = GetItemTileRectAt(0, 0).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); // Dragging changes model order. SimulateDrag(AppsGridView::MOUSE, from, to); @@ -420,8 +420,8 @@ EXPECT_EQ(model_->top_level_item_list()->item_count(), kTotalItems); EXPECT_EQ(std::string("Item 0,Item 1,Item 2"), model_->GetModelContent()); - gfx::Point from = GetItemTileRectAt(0, 1).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 0).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); // Dragging item_1 over item_0 creates a folder. SimulateDrag(AppsGridView::MOUSE, from, to); @@ -482,8 +482,8 @@ EXPECT_EQ(model_->GetItemName(GetMaxFolderItems()), model_->top_level_item_list()->item_at(2)->id()); - gfx::Point from = GetItemTileRectAt(0, 1).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 0).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); // Dragging one item into the folder, the folder should accept the item. SimulateDrag(AppsGridView::MOUSE, from, to); @@ -525,23 +525,23 @@ model_->top_level_item_list()->item_at(1)->id()); AppListItemView* folder_view = - GetItemViewForPoint(GetItemTileRectAt(0, 0).CenterPoint()); + GetItemViewForPoint(GetItemRectOnCurrentPageAt(0, 0).CenterPoint()); // Drag the new item to the left so that the grid reorders. - gfx::Point from = GetItemTileRectAt(0, 1).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 0).bottom_left(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).bottom_left(); to.Offset(0, -1); // Get a point inside the rect. AppListItemView* dragged_view = SimulateDrag(AppsGridView::MOUSE, from, to); test_api_->LayoutToIdealBounds(); // The grid now looks like | blank | folder |. - EXPECT_EQ(nullptr, - GetItemViewForPoint(GetItemTileRectAt(0, 0).CenterPoint())); - EXPECT_EQ(folder_view, - GetItemViewForPoint(GetItemTileRectAt(0, 1).CenterPoint())); + EXPECT_EQ(nullptr, GetItemViewForPoint( + GetItemRectOnCurrentPageAt(0, 0).CenterPoint())); + EXPECT_EQ(folder_view, GetItemViewForPoint( + GetItemRectOnCurrentPageAt(0, 1).CenterPoint())); // Move onto the folder and end the drag. - to = GetItemTileRectAt(0, 1).CenterPoint(); + to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); gfx::Point translated_to = gfx::PointAtOffsetFromOrigin(to - dragged_view->origin()); ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, translated_to, to, @@ -567,11 +567,13 @@ // Dragging an item towards its neighbours should not reorder until the drag // is past the folder drop point. - gfx::Point top_right = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point top_right = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); gfx::Vector2d drag_vector; - int half_tile_width = - (GetItemTileRectAt(0, 1).x() - GetItemTileRectAt(0, 0).x()) / 2; - int tile_height = GetItemTileRectAt(1, 0).y() - GetItemTileRectAt(0, 0).y(); + int half_tile_width = (GetItemRectOnCurrentPageAt(0, 1).x() - + GetItemRectOnCurrentPageAt(0, 0).x()) / + 2; + int tile_height = GetItemRectOnCurrentPageAt(1, 0).y() - + GetItemRectOnCurrentPageAt(0, 0).y(); // Drag left but stop before the folder dropping circle. drag_vector.set_x(-half_tile_width - 4); @@ -633,8 +635,8 @@ model_->top_level_item_list()->item_at(0)); EXPECT_EQ("Item 2", model_->top_level_item_list()->item_at(1)->id()); - gfx::Point from = GetItemTileRectAt(0, 0).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); // Dragging folder over item_1 should leads to re-ordering these two // items. @@ -653,8 +655,8 @@ EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), model_->GetModelContent()); - gfx::Point from = GetItemTileRectAt(0, 0).CenterPoint(); - gfx::Point to = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); + gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); // Canceling drag should keep existing order. SimulateDrag(AppsGridView::MOUSE, from, to); @@ -690,7 +692,7 @@ EXPECT_EQ(kPages, GetPaginationModel()->total_pages()); EXPECT_EQ(0, GetPaginationModel()->selected_page()); - gfx::Point from = GetItemTileRectAt(0, 0).CenterPoint(); + gfx::Point from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); gfx::Point to; const gfx::Rect apps_grid_bounds = apps_grid_view_->GetLocalBounds(); if (test_with_fullscreen_) @@ -737,11 +739,11 @@ EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), model_->GetModelContent()); - gfx::Point mouse_from = GetItemTileRectAt(0, 0).CenterPoint(); - gfx::Point mouse_to = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point mouse_from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); + gfx::Point mouse_to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); - gfx::Point touch_from = GetItemTileRectAt(0, 2).CenterPoint(); - gfx::Point touch_to = GetItemTileRectAt(0, 3).CenterPoint(); + gfx::Point touch_from = GetItemRectOnCurrentPageAt(0, 2).CenterPoint(); + gfx::Point touch_to = GetItemRectOnCurrentPageAt(0, 3).CenterPoint(); // Starts a mouse drag first then a touch drag. SimulateDrag(AppsGridView::MOUSE, mouse_from, mouse_to); @@ -770,8 +772,8 @@ EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), model_->GetModelContent()); - gfx::Point mouse_from = GetItemTileRectAt(0, 0).CenterPoint(); - gfx::Point mouse_to = GetItemTileRectAt(0, 1).CenterPoint(); + gfx::Point mouse_from = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); + gfx::Point mouse_to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); // Starts a mouse drag and then cancels it. SimulateDrag(AppsGridView::MOUSE, mouse_from, mouse_to);
diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc index 44e87016..74c8776 100644 --- a/ui/app_list/views/contents_view.cc +++ b/ui/app_list/views/contents_view.cc
@@ -34,9 +34,6 @@ namespace { -// Layout constants. -constexpr int kDefaultContentsViewHeight = 623; - void DoCloseAnimation(base::TimeDelta animation_duration, ui::Layer* layer) { ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); animation.SetTransitionDuration(animation_duration); @@ -440,10 +437,7 @@ } gfx::Size ContentsView::GetDefaultContentsSize() const { - gfx::Size size = apps_container_view_->GetPreferredSize(); - if (is_fullscreen_app_list_enabled_) - size.set_height(kDefaultContentsViewHeight); - return size; + return apps_container_view_->GetPreferredSize(); } gfx::Size ContentsView::CalculatePreferredSize() const {
diff --git a/ui/app_list/views/test/apps_grid_view_test_api.cc b/ui/app_list/views/test/apps_grid_view_test_api.cc index 2a945e2d7..317398f 100644 --- a/ui/app_list/views/test/apps_grid_view_test_api.cc +++ b/ui/app_list/views/test/apps_grid_view_test_api.cc
@@ -36,8 +36,11 @@ view_->Layout(); } -gfx::Rect AppsGridViewTestApi::GetItemTileRectAt(int row, int col) const { - return view_->GetExpectedTileBounds(row, col); +gfx::Rect AppsGridViewTestApi::GetItemTileRectOnCurrentPageAt(int row, + int col) const { + int slot = row * (view_->cols()) + col; + return view_->GetExpectedTileBounds( + AppsGridView::Index(view_->pagination_model()->selected_page(), slot)); } void AppsGridViewTestApi::PressItemAt(int index) {
diff --git a/ui/app_list/views/test/apps_grid_view_test_api.h b/ui/app_list/views/test/apps_grid_view_test_api.h index a778f93..079813d 100644 --- a/ui/app_list/views/test/apps_grid_view_test_api.h +++ b/ui/app_list/views/test/apps_grid_view_test_api.h
@@ -30,7 +30,7 @@ void LayoutToIdealBounds(); - gfx::Rect GetItemTileRectAt(int row, int col) const; + gfx::Rect GetItemTileRectOnCurrentPageAt(int row, int col) const; void PressItemAt(int index);
diff --git a/ui/display/manager/chromeos/touch_transform_controller_unittest.cc b/ui/display/manager/chromeos/touch_transform_controller_unittest.cc index 5200442..ec46dc8 100644 --- a/ui/display/manager/chromeos/touch_transform_controller_unittest.cc +++ b/ui/display/manager/chromeos/touch_transform_controller_unittest.cc
@@ -35,8 +35,8 @@ // Create a default mode. ManagedDisplayInfo::ManagedDisplayModeList default_modes( - 1, make_scoped_refptr( - new ManagedDisplayMode(bounds.size(), 60, false, true))); + 1, + base::MakeRefCounted<ManagedDisplayMode>(bounds.size(), 60, false, true)); info.SetManagedDisplayModes(default_modes); return info; @@ -172,10 +172,10 @@ ManagedDisplayInfo::ManagedDisplayModeList internal_modes; - internal_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(2560, 1700), 60, false, true))); - internal_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(1920, 1200), 60, false, false))); + internal_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(2560, 1700), 60, false, true)); + internal_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(1920, 1200), 60, false, false)); internal_display_info.SetManagedDisplayModes(internal_modes); ManagedDisplayInfo external_display_info = @@ -238,10 +238,10 @@ CreateDisplayInfo(1, internal_touchscreen, gfx::Rect(0, 0, 1024, 768)); internal_display_info.set_is_aspect_preserving_scaling(true); ManagedDisplayInfo::ManagedDisplayModeList internal_modes; - internal_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(1366, 768), 60, false, true))); - internal_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(1024, 768), 60, false, false))); + internal_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(1366, 768), 60, false, true)); + internal_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(1024, 768), 60, false, false)); internal_display_info.SetManagedDisplayModes(internal_modes); ManagedDisplayInfo external_display_info = @@ -308,15 +308,15 @@ ManagedDisplayInfo display1_info = CreateDisplayInfo(1, display1_touchscreen, gfx::Rect(0, 0, 1280, 850)); ManagedDisplayInfo::ManagedDisplayModeList display1_modes; - display1_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(1280, 850), 60, false, true))); + display1_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(1280, 850), 60, false, true)); display1_info.SetManagedDisplayModes(display1_modes); ManagedDisplayInfo display2_info = CreateDisplayInfo(2, display2_touchscreen, gfx::Rect(0, 950, 1920, 1080)); ManagedDisplayInfo::ManagedDisplayModeList display2_modes; - display2_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(gfx::Size(1920, 1080), 60, false, true))); + display2_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + gfx::Size(1920, 1080), 60, false, true)); display2_info.SetManagedDisplayModes(display2_modes); ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
diff --git a/ui/display/manager/managed_display_info.cc b/ui/display/manager/managed_display_info.cc index cf88a59..0d9bb6f 100644 --- a/ui/display/manager/managed_display_info.cc +++ b/ui/display/manager/managed_display_info.cc
@@ -282,9 +282,9 @@ highest_refresh_rate = refresh_rate; native_mode = i; } - display_modes.push_back(make_scoped_refptr( - new ManagedDisplayMode(size, refresh_rate, is_interlaced, false, - 1.0, device_scale_factor))); + display_modes.push_back(base::MakeRefCounted<ManagedDisplayMode>( + size, refresh_rate, is_interlaced, false, 1.0, + device_scale_factor)); } } scoped_refptr<ManagedDisplayMode> dm = display_modes[native_mode];
diff --git a/ui/message_center/notification.h b/ui/message_center/notification.h index a3cd1df..a8d0c5d 100644 --- a/ui/message_center/notification.h +++ b/ui/message_center/notification.h
@@ -145,7 +145,7 @@ bool should_make_spoken_feedback_for_popup_updates = true; // Whether it should be possible for the user to click on the notification. - bool clickable = true; + bool clickable = false; #if defined(OS_CHROMEOS) // Flag if the notification is pinned. If true, the notification is pinned
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index 188a4b7..4a2a5de 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc
@@ -330,10 +330,11 @@ } gfx::NativeCursor NotificationView::GetCursor(const ui::MouseEvent& event) { - if (!clickable_ || !controller()->HasClickedListener(notification_id())) - return views::View::GetCursor(event); + // TODO(estade): remove NotificationDelegate::HasClickedListener. + if (clickable_ || controller()->HasClickedListener(notification_id())) + return views::GetNativeHandCursor(); - return views::GetNativeHandCursor(); + return views::View::GetCursor(event); }
diff --git a/ui/message_center/views/notification_view_md.cc b/ui/message_center/views/notification_view_md.cc index 888e2bc..8cfd0f0 100644 --- a/ui/message_center/views/notification_view_md.cc +++ b/ui/message_center/views/notification_view_md.cc
@@ -442,10 +442,10 @@ } gfx::NativeCursor NotificationViewMD::GetCursor(const ui::MouseEvent& event) { - if (!clickable_ || !controller()->HasClickedListener(notification_id())) - return views::View::GetCursor(event); + if (clickable_ || controller()->HasClickedListener(notification_id())) + return views::GetNativeHandCursor(); - return views::GetNativeHandCursor(); + return views::View::GetCursor(event); } void NotificationViewMD::OnMouseEntered(const ui::MouseEvent& event) {
diff --git a/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.html b/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.html index 404b5d7..82fda19 100644 --- a/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.html +++ b/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.html
@@ -64,9 +64,10 @@ #cameraVideo { height: var(--cr-camera-image-size, 228px); - /* Center image for 4:3 aspect ratio. */ - left: -16.6%; + object-fit: cover; + object-position: center; position: absolute; + width: var(--cr-camera-image-size, 228px); } #cameraControls {