diff --git a/DEPS b/DEPS index bcaa9e1..aba50b0 100644 --- a/DEPS +++ b/DEPS
@@ -79,11 +79,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': '6eba063b63efbf824aff8ec6b32af05e4d54c38b', + 'skia_revision': 'c3bc425bd4d630f4c6b69f38473fc69b77a1d5b9', # 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': 'deec2b95b687c0f6d928ab6f3a9398e57e92d1dd', + 'v8_revision': 'f126268aefd03c8e3e5c038f252eaf97404c4180', # 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. @@ -91,7 +91,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': 'a3b220f36f519870e0b4895df21cf4586bd1f2b5', + 'angle_revision': '96310cdad3174fe81c05d53de3d1186cbc82e768', # 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. @@ -873,7 +873,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '3c1cb0203b6cfc10389e85a350b2ea6ca29d01ce', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '7abc9a07d774576e98fa8f00e75f17b6e5d83d2b', # commit position 21742 + Var('webrtc_git') + '/src.git' + '@' + 'a21090b7706eb6577f4b305f3e00b04fe833c50d', # commit position 21742 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/ash/assistant/ash_assistant_controller.cc b/ash/assistant/ash_assistant_controller.cc index 6e274fb..9fdd0b3 100644 --- a/ash/assistant/ash_assistant_controller.cc +++ b/ash/assistant/ash_assistant_controller.cc
@@ -41,6 +41,11 @@ NOTIMPLEMENTED(); } +void AshAssistantController::OnSpeechLevelUpdated(float speech_level) { + // TODO(dmblack): Handle. + NOTIMPLEMENTED(); +} + void AshAssistantController::OnOpenUrlResponse(const GURL& url) { Shell::Get()->shell_delegate()->OpenUrlFromArc(url); }
diff --git a/ash/assistant/ash_assistant_controller.h b/ash/assistant/ash_assistant_controller.h index 551d6c8a..2401e07 100644 --- a/ash/assistant/ash_assistant_controller.h +++ b/ash/assistant/ash_assistant_controller.h
@@ -26,6 +26,9 @@ void OnTextResponse(const std::string& response) override; void OnOpenUrlResponse(const GURL& url) override; + // Assistant got a speech level update in dB. + void OnSpeechLevelUpdated(float speech_level) override; + // mojom::AshAssistantController: void SetAssistant( chromeos::assistant::mojom::AssistantPtr assistant) override;
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc index 917b8a3b..4e5a044 100644 --- a/ash/system/overview/overview_button_tray.cc +++ b/ash/system/overview/overview_button_tray.cc
@@ -14,6 +14,7 @@ #include "ash/system/tray/tray_container.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/window_selector_controller.h" +#include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/window_state.h" #include "base/metrics/user_metrics.h" @@ -22,6 +23,7 @@ #include "ui/gfx/paint_vector_icon.h" #include "ui/views/border.h" #include "ui/views/controls/image_view.h" +#include "ui/wm/core/window_util.h" namespace ash { @@ -80,14 +82,35 @@ DCHECK(Shell::Get()->window_selector_controller()->IsSelecting()); base::RecordAction(base::UserMetricsAction("Tablet_QuickSwitch")); + + // Build mru window list. Use cycle as it excludes some windows we are not + // interested in such as transient children. MruWindowTracker::WindowList mru_window_list = - Shell::Get()->mru_window_tracker()->BuildMruWindowList(); + Shell::Get()->mru_window_tracker()->BuildWindowForCycleList(); // Switch to the second most recently used window (most recent is the - // current window), if it exists. + // current window) if it exists, unless splitview mode is active. if (mru_window_list.size() > 1u) { + aura::Window* new_active_window = mru_window_list[1]; + + // In splitview mode, quick switch will only affect the windows on the non + // default side. The window which was dragged to either side to begin + // splitview will remain untouched. Skip that window if it appears in the + // mru list. + SplitViewController* split_view_controller = + Shell::Get()->split_view_controller(); + if (split_view_controller->IsSplitViewModeActive() && + mru_window_list.size() > 2u) { + if (mru_window_list[0] == + split_view_controller->GetDefaultSnappedWindow() || + mru_window_list[1] == + split_view_controller->GetDefaultSnappedWindow()) { + new_active_window = mru_window_list[2]; + } + } + AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); - wm::GetWindowState(mru_window_list[1])->Activate(); + wm::GetWindowState(new_active_window)->Activate(); last_press_event_time_ = base::nullopt; return true; }
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc index a0535b6..f52f88d 100644 --- a/ash/system/overview/overview_button_tray_unittest.cc +++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -16,6 +16,7 @@ #include "ash/test/ash_test_base.h" #include "ash/test/ash_test_helper.h" #include "ash/wm/overview/window_selector_controller.h" +#include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" @@ -293,4 +294,59 @@ EXPECT_FALSE(GetTray()->visible()); } +// Verify that quick switch works properly when one of the windows has a +// transient child. +TEST_F(OverviewButtonTrayTest, TransientChildQuickSwitch) { + std::unique_ptr<aura::Window> window1 = CreateTestWindow(); + std::unique_ptr<aura::Window> window2 = + CreateTestWindow(gfx::Rect(), aura::client::WINDOW_TYPE_POPUP); + std::unique_ptr<aura::Window> window3 = CreateTestWindow(); + + // Add |window2| as a transient child of |window1|, and focus |window1|. + ::wm::AddTransientChild(window1.get(), window2.get()); + ::wm::ActivateWindow(window3.get()); + ::wm::ActivateWindow(window2.get()); + ::wm::ActivateWindow(window1.get()); + + // Verify that after double tapping, we have switched to |window3|, even + // though |window2| is more recently used. + PerformDoubleTap(); + EXPECT_EQ(window3.get(), wm::GetActiveWindow()); +} + +// Verify that quick switch works properly when in split view mode. +TEST_F(OverviewButtonTrayTest, SplitviewModeQuickSwitch) { + // Splitview is only available in tablet mode. + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); + + std::unique_ptr<aura::Window> window1 = CreateTestWindow(); + std::unique_ptr<aura::Window> window2 = CreateTestWindow(); + std::unique_ptr<aura::Window> window3 = CreateTestWindow(); + + // Enter splitview mode. Snap |window1| to the left, this will be the default + // splitview window. + Shell::Get()->window_selector_controller()->ToggleOverview(); + SplitViewController* split_view_controller = + Shell::Get()->split_view_controller(); + split_view_controller->SnapWindow(window1.get(), SplitViewController::LEFT); + split_view_controller->SnapWindow(window2.get(), SplitViewController::RIGHT); + ASSERT_EQ(window1.get(), split_view_controller->GetDefaultSnappedWindow()); + EXPECT_EQ(window2.get(), wm::GetActiveWindow()); + + // Verify that after double tapping, we have switched to |window3|, even + // though |window1| is more recently used. + PerformDoubleTap(); + EXPECT_EQ(window3.get(), split_view_controller->right_window()); + EXPECT_EQ(window3.get(), wm::GetActiveWindow()); + + // Focus |window1|. Verify that after double tapping, |window2| is the on the + // right side for splitview. + wm::ActivateWindow(window1.get()); + PerformDoubleTap(); + EXPECT_EQ(window2.get(), split_view_controller->right_window()); + EXPECT_EQ(window2.get(), wm::GetActiveWindow()); + + split_view_controller->EndSplitView(); +} + } // namespace ash
diff --git a/base/BUILD.gn b/base/BUILD.gn index f2cf35f..33c99aed 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1274,13 +1274,6 @@ # Needs to be a public config so that dependent targets link against it as # well when doing a component build. public_configs = [ ":android_system_libs" ] - - if (can_unwind_with_cfi_table) { - sources += [ - "trace_event/cfi_backtrace_android.cc", - "trace_event/cfi_backtrace_android.h", - ] - } } # Chromeos. @@ -2469,20 +2462,6 @@ } if (is_android) { - # Add unwind tables in base_unittests_apk test apk. The unwind tables are - # generated from debug info in the binary. Removing "default_symbols" and - # adding symbols config removes the "strip_debug" config that strips the - # debug info, on base unittests apk. - if (can_unwind_with_cfi_table) { - configs -= [ "//build/config/compiler:default_symbols" ] - if (symbol_level == 2) { - configs += [ "//build/config/compiler:symbols" ] - } else { - configs += [ "//build/config/compiler:minimal_symbols" ] - } - add_unwind_tables_in_apk = true - sources += [ "trace_event/cfi_backtrace_android_unittest.cc" ] - } sources -= [ "process/process_unittest.cc", "process/process_util_unittest.cc",
diff --git a/base/test/fontconfig_util_linux.cc b/base/test/fontconfig_util_linux.cc index 4ffa3d8..c0a34dd8 100644 --- a/base/test/fontconfig_util_linux.cc +++ b/base/test/fontconfig_util_linux.cc
@@ -64,18 +64,6 @@ <glob>/usr/share/fonts/truetype/msttcorefonts/Impact.ttf</glob> </acceptfont> <acceptfont> - <glob>/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf</glob> - </acceptfont> - <acceptfont> - <glob>/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf</glob> - </acceptfont> - <acceptfont> - <glob>/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf</glob> - </acceptfont> - <acceptfont> - <glob>/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf</glob> - </acceptfont> - <acceptfont> <glob>/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf</glob> </acceptfont> <acceptfont>
diff --git a/base/trace_event/cfi_backtrace_android.cc b/base/trace_event/cfi_backtrace_android.cc deleted file mode 100644 index fa26c58..0000000 --- a/base/trace_event/cfi_backtrace_android.cc +++ /dev/null
@@ -1,277 +0,0 @@ -// Copyright 2018 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/trace_event/cfi_backtrace_android.h" - -#include <sys/mman.h> -#include <sys/types.h> - -#include "base/android/apk_assets.h" -#include "base/debug/stack_trace.h" - -#if !defined(ARCH_CPU_ARMEL) -#error This file should not be built for this architecture. -#endif - -/* -Basics of unwinding: -For each instruction in a function we need to know what is the offset of SP -(Stack Pointer) to reach the previous function's stack frame. To know which -function is being invoked, we need the return address of the next function. The -CFI information for an instruction is made up of 2 offsets, CFA (Call Frame -Address) offset and RA (Return Address) offset. The CFA offset is the change in -SP made by the function till the current instruction. This depends on amount of -memory allocated on stack by the function plus some registers that the function -stores that needs to be restored at the end of function. So, at each instruction -the CFA offset tells the offset from original SP before the function call. The -RA offset tells us the offset from the previous SP into the current function -where the return address is stored. - -The unwind table contains rows of 64 bits each. -We have 2 types of rows, FUNCTION and CFI. -Each function with CFI info has a single FUNCTION row, followed by one or more -CFI rows. All the addresses of the CFI rows will be within the function. -1. FUNCTION. Bits in order of high to low represent: - 31 bits: specifies function address, without the last bit (always 0). - 1 bit : always 1. Last bit of the address, specifies the row type is - FUNCTION. - 32 bits: length of the current function. - -2. CFI. Bits in order of high to low represent: - 31 bits: instruction address in the current function. - 1 bit : always 0. Last bit of the address, specifies the row type is CFI. - 30 bits: CFA offset / 4. - 2 bits: RA offset / 4. -If the RA offset of a row is 0, then use the offset of the previous rows in the -same function. -TODO(ssid): Make sure RA offset is always present. - -See extract_unwind_tables.py for details about how this data is extracted from -breakpad symbol files. -*/ - -extern "C" { -extern char __executable_start; -extern char _etext; -} - -namespace base { -namespace trace_event { - -namespace { - -// The bit of the address that is used to specify the type of the row is -// FUNCTION or CFI type. -constexpr uint32_t kFunctionTypeMask = 0x1; - -// The mask on the CFI row data that is used to get the high 30 bits and -// multiply it by 4 to get CFA offset. Since the last 2 bits are masked out, a -// shift is not necessary. -constexpr uint32_t kCFAMask = 0xfffffffc; - -// The mask on the CFI row data that is used to get the low 2 bits and multiply -// it by 4 to get the RA offset. -constexpr uint32_t kRAMask = 0x3; -constexpr uint32_t kRAShift = 2; - -// The code in this file assumes we are running in 32-bit builds since all the -// addresses in the unwind table are specified in 32 bits. -static_assert(sizeof(uintptr_t) == 4, - "The unwind table format is only valid for 32 bit builds."); - -// The struct that corresponds to each row in the unwind table. The row can be -// of any type, CFI or FUNCTION. The first 4 bytes in the row represents the -// address and the next 4 bytes have data. The members of this struct is in -// order of the input format. We cast the memory map of the unwind table as an -// array of CFIUnwindInfo and use it to read data and search. So, the size of -// this struct should be 8 bytes and the order of the members is fixed according -// to the given format. -struct CFIUnwindInfo { - // The address is either the start address of the function or the instruction - // address where the CFI information changes in a function. If the last bit of - // the address is 1 then it specifies that the row is of type FUNCTION and if - // the last bit is 0 then it specifies the row is of type CFI. - uintptr_t addr; - - // If the row type is function, |data| is |function_length|. If the row type - // is CFI, |data| is |cfi_data|. - union { - // Represents the total length of the function that start with the |addr|. - uintptr_t function_length; - // Represents the CFA and RA offsets to get information about next stack - // frame. - uintptr_t cfi_data; - } data; - - bool is_function_type() const { return !!(addr & kFunctionTypeMask); } - - // Returns the address of the current row, CFI or FUNCTION type. - uintptr_t address() const { - return is_function_type() ? (addr & ~kFunctionTypeMask) : addr; - } - - // Return the RA offset when the current row is CFI type. - uintptr_t ra_offset() const { - DCHECK(!is_function_type()); - return (data.cfi_data & kRAMask) << kRAShift; - } - - // Returns the CFA offset if the current row is CFI type. - uintptr_t cfa_offset() const { - DCHECK(!is_function_type()); - return data.cfi_data & kCFAMask; - } - - // Returns true if the instruction is within the function address range, given - // that the current row is FUNCTION type and the |instruction_addr| is offset - // address of instruction from the start of the binary. - bool is_instruction_in_function(uintptr_t instruction_addr) const { - DCHECK(is_function_type()); - return (instruction_addr >= address()) && - (instruction_addr <= address() + data.function_length); - } -}; - -static_assert( - sizeof(CFIUnwindInfo) == 8, - "The CFIUnwindInfo struct must be exactly 8 bytes for searching."); - -} // namespace - -// static -CFIBacktraceAndroid* CFIBacktraceAndroid::GetInstance() { - static CFIBacktraceAndroid* instance = new CFIBacktraceAndroid(); - return instance; -} - -CFIBacktraceAndroid::CFIBacktraceAndroid() { - Initialize(); -} - -CFIBacktraceAndroid::~CFIBacktraceAndroid() {} - -void CFIBacktraceAndroid::Initialize() { - // The address |_etext| gives the end of the .text section in the binary. This - // value is more accurate than parsing the memory map since the mapped - // regions are usualy larger than the .text section. - executable_end_addr_ = reinterpret_cast<uintptr_t>(&_etext); - // The address of |__executable_start| gives the start address of the - // executable. This value is used to find the offset address of the - // instruction in binary from PC. - executable_start_addr_ = reinterpret_cast<uintptr_t>(&__executable_start); - - // This file name is defined by extract_unwind_tables.gni. - static constexpr char kCfiFileName[] = "assets/unwind_cfi"; - MemoryMappedFile::Region cfi_region; - int fd = base::android::OpenApkAsset(kCfiFileName, &cfi_region); - if (fd < 0) - return; - cfi_mmap_ = std::make_unique<MemoryMappedFile>(); - // The CFI region starts at |cfi_region.offset|. - if (!cfi_mmap_->Initialize(base::File(fd), cfi_region)) - return; - // The CFI file should contain rows of 8 bytes each. - DCHECK_EQ(0u, cfi_region.size % sizeof(CFIUnwindInfo)); - unwind_table_row_count_ = cfi_region.size / sizeof(CFIUnwindInfo); - can_unwind_stack_frames_ = true; -} - -size_t CFIBacktraceAndroid::Unwind(const void** out_trace, - size_t max_depth) const { - // This function walks the stack using the call frame information to find the - // return addresses of all the functions that belong to current binary in call - // stack. For each function the CFI table defines the offset of the previous - // call frame and offset where the return address is stored. - if (!can_unwind_stack_frames()) - return 0; - - // Get the current register state. This register state can be taken at any - // point in the function and the unwind information would be for this point. - // Define local variables before trying to get the current PC and SP to make - // sure the register state obtained is consistent with each other. - uintptr_t pc = 0, sp = 0; - asm volatile("mov %0, pc" : "=r"(pc)); - asm volatile("mov %0, sp" : "=r"(sp)); - - // We can only unwind as long as the pc is within the chrome.so. - size_t depth = 0; - while (pc > executable_start_addr_ && pc <= executable_end_addr_ && - depth < max_depth) { - out_trace[depth++] = reinterpret_cast<void*>(pc); - // The offset of function from the start of the chrome.so binary: - uintptr_t func_addr = pc - executable_start_addr_; - CFIRow cfi{}; - if (!FindCFIRowForPC(func_addr, &cfi)) - break; - - // The rules for unwinding using the CFI information are: - // SP_prev = SP_cur + cfa_offset and - // PC_prev = * (SP_prev - ra_offset). - sp = sp + cfi.cfa_offset; - memcpy(&pc, reinterpret_cast<uintptr_t*>(sp - cfi.ra_offset), - sizeof(uintptr_t)); - } - return depth; -} - -bool CFIBacktraceAndroid::FindCFIRowForPC( - uintptr_t func_addr, - CFIBacktraceAndroid::CFIRow* cfi) const { - // Consider the CFI mapped region as an array of CFIUnwindInfo since each row - // is 8 bytes long and it contains |cfi_region_size_| / 8 rows. We define - // start and end iterator on this array and use std::lower_bound() to binary - // search on this array. std::lower_bound() returns the row that corresponds - // to the first row that has address greater than the current value, since - // address is used in compartor. - const CFIUnwindInfo* start = - reinterpret_cast<const CFIUnwindInfo*>(cfi_mmap_->data()); - const CFIUnwindInfo* end = start + unwind_table_row_count_; - const CFIUnwindInfo to_find = {func_addr, {0}}; - const CFIUnwindInfo* found = std::lower_bound( - start, end, to_find, - [](const auto& a, const auto& b) { return a.addr < b.addr; }); - *cfi = {0}; - - // The given address is less than the start address in the CFI table if - // lower_bound() returns start. - if (found == start) - return false; - // If the given address is equal to the found address, then use the found row. - // Otherwise the required row is always one less than the value returned by - // std::lower_bound(). - if (found == end || found->address() != func_addr) - found--; - - DCHECK_LE(found->address(), func_addr); - DCHECK(!found->is_function_type()) - << "Current PC cannot be start of a function"; - - // The CFIUnwindInfo::data field hold the CFI information since the row - // found should not correspond to function start address. So, interpret the - // data in the found row as CFI data which contains the CFA and RA offsets. - *cfi = {found->cfa_offset(), found->ra_offset()}; - DCHECK(cfi->cfa_offset); - - // Find the function data for the current row by iterating till we reach the a - // row of type FUNCTION, to check if the unwind information is valid. Also - // find the RA offset if we do not have it in the CFI row found. - const CFIUnwindInfo* it = found; - for (; !it->is_function_type() && it >= start; it--) { - // If ra offset of the last specified row should be used, if unspecified. - // TODO(ssid): This should be fixed in the format and we should always - // output ra offset. - if (!cfi->ra_offset) - cfi->ra_offset = it->ra_offset(); - } - // If the given function adddress does not belong to the function found, then - // the unwind info is invalid. - if (!it->is_instruction_in_function(func_addr)) - return false; - - DCHECK(cfi->ra_offset); - return true; -} - -} // namespace trace_event -} // namespace base
diff --git a/base/trace_event/cfi_backtrace_android.h b/base/trace_event/cfi_backtrace_android.h deleted file mode 100644 index bad7290..0000000 --- a/base/trace_event/cfi_backtrace_android.h +++ /dev/null
@@ -1,103 +0,0 @@ -// Copyright 2018 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 BASE_TRACE_EVENT_CFI_BACKTRACE_ANDROID_H_ -#define BASE_TRACE_EVENT_CFI_BACKTRACE_ANDROID_H_ - -#include <stddef.h> -#include <stdint.h> - -#include <memory> - -#include "base/base_export.h" -#include "base/debug/debugging_buildflags.h" -#include "base/files/memory_mapped_file.h" -#include "base/gtest_prod_util.h" - -namespace base { -namespace trace_event { - -// This class is used to unwind stack frames in the current thread. The unwind -// information (dwarf debug info) is stripped from the chrome binary and we do -// not build with exception tables (ARM EHABI) in release builds. So, we use a -// custom unwind table which is generated and added to specific android builds, -// when add_unwind_tables_in_apk build option is specified. This unwind table -// contains information for unwinding stack frames when the functions calls are -// from lib[mono]chrome.so. The file is added as an asset to the apk and the -// table is used to unwind stack frames for profiling. This class implements -// methods to read and parse the unwind table and unwind stack frames using this -// data. -class BASE_EXPORT CFIBacktraceAndroid { - public: - // Creates and initializes the unwinder on first call. - static CFIBacktraceAndroid* GetInstance(); - - // Returns true if stack unwinding is possible using CFI unwind tables in apk. - // There is no need to check this before each unwind call. Will always return - // the same value based on CFI tables being present in the binary. - bool can_unwind_stack_frames() const { return can_unwind_stack_frames_; } - - // Returns the program counters by unwinding stack in the current thread in - // order of latest call frame first. Unwinding works only if - // can_unwind_stack_frames() returns true. This function does not allocate - // memory from heap. For each stack frame, this method searches through the - // unwind table mapped in memory to find the unwind information for function - // and walks the stack to find all the return address. This only works until - // the last function call from the chrome.so. We do not have unwind - // information to unwind beyond any frame outside of chrome.so. Calls to - // Unwind() are thread safe and lock free, once Initialize() returns success. - size_t Unwind(const void** out_trace, size_t max_depth) const; - - private: - FRIEND_TEST_ALL_PREFIXES(CFIBacktraceAndroidTest, TestFindCFIRow); - FRIEND_TEST_ALL_PREFIXES(CFIBacktraceAndroidTest, TestUnwinding); - - // The CFI information that correspond to an instruction. - struct CFIRow { - bool operator==(const CFIBacktraceAndroid::CFIRow& o) const { - return cfa_offset == o.cfa_offset && ra_offset == o.ra_offset; - } - - // The offset of the call frame address of previous function from the - // current stack pointer. Rule for unwinding SP: SP_prev = SP_cur + - // cfa_offset. - size_t cfa_offset = 0; - // The offset of location of return address from the previous call frame - // address. Rule for unwinding PC: PC_prev = * (SP_prev - ra_offset). - size_t ra_offset = 0; - }; - - CFIBacktraceAndroid(); - ~CFIBacktraceAndroid(); - - // Initializes unwind tables using the CFI asset file in the apk if present. - // Also stores the limits of mapped region of the lib[mono]chrome.so binary, - // since the unwind is only feasible for addresses within the .so file. Once - // initialized, the memory map of the unwind table is never cleared since we - // cannot guarantee that all the threads are done using the memory map when - // heap profiling is turned off. But since we keep the memory map is clean, - // the system can choose to evict the unused pages when needed. This would - // still reduce the total amount of address space available in process. - void Initialize(); - - // Finds the CFI row for the given |func_addr| in terms of offset from - // the start of the current binary. - bool FindCFIRowForPC(uintptr_t func_addr, CFIRow* out) const; - - // Details about the memory mapped region which contains the libchrome.so - // library file. - uintptr_t executable_start_addr_ = 0; - uintptr_t executable_end_addr_ = 0; - - // The start address of the memory mapped unwind table asset file. Unique ptr - // because it is replaced in tests. - std::unique_ptr<MemoryMappedFile> cfi_mmap_; - size_t unwind_table_row_count_ = 0; - bool can_unwind_stack_frames_ = false; -}; - -} // namespace trace_event -} // namespace base - -#endif // BASE_TRACE_EVENT_CFI_BACKTRACE_ANDROID_H_
diff --git a/base/trace_event/cfi_backtrace_android_unittest.cc b/base/trace_event/cfi_backtrace_android_unittest.cc deleted file mode 100644 index 0a25d37..0000000 --- a/base/trace_event/cfi_backtrace_android_unittest.cc +++ /dev/null
@@ -1,117 +0,0 @@ -// Copyright 2018 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/trace_event/cfi_backtrace_android.h" - -#include "base/files/file_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace base { -namespace trace_event { - -namespace { - -void* GetPC() { - return __builtin_return_address(0); -} - -} // namespace - -TEST(CFIBacktraceAndroidTest, TestUnwinding) { - auto* unwinder = CFIBacktraceAndroid::GetInstance(); - EXPECT_TRUE(unwinder->can_unwind_stack_frames()); - EXPECT_GT(unwinder->executable_start_addr_, 0u); - EXPECT_GT(unwinder->executable_end_addr_, unwinder->executable_start_addr_); - EXPECT_GT(unwinder->cfi_mmap_->length(), 0u); - - const size_t kMaxFrames = 100; - const void* frames[kMaxFrames]; - size_t unwind_count = unwinder->Unwind(frames, kMaxFrames); - // Expect at least 2 frames in the result. - ASSERT_GT(unwind_count, 2u); - EXPECT_LE(unwind_count, kMaxFrames); - - const size_t kMaxCurrentFuncCodeSize = 50; - const uintptr_t current_pc = reinterpret_cast<uintptr_t>(GetPC()); - const uintptr_t actual_frame = reinterpret_cast<uintptr_t>(frames[2]); - EXPECT_NEAR(current_pc, actual_frame, kMaxCurrentFuncCodeSize); - - for (size_t i = 0; i < unwind_count; ++i) { - EXPECT_GT(reinterpret_cast<uintptr_t>(frames[i]), - unwinder->executable_start_addr_); - EXPECT_LT(reinterpret_cast<uintptr_t>(frames[i]), - unwinder->executable_end_addr_); - } -} - -TEST(CFIBacktraceAndroidTest, TestFindCFIRow) { - auto* unwinder = CFIBacktraceAndroid::GetInstance(); - size_t input[] = {// Function 1 - 0x1000 - 0x1001, 0x500, - 0x1002, 0x111, - 0x1008, 0x220, - 0x1040, 0x330, - 0x1050, 0x332, - 0x1080, 0x330, - - // Function 2 - 0x2000 - 0x2001, 0x22, - 0x2004, 0x13, - 0x2008, 0x23, - - // Function 3 - 0x2024 - 0x2025, 0x100, - 0x2030, 0x33, - 0x2100, 0x40, - - // Function 4 - 0x2200 - 0x2201, 0x10, - 0x2204, 0x2e}; - FilePath temp_path; - CreateTemporaryFile(&temp_path); - EXPECT_EQ( - static_cast<int>(sizeof(input)), - WriteFile(temp_path, reinterpret_cast<char*>(input), sizeof(input))); - - unwinder->cfi_mmap_.reset(new MemoryMappedFile()); - ASSERT_TRUE(unwinder->cfi_mmap_->Initialize(temp_path)); - unwinder->unwind_table_row_count_ = sizeof(input) / (2 * sizeof(size_t)); - - CFIBacktraceAndroid::CFIRow cfi_row = {0}; - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x00, &cfi_row)); - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x100, &cfi_row)); - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x1501, &cfi_row)); - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x3000, &cfi_row)); - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x2023, &cfi_row)); - EXPECT_FALSE(unwinder->FindCFIRowForPC(0x2215, &cfi_row)); - - const CFIBacktraceAndroid::CFIRow kRow1 = {0x110, 0x4}; - const CFIBacktraceAndroid::CFIRow kRow2 = {0x220, 0x4}; - const CFIBacktraceAndroid::CFIRow kRow3 = {0x330, 0x8}; - const CFIBacktraceAndroid::CFIRow kRow4 = {0x30, 0xc}; - const CFIBacktraceAndroid::CFIRow kRow5 = {0x2c, 0x8}; - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1002, &cfi_row)); - EXPECT_EQ(kRow1, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1003, &cfi_row)); - EXPECT_EQ(kRow1, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1008, &cfi_row)); - EXPECT_EQ(kRow2, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1009, &cfi_row)); - EXPECT_EQ(kRow2, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1039, &cfi_row)); - EXPECT_EQ(kRow2, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1080, &cfi_row)); - EXPECT_EQ(kRow3, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x1100, &cfi_row)); - EXPECT_EQ(kRow3, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x2050, &cfi_row)); - EXPECT_EQ(kRow4, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x2208, &cfi_row)); - EXPECT_EQ(kRow5, cfi_row); - EXPECT_TRUE(unwinder->FindCFIRowForPC(0x2210, &cfi_row)); - EXPECT_EQ(kRow5, cfi_row); -} - -} // namespace trace_event -} // namespace base
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index e018349..23b7971 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -2096,6 +2096,9 @@ # TODO(thakis): Consider making clang emit DW_AT_linkage_name in -g1 mode; # failing that consider doing this on non-Android too. cflags += [ "-fdebug-info-for-profiling" ] + if (strip_debug_info) { + ldflags += [ "-Wl,--strip-debug" ] + } } # Note: -gsplit-dwarf implicitly turns on -g2 with clang, so don't pass it. @@ -2122,18 +2125,6 @@ } else { assert(false) } - - # This config is removed by base unittests apk. - if (is_android && is_clang && strip_debug_info) { - configs += [ ":strip_debug" ] - } -} - -config("strip_debug") { - if (!defined(ldflags)) { - ldflags = [] - } - ldflags += [ "-Wl,--strip-debug" ] } if (is_ios || is_mac) {
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 60f05de..5fb5a3c 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni
@@ -141,14 +141,6 @@ assert(!can_unwind_with_frame_pointers || enable_frame_pointers) -# Unwinding with CFI table is only possible on static library builds and -# requried only when frame pointers are not enabled. -# Builds with use_thin_lto use link registers to store offsets, and this is -# not supported yet. -can_unwind_with_cfi_table = - is_android && !is_component_build && !can_unwind_with_frame_pointers && - current_cpu == "arm" && !use_thin_lto - declare_args() { # Whether or not the official builds should be built with full WPO. Enabled by # default for the PGO and the x64 builds.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java index 2823533..7fca846 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -18,6 +18,7 @@ import android.os.Process; import android.os.SystemClock; import android.support.annotation.Nullable; +import android.support.annotation.StringDef; import android.support.customtabs.CustomTabsCallback; import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsService; @@ -156,6 +157,22 @@ static final String PARALLEL_REQUEST_URL_KEY = "android.support.customtabs.PARALLEL_REQUEST_URL"; + @StringDef({PARALLEL_REQUEST_SUCCESS, PARALLEL_REQUEST_FAILURE_NOT_AUTHORIZED, + PARALLEL_REQUEST_FAILURE_INVALID_URL, PARALLEL_REQUEST_FAILURE_INVALID_REFERRER, + PARALLEL_REQUEST_FAILURE_INVALID_REFERRER_FOR_SESSION}) + @interface ParallelRequestStatus {} + @VisibleForTesting + static final String PARALLEL_REQUEST_SUCCESS = "Success"; + @VisibleForTesting + static final String PARALLEL_REQUEST_FAILURE_NOT_AUTHORIZED = "Not authorized"; + @VisibleForTesting + static final String PARALLEL_REQUEST_FAILURE_INVALID_URL = "Invalid URL"; + @VisibleForTesting + static final String PARALLEL_REQUEST_FAILURE_INVALID_REFERRER = "Invalid referrer"; + @VisibleForTesting + static final String PARALLEL_REQUEST_FAILURE_INVALID_REFERRER_FOR_SESSION = + "Invalid referrer for session"; + private static final CustomTabsConnection sInstance = AppHooks.get().createCustomTabsConnection(); private @Nullable String mTrustedPublisherUrlPackage; @@ -904,7 +921,10 @@ if (mWarmupTasks != null) mWarmupTasks.cancel(); maybePreconnectToRedirectEndpoint(session, url, intent); - maybeStartParallelRequest(session, intent); + String status = maybeStartParallelRequest(session, intent); + if (mLogRequests) { + Log.w(TAG, "maybeStartParallelRequest() = " + status); + } } private void maybePreconnectToRedirectEndpoint( @@ -929,15 +949,19 @@ Profile.getLastUsedProfile(), redirectEndpoint.toString()); } - private void maybeStartParallelRequest(CustomTabsSessionToken session, Intent intent) { - if (!mClientManager.getAllowParallelRequestForSession(session)) return; + @ParallelRequestStatus + private String maybeStartParallelRequest(CustomTabsSessionToken session, Intent intent) { + if (!mClientManager.getAllowParallelRequestForSession(session)) { + return PARALLEL_REQUEST_FAILURE_NOT_AUTHORIZED; + } Uri referrer = intent.getParcelableExtra(PARALLEL_REQUEST_REFERRER_KEY); Uri url = intent.getParcelableExtra(PARALLEL_REQUEST_URL_KEY); int policy = intent.getIntExtra(PARALLEL_REQUEST_REFERRER_POLICY_KEY, WebReferrerPolicy.DEFAULT); - if (referrer == null || url == null) return; + if (url == null) return PARALLEL_REQUEST_FAILURE_INVALID_URL; + if (referrer == null) return PARALLEL_REQUEST_FAILURE_INVALID_REFERRER; if (policy < 0 || policy > WebReferrerPolicy.LAST) policy = WebReferrerPolicy.DEFAULT; - startParallelRequest(session, url, referrer, policy); + return startParallelRequest(session, url, referrer, policy); } /** @return Whether {@code session} can create a parallel request for a given @@ -964,22 +988,27 @@ * @param url URL to send the request to. * @param referrer Referrer (and first party for cookies) to use. * @param referrerPolicy Referrer policy for the parallel request. - * @return Whether the request started. False if the session is not authorized to use the - * provided origin, if Chrome hasn't been initialized, or the feature is disabled. - * Also fails if the URL is neither HTTPS not HTTP. + * @return Whether the request was started, with reason in case of failure. */ @VisibleForTesting - boolean startParallelRequest(CustomTabsSessionToken session, Uri url, Uri referrer, + @ParallelRequestStatus + String startParallelRequest(CustomTabsSessionToken session, Uri url, Uri referrer, @WebReferrerPolicy int referrerPolicy) { ThreadUtils.assertOnUiThread(); - if (url.toString().equals("") || !isValid(url) - || !canDoParallelRequest(session, referrer)) { - return false; + if (url.toString().equals("") || !isValid(url)) return PARALLEL_REQUEST_FAILURE_INVALID_URL; + if (!canDoParallelRequest(session, referrer)) { + return PARALLEL_REQUEST_FAILURE_INVALID_REFERRER_FOR_SESSION; } + String urlString = url.toString(); + String referrerString = referrer.toString(); nativeCreateAndStartDetachedResourceRequest( - Profile.getLastUsedProfile(), url.toString(), referrer.toString(), referrerPolicy); - return true; + Profile.getLastUsedProfile(), urlString, referrerString, referrerPolicy); + if (mLogRequests) { + Log.w(TAG, "startParallelRequest(%s, %s, %d)", urlString, referrerString, + referrerPolicy); + } + return PARALLEL_REQUEST_SUCCESS; } /** See {@link ClientManager#getReferrerForSession(CustomTabsSessionToken)} */
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java index 34794a1d..75c3dd6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java
@@ -98,18 +98,22 @@ public void testStartParallelRequestValidation() throws Exception { CustomTabsSessionToken session = prepareSession(); ThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertFalse("Should not allow android-app:// scheme", + Assert.assertEquals("Should not allow android-app:// scheme", + CustomTabsConnection.PARALLEL_REQUEST_FAILURE_INVALID_URL, mConnection.startParallelRequest(session, Uri.parse("android-app://this.is.an.android.app"), ORIGIN, WebReferrerPolicy.DEFAULT)); - Assert.assertFalse("Should not allow an empty URL", + Assert.assertEquals("Should not allow an empty URL", + CustomTabsConnection.PARALLEL_REQUEST_FAILURE_INVALID_URL, mConnection.startParallelRequest( session, Uri.parse(""), ORIGIN, WebReferrerPolicy.DEFAULT)); - Assert.assertFalse("Should not allow an arbitrary origin", + Assert.assertEquals("Should not allow an arbitrary origin", + CustomTabsConnection.PARALLEL_REQUEST_FAILURE_INVALID_REFERRER_FOR_SESSION, mConnection.startParallelRequest(session, Uri.parse("HTTPS://foo.bar"), Uri.parse("wrong://origin"), WebReferrerPolicy.DEFAULT)); - Assert.assertTrue(mConnection.startParallelRequest( - session, Uri.parse("HTTP://foo.bar"), ORIGIN, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest(session, Uri.parse("HTTP://foo.bar"), ORIGIN, + WebReferrerPolicy.DEFAULT)); }); } @@ -128,8 +132,9 @@ Uri url = Uri.parse(mServer.getURL("/echotitle")); ThreadUtils.runOnUiThread(() -> { - Assert.assertTrue(mConnection.startParallelRequest( - session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest( + session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); }); cb.waitForCallback(0, 1); } @@ -142,8 +147,9 @@ mServer = EmbeddedTestServer.createAndStartServer(mContext); final Uri url = Uri.parse(mServer.getURL("/set-cookie?acookie")); ThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertTrue(mConnection.startParallelRequest( - session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest( + session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); }); String echoUrl = mServer.getURL("/echoheader?Cookie"); @@ -184,8 +190,9 @@ Uri url = Uri.parse(mServer.getURL("/cachetime")); // Cacheable response. String urlString = url.toString(); ThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertTrue(mConnection.startParallelRequest( - session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest( + session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); }); readFromSocketCallback.waitForCallback(0, 1); @@ -218,8 +225,9 @@ }); final Uri url = Uri.parse(mServer.getURL("/set-cookie?acookie")); ThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertTrue(mConnection.startParallelRequest( - session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest( + session, url, ORIGIN, WebReferrerPolicy.DEFAULT)); }); String echoUrl = mServer.getURL("/echoheader?Cookie"); @@ -248,8 +256,9 @@ CustomTabsSessionToken session = prepareSession(url); ThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertTrue(mConnection.startParallelRequest( - session, url, origin, WebReferrerPolicy.DEFAULT)); + Assert.assertEquals(CustomTabsConnection.PARALLEL_REQUEST_SUCCESS, + mConnection.startParallelRequest( + session, url, origin, WebReferrerPolicy.DEFAULT)); }); String echoUrl = mServer.getURL("/echoheader?Cookie");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java index 5ebc293..8689ce5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java
@@ -45,6 +45,7 @@ import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.net.test.util.TestWebServer; +import org.chromium.ui.base.DeviceFormFactor; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -150,13 +151,25 @@ mScreenShooter.shoot("trustedPublisherUrlRtl"); } + private int getDefaultSecurityIcon() { + // On tablets an info icon is shown for ConnectionSecurityLevel.NONE pages, + // on smaller form factors nothing. + if (DeviceFormFactor.isNonMultiDisplayContextOnTablet( + InstrumentationRegistry.getTargetContext())) { + return org.chromium.chrome.R.drawable.omnibox_info; + } + + return 0; + } + @Test @SmallTest @Feature({"UiCatalogue"}) @Features.EnableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) @OverrideTrustedCdn public void testUntrustedClient() throws Exception { - runTrustedCdnPublisherUrlTest("https://example.com/test", "com.someoneelse.bla", null, 0); + runTrustedCdnPublisherUrlTest( + "https://example.com/test", "com.someoneelse.bla", null, getDefaultSecurityIcon()); } @Test @@ -165,7 +178,7 @@ @Features.EnableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) @OverrideTrustedCdn public void testNoHeader() throws Exception { - runTrustedCdnPublisherUrlTest(null, "com.example.test", null, 0); + runTrustedCdnPublisherUrlTest(null, "com.example.test", null, getDefaultSecurityIcon()); } @Test @@ -174,7 +187,8 @@ @Features.EnableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) @OverrideTrustedCdn public void testMalformedHeader() throws Exception { - runTrustedCdnPublisherUrlTest("garbage", "com.example.test", null, 0); + runTrustedCdnPublisherUrlTest( + "garbage", "com.example.test", null, getDefaultSecurityIcon()); } @Test @@ -183,7 +197,8 @@ @Features.DisableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) @OverrideTrustedCdn public void testDisabled() throws Exception { - runTrustedCdnPublisherUrlTest("https://example.com/test", "com.example.test", null, 0); + runTrustedCdnPublisherUrlTest( + "https://example.com/test", "com.example.test", null, getDefaultSecurityIcon()); } @Test @@ -192,7 +207,8 @@ @Features.EnableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) // No @OverrideTrustedCdn public void testUntrustedCdn() throws Exception { - runTrustedCdnPublisherUrlTest("https://example.com/test", "com.example.test", null, 0); + runTrustedCdnPublisherUrlTest( + "https://example.com/test", "com.example.test", null, getDefaultSecurityIcon()); } // TODO(bauerb): Test an insecure HTTPS connection.
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index a360039a..c202f83a 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -10884,7 +10884,18 @@ <message name="IDS_VR_SHELL_SITE_IS_SHARING_SCREEN" desc="Text displayed in a transient bubble to inform the user that the page is sharing the screen."> Site is sharing your screen </message> - + <message name="IDS_VR_SHELL_BG_IS_USING_MICROPHONE" desc="Text displayed in a transient bubble to inform the user that a background tab is using the microphone."> + Background tab is using your microphone + </message> + <message name="IDS_VR_SHELL_BG_IS_USING_BLUETOOTH" desc="Text displayed in a transient bubble to inform the user that a background tab is using bluetooth."> + Background tab is using bluetooth + </message> + <message name="IDS_VR_SHELL_BG_IS_USING_CAMERA" desc="Text displayed in a transient bubble to inform the user that a background tab is using the camera."> + Background tab is using your camera + </message> + <message name="IDS_VR_SHELL_BG_IS_SHARING_SCREEN" desc="Text displayed in a transient bubble to inform the user that a background tab is sharing the screen."> + Background tab is sharing your screen + </message> <message name="IDS_VR_SHELL_SITE_CAN_TRACK_LOCATION" desc="Text displayed in a transient bubble to inform the user that the page may track location, but isn't doing so yet."> Site can track your location </message>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index eabcc00..f89c7d6 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3675,7 +3675,7 @@ {"unified-consent", flag_descriptions::kUnifiedConsentName, flag_descriptions::kUnifiedConsentDescription, kOsAll, - FEATURE_VALUE_TYPE(features::kUnifiedConsent)}, + FEATURE_VALUE_TYPE(signin::kUnifiedConsent)}, {"simplify-https-indicator", flag_descriptions::kSimplifyHttpsIndicatorName, flag_descriptions::kSimplifyHttpsIndicatorDescription, kOsDesktop,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 5f72c170..5fddcfc 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -23,6 +23,7 @@ #include "components/password_manager/core/common/password_manager_features.h" #include "components/payments/core/features.h" #include "components/safe_browsing/features.h" +#include "components/signin/core/browser/profile_management_switches.h" #include "components/subresource_filter/core/browser/subresource_filter_features.h" #include "content/public/common/content_features.h" #include "jni/ChromeFeatureList_jni.h" @@ -56,7 +57,6 @@ &features::kSiteNotificationChannels, &features::kSimplifiedFullscreenUI, &features::kSoundContentSetting, - &features::kUnifiedConsent, &features::kWebPayments, &feed::kInterestFeedContentSuggestions, &kAdjustWebApkInstallationSpace, @@ -149,6 +149,7 @@ &omnibox::kUIExperimentHideSteadyStateUrlSchemeAndSubdomains, &password_manager::features::kPasswordExport, &password_manager::features::kPasswordSearchMobile, + &signin::kUnifiedConsent, &subresource_filter::kSafeBrowsingSubresourceFilterExperimentalUI, &safe_browsing::kDispatchSafetyNetCheckOffThread, };
diff --git a/chrome/browser/android/vr/vr_shell.cc b/chrome/browser/android/vr/vr_shell.cc index 29f5439..1472998a 100644 --- a/chrome/browser/android/vr/vr_shell.cc +++ b/chrome/browser/android/vr/vr_shell.cc
@@ -49,6 +49,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host_iterator.h" @@ -920,17 +921,23 @@ FROM_HERE, poll_capturing_state_task_.callback(), kPollCapturingStateInterval); - int num_tabs_capturing_audio = 0; - int num_tabs_capturing_video = 0; - int num_tabs_capturing_screen = 0; - int num_tabs_bluetooth_connected = 0; scoped_refptr<MediaStreamCaptureIndicator> indicator = MediaCaptureDevicesDispatcher::GetInstance() ->GetMediaStreamCaptureIndicator(); + capturing_state_.audio_capture_enabled = false; + capturing_state_.video_capture_enabled = false; + capturing_state_.screen_capture_enabled = false; + capturing_state_.bluetooth_connected = false; + capturing_state_.background_audio_capture_enabled = false; + capturing_state_.background_video_capture_enabled = false; + capturing_state_.background_screen_capture_enabled = false; + capturing_state_.background_bluetooth_connected = false; + std::unique_ptr<content::RenderWidgetHostIterator> widgets( content::RenderWidgetHost::GetRenderWidgetHosts()); while (content::RenderWidgetHost* rwh = widgets->GetNextHost()) { + bool is_foreground = rwh->GetProcess()->VisibleClientCount() > 0; content::RenderViewHost* rvh = content::RenderViewHost::From(rwh); if (!rvh) continue; @@ -940,23 +947,35 @@ continue; if (web_contents->GetRenderViewHost() != rvh) continue; + // Because a WebContents can only have one current RVH at a time, there will // be no duplicate WebContents here. - if (indicator->IsCapturingAudio(web_contents)) - num_tabs_capturing_audio++; - if (indicator->IsCapturingVideo(web_contents)) - num_tabs_capturing_video++; - if (indicator->IsBeingMirrored(web_contents)) - num_tabs_capturing_screen++; - if (web_contents->IsConnectedToBluetoothDevice()) - num_tabs_bluetooth_connected++; + if (indicator->IsCapturingAudio(web_contents)) { + if (is_foreground) + capturing_state_.audio_capture_enabled = true; + else + capturing_state_.background_audio_capture_enabled = true; + } + if (indicator->IsCapturingVideo(web_contents)) { + if (is_foreground) + capturing_state_.video_capture_enabled = true; + else + capturing_state_.background_video_capture_enabled = true; + } + if (indicator->IsBeingMirrored(web_contents)) { + if (is_foreground) + capturing_state_.screen_capture_enabled = true; + else + capturing_state_.background_screen_capture_enabled = true; + } + if (web_contents->IsConnectedToBluetoothDevice()) { + if (is_foreground) + capturing_state_.bluetooth_connected = true; + else + capturing_state_.background_bluetooth_connected = true; + } } - capturing_state_.audio_capture_enabled = num_tabs_capturing_audio > 0; - capturing_state_.video_capture_enabled = num_tabs_capturing_video > 0; - capturing_state_.screen_capture_enabled = num_tabs_capturing_screen > 0; - capturing_state_.bluetooth_connected = num_tabs_bluetooth_connected > 0; - geolocation_config_->IsHighAccuracyLocationBeingCaptured(base::BindRepeating( [](VrShell* shell, BrowserUiInterface* ui, CapturingStateModel* capturing_state, bool high_accuracy_location) {
diff --git a/chrome/browser/chrome_content_browser_manifest_overlay.json b/chrome/browser/chrome_content_browser_manifest_overlay.json index 1a4f99d..fc235c55 100644 --- a/chrome/browser/chrome_content_browser_manifest_overlay.json +++ b/chrome/browser/chrome_content_browser_manifest_overlay.json
@@ -100,7 +100,9 @@ "mojom::SiteEngagementDetailsProvider", "mojom::UsbInternalsPageHandler" ], - "multidevice_setup" : [ "multidevice_setup::mojom::MultiDeviceSetup" ] + "multidevice_setup" : [ + "chromeos::multidevice_setup::mojom::MultiDeviceSetup" + ] } }, "navigation:dedicated_worker": {
diff --git a/chrome/browser/chromeos/login/auth/mount_manager.cc b/chrome/browser/chromeos/login/auth/mount_manager.cc deleted file mode 100644 index 5ca790c..0000000 --- a/chrome/browser/chromeos/login/auth/mount_manager.cc +++ /dev/null
@@ -1,48 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/login/auth/mount_manager.h" - -#include "chrome/browser/chromeos/profiles/profile_helper.h" - -namespace chromeos { - -MountManager* MountManager::Get() { - if (!instance_) - instance_ = new MountManager(); - return instance_; -} - -// static -MountManager* MountManager::instance_ = NULL; - -base::FilePath MountManager::GetHomeDir(std::string& user_hash) { - return ProfileHelper::GetProfilePathByUserIdHash(user_hash); -} - -MountManager::MountManager() {} - -MountManager::~MountManager() {} - -bool MountManager::IsMounted(const std::string& user_id) { - UserToPathMap::iterator i(additional_mounts_.find(user_id)); - return i != additional_mounts_.end(); -} - -base::FilePath MountManager::GetPath(const std::string& user_id) { - UserToPathMap::iterator i(additional_mounts_.find(user_id)); - DCHECK(i != additional_mounts_.end()); - return (i == additional_mounts_.end()) ? base::FilePath() : i->second; -} - -void MountManager::SetPath(const std::string& user_id, - const base::FilePath& path) { - additional_mounts_[user_id] = path; -} - -void MountManager::DeletePath(const std::string& user_id) { - additional_mounts_.erase(user_id); -} - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/auth/mount_manager.h b/chrome/browser/chromeos/login/auth/mount_manager.h deleted file mode 100644 index 3a04ba8..0000000 --- a/chrome/browser/chromeos/login/auth/mount_manager.h +++ /dev/null
@@ -1,48 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOUNT_MANAGER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOUNT_MANAGER_H_ - -#include <map> -#include <memory> -#include <string> - -#include "base/files/file_path.h" -#include "base/macros.h" - -namespace chromeos { - -// Keeps track of mount points for different users. -class MountManager { - public: - // Returns a shared instance of a MountManager. Not thread-safe, - // should only be called from the main UI thread. - static MountManager* Get(); - - static base::FilePath GetHomeDir(std::string& user_hash); - - virtual ~MountManager(); - - virtual bool IsMounted(const std::string& user_id); - virtual base::FilePath GetPath(const std::string& user_id); - - virtual void SetPath(const std::string& user_id, const base::FilePath& path); - virtual void DeletePath(const std::string& user_id); - - private: - MountManager(); - - typedef std::map<std::string, base::FilePath> UserToPathMap; - - UserToPathMap additional_mounts_; - - static MountManager* instance_; - - DISALLOW_COPY_AND_ASSIGN(MountManager); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOUNT_MANAGER_H_
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc index 1b010c4..9c251b6 100644 --- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc +++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -1006,11 +1006,13 @@ if (policy.has_unaffiliated_arc_allowed()) { const em::UnaffiliatedArcAllowedProto& container( policy.unaffiliated_arc_allowed()); - policies->Set( - key::kUnaffiliatedArcAllowed, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, - std::make_unique<base::Value>(container.unaffiliated_arc_allowed()), - nullptr); + if (container.has_unaffiliated_arc_allowed()) { + policies->Set( + key::kUnaffiliatedArcAllowed, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(container.unaffiliated_arc_allowed()), + nullptr); + } } if (policy.has_device_user_policy_loopback_processing_mode()) {
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc index 15c48e0..67d21ea 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -517,7 +517,8 @@ } } - if (policy.has_allow_redeem_offers()) { + if (policy.has_allow_redeem_offers() && + policy.allow_redeem_offers().has_allow_redeem_offers()) { new_values_cache->SetBoolean( kAllowRedeemChromeOsRegistrationOffers, policy.allow_redeem_offers().allow_redeem_offers());
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index db00b72..d8ab1826 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -804,7 +804,6 @@ "//components/bubble", "//components/content_settings/core/browser", "//components/crx_file", - "//components/cryptauth", "//components/data_reduction_proxy/core/browser", "//components/dom_distiller/core", "//components/download/content/public", @@ -985,6 +984,7 @@ "//components/arc", "//components/chrome_apps", "//components/constrained_window", + "//components/cryptauth", "//components/drive", "//components/proximity_auth", "//components/proximity_auth/logging",
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 9be7c453..bdfc1427 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -831,7 +831,13 @@ // Test that a browser action popup can download data URLs. See // https://crbug.com/821219 -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionPopupDownload) { +// Fails consistently on Win7. https://crbug.com/827160 +#if defined(OS_WIN) +#define MAYBE_BrowserActionPopupDownload DISABLED_BrowserActionPopupDownload +#else +#define MAYBE_BrowserActionPopupDownload BrowserActionPopupDownload +#endif +IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, MAYBE_BrowserActionPopupDownload) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(LoadExtension(
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index 36d4bde..3b3388e 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/command_line.h" +#include "base/logging.h" #include "base/version.h" #include "build/build_config.h" #include "chrome/browser/app_mode/app_mode_utils.h" @@ -138,6 +139,7 @@ content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext( content::BrowserContext* context) { + DCHECK(context); return static_cast<Profile*>(context)->GetOriginalProfile(); }
diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc index 4376497..aefac31 100644 --- a/chrome/browser/extensions/test_extension_environment.cc +++ b/chrome/browser/extensions/test_extension_environment.cc
@@ -8,10 +8,7 @@ #include "base/command_line.h" #include "base/json/json_writer.h" -#include "base/macros.h" -#include "base/run_loop.h" #include "base/values.h" -#include "build/build_config.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/test_extension_system.h" #include "chrome/browser/sessions/session_tab_helper.h" @@ -20,7 +17,6 @@ #include "content/public/test/test_utils.h" #include "content/public/test/web_contents_tester.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" #include "testing/gtest/include/gtest/gtest.h" @@ -74,20 +70,20 @@ } // namespace +#if defined(OS_CHROMEOS) // Extra environment state required for ChromeOS. class TestExtensionEnvironment::ChromeOSEnv { public: ChromeOSEnv() {} private: -#if defined(OS_CHROMEOS) chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; chromeos::ScopedTestCrosSettings test_cros_settings_; chromeos::ScopedTestUserManager test_user_manager_; -#endif DISALLOW_COPY_AND_ASSIGN(ChromeOSEnv); }; +#endif // defined(OS_CHROMEOS) // static ExtensionService* TestExtensionEnvironment::CreateExtensionServiceForProfile( @@ -98,24 +94,16 @@ base::CommandLine::ForCurrentProcess(), base::FilePath(), false); } -TestExtensionEnvironment::TestExtensionEnvironment() - : thread_bundle_(new content::TestBrowserThreadBundle), - extension_service_(nullptr) { - Init(); -} - -TestExtensionEnvironment::TestExtensionEnvironment( - base::MessageLoopForUI* message_loop) - : extension_service_(nullptr) { - Init(); -} - -void TestExtensionEnvironment::Init() { - profile_.reset(new TestingProfile); +TestExtensionEnvironment::TestExtensionEnvironment(Type type) + : thread_bundle_(type == Type::kWithTaskEnvironment + ? std::make_unique<content::TestBrowserThreadBundle>() + : nullptr), #if defined(OS_CHROMEOS) - if (!chromeos::DeviceSettingsService::IsInitialized()) - chromeos_env_.reset(new ChromeOSEnv); + chromeos_env_(chromeos::DeviceSettingsService::IsInitialized() + ? nullptr + : std::make_unique<ChromeOSEnv>()), #endif + profile_(std::make_unique<TestingProfile>()) { } TestExtensionEnvironment::~TestExtensionEnvironment() {
diff --git a/chrome/browser/extensions/test_extension_environment.h b/chrome/browser/extensions/test_extension_environment.h index 889452bb..7d2083bc 100644 --- a/chrome/browser/extensions/test_extension_environment.h +++ b/chrome/browser/extensions/test_extension_environment.h
@@ -6,10 +6,12 @@ #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_ENVIRONMENT_H_ #include <memory> +#include <string> #include "base/macros.h" -#include "base/message_loop/message_loop.h" +#include "base/memory/scoped_refptr.h" #include "build/build_config.h" +#include "extensions/common/extension.h" #if defined(OS_WIN) #include "ui/base/win/scoped_ole_initializer.h" @@ -42,12 +44,16 @@ static ExtensionService* CreateExtensionServiceForProfile( TestingProfile* profile); - TestExtensionEnvironment(); + enum class Type { + // A TestExtensionEnvironment which will provide a TestBrowserThreadBundle + // in its scope. + kWithTaskEnvironment, + // A TestExtensionEnvironment which will run on top of the existing task + // environment without trying to provide one. + kInheritExistingTaskEnvironment, + }; - // Allows a test harness to pass its own message loop (typically - // base::MessageLoopForUI::current()), rather than have - // TestExtensionEnvironment create and own a TestBrowserThreadBundle. - explicit TestExtensionEnvironment(base::MessageLoopForUI* message_loop); + explicit TestExtensionEnvironment(Type type = Type::kWithTaskEnvironment); ~TestExtensionEnvironment(); @@ -90,14 +96,16 @@ void Init(); - std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; - std::unique_ptr<ChromeOSEnv> chromeos_env_; + const std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; +#if defined(OS_CHROMEOS) + const std::unique_ptr<ChromeOSEnv> chromeos_env_; +#endif #if defined(OS_WIN) ui::ScopedOleInitializer ole_initializer_; #endif std::unique_ptr<TestingProfile> profile_; - ExtensionService* extension_service_; + ExtensionService* extension_service_ = nullptr; DISALLOW_COPY_AND_ASSIGN(TestExtensionEnvironment); };
diff --git a/chrome/browser/password_manager/save_password_infobar_delegate_android.cc b/chrome/browser/password_manager/save_password_infobar_delegate_android.cc index 162b883..32501f6 100644 --- a/chrome/browser/password_manager/save_password_infobar_delegate_android.cc +++ b/chrome/browser/password_manager/save_password_infobar_delegate_android.cc
@@ -41,7 +41,7 @@ } SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { - password_manager::metrics_util::LogUIDismissalReason(infobar_response_); + password_manager::metrics_util::LogSaveUIDismissalReason(infobar_response_); form_to_save_->metrics_recorder()->RecordUIDismissalReason(infobar_response_); }
diff --git a/chrome/browser/password_manager/update_password_infobar_delegate_android.cc b/chrome/browser/password_manager/update_password_infobar_delegate_android.cc index a883709a..010023e6 100644 --- a/chrome/browser/password_manager/update_password_infobar_delegate_android.cc +++ b/chrome/browser/password_manager/update_password_infobar_delegate_android.cc
@@ -38,6 +38,7 @@ } UpdatePasswordInfoBarDelegate::~UpdatePasswordInfoBarDelegate() { + password_manager::metrics_util::LogUpdateUIDismissalReason(infobar_response_); passwords_state_.form_manager()->metrics_recorder()->RecordUIDismissalReason( infobar_response_); }
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index 05f37014..28bffab 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -319,11 +319,18 @@ } if (message_id) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce(&ShowProfileErrorDialog, ProfileErrorType::PREFERENCES, - message_id, - sql::GetCorruptFileDiagnosticsInfo(pref_filename))); + auto show_profile_error_dialog = base::BindOnce( + &ShowProfileErrorDialog, ProfileErrorType::PREFERENCES, message_id, + sql::GetCorruptFileDiagnosticsInfo(pref_filename)); + if (BrowserThread::IsThreadInitialized(BrowserThread::UI)) { + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + std::move(show_profile_error_dialog)); + } else { + // In early startup (e.g. on error loading Local State before most + // browser pieces are up), the only option is to show the dialog + // synchronously. + std::move(show_profile_error_dialog).Run(); + } } #else // On ChromeOS error screen with message about broken local state
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 0092b13d..69701e2a 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc
@@ -1129,10 +1129,11 @@ info.task_runner = base::ThreadTaskRunnerHandle::Get(); info.factory = base::BindRepeating([] { return std::unique_ptr<service_manager::Service>( - std::make_unique<chromeos::multidevice::MultiDeviceSetupService>()); + std::make_unique< + chromeos::multidevice_setup::MultiDeviceSetupService>()); }); services->insert( - std::make_pair(multidevice_setup::mojom::kServiceName, info)); + std::make_pair(chromeos::multidevice_setup::mojom::kServiceName, info)); } #endif
diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc index e691ebb..73cca42 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.cc +++ b/chrome/browser/signin/account_consistency_mode_manager.cc
@@ -197,8 +197,21 @@ } #endif + signin::AccountConsistencyMethod method = + signin::GetAccountConsistencyMethod(); + + // Legacy supervised users cannot get Dice. + // TODO(droger): remove this once legacy supervised users are no longer + // supported. + if (profile_->IsLegacySupervised() && + (method != signin::AccountConsistencyMethod::kMirror) && + signin::DiceMethodGreaterOrEqual( + method, signin::AccountConsistencyMethod::kDiceFixAuthErrors)) { + return signin::AccountConsistencyMethod::kDiceFixAuthErrors; + } + if (signin::IsDiceEnabledForProfile(profile_->GetPrefs())) return signin::AccountConsistencyMethod::kDice; - return signin::GetAccountConsistencyMethod(); + return method; }
diff --git a/chrome/browser/signin/account_consistency_mode_manager_unittest.cc b/chrome/browser/signin/account_consistency_mode_manager_unittest.cc index 5835fb8..f41b904 100644 --- a/chrome/browser/signin/account_consistency_mode_manager_unittest.cc +++ b/chrome/browser/signin/account_consistency_mode_manager_unittest.cc
@@ -129,6 +129,19 @@ signin::AccountConsistencyMethod::kDiceFixAuthErrors, AccountConsistencyModeManager::GetMethodForProfile(profile.get())); } + + { + // Legacy supervised profile. + TestingProfile::Builder profile_builder; + profile_builder.SetSupervisedUserId("supervised_id"); + std::unique_ptr<Profile> profile = profile_builder.Build(); + ASSERT_TRUE(profile->IsLegacySupervised()); + EXPECT_FALSE( + AccountConsistencyModeManager::IsDiceEnabledForProfile(profile.get())); + EXPECT_EQ( + signin::AccountConsistencyMethod::kDiceFixAuthErrors, + AccountConsistencyModeManager::GetMethodForProfile(profile.get())); + } } #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc index 2a84d57..41e7e23 100644 --- a/chrome/browser/signin/signin_ui_util.cc +++ b/chrome/browser/signin/signin_ui_util.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/signin/signin_ui_util.h" +#include "base/bind_helpers.h" +#include "base/callback.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" @@ -40,6 +42,23 @@ #include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" #endif +#if BUILDFLAG(ENABLE_DICE_SUPPORT) +namespace { +void CreateDiceTurnSyncOnHelper( + Profile* profile, + Browser* browser, + signin_metrics::AccessPoint signin_access_point, + signin_metrics::Reason signin_reason, + const std::string& account_id, + DiceTurnSyncOnHelper::SigninAbortedMode signin_aborted_mode) { + // DiceTurnSyncOnHelper is suicidal (it will delete itself once it finishes + // enabling sync). + new DiceTurnSyncOnHelper(profile, browser, signin_access_point, signin_reason, + account_id, signin_aborted_mode); +} +} // namespace +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + namespace signin_ui_util { base::string16 GetAuthenticatedUsername(const SigninManagerBase* signin) { @@ -64,8 +83,8 @@ void InitializePrefsForProfile(Profile* profile) { if (profile->IsNewProfile()) { // Suppresses the upgrade tutorial for a new profile. - profile->GetPrefs()->SetInteger( - prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1); + profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, + kUpgradeWelcomeTutorialShowMax + 1); } } @@ -93,6 +112,27 @@ void EnableSync(Browser* browser, const AccountInfo& account, signin_metrics::AccessPoint access_point) { +#if BUILDFLAG(ENABLE_DICE_SUPPORT) + internal::EnableSync(browser, account, access_point, + base::BindOnce(&CreateDiceTurnSyncOnHelper)); +#else + internal::EnableSync(browser, account, access_point, base::DoNothing()); +#endif +} + +namespace internal { +void EnableSync( + Browser* browser, + const AccountInfo& account, + signin_metrics::AccessPoint access_point, + base::OnceCallback< + void(Profile* profile, + Browser* browser, + signin_metrics::AccessPoint signin_access_point, + signin_metrics::Reason signin_reason, + const std::string& account_id, + DiceTurnSyncOnHelper::SigninAbortedMode signin_aborted_mode)> + create_dice_turn_sync_on_helper_callback) { DCHECK(browser); DCHECK_NE(signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN, access_point); Profile* profile = browser->profile(); @@ -138,16 +178,17 @@ return; } - // DiceTurnSyncOnHelper is suicidal (it will delete itself once it finishes - // enabling sync). - new DiceTurnSyncOnHelper( - profile, browser, access_point, - signin_metrics::Reason::REASON_UNKNOWN_REASON, account.account_id, - DiceTurnSyncOnHelper::SigninAbortedMode::KEEP_ACCOUNT); + signin_metrics::LogSigninAccessPointStarted(access_point); + signin_metrics::RecordSigninUserActionForAccessPoint(access_point); + std::move(create_dice_turn_sync_on_helper_callback) + .Run(profile, browser, access_point, + signin_metrics::Reason::REASON_UNKNOWN_REASON, account.account_id, + DiceTurnSyncOnHelper::SigninAbortedMode::KEEP_ACCOUNT); #else NOTREACHED(); #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) } +} // namespace internal #if BUILDFLAG(ENABLE_DICE_SUPPORT) // TODO(tangltom): Add a unit test for this function.
diff --git a/chrome/browser/signin/signin_ui_util.h b/chrome/browser/signin/signin_ui_util.h index fdc4b6f8..5b5273ece 100644 --- a/chrome/browser/signin/signin_ui_util.h +++ b/chrome/browser/signin/signin_ui_util.h
@@ -8,8 +8,10 @@ #include <string> #include <vector> +#include "base/callback_forward.h" #include "base/strings/string16.h" #include "build/buildflag.h" +#include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" #include "components/signin/core/browser/account_info.h" #include "components/signin/core/browser/signin_buildflags.h" #include "components/signin/core/browser/signin_metrics.h" @@ -65,6 +67,23 @@ // Also, the parser does not validate the policy value. std::string GetAllowedDomain(std::string signin_pattern); +namespace internal { +// Same as |EnableSync| but with a callback that creates a +// DiceTurnSyncOnHelper so that it can be unit tested. +void EnableSync( + Browser* browser, + const AccountInfo& account, + signin_metrics::AccessPoint access_point, + base::OnceCallback< + void(Profile* profile, + Browser* browser, + signin_metrics::AccessPoint signin_access_point, + signin_metrics::Reason signin_reason, + const std::string& account_id, + DiceTurnSyncOnHelper::SigninAbortedMode signin_aborted_mode)> + create_dice_turn_sync_on_helper_callback); +} // namespace internal + } // namespace signin_ui_util #endif // CHROME_BROWSER_SIGNIN_SIGNIN_UI_UTIL_H_
diff --git a/chrome/browser/signin/signin_ui_util_unittest.cc b/chrome/browser/signin/signin_ui_util_unittest.cc index 2f14bd0..c18741cd 100644 --- a/chrome/browser/signin/signin_ui_util_unittest.cc +++ b/chrome/browser/signin/signin_ui_util_unittest.cc
@@ -4,13 +4,29 @@ #include "chrome/browser/signin/signin_ui_util.h" +#include "base/macros.h" +#include "base/test/histogram_tester.h" +#include "base/test/user_action_tester.h" +#include "build/buildflag.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" +#include "chrome/browser/signin/fake_gaia_cookie_manager_service_builder.h" +#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" +#include "chrome/browser/signin/fake_signin_manager_builder.h" +#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/signin/signin_promo.h" +#include "chrome/test/base/browser_with_test_window_test.h" +#include "components/signin/core/browser/profile_management_switches.h" +#include "components/signin/core/browser/scoped_account_consistency.h" +#include "components/signin/core/browser/signin_buildflags.h" #include "testing/gtest/include/gtest/gtest.h" namespace signin_ui_util { -class SigninUIUtilTest : public ::testing::Test {}; +class GetAllowedDomainTest : public ::testing::Test {}; -TEST_F(SigninUIUtilTest, TestGetAllowedDomainWithInvalidPattern) { +TEST_F(GetAllowedDomainTest, WithInvalidPattern) { EXPECT_EQ(std::string(), GetAllowedDomain("email")); EXPECT_EQ(std::string(), GetAllowedDomain("email@a@b")); EXPECT_EQ(std::string(), GetAllowedDomain("email@a[b")); @@ -23,7 +39,7 @@ EXPECT_EQ(std::string(), GetAllowedDomain("")); } -TEST_F(SigninUIUtilTest, TestGetAllowedDomainWithValidPattern) { +TEST_F(GetAllowedDomainTest, WithValidPattern) { EXPECT_EQ("example.com", GetAllowedDomain("email@example.com")); EXPECT_EQ("example.com", GetAllowedDomain("email@example.com\\E")); EXPECT_EQ("example.com", GetAllowedDomain("email@example.com$")); @@ -33,4 +49,220 @@ EXPECT_EQ("example-1.com", GetAllowedDomain("email@example-1.com")); } +#if BUILDFLAG(ENABLE_DICE_SUPPORT) + +namespace { +const char kMainEmail[] = "main_email@example.com"; +const char kMainGaiaID[] = "main_gaia_id"; +class SigninUiUtilTestBrowserWindow : public TestBrowserWindow { + public: + SigninUiUtilTestBrowserWindow() = default; + ~SigninUiUtilTestBrowserWindow() override = default; + void set_browser(Browser* browser) { browser_ = browser; } + + void ShowAvatarBubbleFromAvatarButton( + AvatarBubbleMode mode, + const signin::ManageAccountsParams& manage_accounts_params, + signin_metrics::AccessPoint access_point, + bool is_source_keyboard) override { + ASSERT_TRUE(browser_); + // Simulate what |BrowserView| does for a regular Chrome sign-in flow. + browser_->signin_view_controller()->ShowSignin( + profiles::BubbleViewMode::BUBBLE_VIEW_MODE_GAIA_SIGNIN, browser_, + access_point); + } + + private: + Browser* browser_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(SigninUiUtilTestBrowserWindow); +}; +} // namespace + +class DiceSigninUiUtilTest : public BrowserWithTestWindowTest { + public: + DiceSigninUiUtilTest() + : scoped_account_consistency_(signin::AccountConsistencyMethod::kDice) {} + ~DiceSigninUiUtilTest() override = default; + + struct CreateDiceTurnSyncOnHelperParams { + public: + Profile* profile = nullptr; + Browser* browser = nullptr; + signin_metrics::AccessPoint signin_access_point = + signin_metrics::AccessPoint::ACCESS_POINT_MAX; + signin_metrics::Reason signin_reason = signin_metrics::Reason::REASON_MAX; + std::string account_id; + DiceTurnSyncOnHelper::SigninAbortedMode signin_aborted_mode = + DiceTurnSyncOnHelper::SigninAbortedMode::REMOVE_ACCOUNT; + }; + + void CreateDiceTurnSyncOnHelper( + Profile* profile, + Browser* browser, + signin_metrics::AccessPoint signin_access_point, + signin_metrics::Reason signin_reason, + const std::string& account_id, + DiceTurnSyncOnHelper::SigninAbortedMode signin_aborted_mode) { + create_dice_turn_sync_on_helper_called_ = true; + create_dice_turn_sync_on_helper_params_.profile = profile; + create_dice_turn_sync_on_helper_params_.browser = browser; + create_dice_turn_sync_on_helper_params_.signin_access_point = + signin_access_point; + create_dice_turn_sync_on_helper_params_.signin_reason = signin_reason; + create_dice_turn_sync_on_helper_params_.account_id = account_id; + create_dice_turn_sync_on_helper_params_.signin_aborted_mode = + signin_aborted_mode; + } + + protected: + // BrowserWithTestWindowTest: + void SetUp() override { + BrowserWithTestWindowTest::SetUp(); + static_cast<SigninUiUtilTestBrowserWindow*>(browser()->window()) + ->set_browser(browser()); + } + + // BrowserWithTestWindowTest: + TestingProfile::TestingFactories GetTestingFactories() override { + return {{SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase}, + {ProfileOAuth2TokenServiceFactory::GetInstance(), + BuildFakeProfileOAuth2TokenService}, + {GaiaCookieManagerServiceFactory::GetInstance(), + BuildFakeGaiaCookieManagerService}}; + } + + // BrowserWithTestWindowTest: + BrowserWindow* CreateBrowserWindow() override { + return new SigninUiUtilTestBrowserWindow(); + } + + // Returns the token service. + ProfileOAuth2TokenService* GetTokenService() { + return ProfileOAuth2TokenServiceFactory::GetForProfile(profile()); + } + + // Returns the account tracker service. + AccountTrackerService* GetAccountTrackerService() { + return AccountTrackerServiceFactory::GetForProfile(profile()); + } + + void EnableSync(const AccountInfo& account_info) { + signin_ui_util::internal::EnableSync( + browser(), account_info, access_point_, + base::BindOnce(&DiceSigninUiUtilTest::CreateDiceTurnSyncOnHelper, + base::Unretained(this))); + } + + const signin::ScopedAccountConsistency scoped_account_consistency_; + const signin_metrics::AccessPoint access_point_ = + signin_metrics::AccessPoint::ACCESS_POINT_BOOKMARK_BUBBLE; + base::HistogramTester histogram_tester_; + base::UserActionTester user_action_tester_; + + bool create_dice_turn_sync_on_helper_called_ = false; + CreateDiceTurnSyncOnHelperParams create_dice_turn_sync_on_helper_params_; +}; + +TEST_F(DiceSigninUiUtilTest, EnableSyncWithExistingAccount) { + // Add an account. + std::string account_id = + GetAccountTrackerService()->SeedAccountInfo(kMainEmail, kMainGaiaID); + GetTokenService()->UpdateCredentials(account_id, "token"); + + histogram_tester_.ExpectTotalCount("Signin.SigninStartedAccessPoint", 0); + EXPECT_EQ(0, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + EnableSync(GetAccountTrackerService()->GetAccountInfo(account_id)); + ASSERT_TRUE(create_dice_turn_sync_on_helper_called_); + + histogram_tester_.ExpectUniqueSample("Signin.SigninStartedAccessPoint", + access_point_, 1); + EXPECT_EQ(1, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + // Verify that the helper to enable sync is created with the expected params. + EXPECT_EQ(profile(), create_dice_turn_sync_on_helper_params_.profile); + EXPECT_EQ(browser(), create_dice_turn_sync_on_helper_params_.browser); + EXPECT_EQ(account_id, create_dice_turn_sync_on_helper_params_.account_id); + EXPECT_EQ(signin_metrics::AccessPoint::ACCESS_POINT_BOOKMARK_BUBBLE, + create_dice_turn_sync_on_helper_params_.signin_access_point); + EXPECT_EQ(signin_metrics::Reason::REASON_UNKNOWN_REASON, + create_dice_turn_sync_on_helper_params_.signin_reason); + EXPECT_EQ(DiceTurnSyncOnHelper::SigninAbortedMode::KEEP_ACCOUNT, + create_dice_turn_sync_on_helper_params_.signin_aborted_mode); +} + +TEST_F(DiceSigninUiUtilTest, EnableSyncWithAccountThatNeedsReauth) { + // Add an account to the account tracker, but do not add it to the token + // service in order for it to require a reauth before enabling sync. + std::string account_id = + GetAccountTrackerService()->SeedAccountInfo(kMainGaiaID, kMainEmail); + + histogram_tester_.ExpectTotalCount("Signin.SigninStartedAccessPoint", 0); + EXPECT_EQ(0, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + EnableSync(GetAccountTrackerService()->GetAccountInfo(account_id)); + ASSERT_FALSE(create_dice_turn_sync_on_helper_called_); + + histogram_tester_.ExpectUniqueSample("Signin.SigninStartedAccessPoint", + access_point_, 1); + EXPECT_EQ(1, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + // Verify that the active tab has the correct DICE sign-in URL. + content::WebContents* active_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(active_contents); + EXPECT_EQ(signin::GetSigninURLForDice(profile(), kMainEmail), + active_contents->GetVisibleURL()); +} + +TEST_F(DiceSigninUiUtilTest, EnableSyncForNewAccountWithNoTab) { + histogram_tester_.ExpectTotalCount("Signin.SigninStartedAccessPoint", 0); + EXPECT_EQ(0, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + EnableSync(AccountInfo()); + ASSERT_FALSE(create_dice_turn_sync_on_helper_called_); + + histogram_tester_.ExpectUniqueSample("Signin.SigninStartedAccessPoint", + access_point_, 1); + EXPECT_EQ(1, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + // Verify that the active tab has the correct DICE sign-in URL. + content::WebContents* active_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(active_contents); + EXPECT_EQ(signin::GetSigninURLForDice(profile(), ""), + active_contents->GetVisibleURL()); +} + +TEST_F(DiceSigninUiUtilTest, EnableSyncForNewAccountWithOneTab) { + AddTab(browser(), GURL("http://foo/1")); + + histogram_tester_.ExpectTotalCount("Signin.SigninStartedAccessPoint", 0); + EXPECT_EQ(0, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + EnableSync(AccountInfo()); + ASSERT_FALSE(create_dice_turn_sync_on_helper_called_); + + histogram_tester_.ExpectUniqueSample("Signin.SigninStartedAccessPoint", + access_point_, 1); + EXPECT_EQ(1, user_action_tester_.GetActionCount( + "Signin_Signin_FromBookmarkBubble")); + + // Verify that the active tab has the correct DICE sign-in URL. + content::WebContents* active_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(active_contents); + EXPECT_EQ(signin::GetSigninURLForDice(profile(), ""), + active_contents->GetVisibleURL()); +} +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + } // namespace signin_ui_util
diff --git a/chrome/browser/signin/unified_consent_helper.cc b/chrome/browser/signin/unified_consent_helper.cc index 350dc3c..94a50b2 100644 --- a/chrome/browser/signin/unified_consent_helper.cc +++ b/chrome/browser/signin/unified_consent_helper.cc
@@ -7,7 +7,7 @@ #include "base/feature_list.h" #include "build/buildflag.h" #include "chrome/browser/signin/account_consistency_mode_manager.h" -#include "chrome/common/chrome_features.h" +#include "components/signin/core/browser/profile_management_switches.h" #include "components/signin/core/browser/signin_buildflags.h" bool IsUnifiedConsentEnabled(Profile* profile) { @@ -17,5 +17,5 @@ return false; #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) - return base::FeatureList::IsEnabled(features::kUnifiedConsent); + return base::FeatureList::IsEnabled(signin::kUnifiedConsent); }
diff --git a/chrome/browser/sync/profile_sync_service_factory.cc b/chrome/browser/sync/profile_sync_service_factory.cc index e128f3bf..b2b1764 100644 --- a/chrome/browser/sync/profile_sync_service_factory.cc +++ b/chrome/browser/sync/profile_sync_service_factory.cc
@@ -210,12 +210,17 @@ if (local_sync_backend_folder.empty()) return nullptr; + init_params.signin_scoped_device_id_callback = + base::BindRepeating([]() { return std::string("local_device"); }); + init_params.start_behavior = ProfileSyncService::AUTO_START; } #endif // defined(OS_WIN) if (!local_sync_backend_enabled) { SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); + SigninClient* signin_client = + ChromeSigninClientFactory::GetForProfile(profile); // Always create the GCMProfileService instance such that we can listen to // the profile notifications and purge the GCM store when the profile is @@ -228,6 +233,12 @@ init_params.signin_wrapper = std::make_unique<SupervisedUserSigninManagerWrapper>(profile, signin); + // Note: base::Unretained(signin_client) is safe because the SigninClient is + // guaranteed to outlive the PSS, per a DependsOn() above (and because PSS + // clears the callback in its Shutdown()). + init_params.signin_scoped_device_id_callback = + base::BindRepeating(&SigninClient::GetSigninScopedDeviceId, + base::Unretained(signin_client)); init_params.oauth2_token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile); init_params.gaia_cookie_manager_service =
diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc index 8a17d9e..d3930f21 100644 --- a/chrome/browser/sync/profile_sync_test_util.cc +++ b/chrome/browser/sync/profile_sync_test_util.cc
@@ -46,6 +46,8 @@ init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>( SigninManagerFactory::GetForProfile(profile)); + init_params.signin_scoped_device_id_callback = + base::BindRepeating([]() { return std::string(); }); init_params.oauth2_token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile); init_params.start_behavior = ProfileSyncService::MANUAL_START;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 5bf6dfa..0a326ee 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2780,6 +2780,8 @@ "views/chrome_browser_main_extra_parts_views.h", "views/chrome_constrained_window_views_client.cc", "views/chrome_constrained_window_views_client.h", + "views/chrome_platform_style.cc", + "views/chrome_platform_style.h", "views/chrome_views_delegate.cc", "views/chrome_views_delegate.h", "views/collected_cookies_views.cc", @@ -3306,6 +3308,10 @@ ] } + if (is_mac) { + sources += [ "views/chrome_platform_style_mac.mm" ] + } + if (is_win) { sources += [ "views/chrome_views_delegate_win.cc" ] }
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc index 1962e6e..89705fd3 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc
@@ -14,7 +14,6 @@ #include "chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" -#include "services/metrics/public/cpp/ukm_source_id.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(PopupOpenerTabHelper); @@ -69,17 +68,6 @@ web_contents->GetVisibility() != content::Visibility::HIDDEN); } -void PopupOpenerTabHelper::DidFinishNavigation( - content::NavigationHandle* navigation_handle) { - if (!navigation_handle->HasCommitted() || - !navigation_handle->IsInMainFrame() || - navigation_handle->IsSameDocument()) { - return; - } - last_committed_source_id_ = ukm::ConvertToSourceId( - navigation_handle->GetNavigationId(), ukm::SourceIdType::NAVIGATION_ID); -} - void PopupOpenerTabHelper::OnVisibilityChanged(content::Visibility visibility) { // TODO(csharrison): Consider handling OCCLUDED tabs the same way as HIDDEN // tabs.
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h index 60f92c71..95d333a9 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h
@@ -11,7 +11,6 @@ #include "base/optional.h" #include "base/time/tick_clock.h" #include "base/time/time.h" -#include "components/ukm/ukm_source.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -50,10 +49,6 @@ return visible_time_before_tab_under_.has_value(); } - const base::Optional<ukm::SourceId>& last_committed_source_id() { - return last_committed_source_id_; - } - private: friend class content::WebContentsUserData<PopupOpenerTabHelper>; @@ -61,8 +56,6 @@ base::TickClock* tick_clock); // content::WebContentsObserver: - void DidFinishNavigation( - content::NavigationHandle* navigation_handle) override; void OnVisibilityChanged(content::Visibility visibility) override; void DidGetUserInteraction(const blink::WebInputEvent::Type type) override; @@ -71,10 +64,6 @@ // tab-under is detected. base::Optional<base::TimeDelta> visible_time_before_tab_under_; - // The UKM source id of the current page load. i.e. the id of the last - // committed main frame navigation. - base::Optional<ukm::SourceId> last_committed_source_id_; - // The clock which is used by the visibility trackers. base::TickClock* tick_clock_;
diff --git a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc index ca2bc5b8..1318cc34 100644 --- a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc +++ b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc
@@ -25,6 +25,7 @@ #include "chrome/common/pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" +#include "components/ukm/content/source_url_recorder.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/navigation_handle.h" @@ -35,6 +36,7 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" +#include "services/metrics/public/cpp/ukm_source_id.h" #include "url/gurl.h" #if defined(OS_ANDROID) @@ -89,7 +91,6 @@ #endif void LogTabUnderAttempt(content::NavigationHandle* handle, - base::Optional<ukm::SourceId> opener_source_id, bool off_the_record) { LogAction(TabUnderNavigationThrottle::Action::kDidTabUnder, off_the_record); @@ -97,8 +98,10 @@ // where the popup opener tab helper is not observing at the time the // previous navigation commit. ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get(); - if (opener_source_id && ukm_recorder) { - ukm::builders::AbusiveExperienceHeuristic(opener_source_id.value()) + ukm::SourceId opener_source_id = + ukm::GetSourceIdForWebContentsDocument(handle->GetWebContents()); + if (opener_source_id != ukm::kInvalidSourceId && ukm_recorder) { + ukm::builders::AbusiveExperienceHeuristic(opener_source_id) .SetDidTabUnder(true) .Record(ukm_recorder); } @@ -199,8 +202,7 @@ DCHECK(popup_opener); popup_opener->OnDidTabUnder(); - LogTabUnderAttempt(navigation_handle(), - popup_opener->last_committed_source_id(), off_the_record_); + LogTabUnderAttempt(navigation_handle(), off_the_record_); if (block_) { const std::string error =
diff --git a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h index c15f42b..352f984 100644 --- a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h +++ b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h
@@ -9,7 +9,6 @@ #include "base/feature_list.h" #include "base/macros.h" -#include "base/optional.h" #include "base/time/time.h" #include "content/public/browser/navigation_throttle.h"
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index eb3e50819..d910711 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_navigator_params.h" @@ -410,31 +411,36 @@ #if defined(OS_CHROMEOS) // ChromeOS doesn't have the avatar bubble. - const bool can_show_avatar_bubble = false; + const bool show_full_tab_chrome_signin_page = true; #else - // The sign-in modal dialog is presented as a tab-modal dialog (which is - // automatically dismissed when the page navigates). Displaying the dialog on - // a new tab that loads any page will lead to it being dismissed as soon as - // the new tab is loaded. So the sign-in dialog must only be presented on top - // of an existing tab. + // When Desktop Identity Consistency (aka DICE) is not enabled, Chrome uses + // a modal sign-in dialog for signing in. This sign-in modal dialog is + // presented as a tab-modal dialog (which is automatically dismissed when + // the page navigates). Displaying the dialog on a new tab that loads any + // page will lead to it being dismissed as soon as the new tab is loaded. + // So the sign-in dialog must only be presented on top of an existing tab. // // If ScopedTabbedBrowserDisplayer had to create a (non-incognito) Browser*, // it won't have any tabs yet. Fallback to the full-tab sign-in flow in this // case. - const bool can_show_avatar_bubble = !browser->tab_strip_model()->empty(); + const bool show_full_tab_chrome_signin_page = + !signin::DiceMethodGreaterOrEqual( + AccountConsistencyModeManager::GetMethodForProfile( + browser->profile()), + signin::AccountConsistencyMethod::kDicePrepareMigration) && + browser->tab_strip_model()->empty(); #endif // defined(OS_CHROMEOS) - - if (can_show_avatar_bubble) { - browser->window()->ShowAvatarBubbleFromAvatarButton( - BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, - signin::ManageAccountsParams(), access_point, false); - } else { + if (show_full_tab_chrome_signin_page) { NavigateToSingletonTab( browser, signin::GetPromoURLForTab( access_point, signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false)); DCHECK_GT(browser->tab_strip_model()->count(), 0); + } else { + browser->window()->ShowAvatarBubbleFromAvatarButton( + BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, + signin::ManageAccountsParams(), access_point, false); } }
diff --git a/chrome/browser/ui/cocoa/bubble_anchor_helper_views.mm b/chrome/browser/ui/cocoa/bubble_anchor_helper_views.mm index 1ac2ac8..1f88895 100644 --- a/chrome/browser/ui/cocoa/bubble_anchor_helper_views.mm +++ b/chrome/browser/ui/cocoa/bubble_anchor_helper_views.mm
@@ -9,6 +9,7 @@ #include "base/bind.h" #import "base/mac/scoped_nsobject.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" +#include "chrome/browser/ui/cocoa/l10n_util.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" @@ -47,7 +48,8 @@ // Whether offset from the left of the parent window is fixed. bool IsMinXFixed() const { - return views::BubbleBorder::is_arrow_on_left(bubble_->arrow()); + return cocoa_l10n_util::ShouldDoExperimentalRTLLayout() != + views::BubbleBorder::is_arrow_on_left(bubble_->arrow()); } // Re-positions |bubble_| so that the offset to the parent window at
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.mm index 529ae54..1eb5c296 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.mm
@@ -38,7 +38,7 @@ object:parent_window queue:nil usingBlock:^(NSNotification* notification) { - popup->OnAnchorWindowActivation(); + popup->CloseUnlessUnderInspection(); }]; [popup->observer_tokens_ addObject:token]; return popup;
diff --git a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm index 0b2129b..4142f7fe 100644 --- a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm +++ b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
@@ -72,6 +72,8 @@ base::ASCIIToUTF16("pass_el" + std::to_string(i))}); } EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); + std::vector<std::unique_ptr<autofill::PasswordForm>> forms; + EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); GURL origin(kSiteOrigin); EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); EXPECT_CALL(*ui_controller_, GetState())
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm index c04bb06..d01a2f61 100644 --- a/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm
@@ -77,6 +77,8 @@ ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(mock)); autofill::PasswordForm form; EXPECT_CALL(*mock, GetPendingPassword()).WillOnce(ReturnRef(form)); + std::vector<std::unique_ptr<autofill::PasswordForm>> forms; + EXPECT_CALL(*mock, GetCurrentForms()).WillOnce(ReturnRef(forms)); GURL origin; EXPECT_CALL(*mock, GetOrigin()).WillOnce(ReturnRef(origin)); EXPECT_CALL(*mock, GetState())
diff --git a/chrome/browser/ui/login/login_handler.cc b/chrome/browser/ui/login/login_handler.cc index 3dac9e9..fe7c846 100644 --- a/chrome/browser/ui/login/login_handler.cc +++ b/chrome/browser/ui/login/login_handler.cc
@@ -313,6 +313,8 @@ } void LoginHandler::ReleaseSoon() { + CHECK(content::BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (release_soon_has_been_called_) { return; } else {
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc index 54c94b68..33a6def 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -92,11 +92,6 @@ dismissal_reason_ = reason; } - void set_update_password_submission_event( - password_manager::metrics_util::UpdatePasswordSubmissionEvent event) { - update_password_submission_event_ = event; - } - void set_sign_in_promo_dismissal_reason( password_manager::metrics_util::SyncSignInUserAction reason) { sign_in_promo_dismissal_reason_ = reason; @@ -109,22 +104,13 @@ } private: - static password_manager::metrics_util::UIDismissalReason - ToNearestUIDismissalReason( - password_manager::metrics_util::UpdatePasswordSubmissionEvent - update_password_submission_event); - // The way the bubble appeared. const password_manager::metrics_util::UIDisplayDisposition display_disposition_; - // Dismissal reason for a save bubble. Not filled for update bubbles. + // Dismissal reason for a password bubble. password_manager::metrics_util::UIDismissalReason dismissal_reason_; - // Dismissal reason for the update bubble. - password_manager::metrics_util::UpdatePasswordSubmissionEvent - update_password_submission_event_; - // Dismissal reason for the Chrome Sign in bubble. password_manager::metrics_util::SyncSignInUserAction sign_in_promo_dismissal_reason_; @@ -146,7 +132,6 @@ password_manager::metrics_util::UIDisplayDisposition display_disposition) : display_disposition_(display_disposition), dismissal_reason_(metrics_util::NO_DIRECT_INTERACTION), - update_password_submission_event_(metrics_util::NO_UPDATE_SUBMISSION), sign_in_promo_dismissal_reason_(metrics_util::CHROME_SIGNIN_DISMISSED), interaction_stats_(std::move(stats)), clock_(base::DefaultClock::GetInstance()), @@ -155,6 +140,7 @@ void ManagePasswordsBubbleModel::InteractionKeeper::ReportInteractions( const ManagePasswordsBubbleModel* model) { if (model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { + // Update the statistics for the save password bubble. Profile* profile = model->GetProfile(); if (profile) { if (dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION && @@ -173,6 +159,7 @@ } } + // Log UMA histograms. if (model->state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { metrics_util::LogSyncSigninPromoUserAction(sign_in_promo_dismissal_reason_); switch (sign_in_promo_dismissal_reason_) { @@ -192,82 +179,35 @@ NOTREACHED(); break; } - } else if (model->state() != + } else if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { - // We have separate metrics for the Update bubble so do not record dismissal - // reason for it. - metrics_util::LogUIDismissalReason(dismissal_reason_); + metrics_util::LogUpdateUIDismissalReason(dismissal_reason_); + } else if (model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { + metrics_util::LogSaveUIDismissalReason(dismissal_reason_); + } else { + metrics_util::LogGeneralUIDismissalReason(dismissal_reason_); } + // Update the delegate so that it can send votes to the server. if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { // Send a notification if there was no interaction with the bubble. bool no_interaction = - model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE - ? update_password_submission_event_ == - metrics_util::NO_UPDATE_SUBMISSION - : dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION; + dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION; if (no_interaction && model->delegate_) { model->delegate_->OnNoInteraction(); } - - // Send UMA. - if (update_password_submission_event_ == - metrics_util::NO_UPDATE_SUBMISSION) { - update_password_submission_event_ = - model->GetUpdateDismissalReason(NO_INTERACTION); - } - if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION) - LogUpdatePasswordSubmissionEvent(update_password_submission_event_); } // Record UKM statistics on dismissal reason. - if (model->metrics_recorder_) { - model->metrics_recorder_->RecordUIDismissalReason( - model->state() != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE - ? dismissal_reason_ - : ToNearestUIDismissalReason(update_password_submission_event_)); - } -} - -// static -password_manager::metrics_util::UIDismissalReason -ManagePasswordsBubbleModel::InteractionKeeper::ToNearestUIDismissalReason( - password_manager::metrics_util::UpdatePasswordSubmissionEvent - update_password_submission_event) { - switch (update_password_submission_event) { - case password_manager::metrics_util::NO_ACCOUNTS_CLICKED_UPDATE: - case password_manager::metrics_util::ONE_ACCOUNT_CLICKED_UPDATE: - case password_manager::metrics_util::MULTIPLE_ACCOUNTS_CLICKED_UPDATE: - case password_manager::metrics_util::PASSWORD_OVERRIDDEN_CLICKED_UPDATE: - return password_manager::metrics_util::CLICKED_SAVE; - - case password_manager::metrics_util::NO_ACCOUNTS_CLICKED_NOPE: - case password_manager::metrics_util::ONE_ACCOUNT_CLICKED_NOPE: - case password_manager::metrics_util::MULTIPLE_ACCOUNTS_CLICKED_NOPE: - case password_manager::metrics_util::PASSWORD_OVERRIDDEN_CLICKED_NOPE: - return password_manager::metrics_util::CLICKED_CANCEL; - - case password_manager::metrics_util::NO_ACCOUNTS_NO_INTERACTION: - case password_manager::metrics_util::ONE_ACCOUNT_NO_INTERACTION: - case password_manager::metrics_util::MULTIPLE_ACCOUNTS_NO_INTERACTION: - case password_manager::metrics_util::PASSWORD_OVERRIDDEN_NO_INTERACTION: - case password_manager::metrics_util::NO_UPDATE_SUBMISSION: - return password_manager::metrics_util::NO_DIRECT_INTERACTION; - - case password_manager::metrics_util::UPDATE_PASSWORD_EVENT_COUNT: - // Not reached. - break; - } - NOTREACHED(); - return password_manager::metrics_util::NO_DIRECT_INTERACTION; + if (model->metrics_recorder_) + model->metrics_recorder_->RecordUIDismissalReason(dismissal_reason_); } ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( base::WeakPtr<PasswordsModelDelegate> delegate, DisplayReason display_reason) - : password_overridden_(false), - delegate_(std::move(delegate)), + : delegate_(std::move(delegate)), interaction_reported_(false), metrics_recorder_(delegate_->GetPasswordFormMetricsRecorder()) { origin_ = delegate_->GetOrigin(); @@ -276,10 +216,8 @@ if (state_ == password_manager::ui::PENDING_PASSWORD_STATE || state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { pending_password_ = delegate_->GetPendingPassword(); - if (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { - local_credentials_ = DeepCopyForms(delegate_->GetCurrentForms()); - password_overridden_ = delegate_->IsPasswordOverridden(); - } else { + local_credentials_ = DeepCopyForms(delegate_->GetCurrentForms()); + if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) { interaction_stats.origin_domain = origin_.GetOrigin(); interaction_stats.username_value = pending_password_.username_value; const password_manager::InteractionsStats* stats = @@ -407,11 +345,16 @@ interaction_reported_ = true; } +void ManagePasswordsBubbleModel::OnNopeUpdateClicked() { + DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, state_); + interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_CANCEL); + if (delegate_) + delegate_->OnNopeUpdateClicked(); +} + void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() { DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_NEVER); - interaction_keeper_->set_update_password_submission_event( - GetUpdateDismissalReason(NOPE_CLICKED)); if (delegate_) { CleanStatisticsForSite(GetProfile(), origin_); delegate_->NeverSavePassword(); @@ -421,16 +364,16 @@ void ManagePasswordsBubbleModel::OnCredentialEdited( base::string16 new_username, base::string16 new_password) { - DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); + DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE || + state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); pending_password_.username_value = std::move(new_username); pending_password_.password_value = std::move(new_password); } void ManagePasswordsBubbleModel::OnSaveClicked() { - DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); + DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE || + state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_SAVE); - interaction_keeper_->set_update_password_submission_event( - GetUpdateDismissalReason(UPDATE_CLICKED)); if (delegate_) { CleanStatisticsForSite(GetProfile(), origin_); delegate_->SavePassword(pending_password_.username_value, @@ -438,17 +381,8 @@ } } -void ManagePasswordsBubbleModel::OnNopeUpdateClicked() { - interaction_keeper_->set_update_password_submission_event( - GetUpdateDismissalReason(NOPE_CLICKED)); - if (delegate_) - delegate_->OnNopeUpdateClicked(); -} - void ManagePasswordsBubbleModel::OnUpdateClicked( const autofill::PasswordForm& password_form) { - interaction_keeper_->set_update_password_submission_event( - GetUpdateDismissalReason(UPDATE_CLICKED)); if (delegate_) delegate_->UpdatePassword(password_form); } @@ -457,8 +391,6 @@ interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_DONE); } -// TODO(gcasto): Is it worth having this be separate from OnDoneClicked()? -// User intent is pretty similar in both cases. void ManagePasswordsBubbleModel::OnOKClicked() { interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_OK); } @@ -533,28 +465,24 @@ bool ManagePasswordsBubbleModel::ShouldShowMultipleAccountUpdateUI() const { return state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE && - local_credentials_.size() > 1 && !password_overridden_; + local_credentials_.size() > 1; } -base::string16 ManagePasswordsBubbleModel::GetInitialUsername() const { - const base::string16& captured_username = pending_password_.username_value; - if (!ShouldShowMultipleAccountUpdateUI()) - return captured_username; - DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, state_); - DCHECK_GT(local_credentials_.size(), 1u); - size_t preferred_form_index = 0; - for (size_t index = 0; index < local_credentials_.size(); ++index) { - if (local_credentials_.at(index).username_value == captured_username) - return captured_username; - if (local_credentials_.at(index).preferred) - preferred_form_index = index; - } +bool ManagePasswordsBubbleModel::IsCurrentStateUpdate() const { + DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || + state_ == password_manager::ui::PENDING_PASSWORD_STATE); + return std::any_of(local_credentials_.begin(), local_credentials_.end(), + [this](const autofill::PasswordForm& form) { + return form.username_value == + pending_password_.username_value; + }); +} - return local_credentials_.at(preferred_form_index).username_value; +const base::string16& ManagePasswordsBubbleModel::GetCurrentUsername() const { + return pending_password_.username_value; } bool ManagePasswordsBubbleModel::ReplaceToShowPromotionIfNeeded() { - DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); PrefService* prefs = GetProfile()->GetPrefs(); const browser_sync::ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(GetProfile()); @@ -616,34 +544,3 @@ GetManagePasswordsDialogTitleText(GetWebContents()->GetVisibleURL(), origin_, !local_credentials_.empty(), &title_); } - -metrics_util::UpdatePasswordSubmissionEvent -ManagePasswordsBubbleModel::GetUpdateDismissalReason( - UserBehaviorOnUpdateBubble behavior) const { - static const metrics_util::UpdatePasswordSubmissionEvent update_events[4][3] = - {{metrics_util::NO_ACCOUNTS_CLICKED_UPDATE, - metrics_util::NO_ACCOUNTS_CLICKED_NOPE, - metrics_util::NO_ACCOUNTS_NO_INTERACTION}, - {metrics_util::ONE_ACCOUNT_CLICKED_UPDATE, - metrics_util::ONE_ACCOUNT_CLICKED_NOPE, - metrics_util::ONE_ACCOUNT_NO_INTERACTION}, - {metrics_util::MULTIPLE_ACCOUNTS_CLICKED_UPDATE, - metrics_util::MULTIPLE_ACCOUNTS_CLICKED_NOPE, - metrics_util::MULTIPLE_ACCOUNTS_NO_INTERACTION}, - {metrics_util::PASSWORD_OVERRIDDEN_CLICKED_UPDATE, - metrics_util::PASSWORD_OVERRIDDEN_CLICKED_NOPE, - metrics_util::PASSWORD_OVERRIDDEN_NO_INTERACTION}}; - - if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) { - if (pending_password_.IsPossibleChangePasswordFormWithoutUsername()) - return update_events[0][behavior]; - return metrics_util::NO_UPDATE_SUBMISSION; - } - if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) - return metrics_util::NO_UPDATE_SUBMISSION; - if (password_overridden_) - return update_events[3][behavior]; - if (ShouldShowMultipleAccountUpdateUI()) - return update_events[2][behavior]; - return update_events[1][behavior]; -}
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h index e7a6e323..9e25aa9 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
@@ -60,16 +60,18 @@ void OnCredentialEdited(base::string16 new_username, base::string16 new_password); - // Called by the view code when the save button is clicked by the user. + // Called by the view code when the save/update button is clicked by the user. void OnSaveClicked(); // Called by the view code when the update link is clicked by the user. + // TODO(vasilii): remove when the cocoa bubble is gone. void OnUpdateClicked(const autofill::PasswordForm& password_form); // Called by the view code when the "Done" button is clicked by the user. + // TODO(vasilii): remove when the cocoa bubble is gone. void OnDoneClicked(); - // Called by the view code when the "OK" button is clicked by the user. + // TODO(vasilii): remove when the cocoa bubble is gone. void OnOKClicked(); // Called by the view code when the manage button is clicked by the user. @@ -142,10 +144,16 @@ // Returns true iff the multiple account selection prompt for account update // should be presented. + // TODO(vasilii): remove when the cocoa bubble is gone. bool ShouldShowMultipleAccountUpdateUI() const; + // The password bubble can switch its state between "save" and "update" + // depending on the user input. |state_| only captures the correct state on + // creation. This method returns true iff the current state is "update". + bool IsCurrentStateUpdate() const; + // Returns the value for the username field when the bubble is opened. - base::string16 GetInitialUsername() const; + const base::string16& GetCurrentUsername() const; // Returns true and updates the internal state iff the Save bubble should // switch to show a promotion after the password was saved. Otherwise, @@ -162,19 +170,13 @@ bool RevealPasswords(); private: - enum UserBehaviorOnUpdateBubble { - UPDATE_CLICKED, - NOPE_CLICKED, - NO_INTERACTION - }; class InteractionKeeper; // Updates |title_| and |title_brand_link_range_| for the // PENDING_PASSWORD_STATE. void UpdatePendingStateTitle(); // Updates |title_| for the MANAGE_STATE. void UpdateManageStateTitle(); - password_manager::metrics_util::UpdatePasswordSubmissionEvent - GetUpdateDismissalReason(UserBehaviorOnUpdateBubble behavior) const; + // URL of the page from where this bubble was triggered. GURL origin_; password_manager::ui::State state_; @@ -183,7 +185,6 @@ // should point to an article. For the default title the range is empty. gfx::Range title_brand_link_range_; autofill::PasswordForm pending_password_; - bool password_overridden_; std::vector<autofill::PasswordForm> local_credentials_; base::string16 manage_link_; base::string16 save_confirmation_text_;
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc index 2267bc8..75dd2a6 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -59,8 +59,16 @@ "PasswordManager.SignInPromo"; constexpr char kSiteOrigin[] = "http://example.com/login"; constexpr char kUsername[] = "Admin"; +constexpr char kUsernameExisting[] = "User"; +constexpr char kUsernameNew[] = "User585"; constexpr char kPassword[] = "AdminPass"; -constexpr char kUIDismissalReasonMetric[] = "PasswordManager.UIDismissalReason"; +constexpr char kPasswordEdited[] = "asDfjkl;"; +constexpr char kUIDismissalReasonGeneralMetric[] = + "PasswordManager.UIDismissalReason"; +constexpr char kUIDismissalReasonSaveMetric[] = + "PasswordManager.SaveUIDismissalReason"; +constexpr char kUIDismissalReasonUpdateMetric[] = + "PasswordManager.UpdateUIDismissalReason"; class TestSyncService : public browser_sync::ProfileSyncServiceMock { public: @@ -120,7 +128,7 @@ void SetUp() override { test_web_contents_.reset( content::WebContentsTester::CreateTestWebContents(&profile_, nullptr)); - mock_delegate_.reset(new PasswordsModelDelegateMock); + mock_delegate_.reset(new testing::NiceMock<PasswordsModelDelegateMock>); ON_CALL(*mock_delegate_, GetPasswordFormMetricsRecorder()) .WillByDefault(Return(nullptr)); PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( @@ -128,6 +136,10 @@ password_manager::BuildPasswordStore< content::BrowserContext, testing::StrictMock<password_manager::MockPasswordStore>>); + pending_password_.origin = GURL(kSiteOrigin); + pending_password_.signon_realm = kSiteOrigin; + pending_password_.username_value = base::ASCIIToUTF16(kUsername); + pending_password_.password_value = base::ASCIIToUTF16(kPassword); } void TearDown() override { @@ -153,11 +165,16 @@ ManagePasswordsBubbleModel* model() { return model_.get(); } + autofill::PasswordForm& pending_password() { return pending_password_; } + const autofill::PasswordForm& pending_password() const { + return pending_password_; + } + void SetUpWithState(password_manager::ui::State state, ManagePasswordsBubbleModel::DisplayReason reason); - void PretendPasswordWaiting(); - void PretendUpdatePasswordWaiting( - const autofill::PasswordForm& pending_password); + void PretendPasswordWaiting(ManagePasswordsBubbleModel::DisplayReason reason = + ManagePasswordsBubbleModel::AUTOMATIC); + void PretendUpdatePasswordWaiting(); void PretendAutoSigningIn(); void PretendManagingPasswords(); @@ -166,8 +183,7 @@ password_manager::metrics_util::UIDismissalReason dismissal_reason); static password_manager::InteractionsStats GetTestStats(); - static autofill::PasswordForm GetPendingPassword(); - static std::vector<std::unique_ptr<autofill::PasswordForm>> GetCurrentForms(); + std::vector<std::unique_ptr<autofill::PasswordForm>> GetCurrentForms() const; private: content::TestBrowserThreadBundle thread_bundle_; @@ -175,6 +191,7 @@ std::unique_ptr<content::WebContents> test_web_contents_; std::unique_ptr<ManagePasswordsBubbleModel> model_; std::unique_ptr<PasswordsModelDelegateMock> mock_delegate_; + autofill::PasswordForm pending_password_; }; void ManagePasswordsBubbleModelTest::SetUpWithState( @@ -193,31 +210,36 @@ Return(test_web_contents_.get())); } -void ManagePasswordsBubbleModelTest::PretendPasswordWaiting() { - autofill::PasswordForm form = GetPendingPassword(); - EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); +void ManagePasswordsBubbleModelTest::PretendPasswordWaiting( + ManagePasswordsBubbleModel::DisplayReason reason) { + EXPECT_CALL(*controller(), GetPendingPassword()) + .WillOnce(ReturnRef(pending_password())); password_manager::InteractionsStats stats = GetTestStats(); EXPECT_CALL(*controller(), GetCurrentInteractionStats()) .WillOnce(Return(&stats)); - SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, - ManagePasswordsBubbleModel::AUTOMATIC); -} - -void ManagePasswordsBubbleModelTest::PretendUpdatePasswordWaiting( - const autofill::PasswordForm& pending_password) { - EXPECT_CALL(*controller(), GetPendingPassword()) - .WillOnce(ReturnRef(pending_password)); std::vector<std::unique_ptr<autofill::PasswordForm>> forms = GetCurrentForms(); EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms)); - EXPECT_CALL(*controller(), IsPasswordOverridden()).WillOnce(Return(false)); + SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, reason); +} + +void ManagePasswordsBubbleModelTest::PretendUpdatePasswordWaiting() { + EXPECT_CALL(*controller(), GetPendingPassword()) + .WillOnce(ReturnRef(pending_password())); + std::vector<std::unique_ptr<autofill::PasswordForm>> forms = + GetCurrentForms(); + auto current_form = + std::make_unique<autofill::PasswordForm>(pending_password()); + current_form->password_value = base::ASCIIToUTF16("old_password"); + forms.push_back(std::move(current_form)); + EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms)); SetUpWithState(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, ManagePasswordsBubbleModel::AUTOMATIC); } void ManagePasswordsBubbleModelTest::PretendAutoSigningIn() { - autofill::PasswordForm form = GetPendingPassword(); - EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); + EXPECT_CALL(*controller(), GetPendingPassword()) + .WillOnce(ReturnRef(pending_password())); SetUpWithState(password_manager::ui::AUTO_SIGNIN_STATE, ManagePasswordsBubbleModel::AUTOMATIC); } @@ -241,9 +263,14 @@ void ManagePasswordsBubbleModelTest::DestroyModelExpectReason( password_manager::metrics_util::UIDismissalReason dismissal_reason) { base::HistogramTester histogram_tester; + password_manager::ui::State state = model_->state(); + std::string histogram(kUIDismissalReasonGeneralMetric); + if (state == password_manager::ui::PENDING_PASSWORD_STATE) + histogram = kUIDismissalReasonSaveMetric; + else if (state == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) + histogram = kUIDismissalReasonUpdateMetric; DestroyModelAndVerifyControllerExpectations(); - histogram_tester.ExpectUniqueSample(kUIDismissalReasonMetric, - dismissal_reason, 1); + histogram_tester.ExpectUniqueSample(histogram, dismissal_reason, 1); } // static @@ -257,28 +284,20 @@ return result; } -// static -autofill::PasswordForm ManagePasswordsBubbleModelTest::GetPendingPassword() { - autofill::PasswordForm form; - form.origin = GURL(kSiteOrigin); - form.signon_realm = kSiteOrigin; - form.username_value = base::ASCIIToUTF16(kUsername); - form.password_value = base::ASCIIToUTF16(kPassword); - return form; -} - -// static std::vector<std::unique_ptr<autofill::PasswordForm>> -ManagePasswordsBubbleModelTest::GetCurrentForms() { - std::vector<std::unique_ptr<autofill::PasswordForm>> forms(3); - autofill::PasswordForm another_form(GetPendingPassword()); - another_form.username_value = base::ASCIIToUTF16("another_username"); - forms[0].reset(new autofill::PasswordForm(another_form)); - forms[1].reset(new autofill::PasswordForm(GetPendingPassword())); - autofill::PasswordForm preferred_form(GetPendingPassword()); +ManagePasswordsBubbleModelTest::GetCurrentForms() const { + autofill::PasswordForm form(pending_password()); + form.username_value = base::ASCIIToUTF16(kUsernameExisting); + form.password_value = base::ASCIIToUTF16("123456"); + + autofill::PasswordForm preferred_form(pending_password()); preferred_form.username_value = base::ASCIIToUTF16("preferred_username"); + preferred_form.password_value = base::ASCIIToUTF16("654321"); preferred_form.preferred = true; - forms[2].reset(new autofill::PasswordForm(preferred_form)); + + std::vector<std::unique_ptr<autofill::PasswordForm>> forms; + forms.push_back(std::make_unique<autofill::PasswordForm>(form)); + forms.push_back(std::make_unique<autofill::PasswordForm>(preferred_form)); return forms; } @@ -305,11 +324,30 @@ PretendPasswordWaiting(); EXPECT_TRUE(model()->enable_editing()); + EXPECT_FALSE(model()->IsCurrentStateUpdate()); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - EXPECT_CALL(*controller(), SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); + EXPECT_CALL(*controller(), OnNopeUpdateClicked()).Times(0); + model()->OnSaveClicked(); + DestroyModelExpectReason(password_manager::metrics_util::CLICKED_SAVE); +} + +TEST_F(ManagePasswordsBubbleModelTest, ClickSaveInUpdateState) { + PretendUpdatePasswordWaiting(); + + // Edit username, now it's a new credential. + model()->OnCredentialEdited(base::ASCIIToUTF16(kUsernameNew), + base::ASCIIToUTF16(kPasswordEdited)); + EXPECT_FALSE(model()->IsCurrentStateUpdate()); + + EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); + EXPECT_CALL(*controller(), SavePassword(base::ASCIIToUTF16(kUsernameNew), + base::ASCIIToUTF16(kPasswordEdited))); + EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); + EXPECT_CALL(*controller(), OnNopeUpdateClicked()).Times(0); model()->OnSaveClicked(); DestroyModelExpectReason(password_manager::metrics_util::CLICKED_SAVE); } @@ -352,26 +390,40 @@ } TEST_F(ManagePasswordsBubbleModelTest, ClickUpdate) { - PretendUpdatePasswordWaiting(GetPendingPassword()); + PretendUpdatePasswordWaiting(); - autofill::PasswordForm form; - EXPECT_CALL(*controller(), UpdatePassword(form)); - model()->OnUpdateClicked(form); - DestroyModelAndVerifyControllerExpectations(); + EXPECT_TRUE(model()->enable_editing()); + EXPECT_TRUE(model()->IsCurrentStateUpdate()); + + EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); + EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); + EXPECT_CALL(*controller(), OnNopeUpdateClicked()).Times(0); + model()->OnSaveClicked(); + DestroyModelExpectReason(password_manager::metrics_util::CLICKED_SAVE); +} + +TEST_F(ManagePasswordsBubbleModelTest, ClickUpdateInSaveState) { + PretendPasswordWaiting(); + + // Edit username, now it's an existing credential. + model()->OnCredentialEdited(base::ASCIIToUTF16(kUsernameExisting), + base::ASCIIToUTF16(kPasswordEdited)); + EXPECT_TRUE(model()->IsCurrentStateUpdate()); + + EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); + EXPECT_CALL(*controller(), SavePassword(base::ASCIIToUTF16(kUsernameExisting), + base::ASCIIToUTF16(kPasswordEdited))); + EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); + EXPECT_CALL(*controller(), OnNopeUpdateClicked()).Times(0); + model()->OnSaveClicked(); + DestroyModelExpectReason(password_manager::metrics_util::CLICKED_SAVE); } TEST_F(ManagePasswordsBubbleModelTest, GetInitialUsername_MatchedUsername) { - PretendUpdatePasswordWaiting(GetPendingPassword()); - EXPECT_EQ(base::UTF8ToUTF16(kUsername), model()->GetInitialUsername()); -} - -TEST_F(ManagePasswordsBubbleModelTest, GetInitialUsername_PreferredCredential) { - autofill::PasswordForm form = GetPendingPassword(); - // There is no matched username, the preferred credential should be selected. - form.username_value = base::UTF8ToUTF16("captcha_code"); - PretendUpdatePasswordWaiting(form); - EXPECT_EQ(base::UTF8ToUTF16("preferred_username"), - model()->GetInitialUsername()); + PretendUpdatePasswordWaiting(); + EXPECT_EQ(base::UTF8ToUTF16(kUsername), model()->GetCurrentUsername()); } TEST_F(ManagePasswordsBubbleModelTest, EditCredential) { @@ -404,8 +456,8 @@ base::HistogramTester histogram_tester; PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - EXPECT_CALL(*controller(), SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); model()->OnSaveClicked(); EXPECT_FALSE(model()->ReplaceToShowPromotionIfNeeded()); @@ -420,8 +472,8 @@ base::HistogramTester histogram_tester; PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - EXPECT_CALL(*controller(), SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); model()->OnSaveClicked(); EXPECT_TRUE(model()->ReplaceToShowPromotionIfNeeded()); @@ -434,8 +486,8 @@ model()->OnSignInToChromeClicked(account); DestroyModelAndVerifyControllerExpectations(); histogram_tester.ExpectUniqueSample( - kUIDismissalReasonMetric, password_manager::metrics_util::CLICKED_SAVE, - 1); + kUIDismissalReasonSaveMetric, + password_manager::metrics_util::CLICKED_SAVE, 1); histogram_tester.ExpectUniqueSample( kSignInPromoDismissalReasonMetric, password_manager::metrics_util::CHROME_SIGNIN_OK, 1); @@ -450,15 +502,15 @@ base::HistogramTester histogram_tester; PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - EXPECT_CALL(*controller(), SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); model()->OnSaveClicked(); EXPECT_TRUE(model()->ReplaceToShowPromotionIfNeeded()); model()->OnSkipSignInClicked(); DestroyModelAndVerifyControllerExpectations(); histogram_tester.ExpectUniqueSample( - kUIDismissalReasonMetric, + kUIDismissalReasonSaveMetric, password_manager::metrics_util::CLICKED_SAVE, 1); histogram_tester.ExpectUniqueSample( kSignInPromoDismissalReasonMetric, @@ -474,14 +526,14 @@ base::HistogramTester histogram_tester; PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - EXPECT_CALL(*controller(), SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, + pending_password().password_value)); model()->OnSaveClicked(); EXPECT_TRUE(model()->ReplaceToShowPromotionIfNeeded()); DestroyModelAndVerifyControllerExpectations(); histogram_tester.ExpectUniqueSample( - kUIDismissalReasonMetric, + kUIDismissalReasonSaveMetric, password_manager::metrics_util::CLICKED_SAVE, 1); histogram_tester.ExpectUniqueSample( kSignInPromoDismissalReasonMetric, @@ -595,21 +647,16 @@ : CredentialSourceType::kPasswordManager)); if (update) - PretendUpdatePasswordWaiting(GetPendingPassword()); + PretendUpdatePasswordWaiting(); else PretendPasswordWaiting(); - if (interaction == BubbleDismissalReason::kAccepted && update) { - autofill::PasswordForm form; - EXPECT_CALL(*controller(), UpdatePassword(form)); - model()->OnUpdateClicked(form); - } else if (interaction == BubbleDismissalReason::kAccepted && - !update) { + if (interaction == BubbleDismissalReason::kAccepted) { EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); EXPECT_CALL(*controller(), - SavePassword(GetPendingPassword().username_value, - GetPendingPassword().password_value)); + SavePassword(pending_password().username_value, + pending_password().password_value)); model()->OnSaveClicked(); } else if (interaction == BubbleDismissalReason::kDeclined && update) { @@ -691,23 +738,14 @@ ? "AUTOMATIC" : "USER_ACTION")); - autofill::PasswordForm form = GetPendingPassword(); - form.form_has_autofilled_value = form_has_autofilled_value; - EXPECT_CALL(*controller(), GetPendingPassword()) - .WillOnce(ReturnRef(form)); - password_manager::InteractionsStats stats = GetTestStats(); - EXPECT_CALL(*controller(), GetCurrentInteractionStats()) - .WillOnce(Return(&stats)); - if (display_reason == ManagePasswordsBubbleModel::AUTOMATIC) - EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)); - + pending_password().form_has_autofilled_value = + form_has_autofilled_value; EXPECT_CALL(*controller(), ArePasswordsRevealedWhenBubbleIsOpened()) .WillOnce(Return(false)); EXPECT_CALL(*controller(), BubbleIsManualFallbackForSaving()) .WillOnce(Return(is_manual_fallback_for_saving)); - SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, - display_reason); + PretendPasswordWaiting(display_reason); bool reauth_expected = is_manual_fallback_for_saving ? form_has_autofilled_value @@ -727,6 +765,9 @@ EXPECT_TRUE(model()->RevealPasswords()); } + if (display_reason == ManagePasswordsBubbleModel::AUTOMATIC) + EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)); + DestroyModelAndVerifyControllerExpectations(); // Flush async calls on password store. base::RunLoop().RunUntilIdle(); @@ -739,37 +780,22 @@ TEST_F(ManagePasswordsBubbleModelTest, EyeIcon_BubbleReopenedAfterAuth) { // Checks re-authentication is not needed if the bubble is opened right after // successful authentication. - autofill::PasswordForm form = GetPendingPassword(); - form.form_has_autofilled_value = true; - EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); - password_manager::InteractionsStats stats = GetTestStats(); - EXPECT_CALL(*controller(), GetCurrentInteractionStats()) - .WillOnce(Return(&stats)); - + pending_password().form_has_autofilled_value = true; // After successful authentication this value is set to true. EXPECT_CALL(*controller(), ArePasswordsRevealedWhenBubbleIsOpened()) .WillOnce(Return(true)); - - SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, - ManagePasswordsBubbleModel::USER_ACTION); + PretendPasswordWaiting(ManagePasswordsBubbleModel::USER_ACTION); EXPECT_FALSE(model()->password_revealing_requires_reauth()); EXPECT_TRUE(model()->RevealPasswords()); } TEST_F(ManagePasswordsBubbleModelTest, DisableEditing) { - autofill::PasswordForm form = GetPendingPassword(); - EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); - password_manager::InteractionsStats stats = GetTestStats(); - EXPECT_CALL(*controller(), GetCurrentInteractionStats()) - .WillOnce(Return(&stats)); EXPECT_CALL(*controller(), BubbleIsManualFallbackForSaving()) .WillOnce(Return(false)); - EXPECT_CALL(*controller(), GetCredentialSource()) .WillOnce(Return(password_manager::metrics_util::CredentialSourceType:: kCredentialManagementAPI)); - SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, - ManagePasswordsBubbleModel::AUTOMATIC); + PretendPasswordWaiting(); EXPECT_FALSE(model()->enable_editing()); }
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index 705cab6..4ab42bf 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -312,12 +312,6 @@ : password_manager::metrics_util::CredentialSourceType::kUnknown; } -bool ManagePasswordsUIController::IsPasswordOverridden() const { - const password_manager::PasswordFormManager* form_manager = - passwords_data_.form_manager(); - return form_manager ? form_manager->password_overridden() : false; -} - const std::vector<std::unique_ptr<autofill::PasswordForm>>& ManagePasswordsUIController::GetCurrentForms() const { return passwords_data_.GetCurrentForms(); @@ -384,7 +378,6 @@ void ManagePasswordsUIController::SavePassword(const base::string16& username, const base::string16& password) { - DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, GetState()); const auto& pending_credentials = passwords_data_.form_manager()->pending_credentials(); bool username_edited = pending_credentials.username_value != username;
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h index 0ba6edf..001d990 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
@@ -108,7 +108,6 @@ const autofill::PasswordForm& GetPendingPassword() const override; password_manager::metrics_util::CredentialSourceType GetCredentialSource() const override; - bool IsPasswordOverridden() const override; const std::vector<std::unique_ptr<autofill::PasswordForm>>& GetCurrentForms() const override; const password_manager::InteractionsStats* GetCurrentInteractionStats()
diff --git a/chrome/browser/ui/passwords/passwords_model_delegate.h b/chrome/browser/ui/passwords/passwords_model_delegate.h index 3067e61..3297b1c 100644 --- a/chrome/browser/ui/passwords/passwords_model_delegate.h +++ b/chrome/browser/ui/passwords/passwords_model_delegate.h
@@ -57,10 +57,6 @@ virtual password_manager::metrics_util::CredentialSourceType GetCredentialSource() const = 0; - // True if the password for previously stored account was overridden, i.e. in - // newly submitted form the password is different from stored one. - virtual bool IsPasswordOverridden() const = 0; - // Returns current local forms for the current page. virtual const std::vector<std::unique_ptr<autofill::PasswordForm>>& GetCurrentForms() const = 0;
diff --git a/chrome/browser/ui/passwords/passwords_model_delegate_mock.h b/chrome/browser/ui/passwords/passwords_model_delegate_mock.h index 3d06f9e..ee3a6606 100644 --- a/chrome/browser/ui/passwords/passwords_model_delegate_mock.h +++ b/chrome/browser/ui/passwords/passwords_model_delegate_mock.h
@@ -25,7 +25,6 @@ MOCK_CONST_METHOD0(GetPendingPassword, const autofill::PasswordForm&()); MOCK_CONST_METHOD0(GetCredentialSource, password_manager::metrics_util::CredentialSourceType()); - MOCK_CONST_METHOD0(IsPasswordOverridden, bool()); MOCK_CONST_METHOD0( GetCurrentForms, const std::vector<std::unique_ptr<autofill::PasswordForm>>&());
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_ash_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_ash_unittest.cc index f5effa0..e8ca2f3 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_ash_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_ash_unittest.cc
@@ -26,8 +26,7 @@ class AppInfoDialogAshTest : public ash::AshTestBase { public: - AppInfoDialogAshTest() - : extension_environment_(base::MessageLoopForUI::current()) {} + AppInfoDialogAshTest() = default; // Overridden from testing::Test: void SetUp() override { @@ -49,7 +48,9 @@ } protected: - extensions::TestExtensionEnvironment extension_environment_; + extensions::TestExtensionEnvironment extension_environment_{ + extensions::TestExtensionEnvironment::Type:: + kInheritExistingTaskEnvironment}; views::Widget* widget_ = nullptr; AppInfoDialog* dialog_ = nullptr; // Owned by |widget_|'s views hierarchy.
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_browsertest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_browsertest.cc index c846e13..17fd2f9f 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_browsertest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_browsertest.cc
@@ -26,7 +26,9 @@ // DialogBrowserTest: void ShowUi(const std::string& name) override { extension_environment_ = - std::make_unique<extensions::TestExtensionEnvironment>(nullptr); + std::make_unique<extensions::TestExtensionEnvironment>( + extensions::TestExtensionEnvironment::Type:: + kInheritExistingTaskEnvironment); constexpr char kTestExtensionId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; extension_ = extension_environment_->MakePackagedApp(kTestExtensionId, true);
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc index 4c2a22f2..d5beaa2b 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc
@@ -82,8 +82,7 @@ class AppInfoDialogViewsTest : public BrowserWithTestWindowTest, public views::WidgetObserver { public: - AppInfoDialogViewsTest() - : extension_environment_(base::MessageLoopForUI::current()) {} + AppInfoDialogViewsTest() = default; // Overridden from testing::Test: void SetUp() override { @@ -159,7 +158,9 @@ AppInfoDialog* dialog_ = nullptr; // Owned by |widget_|'s views hierarchy. scoped_refptr<extensions::Extension> extension_; scoped_refptr<extensions::Extension> chrome_app_; - extensions::TestExtensionEnvironment extension_environment_; + extensions::TestExtensionEnvironment extension_environment_{ + extensions::TestExtensionEnvironment::Type:: + kInheritExistingTaskEnvironment}; #if defined(OS_CHROMEOS) ArcAppTest arc_test_; #endif
diff --git a/chrome/browser/ui/views/chrome_platform_style.cc b/chrome/browser/ui/views/chrome_platform_style.cc new file mode 100644 index 0000000..cd6d8d6 --- /dev/null +++ b/chrome/browser/ui/views/chrome_platform_style.cc
@@ -0,0 +1,14 @@ +// Copyright 2018 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/ui/views/chrome_platform_style.h" + +#include "build/build_config.h" + +#if !defined(OS_MACOSX) +// static +bool ChromePlatformStyle::ShouldOmniboxUseFocusRing() { + return false; +} +#endif
diff --git a/chrome/browser/ui/views/chrome_platform_style.h b/chrome/browser/ui/views/chrome_platform_style.h new file mode 100644 index 0000000..a8b5c94a --- /dev/null +++ b/chrome/browser/ui/views/chrome_platform_style.h
@@ -0,0 +1,21 @@ +// Copyright 2018 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_VIEWS_CHROME_PLATFORM_STYLE_H_ +#define CHROME_BROWSER_UI_VIEWS_CHROME_PLATFORM_STYLE_H_ + +// This class defines per-platform design variations in the //chrome layer, to +// make it more apparent which are accidental and which are intentional. It +// is similar in purpose to //ui/views' PlatformStyle. +class ChromePlatformStyle { + public: + // Whether the Omnibox should use a focus ring to indicate that it has + // keyboard focus. + static bool ShouldOmniboxUseFocusRing(); + + private: + ChromePlatformStyle() = delete; +}; + +#endif // CHROME_BROWSER_UI_VIEWS_CHROME_PLATFORM_STYLE_H_
diff --git a/chrome/browser/ui/views/chrome_platform_style_mac.mm b/chrome/browser/ui/views/chrome_platform_style_mac.mm new file mode 100644 index 0000000..7c9a3c0 --- /dev/null +++ b/chrome/browser/ui/views/chrome_platform_style_mac.mm
@@ -0,0 +1,10 @@ +// Copyright 2018 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/ui/views/chrome_platform_style.h" + +// static +bool ChromePlatformStyle::ShouldOmniboxUseFocusRing() { + return true; +}
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 4582862a..2c1a471f 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -155,7 +155,7 @@ void ExtensionPopup::OnWidgetActivationChanged(views::Widget* widget, bool active) { if (active && widget == anchor_widget()) - OnAnchorWindowActivation(); + CloseUnlessUnderInspection(); } void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents, @@ -165,7 +165,7 @@ GetWidget()->Close(); } -void ExtensionPopup::OnAnchorWindowActivation() { +void ExtensionPopup::CloseUnlessUnderInspection() { if (!inspect_with_devtools_) GetWidget()->Close(); }
diff --git a/chrome/browser/ui/views/extensions/extension_popup.h b/chrome/browser/ui/views/extensions/extension_popup.h index 0b01c8fd..b9b8eef 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.h +++ b/chrome/browser/ui/views/extensions/extension_popup.h
@@ -94,8 +94,7 @@ views::BubbleBorder::Arrow arrow, ShowAction show_action); - // Called on anchor window activation (ie. user clicked the browser window). - void OnAnchorWindowActivation(); + void CloseUnlessUnderInspection(); private: static ExtensionPopup* Create(extensions::ExtensionViewHost* host,
diff --git a/chrome/browser/ui/views/extensions/extension_popup_aura.cc b/chrome/browser/ui/views/extensions/extension_popup_aura.cc index cfc0a23..cdbb39d 100644 --- a/chrome/browser/ui/views/extensions/extension_popup_aura.cc +++ b/chrome/browser/ui/views/extensions/extension_popup_aura.cc
@@ -63,5 +63,5 @@ // [de]activation events when activating widgets in its own root window. // This additional check handles those cases. See: http://crbug.com/320889 if (gained_active == anchor_widget()->GetNativeWindow()) - OnAnchorWindowActivation(); + CloseUnlessUnderInspection(); }
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 c21ec76..8cab179 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -40,6 +40,7 @@ #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" +#include "chrome/browser/ui/views/chrome_platform_style.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/harmony/chrome_typography.h" #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" @@ -98,6 +99,7 @@ #include "ui/views/button_drag_utils.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button_factory.h" +#include "ui/views/controls/focus_ring.h" #include "ui/views/controls/label.h" #include "ui/views/widget/widget.h" @@ -181,10 +183,10 @@ // not prepared for that. DCHECK(GetWidget()); - // Make sure children with layers are clipped. See http://crbug.com/589497 + // Note that children with layers are *not* clipped, because focus rings have + // to draw outside the parent's bounds. SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); - layer()->SetMasksToBounds(true); const gfx::FontList& font_list = views::style::GetFont( CONTEXT_OMNIBOX_PRIMARY, views::style::STYLE_PRIMARY); @@ -456,6 +458,8 @@ if (!IsInitialized()) return; + View::Layout(); + selected_keyword_view_->SetVisible(false); location_icon_view_->SetVisible(false); keyword_hint_view_->SetVisible(false); @@ -705,6 +709,16 @@ 2 * GetTotalVerticalPadding()); } +void LocationBarView::OnOmniboxFocused() { + if (ChromePlatformStyle::ShouldOmniboxUseFocusRing()) + views::FocusRing::Install(this); +} + +void LocationBarView::OnOmniboxBlurred() { + if (ChromePlatformStyle::ShouldOmniboxUseFocusRing()) + views::FocusRing::Uninstall(this); +} + // static int LocationBarView::GetAvailableDecorationTextHeight() { const int bubble_padding = @@ -1040,7 +1054,8 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { View::OnPaint(canvas); - if (show_focus_rect_ && omnibox_view_->HasFocus()) { + if (show_focus_rect_ && omnibox_view_->HasFocus() && + !ChromePlatformStyle::ShouldOmniboxUseFocusRing()) { static_cast<BackgroundWith1PxBorder*>(background()) ->PaintFocusRing(canvas, GetNativeTheme(), GetLocalBounds()); }
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 5cb47b66..6d7dc05 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -257,6 +257,9 @@ // Returns the height available for text within location bar decorations. static int GetAvailableDecorationTextHeight(); + void OnOmniboxFocused(); + void OnOmniboxBlurred(); + private: FRIEND_TEST_ALL_PREFIXES(SecurityIndicatorTest, CheckIndicatorText); using ContentSettingViews = std::vector<ContentSettingImageView*>;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index cbce85f..9e5674b3 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -913,6 +913,9 @@ ->OnOmniboxFocused(); } #endif + + if (location_bar_view_) + location_bar_view_->OnOmniboxFocused(); } void OmniboxViewViews::OnBlur() { @@ -965,6 +968,8 @@ if (model()->is_keyword_hint()) location_bar_view_->Layout(); + location_bar_view_->OnOmniboxBlurred(); + // The location bar needs to repaint without a focus ring. location_bar_view_->SchedulePaint(); }
diff --git a/chrome/browser/ui/views/passwords/password_pending_view.cc b/chrome/browser/ui/views/passwords/password_pending_view.cc index ff224dde..dda0bdc 100644 --- a/chrome/browser/ui/views/passwords/password_pending_view.cc +++ b/chrome/browser/ui/views/passwords/password_pending_view.cc
@@ -204,16 +204,28 @@ password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); const autofill::PasswordForm& password_form = model()->pending_password(); if (model()->enable_editing()) { - username_field_ = - CreateUsernameEditable(model()->GetInitialUsername()).release(); + views::Textfield* username_field = + CreateUsernameEditable(model()->GetCurrentUsername()).release(); + username_field->set_controller(this); + username_field_ = username_field; } else { username_field_ = CreateUsernameLabel(password_form).release(); } + if (password_form.all_possible_passwords.size() > 1 && + model()->enable_editing()) { + password_dropdown_ = + CreatePasswordDropdownView(password_form, are_passwords_revealed_) + .release(); + } else { + password_label_ = + CreatePasswordLabel(password_form, + IDS_PASSWORD_MANAGER_SIGNIN_VIA_FEDERATION, + are_passwords_revealed_) + .release(); + } + const bool is_password_credential = password_form.federation_origin.unique(); - - CreatePasswordField(); - if (is_password_credential) { password_view_button_ = CreatePasswordViewButton(this, are_passwords_revealed_).release(); @@ -276,11 +288,6 @@ PasswordPendingView::~PasswordPendingView() = default; bool PasswordPendingView::Accept() { - if (is_update_bubble_) { - UpdateUsernameAndPasswordInModel(); - model()->OnUpdateClicked(model()->pending_password()); - return true; - } if (sign_in_promo_) return sign_in_promo_->Accept(); #if defined(OS_WIN) @@ -297,19 +304,19 @@ } bool PasswordPendingView::Cancel() { + if (sign_in_promo_) + return sign_in_promo_->Cancel(); +#if defined(OS_WIN) + if (desktop_ios_promo_) + return desktop_ios_promo_->Cancel(); +#endif + UpdateUsernameAndPasswordInModel(); if (is_update_bubble_) { model()->OnNopeUpdateClicked(); return true; - } else { - if (sign_in_promo_) - return sign_in_promo_->Cancel(); -#if defined(OS_WIN) - if (desktop_ios_promo_) - return desktop_ios_promo_->Cancel(); -#endif - model()->OnNeverForThisSiteClicked(); - return true; } + model()->OnNeverForThisSiteClicked(); + return true; } bool PasswordPendingView::Close() { @@ -329,6 +336,17 @@ model()->OnBrandLinkClicked(); } +void PasswordPendingView::ContentsChanged(views::Textfield* sender, + const base::string16& new_contents) { + bool is_update_before = model()->IsCurrentStateUpdate(); + UpdateUsernameAndPasswordInModel(); + // May be the buttons should be updated. + if (is_update_before != model()->IsCurrentStateUpdate()) { + DialogModelChanged(); + GetDialogClientView()->Layout(); + } +} + gfx::Size PasswordPendingView::CalculatePreferredSize() const { const int width = ChromeLayoutProvider::Get()->GetDistanceMetric( DISTANCE_BUBBLE_PREFERRED_WIDTH) - @@ -351,11 +369,6 @@ base::string16 PasswordPendingView::GetDialogButtonLabel( ui::DialogButton button) const { - if (is_update_bubble_) { - return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK - ? IDS_PASSWORD_MANAGER_UPDATE_BUTTON - : IDS_PASSWORD_MANAGER_CANCEL_BUTTON); - } // TODO(pbos): Generalize the different promotion classes to not store and // ask each different possible promo. if (sign_in_promo_) @@ -365,10 +378,17 @@ return desktop_ios_promo_->GetDialogButtonLabel(button); #endif - return l10n_util::GetStringUTF16( - button == ui::DIALOG_BUTTON_OK - ? IDS_PASSWORD_MANAGER_SAVE_BUTTON - : IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON); + int message = 0; + if (button == ui::DIALOG_BUTTON_OK) { + message = model()->IsCurrentStateUpdate() + ? IDS_PASSWORD_MANAGER_UPDATE_BUTTON + : IDS_PASSWORD_MANAGER_SAVE_BUTTON; + } else { + message = is_update_bubble_ ? IDS_PASSWORD_MANAGER_CANCEL_BUTTON + : IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON; + } + + return l10n_util::GetStringUTF16(message); } gfx::ImageSkia PasswordPendingView::GetWindowIcon() { @@ -406,27 +426,10 @@ password_view_button_, show_password_label); } -void PasswordPendingView::CreatePasswordField() { - const autofill::PasswordForm& password_form = model()->pending_password(); - if (password_form.all_possible_passwords.size() > 1 && - model()->enable_editing()) { - password_dropdown_ = - CreatePasswordDropdownView(password_form, are_passwords_revealed_) - .release(); - } else { - password_label_ = - CreatePasswordLabel(password_form, - IDS_PASSWORD_MANAGER_SIGNIN_VIA_FEDERATION, - are_passwords_revealed_) - .release(); - } -} - void PasswordPendingView::TogglePasswordVisibility() { if (!are_passwords_revealed_ && !model()->RevealPasswords()) return; - UpdateUsernameAndPasswordInModel(); are_passwords_revealed_ = !are_passwords_revealed_; password_view_button_->SetToggled(are_passwords_revealed_); DCHECK(!password_dropdown_ || !password_label_); @@ -458,7 +461,7 @@ .all_possible_passwords.at(password_dropdown_->selected_index()) .first; } - model()->OnCredentialEdited(new_username, new_password); + model()->OnCredentialEdited(std::move(new_username), std::move(new_password)); } void PasswordPendingView::ReplaceWithPromo() {
diff --git a/chrome/browser/ui/views/passwords/password_pending_view.h b/chrome/browser/ui/views/passwords/password_pending_view.h index 0afbd083..51878c1c 100644 --- a/chrome/browser/ui/views/passwords/password_pending_view.h +++ b/chrome/browser/ui/views/passwords/password_pending_view.h
@@ -8,6 +8,7 @@ #include "chrome/browser/ui/views/passwords/password_bubble_view_base.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/styled_label_listener.h" +#include "ui/views/controls/textfield/textfield_controller.h" #include "ui/views/view.h" namespace views { @@ -26,7 +27,8 @@ // "Save"/"Update" button and a "Never"/"Nope" button. class PasswordPendingView : public PasswordBubbleViewBase, public views::ButtonListener, - public views::StyledLabelListener { + public views::StyledLabelListener, + public views::TextfieldController { public: PasswordPendingView(content::WebContents* web_contents, views::View* anchor_view, @@ -55,6 +57,10 @@ const gfx::Range& range, int event_flags) override; + // views::TextfieldController: + void ContentsChanged(views::Textfield* sender, + const base::string16& new_contents) override; + // PasswordBubbleViewBase: gfx::Size CalculatePreferredSize() const override; views::View* GetInitiallyFocusedView() override; @@ -69,13 +75,13 @@ bool Close() override; void CreateAndSetLayout(bool show_password_label); - void CreatePasswordField(); void TogglePasswordVisibility(); void UpdateUsernameAndPasswordInModel(); void ReplaceWithPromo(); void UpdateTitleText(views::StyledLabel* title_view); - // True iff it is an update password bubble. False iff it is a save bubble. + // True iff it is an update password bubble on creation. False iff it is a + // save bubble. const bool is_update_bubble_; // Different promo dialogs that helps the user get access to credentials
diff --git a/chrome/browser/vr/elements/indicator_spec.cc b/chrome/browser/vr/elements/indicator_spec.cc index 05b15e19a..73dd269 100644 --- a/chrome/browser/vr/elements/indicator_spec.cc +++ b/chrome/browser/vr/elements/indicator_spec.cc
@@ -9,6 +9,41 @@ namespace vr { +IndicatorSpec::IndicatorSpec(UiElementName name, + UiElementName webvr_name, + const gfx::VectorIcon& icon, + int resource_string, + int background_resource_string, + int potential_resource_string, + bool CapturingStateModel::*signal, + bool CapturingStateModel::*background_signal, + bool CapturingStateModel::*potential_signal, + bool is_url) + : name(name), + webvr_name(webvr_name), + icon(icon), + resource_string(resource_string), + background_resource_string(background_resource_string), + potential_resource_string(potential_resource_string), + signal(signal), + background_signal(background_signal), + potential_signal(potential_signal), + is_url(is_url) {} + +IndicatorSpec::IndicatorSpec(const IndicatorSpec& other) + : name(other.name), + webvr_name(other.webvr_name), + icon(other.icon), + resource_string(other.resource_string), + background_resource_string(other.background_resource_string), + potential_resource_string(other.potential_resource_string), + signal(other.signal), + background_signal(other.background_signal), + potential_signal(other.potential_signal), + is_url(other.is_url) {} + +IndicatorSpec::~IndicatorSpec() {} + // clang-format off std::vector<IndicatorSpec> GetIndicatorSpecs() { @@ -16,37 +51,53 @@ {kLocationAccessIndicator, kWebVrLocationAccessIndicator, kMyLocationIcon, IDS_VR_SHELL_SITE_IS_TRACKING_LOCATION, + // Background tabs cannot track high accuracy location. + 0, IDS_VR_SHELL_SITE_CAN_TRACK_LOCATION, &CapturingStateModel::location_access_enabled, - &CapturingStateModel::location_access_potentially_enabled}, + &CapturingStateModel::background_location_access_enabled, + &CapturingStateModel::location_access_potentially_enabled, + false}, {kAudioCaptureIndicator, kWebVrAudioCaptureIndicator, vector_icons::kMicIcon, IDS_VR_SHELL_SITE_IS_USING_MICROPHONE, + IDS_VR_SHELL_BG_IS_USING_MICROPHONE, IDS_VR_SHELL_SITE_CAN_USE_MICROPHONE, &CapturingStateModel::audio_capture_enabled, - &CapturingStateModel::audio_capture_potentially_enabled}, + &CapturingStateModel::background_audio_capture_enabled, + &CapturingStateModel::audio_capture_potentially_enabled, + false}, {kVideoCaptureIndicator, kWebVrVideoCaptureIndicator, vector_icons::kVideocamIcon, IDS_VR_SHELL_SITE_IS_USING_CAMERA, + IDS_VR_SHELL_BG_IS_USING_CAMERA, IDS_VR_SHELL_SITE_CAN_USE_CAMERA, &CapturingStateModel::video_capture_enabled, - &CapturingStateModel::video_capture_potentially_enabled}, + &CapturingStateModel::background_video_capture_enabled, + &CapturingStateModel::video_capture_potentially_enabled, + false}, {kBluetoothConnectedIndicator, kWebVrBluetoothConnectedIndicator, vector_icons::kBluetoothConnectedIcon, IDS_VR_SHELL_SITE_IS_USING_BLUETOOTH, + IDS_VR_SHELL_BG_IS_USING_BLUETOOTH, IDS_VR_SHELL_SITE_CAN_USE_BLUETOOTH, &CapturingStateModel::bluetooth_connected, - &CapturingStateModel::bluetooth_potentially_connected}, + &CapturingStateModel::background_bluetooth_connected, + &CapturingStateModel::bluetooth_potentially_connected, + false}, {kScreenCaptureIndicator, kWebVrScreenCaptureIndicator, vector_icons::kScreenShareIcon, IDS_VR_SHELL_SITE_IS_SHARING_SCREEN, + IDS_VR_SHELL_BG_IS_SHARING_SCREEN, IDS_VR_SHELL_SITE_CAN_SHARE_SCREEN, &CapturingStateModel::screen_capture_enabled, - &CapturingStateModel::screen_capture_potentially_enabled}}; + &CapturingStateModel::background_screen_capture_enabled, + &CapturingStateModel::screen_capture_potentially_enabled, + false}}; return specs; }
diff --git a/chrome/browser/vr/elements/indicator_spec.h b/chrome/browser/vr/elements/indicator_spec.h index a6dcd078..ec51b49 100644 --- a/chrome/browser/vr/elements/indicator_spec.h +++ b/chrome/browser/vr/elements/indicator_spec.h
@@ -14,12 +14,27 @@ namespace vr { struct IndicatorSpec { + IndicatorSpec(UiElementName name, + UiElementName webvr_name, + const gfx::VectorIcon& icon, + int resource_string, + int background_resource_string, + int potential_resource_string, + bool CapturingStateModel::*signal, + bool CapturingStateModel::*background_signal, + bool CapturingStateModel::*potential_signal, + bool is_url); + IndicatorSpec(const IndicatorSpec& other); + ~IndicatorSpec(); + UiElementName name; UiElementName webvr_name; const gfx::VectorIcon& icon; int resource_string; + int background_resource_string; int potential_resource_string; bool CapturingStateModel::*signal; + bool CapturingStateModel::*background_signal; bool CapturingStateModel::*potential_signal; bool is_url; };
diff --git a/chrome/browser/vr/model/capturing_state_model.h b/chrome/browser/vr/model/capturing_state_model.h index ef1c6f5c..1ef64394 100644 --- a/chrome/browser/vr/model/capturing_state_model.h +++ b/chrome/browser/vr/model/capturing_state_model.h
@@ -18,6 +18,12 @@ bool location_access_enabled = false; bool bluetooth_connected = false; + bool background_audio_capture_enabled = false; + bool background_video_capture_enabled = false; + bool background_screen_capture_enabled = false; + bool background_location_access_enabled = false; + bool background_bluetooth_connected = false; + bool audio_capture_potentially_enabled = false; bool video_capture_potentially_enabled = false; bool screen_capture_potentially_enabled = false;
diff --git a/chrome/browser/vr/model/model.cc b/chrome/browser/vr/model/model.cc index b699211e..4462b54 100644 --- a/chrome/browser/vr/model/model.cc +++ b/chrome/browser/vr/model/model.cc
@@ -26,9 +26,8 @@ } // namespace -Model::Model() {} - -Model::~Model() {} +Model::Model() = default; +Model::~Model() = default; const ColorScheme& Model::color_scheme() const { ColorScheme::Mode mode = ColorScheme::kModeNormal;
diff --git a/chrome/browser/vr/testapp/vr_test_context.cc b/chrome/browser/vr/testapp/vr_test_context.cc index 8d78f11..eef5e40 100644 --- a/chrome/browser/vr/testapp/vr_test_context.cc +++ b/chrome/browser/vr/testapp/vr_test_context.cc
@@ -111,8 +111,8 @@ ui_->SetLoading(true); ui_->SetLoadProgress(0.4); CapturingStateModel capturing_state; - capturing_state.video_capture_enabled = true; - capturing_state.screen_capture_enabled = true; + capturing_state.video_capture_potentially_enabled = true; + capturing_state.background_screen_capture_enabled = true; capturing_state.bluetooth_connected = true; capturing_state.location_access_enabled = true; ui_->SetCapturingState(capturing_state);
diff --git a/chrome/browser/vr/ui_scene_creator.cc b/chrome/browser/vr/ui_scene_creator.cc index fbe7e81..2d87f84 100644 --- a/chrome/browser/vr/ui_scene_creator.cc +++ b/chrome/browser/vr/ui_scene_creator.cc
@@ -578,6 +578,29 @@ return handlers; } +void BindIndicatorText(Model* model, Text* text, const IndicatorSpec& spec) { + text->AddBinding(std::make_unique<Binding<std::pair<bool, bool>>>( + VR_BIND_LAMBDA( + [](Model* model, bool CapturingStateModel::*signal, + bool CapturingStateModel::*background_signal) { + return std::make_pair(model->capturing_state.*signal, + model->capturing_state.*background_signal); + }, + base::Unretained(model), spec.signal, spec.background_signal), + VR_BIND_LAMBDA( + [](Text* view, int resource, int background_resource, + int potential_resource, const std::pair<bool, bool>& value) { + if (value.first) + view->SetText(l10n_util::GetStringUTF16(resource)); + else if (value.second) + view->SetText(l10n_util::GetStringUTF16(background_resource)); + else + view->SetText(l10n_util::GetStringUTF16(potential_resource)); + }, + base::Unretained(text), spec.resource_string, + spec.background_resource_string, spec.potential_resource_string))); +} + std::unique_ptr<UiElement> CreateWebVrIndicator(Model* model, UiBrowserInterface* browser, IndicatorSpec spec) { @@ -630,24 +653,10 @@ text_element->SetAlignment(UiTexture::kTextAlignmentLeft); text_element->SetColor(SK_ColorWHITE); text_element->SetSize(kWebVrPermissionTextWidth, 0.0f); - if (spec.signal) { - text_element->AddBinding(std::make_unique<Binding<bool>>( - VR_BIND_LAMBDA( - [](Model* model, bool CapturingStateModel::*signal) { - return model->capturing_state.*signal; - }, - base::Unretained(model), spec.signal), - VR_BIND_LAMBDA( - [](Text* view, int resource, int potential_resource, - const bool& value) { - view->SetText(l10n_util::GetStringUTF16( - value ? resource : potential_resource)); - }, - base::Unretained(text_element.get()), spec.resource_string, - spec.potential_resource_string))); - } else { + if (spec.signal) + BindIndicatorText(model, text_element.get(), spec); + else text_element->SetText(l10n_util::GetStringUTF16(spec.resource_string)); - } VR_BIND_COLOR(model, text_element.get(), &ColorScheme::webvr_permission_foreground, &Text::SetColor); description_element = std::move(text_element); @@ -977,10 +986,12 @@ element->set_hover_offset(0.0f); element->AddBinding(std::make_unique<Binding<bool>>( VR_BIND_LAMBDA( - [](Model* model, bool CapturingStateModel::*signal) { - return model->capturing_state.*signal; + [](Model* model, bool CapturingStateModel::*signal, + bool CapturingStateModel::*background_signal) { + return model->capturing_state.*signal || + model->capturing_state.*background_signal; }, - base::Unretained(model_), spec.signal), + base::Unretained(model_), spec.signal, spec.background_signal), VR_BIND_LAMBDA( [](UiElement* view, const bool& value) { view->SetVisible(value); @@ -1033,20 +1044,7 @@ text_element->set_owner_name_for_test(element->name()); text_element->SetSize(0.0f, kWebVrPermissionFontHeight); text_element->SetType(kTypeLabel); - text_element->AddBinding(std::make_unique<Binding<bool>>( - VR_BIND_LAMBDA( - [](Model* model, bool CapturingStateModel::*signal) { - return model->capturing_state.*signal; - }, - base::Unretained(model_), spec.signal), - VR_BIND_LAMBDA( - [](Text* view, int resource, int potential_resource, - const bool& value) { - view->SetText(l10n_util::GetStringUTF16( - value ? resource : potential_resource)); - }, - base::Unretained(text_element.get()), spec.resource_string, - spec.potential_resource_string))); + BindIndicatorText(model_, text_element.get(), spec); VR_BIND_COLOR(model_, text_element.get(), &ColorScheme::webvr_permission_foreground, &Text::SetColor); @@ -2728,19 +2726,26 @@ kRemoveCircleOutlineIcon, IDS_PRESS_APP_TO_EXIT, 0, + 0, + nullptr, nullptr, nullptr, false}; indicators->AddChild(CreateWebVrIndicator(model_, browser_, app_button_spec)); - IndicatorSpec url_indicator_spec = { - kNone, kWebVrUrlToast, toolbar::kHttpsInvalidIcon, 0, 0, nullptr, nullptr, - true}; + IndicatorSpec url_indicator_spec = {kNone, + kWebVrUrlToast, + toolbar::kHttpsInvalidIcon, + 0, + 0, + 0, + nullptr, + nullptr, + nullptr, + true}; indicators->AddChild( CreateWebVrIndicator(model_, browser_, url_indicator_spec)); - // TODO(crbug.com/824472): add an indicator for the transient URL toast. - auto specs = GetIndicatorSpecs(); for (const auto& spec : specs) { indicators->AddChild(CreateWebVrIndicator(model_, browser_, spec)); @@ -2790,7 +2795,8 @@ SetVisibleInLayout( scene->GetUiElementByName(spec.webvr_name), model->capturing_state.*spec.signal || - model->capturing_state.*spec.potential_signal); + model->capturing_state.*spec.potential_signal || + model->capturing_state.*spec.background_signal); } e->RemoveKeyframeModels(TRANSFORM);
diff --git a/chrome/browser/vr/ui_unittest.cc b/chrome/browser/vr/ui_unittest.cc index add869e..e33ea0921 100644 --- a/chrome/browser/vr/ui_unittest.cc +++ b/chrome/browser/vr/ui_unittest.cc
@@ -185,12 +185,15 @@ EXPECT_FALSE(IsVisible(kExclusiveScreenToast)); for (auto& spec : GetIndicatorSpecs()) { - for (int i = 0; i < 2; ++i) { + for (int i = 0; i < 3; ++i) { ui_->SetWebVrMode(true, true); ui_->OnWebVrFrameAvailable(); CapturingStateModel state; state.*spec.signal = i == 0; + // High accuracy location cannot be used in a background tab. + state.*spec.background_signal = + i == 1 && spec.name != kLocationAccessIndicator; state.*spec.potential_signal = true; ui_->SetCapturingState(state);
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index a879d910..0ba33fc 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -574,10 +574,6 @@ const base::Feature kTopSitesFromSiteEngagement{ "TopSitesFromSiteEngagement", base::FEATURE_DISABLED_BY_DEFAULT}; -// Improved and unified consent for privacy-related features. -const base::Feature kUnifiedConsent{"UnifiedConsent", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Enables using the local NTP if Google is the default search engine. const base::Feature kUseGoogleLocalNtp{"UseGoogleLocalNtp", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 376e8c6..bba233c 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -314,8 +314,6 @@ extern const base::Feature kTopSitesFromSiteEngagement; -extern const base::Feature kUnifiedConsent; - extern const base::Feature kUseGoogleLocalNtp; #if defined(OS_CHROMEOS)
diff --git a/chrome/common/profiling/profiling_client.cc b/chrome/common/profiling/profiling_client.cc index 63c9c7b..83c06875 100644 --- a/chrome/common/profiling/profiling_client.cc +++ b/chrome/common/profiling/profiling_client.cc
@@ -4,8 +4,10 @@ #include "chrome/common/profiling/profiling_client.h" +#include "base/allocator/allocator_interception_mac.h" #include "base/files/platform_file.h" #include "base/trace_event/malloc_dump_provider.h" +#include "build/build_config.h" #include "chrome/common/profiling/memlog_allocator_shim.h" #include "chrome/common/profiling/memlog_sender_pipe.h" #include "chrome/common/profiling/memlog_stream.h" @@ -72,6 +74,14 @@ } base::trace_event::MallocDumpProvider::GetInstance()->DisableMetrics(); + +#if defined(OS_MACOSX) + // On macOS, this call is necessary to shim malloc zones that were created + // after startup. This cannot be done during shim initialization because the + // task scheduler has not yet been initialized. + base::allocator::PeriodicallyShimNewMallocZones(); +#endif + InitAllocatorShim(memlog_sender_pipe_.get(), std::move(params)); }
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index a57bdae8..46ce8118 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -122,6 +122,8 @@ 'MobileEmulationCapabilityTest.testTapElement', # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1945 'ChromeDriverTest.testWindowFullScreen', + # crbug.com/827171 + 'ChromeDriverTest.testWindowMinimize', ] _DESKTOP_NEGATIVE_FILTER = [
diff --git a/chrome/test/data/webui/signin_browsertest.cc b/chrome/test/data/webui/signin_browsertest.cc index 2df22391..785fa0b 100644 --- a/chrome/test/data/webui/signin_browsertest.cc +++ b/chrome/test/data/webui/signin_browsertest.cc
@@ -20,5 +20,5 @@ void SigninBrowserTest::EnableUnity() { EnableDice(); - scoped_feature_list_.InitAndEnableFeature(features::kUnifiedConsent); + scoped_feature_list_.InitAndEnableFeature(signin::kUnifiedConsent); }
diff --git a/chromecast/media/base/decrypt_context_impl.cc b/chromecast/media/base/decrypt_context_impl.cc index 2451446..7a33443 100644 --- a/chromecast/media/base/decrypt_context_impl.cc +++ b/chromecast/media/base/decrypt_context_impl.cc
@@ -32,11 +32,11 @@ } bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer, - uint8_t* output, + uint8_t* opaque_handle, size_t data_offset) { bool called = false; bool success = false; - DecryptAsync(buffer, output, data_offset, + DecryptAsync(buffer, opaque_handle, data_offset, false /* clear_output */, base::BindOnce(&BufferDecryptCB, &called, &success)); CHECK(called) << "Sync Decrypt isn't supported"; @@ -44,8 +44,9 @@ } void DecryptContextImpl::DecryptAsync(CastDecoderBuffer* buffer, - uint8_t* output, + uint8_t* output_or_handle, size_t data_offset, + bool clear_output, DecryptCB decrypt_cb) { std::move(decrypt_cb).Run(false); }
diff --git a/chromecast/media/base/decrypt_context_impl.h b/chromecast/media/base/decrypt_context_impl.h index c1ffa3a..7ba5896 100644 --- a/chromecast/media/base/decrypt_context_impl.h +++ b/chromecast/media/base/decrypt_context_impl.h
@@ -11,6 +11,7 @@ #include <memory> #include "base/callback.h" +#include "base/macros.h" #include "chromecast/public/media/cast_key_system.h" #include "chromecast/public/media/decrypt_context.h" @@ -37,16 +38,20 @@ ~DecryptContextImpl() override; // DecryptContext implementation: - CastKeySystem GetKeySystem() override; + CastKeySystem GetKeySystem() final; bool Decrypt(CastDecoderBuffer* buffer, - uint8_t* output, - size_t data_offset) override; + uint8_t* opaque_handle, + size_t data_offset) final; // Similar as the above one. Decryption success or not will be returned in - // |decrypt_cb|. |decrypt_cb| will be called on caller's thread. + // |decrypt_cb|. |output_or_handle| is a pointer to the normal memory, if + // |clear_output| is true. Otherwise, it's an opaque handle to the secure + // memory which is only accessible in TEE. |decrypt_cb| will be called on + // caller's thread. virtual void DecryptAsync(CastDecoderBuffer* buffer, - uint8_t* output, + uint8_t* output_or_handle, size_t data_offset, + bool clear_output, DecryptCB decrypt_cb); // Returns the type of output buffer. @@ -55,10 +60,7 @@ private: CastKeySystem key_system_; - // TODO(smcgruer): Restore macro usage next public API release. - // DISALLOW_COPY_AND_ASSIGN(DecryptContextImpl); - DecryptContextImpl(const DecryptContextImpl&) = delete; - void operator=(const DecryptContextImpl&) = delete; + DISALLOW_COPY_AND_ASSIGN(DecryptContextImpl); }; } // namespace media
diff --git a/chromecast/media/base/decrypt_context_impl_clearkey.cc b/chromecast/media/base/decrypt_context_impl_clearkey.cc index 241743c..eb692fcd 100644 --- a/chromecast/media/base/decrypt_context_impl_clearkey.cc +++ b/chromecast/media/base/decrypt_context_impl_clearkey.cc
@@ -30,7 +30,9 @@ void DecryptContextImplClearKey::DecryptAsync(CastDecoderBuffer* buffer, uint8_t* output, size_t data_offset, + bool clear_output, DecryptCB decrypt_cb) { + DCHECK(clear_output); std::move(decrypt_cb).Run(DoDecrypt(buffer, output, data_offset)); }
diff --git a/chromecast/media/base/decrypt_context_impl_clearkey.h b/chromecast/media/base/decrypt_context_impl_clearkey.h index b2e1c7c..682415a3 100644 --- a/chromecast/media/base/decrypt_context_impl_clearkey.h +++ b/chromecast/media/base/decrypt_context_impl_clearkey.h
@@ -29,6 +29,7 @@ void DecryptAsync(CastDecoderBuffer* buffer, uint8_t* output, size_t data_offset, + bool clear_output, DecryptCB decrypt_cb) override; OutputType GetOutputType() const override;
diff --git a/chromecast/media/cma/pipeline/decrypt_util.cc b/chromecast/media/cma/pipeline/decrypt_util.cc index c72ed59..c2b1b3c 100644 --- a/chromecast/media/cma/pipeline/decrypt_util.cc +++ b/chromecast/media/cma/pipeline/decrypt_util.cc
@@ -75,7 +75,8 @@ void DecryptDecoderBuffer(scoped_refptr<DecoderBufferBase> buffer, DecryptContextImpl* decrypt_ctxt, BufferDecryptedCB buffer_decrypted_cb) { - decrypt_ctxt->DecryptAsync(buffer.get(), buffer->writable_data(), 0, + decrypt_ctxt->DecryptAsync(buffer.get(), buffer->writable_data(), + 0 /* data_offset */, true /* clear_output */, base::BindOnce(&OnBufferDecrypted, buffer, std::move(buffer_decrypted_cb))); }
diff --git a/chromecast/public/media/decrypt_context.h b/chromecast/public/media/decrypt_context.h index 0d152817..02ade39 100644 --- a/chromecast/public/media/decrypt_context.h +++ b/chromecast/public/media/decrypt_context.h
@@ -24,13 +24,16 @@ // Decrypts the given buffer. Returns true/false for success/failure. // - // The decrypted data will be of size |buffer.data_size()| and there must be - // enough space in |output| to store that data. + // |opaque_handle| is a handle to the secure memory, which is only accessible + // by TEE. // - // If non-zero, |data_offset| specifies an offset to be applied to |output| - // before the decrypted data is written. + // The decrypted data will be of size |buffer.data_size()| and there must be + // enough space in |opaque_handle| to store that data. + // + // If non-zero, |data_offset| specifies an offset to be applied to + // |opaque_handle| before the decrypted data is written. virtual bool Decrypt(CastDecoderBuffer* buffer, - uint8_t* output, + uint8_t* opaque_handle, size_t data_offset) = 0; };
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc index 0215f5a..5cbc898 100644 --- a/chromeos/dbus/fake_session_manager_client.cc +++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -14,13 +14,14 @@ #include "base/location.h" #include "base/numerics/safe_conversions.h" #include "base/path_service.h" -#include "base/single_thread_task_runner.h" +#include "base/sequenced_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/chromeos_paths.h" #include "chromeos/dbus/cryptohome_client.h" +#include "chromeos/dbus/login_manager/policy_descriptor.pb.h" #include "components/policy/proto/device_management_backend.pb.h" #include "crypto/sha2.h" @@ -35,6 +36,8 @@ constexpr char kStubDevicePolicyFile[] = "stub_device_policy"; constexpr char kStubPolicyFile[] = "stub_policy"; constexpr char kStubStateKeysFile[] = "stub_state_keys"; +constexpr char kStubPolicyKey[] = "policy.pub"; +constexpr char kEmptyAccountId[] = ""; // Store the owner key in a file on the disk, so that it can be loaded by // DeviceSettingsService and used e.g. for validating policy signatures in the @@ -67,26 +70,6 @@ return result; } -// Helper to notify the callback with SUCCESS, to be used by the stub. -void NotifyOnRetrievePolicySuccess( - SessionManagerClient::RetrievePolicyCallback callback, - const std::string& protobuf) { - std::move(callback).Run(RetrievePolicyResponseType::SUCCESS, protobuf); -} - -// Returns a location for |file| that is specific to the given |cryptohome_id|. -// These paths will be relative to DIR_USER_POLICY_KEYS, and can be used only -// to store stub files. -base::FilePath GetUserFilePath(const cryptohome::Identification& cryptohome_id, - const std::string& file) { - base::FilePath keys_path; - if (!PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &keys_path)) - return base::FilePath(); - const std::string sanitized = - CryptohomeClient::GetStubSanitizedUsername(cryptohome_id); - return keys_path.AppendASCII(sanitized).AppendASCII(file); -} - // Helper to write a file in a background thread. void StoreFile(const base::FilePath& path, const std::string& data) { if (path.empty() || !base::CreateDirectory(path.DirName())) { @@ -98,15 +81,15 @@ LOG(WARNING) << "Failed to write to " << path.value(); } -// Helper to write policy owner key and policy blob in a background thread. -void StorePolicyWithKey( - const enterprise_management::PolicyFetchResponse& policy, - const std::string& policy_blob, - const base::FilePath& owner_key_path, - const base::FilePath& policy_path) { - if (policy.has_new_public_key()) - StoreFile(owner_key_path, policy.new_public_key()); - StoreFile(policy_path, policy_blob); +// Creates a PolicyDescriptor object to store/retrieve Chrome policy. +login_manager::PolicyDescriptor MakeChromePolicyDescriptor( + login_manager::PolicyAccountType account_type, + const std::string& account_id) { + login_manager::PolicyDescriptor descriptor; + descriptor.set_account_type(account_type); + descriptor.set_account_id(account_id); + descriptor.set_domain(login_manager::POLICY_DOMAIN_CHROME); + return descriptor; } // Helper to asynchronously read (or if missing create) state key stubs. @@ -130,6 +113,96 @@ return state_keys; } +// Gets the stub file paths of the policy blob and optionally the policy key +// (|key_path|) for the given |descriptor|. |key_path| can be nullptr. Returns +// an empty file path on error. +base::FilePath GetStubPolicyFilePath( + const login_manager::PolicyDescriptor& descriptor, + base::FilePath* key_path) { + if (key_path) + key_path->clear(); + + switch (descriptor.account_type()) { + case login_manager::ACCOUNT_TYPE_DEVICE: { + base::FilePath owner_key_path; + if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) + return base::FilePath(); + if (key_path) + *key_path = owner_key_path; + return owner_key_path.DirName().AppendASCII(kStubDevicePolicyFile); + } + + case login_manager::ACCOUNT_TYPE_USER: + case login_manager::ACCOUNT_TYPE_SESSIONLESS_USER: + case login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT: { + base::FilePath base_path; + if (!PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &base_path)) + return base::FilePath(); + cryptohome::Identification cryptohome_id = + cryptohome::Identification::FromString(descriptor.account_id()); + const std::string sanitized_id = + CryptohomeClient::GetStubSanitizedUsername(cryptohome_id); + base_path = base_path.AppendASCII(sanitized_id); + if (key_path) + *key_path = base_path.AppendASCII(kStubPolicyKey); + return base_path.AppendASCII(kStubPolicyFile); + } + } +} + +// Blocking stub call to retrieve policy from disk. Returns empty string on +// error. +std::string StubBlockingRetrievePolicy( + const login_manager::PolicyDescriptor& descriptor) { + base::FilePath policy_path = GetStubPolicyFilePath(descriptor, nullptr); + if (policy_path.empty()) + return std::string(); + return GetFileContent(policy_path); +} + +// Non-blocking stub call to retrieve policy from disk. +void StubCallRetrievePolicy( + const login_manager::PolicyDescriptor& descriptor, + SessionManagerClient::RetrievePolicyCallback callback) { + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, + {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + base::BindOnce(&StubBlockingRetrievePolicy, descriptor), + base::BindOnce(std::move(callback), RetrievePolicyResponseType::SUCCESS)); +} + +// Stub call to store policy on disk. +void StubCallStorePolicy(const login_manager::PolicyDescriptor& descriptor, + const std::string& policy_blob, + VoidDBusMethodCallback callback) { + // Decode the blob (to get the new key) and get file paths. + enterprise_management::PolicyFetchResponse response; + base::FilePath key_path; + base::FilePath policy_path = GetStubPolicyFilePath(descriptor, &key_path); + if (policy_path.empty() || !response.ParseFromString(policy_blob)) { + std::move(callback).Run(false); + return; + } + + // Make sure both key (if present) and policy get written before signalling + // completion since Chrome will attempt to retrieve the device policy right + // after storing during enrollment. + scoped_refptr<base::SequencedTaskRunner> task_runner = + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}); + + // Rotate key if there's a new one. + if (response.has_new_public_key()) { + task_runner->PostTask(FROM_HERE, base::BindOnce(&StoreFile, key_path, + response.new_public_key())); + } + + // Write policy and signal completion. + task_runner->PostTaskAndReply( + FROM_HERE, base::BindOnce(&StoreFile, policy_path, policy_blob), + base::BindOnce(std::move(callback), true)); +} + } // namespace FakeSessionManagerClient::FakeSessionManagerClient(uint32_t options) @@ -148,8 +221,7 @@ FakeSessionManagerClient::~FakeSessionManagerClient() = default; -void FakeSessionManagerClient::Init(dbus::Bus* bus) { -} +void FakeSessionManagerClient::Init(dbus::Bus* bus) {} void FakeSessionManagerClient::SetStubDelegate(StubDelegate* delegate) { delegate_ = delegate; @@ -190,14 +262,11 @@ user_sessions_[cryptohome_id] = user_id_hash; } -void FakeSessionManagerClient::StopSession() { -} +void FakeSessionManagerClient::StopSession() {} -void FakeSessionManagerClient::NotifySupervisedUserCreationStarted() { -} +void FakeSessionManagerClient::NotifySupervisedUserCreationStarted() {} -void FakeSessionManagerClient::NotifySupervisedUserCreationFinished() { -} +void FakeSessionManagerClient::NotifySupervisedUserCreationFinished() {} void FakeSessionManagerClient::StartDeviceWipe() { start_device_wipe_call_count_++; @@ -231,21 +300,9 @@ void FakeSessionManagerClient::RetrieveDevicePolicy( RetrievePolicyCallback callback) { if (options_ & USE_HOST_POLICY) { - base::FilePath owner_key_path; - if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), - RetrievePolicyResponseType::SUCCESS, std::string())); - return; - } - base::FilePath device_policy_path = - owner_key_path.DirName().AppendASCII(kStubDevicePolicyFile); - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&GetFileContent, device_policy_path), - base::BindOnce(&NotifyOnRetrievePolicySuccess, std::move(callback))); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); + StubCallRetrievePolicy(descriptor, std::move(callback)); } else { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -258,31 +315,22 @@ FakeSessionManagerClient::BlockingRetrieveDevicePolicy( std::string* policy_out) { if (options_ & USE_HOST_POLICY) { - base::FilePath owner_key_path; - if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) { - *policy_out = ""; - return RetrievePolicyResponseType::SUCCESS; - } - base::FilePath device_policy_path = - owner_key_path.DirName().AppendASCII(kStubDevicePolicyFile); - *policy_out = GetFileContent(device_policy_path); - return RetrievePolicyResponseType::SUCCESS; + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); + *policy_out = StubBlockingRetrievePolicy(descriptor); } else { *policy_out = device_policy_; - return RetrievePolicyResponseType::SUCCESS; } + return RetrievePolicyResponseType::SUCCESS; } void FakeSessionManagerClient::RetrievePolicyForUser( const cryptohome::Identification& cryptohome_id, RetrievePolicyCallback callback) { if (options_ & USE_HOST_POLICY) { - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&GetFileContent, - GetUserFilePath(cryptohome_id, kStubPolicyFile)), - base::BindOnce(&NotifyOnRetrievePolicySuccess, std::move(callback))); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); + StubCallRetrievePolicy(descriptor, std::move(callback)); } else { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -296,8 +344,9 @@ const cryptohome::Identification& cryptohome_id, std::string* policy_out) { if (options_ & USE_HOST_POLICY) { - *policy_out = - GetFileContent(GetUserFilePath(cryptohome_id, kStubPolicyFile)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); + *policy_out = StubBlockingRetrievePolicy(descriptor); } else { *policy_out = user_policies_[cryptohome_id]; } @@ -308,7 +357,9 @@ const cryptohome::Identification& cryptohome_id, RetrievePolicyCallback callback) { if (options_ & USE_HOST_POLICY) { - RetrievePolicyForUser(cryptohome_id, std::move(callback)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_SESSIONLESS_USER, cryptohome_id.id()); + StubCallRetrievePolicy(descriptor, std::move(callback)); } else { auto iter = user_policies_without_session_.find(cryptohome_id); auto task = @@ -326,8 +377,9 @@ const std::string& account_id, RetrievePolicyCallback callback) { if (options_ & USE_HOST_POLICY) { - RetrievePolicyForUser(cryptohome::Identification::FromString(account_id), - std::move(callback)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT, account_id); + StubCallRetrievePolicy(descriptor, std::move(callback)); } else { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -343,39 +395,21 @@ if (options_ & USE_HOST_POLICY) { return BlockingRetrievePolicyForUser( cryptohome::Identification::FromString(account_id), policy_out); + } else { + *policy_out = device_local_account_policy_[account_id]; + return RetrievePolicyResponseType::SUCCESS; } - *policy_out = device_local_account_policy_[account_id]; - return RetrievePolicyResponseType::SUCCESS; } void FakeSessionManagerClient::StoreDevicePolicy( const std::string& policy_blob, VoidDBusMethodCallback callback) { - enterprise_management::PolicyFetchResponse policy; - if (options_ & USE_HOST_POLICY) { - base::FilePath owner_key_path; - if (!policy.ParseFromString(policy_blob) || - !PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), false /* success */)); - return; - } - - // Chrome will attempt to retrieve the device policy right after storing - // during enrollment, so make sure it's written before signaling - // completion. - // Note also that the owner key will be written before the device policy, - // if it was present in the blob. - base::FilePath device_policy_path = - owner_key_path.DirName().AppendASCII(kStubDevicePolicyFile); - base::PostTaskWithTraitsAndReply( - FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&StorePolicyWithKey, policy, policy_blob, owner_key_path, - device_policy_path), - base::BindOnce(std::move(callback), true)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); + StubCallStorePolicy(descriptor, policy_blob, std::move(callback)); } else { + enterprise_management::PolicyFetchResponse policy; if (!policy.ParseFromString(policy_blob)) { LOG(ERROR) << "Unable to parse policy protobuf"; base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -410,27 +444,9 @@ const std::string& policy_blob, VoidDBusMethodCallback callback) { if (options_ & USE_HOST_POLICY) { - // The session manager writes the user policy key to a well-known - // location. Do the same with the stub impl, so that user policy works and - // can be tested on desktop builds. - enterprise_management::PolicyFetchResponse response; - if (!response.ParseFromString(policy_blob)) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), false /* success */)); - return; - } - - // This file isn't read directly by Chrome, but is used by this class to - // reload the user policy across restarts. - base::FilePath stub_policy_path = - GetUserFilePath(cryptohome_id, kStubPolicyFile); - base::FilePath key_path = GetUserFilePath(cryptohome_id, "policy.pub"); - base::PostTaskWithTraitsAndReply( - FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&StorePolicyWithKey, response, policy_blob, key_path, - stub_policy_path), - base::BindOnce(std::move(callback), true)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); + StubCallStorePolicy(descriptor, policy_blob, std::move(callback)); } else { bool result = false; if (store_user_policy_success_) { @@ -447,8 +463,9 @@ const std::string& policy_blob, VoidDBusMethodCallback callback) { if (options_ & USE_HOST_POLICY) { - StorePolicyForUser(cryptohome::Identification::FromString(account_id), - policy_blob, std::move(callback)); + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( + login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT, account_id); + StubCallStorePolicy(descriptor, policy_blob, std::move(callback)); } else { device_local_account_policy_[account_id] = policy_blob; base::ThreadTaskRunnerHandle::Get()->PostTask(
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc index 5a402004..12804739 100644 --- a/chromeos/dbus/session_manager_client.cc +++ b/chromeos/dbus/session_manager_client.cc
@@ -42,7 +42,6 @@ using RetrievePolicyResponseType = SessionManagerClient::RetrievePolicyResponseType; -using login_manager::PolicyDescriptor; constexpr char kEmptyAccountId[] = ""; @@ -89,10 +88,11 @@ } } -PolicyDescriptor MakePolicyDescriptor( +// Creates a PolicyDescriptor object to store/retrieve Chrome policy. +login_manager::PolicyDescriptor MakeChromePolicyDescriptor( login_manager::PolicyAccountType account_type, const std::string& account_id) { - PolicyDescriptor descriptor; + login_manager::PolicyDescriptor descriptor; descriptor.set_account_type(account_type); descriptor.set_account_id(account_id); descriptor.set_domain(login_manager::POLICY_DOMAIN_CHROME); @@ -263,21 +263,21 @@ } void RetrieveDevicePolicy(RetrievePolicyCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); CallRetrievePolicy(descriptor, std::move(callback)); } RetrievePolicyResponseType BlockingRetrieveDevicePolicy( std::string* policy_out) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); return BlockingRetrievePolicy(descriptor, policy_out); } void RetrievePolicyForUser(const cryptohome::Identification& cryptohome_id, RetrievePolicyCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); CallRetrievePolicy(descriptor, std::move(callback)); } @@ -285,7 +285,7 @@ RetrievePolicyResponseType BlockingRetrievePolicyForUser( const cryptohome::Identification& cryptohome_id, std::string* policy_out) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); return BlockingRetrievePolicy(descriptor, policy_out); } @@ -293,7 +293,7 @@ void RetrievePolicyForUserWithoutSession( const cryptohome::Identification& cryptohome_id, RetrievePolicyCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_SESSIONLESS_USER, cryptohome_id.id()); CallRetrievePolicy(descriptor, std::move(callback)); } @@ -301,7 +301,7 @@ void RetrieveDeviceLocalAccountPolicy( const std::string& account_name, RetrievePolicyCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT, account_name); CallRetrievePolicy(descriptor, std::move(callback)); } @@ -309,14 +309,14 @@ RetrievePolicyResponseType BlockingRetrieveDeviceLocalAccountPolicy( const std::string& account_name, std::string* policy_out) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT, account_name); return BlockingRetrievePolicy(descriptor, policy_out); } void StoreDevicePolicy(const std::string& policy_blob, VoidDBusMethodCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId); CallStorePolicy(descriptor, policy_blob, std::move(callback)); } @@ -324,7 +324,7 @@ void StorePolicyForUser(const cryptohome::Identification& cryptohome_id, const std::string& policy_blob, VoidDBusMethodCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_USER, cryptohome_id.id()); CallStorePolicy(descriptor, policy_blob, std::move(callback)); } @@ -332,7 +332,7 @@ void StoreDeviceLocalAccountPolicy(const std::string& account_name, const std::string& policy_blob, VoidDBusMethodCallback callback) override { - PolicyDescriptor descriptor = MakePolicyDescriptor( + login_manager::PolicyDescriptor descriptor = MakeChromePolicyDescriptor( login_manager::ACCOUNT_TYPE_DEVICE_LOCAL_ACCOUNT, account_name); CallStorePolicy(descriptor, policy_blob, std::move(callback)); } @@ -506,7 +506,7 @@ } // Non-blocking call to Session Manager to retrieve policy. - void CallRetrievePolicy(const PolicyDescriptor& descriptor, + void CallRetrievePolicy(const login_manager::PolicyDescriptor& descriptor, RetrievePolicyCallback callback) { dbus::MethodCall method_call( login_manager::kSessionManagerInterface, @@ -526,7 +526,7 @@ // Blocking call to Session Manager to retrieve policy. RetrievePolicyResponseType BlockingRetrievePolicy( - const PolicyDescriptor& descriptor, + const login_manager::PolicyDescriptor& descriptor, std::string* policy_out) { dbus::MethodCall method_call( login_manager::kSessionManagerInterface, @@ -549,13 +549,13 @@ ExtractPolicyResponseString(descriptor.account_type(), response.get(), policy_out); } else { - *policy_out = ""; + policy_out->clear(); } LogPolicyResponseUma(descriptor.account_type(), result); return result; } - void CallStorePolicy(const PolicyDescriptor& descriptor, + void CallStorePolicy(const login_manager::PolicyDescriptor& descriptor, const std::string& policy_blob, VoidDBusMethodCallback callback) { dbus::MethodCall method_call(login_manager::kSessionManagerInterface, @@ -587,8 +587,8 @@ dbus::MessageReader reader(response); dbus::MessageReader array_reader(nullptr); if (!reader.PopArray(&array_reader)) { - LOG(ERROR) << method_name << " response is incorrect: " - << response->ToString(); + LOG(ERROR) << method_name + << " response is incorrect: " << response->ToString(); std::move(callback).Run(base::nullopt); return; }
diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h index b73d8ae..d88f709e0 100644 --- a/chromeos/dbus/session_manager_client.h +++ b/chromeos/dbus/session_manager_client.h
@@ -167,6 +167,10 @@ // active users. virtual void RetrieveActiveSessions(ActiveSessionsCallback callback) = 0; + // TODO(crbug.com/765644): Change the policy storage interface so that it has + // a single StorePolicy, RetrievePolicy, BlockingRetrivePolicy method that + // takes a PolicyDescriptor. + // Used for RetrieveDevicePolicy, RetrievePolicyForUser and // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as // string. Upon success, we will pass a protobuf and SUCCESS |response_type|
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.cc b/chromeos/services/assistant/assistant_manager_service_impl.cc index 2259ac4..a4d60c5 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl.cc
@@ -124,7 +124,10 @@ } void AssistantManagerServiceImpl::OnSpeechLevelUpdated( - const float speech_level) {} + const float speech_level) { + subscribers_.ForAllPtrs( + [&speech_level](auto* ptr) { ptr->OnSpeechLevelUpdated(speech_level); }); +} } // namespace assistant } // namespace chromeos
diff --git a/chromeos/services/assistant/public/mojom/assistant.mojom b/chromeos/services/assistant/public/mojom/assistant.mojom index f3532de0..39c86ebb 100644 --- a/chromeos/services/assistant/public/mojom/assistant.mojom +++ b/chromeos/services/assistant/public/mojom/assistant.mojom
@@ -22,14 +22,17 @@ // untrusted third-party content. Subscriber implementations must be sure to // handle the response data appropriately. interface AssistantEventSubscriber { - // Assistant's got Html response from server. + // Assistant got Html response from server. OnHtmlResponse(string response); - // Assistant's got text response from server. + // Assistant got text response from server. OnTextResponse(string response); - // Assistant's got open URL response from server. + // Assistant got open URL response from server. OnOpenUrlResponse(url.mojom.Url url); + + // Assistant got an instantaneous speech level update in dB. + OnSpeechLevelUpdated(float speech_level); }; // Platform connection to assistant.
diff --git a/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.cc b/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.cc index 7dc544b..4e5f05c1 100644 --- a/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.cc +++ b/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.cc
@@ -6,15 +6,15 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { FakeMultiDeviceSetupObserver::FakeMultiDeviceSetupObserver() = default; FakeMultiDeviceSetupObserver::~FakeMultiDeviceSetupObserver() = default; -multidevice_setup::mojom::MultiDeviceSetupObserverPtr +mojom::MultiDeviceSetupObserverPtr FakeMultiDeviceSetupObserver::GenerateInterfacePtr() { - multidevice_setup::mojom::MultiDeviceSetupObserverPtr interface_ptr; + mojom::MultiDeviceSetupObserverPtr interface_ptr; bindings_.AddBinding(this, mojo::MakeRequest(&interface_ptr)); return interface_ptr; } @@ -31,6 +31,6 @@ ++num_existing_user_chromebook_added_events_handled_; } -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.h b/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.h index a62b14ba..1fc2cafc 100644 --- a/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.h +++ b/chromeos/services/multidevice_setup/fake_multidevice_setup_observer.h
@@ -11,16 +11,15 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { // Fake MultiDeviceSetupObserver implementation for tests. -class FakeMultiDeviceSetupObserver - : public multidevice_setup::mojom::MultiDeviceSetupObserver { +class FakeMultiDeviceSetupObserver : public mojom::MultiDeviceSetupObserver { public: FakeMultiDeviceSetupObserver(); ~FakeMultiDeviceSetupObserver() override; - multidevice_setup::mojom::MultiDeviceSetupObserverPtr GenerateInterfacePtr(); + mojom::MultiDeviceSetupObserverPtr GenerateInterfacePtr(); size_t num_new_user_events_handled() { return num_new_user_events_handled_; } @@ -32,7 +31,7 @@ return num_existing_user_chromebook_added_events_handled_; } - // multidevice_setup::mojom::MultiDeviceSetupObserver: + // mojom::MultiDeviceSetupObserver: void OnPotentialHostExistsForNewUser() override; void OnConnectedHostSwitchedForExistingUser() override; void OnNewChromebookAddedForExistingUser() override; @@ -42,13 +41,12 @@ size_t num_existing_user_host_switched_events_handled_ = 0u; size_t num_existing_user_chromebook_added_events_handled_ = 0u; - mojo::BindingSet<multidevice_setup::mojom::MultiDeviceSetupObserver> - bindings_; + mojo::BindingSet<mojom::MultiDeviceSetupObserver> bindings_; DISALLOW_COPY_AND_ASSIGN(FakeMultiDeviceSetupObserver); }; -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/manifest.json b/chromeos/services/multidevice_setup/manifest.json index bb20ab69..c120f296 100644 --- a/chromeos/services/multidevice_setup/manifest.json +++ b/chromeos/services/multidevice_setup/manifest.json
@@ -4,7 +4,9 @@ "interface_provider_specs": { "service_manager:connector": { "provides": { - "multidevice_setup" : [ "multidevice_setup::mojom::MultiDeviceSetup" ] + "multidevice_setup" : [ + "chromeos::multidevice_setup::mojom::MultiDeviceSetup" + ] } } }
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_impl.cc b/chromeos/services/multidevice_setup/multidevice_setup_impl.cc index 5d8a5e3..d77162a6 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_impl.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_impl.cc
@@ -8,19 +8,17 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { namespace { -using EventType = multidevice_setup::mojom::EventTypeForDebugging; - -std::string EventTypeEnumToString(EventType type) { +std::string EventTypeEnumToString(mojom::EventTypeForDebugging type) { switch (type) { - case EventType::kNewUserPotentialHostExists: + case mojom::EventTypeForDebugging::kNewUserPotentialHostExists: return "kNewUserPotentialHostExists"; - case EventType::kExistingUserConnectedHostSwitched: + case mojom::EventTypeForDebugging::kExistingUserConnectedHostSwitched: return "kExistingUserConnectedHostSwitched"; - case EventType::kExistingUserNewChromebookAdded: + case mojom::EventTypeForDebugging::kExistingUserNewChromebookAdded: return "kExistingUserNewChromebookAdded"; default: NOTREACHED(); @@ -34,13 +32,12 @@ MultiDeviceSetupImpl::~MultiDeviceSetupImpl() = default; -void MultiDeviceSetupImpl::BindRequest( - multidevice_setup::mojom::MultiDeviceSetupRequest request) { +void MultiDeviceSetupImpl::BindRequest(mojom::MultiDeviceSetupRequest request) { bindings_.AddBinding(this, std::move(request)); } void MultiDeviceSetupImpl::SetObserver( - multidevice_setup::mojom::MultiDeviceSetupObserverPtr observer, + mojom::MultiDeviceSetupObserverPtr observer, SetObserverCallback callback) { if (observer_.is_bound()) { PA_LOG(ERROR) << "SetObserver() called when a MultiDeviceSetupObserver was " @@ -54,7 +51,7 @@ } void MultiDeviceSetupImpl::TriggerEventForDebugging( - EventType type, + mojom::EventTypeForDebugging type, TriggerEventForDebuggingCallback callback) { PA_LOG(INFO) << "TriggerEventForDebugging(" << EventTypeEnumToString(type) << ") called."; @@ -67,13 +64,13 @@ } switch (type) { - case EventType::kNewUserPotentialHostExists: + case mojom::EventTypeForDebugging::kNewUserPotentialHostExists: observer_->OnPotentialHostExistsForNewUser(); break; - case EventType::kExistingUserConnectedHostSwitched: + case mojom::EventTypeForDebugging::kExistingUserConnectedHostSwitched: observer_->OnConnectedHostSwitchedForExistingUser(); break; - case EventType::kExistingUserNewChromebookAdded: + case mojom::EventTypeForDebugging::kExistingUserNewChromebookAdded: observer_->OnNewChromebookAddedForExistingUser(); break; default: @@ -83,6 +80,6 @@ std::move(callback).Run(true /* success */); } -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_impl.h b/chromeos/services/multidevice_setup/multidevice_setup_impl.h index 7d4d31638..88a8898 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_impl.h +++ b/chromeos/services/multidevice_setup/multidevice_setup_impl.h
@@ -14,34 +14,33 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { // Concrete MultiDeviceSetup implementation. -class MultiDeviceSetupImpl : public multidevice_setup::mojom::MultiDeviceSetup { +class MultiDeviceSetupImpl : public mojom::MultiDeviceSetup { public: MultiDeviceSetupImpl(); ~MultiDeviceSetupImpl() override; // Binds a request to this implementation. Should be called each time that the // service receives a request. - void BindRequest(multidevice_setup::mojom::MultiDeviceSetupRequest request); + void BindRequest(mojom::MultiDeviceSetupRequest request); - // multidevice_setup::mojom::MultiDeviceSetup: - void SetObserver( - multidevice_setup::mojom::MultiDeviceSetupObserverPtr presenter, - SetObserverCallback callback) override; + // mojom::MultiDeviceSetup: + void SetObserver(mojom::MultiDeviceSetupObserverPtr presenter, + SetObserverCallback callback) override; void TriggerEventForDebugging( - multidevice_setup::mojom::EventTypeForDebugging type, + mojom::EventTypeForDebugging type, TriggerEventForDebuggingCallback callback) override; private: - multidevice_setup::mojom::MultiDeviceSetupObserverPtr observer_; - mojo::BindingSet<multidevice_setup::mojom::MultiDeviceSetup> bindings_; + mojom::MultiDeviceSetupObserverPtr observer_; + mojo::BindingSet<mojom::MultiDeviceSetup> bindings_; DISALLOW_COPY_AND_ASSIGN(MultiDeviceSetupImpl); }; -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_service.cc b/chromeos/services/multidevice_setup/multidevice_setup_service.cc index 79b80d3b..141faf83 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_service.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_service.cc
@@ -9,7 +9,7 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { MultiDeviceSetupService::MultiDeviceSetupService() : multidevice_setup_impl_(std::make_unique<MultiDeviceSetupImpl>()) {} @@ -32,10 +32,10 @@ } void MultiDeviceSetupService::BindRequest( - multidevice_setup::mojom::MultiDeviceSetupRequest request) { + mojom::MultiDeviceSetupRequest request) { multidevice_setup_impl_->BindRequest(std::move(request)); } -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_service.h b/chromeos/services/multidevice_setup/multidevice_setup_service.h index 8a1b8fb..36a39a5cc 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_service.h +++ b/chromeos/services/multidevice_setup/multidevice_setup_service.h
@@ -13,13 +13,13 @@ namespace chromeos { -namespace multidevice { +namespace multidevice_setup { class MultiDeviceSetupImpl; -// Service which provides an implementation for -// multidevice_setup::mojom::MultiDeviceSetup. This service creates one -// implementation and shares it among all connection requests. +// Service which provides an implementation for mojom::MultiDeviceSetup. This +// service creates one implementation and shares it among all connection +// requests. class MultiDeviceSetupService : public service_manager::Service { public: MultiDeviceSetupService(); @@ -32,7 +32,7 @@ const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) override; - void BindRequest(multidevice_setup::mojom::MultiDeviceSetupRequest request); + void BindRequest(mojom::MultiDeviceSetupRequest request); std::unique_ptr<MultiDeviceSetupImpl> multidevice_setup_impl_; @@ -41,7 +41,7 @@ DISALLOW_COPY_AND_ASSIGN(MultiDeviceSetupService); }; -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc b/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc index aaabf71..ff6ea4e 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc
@@ -16,9 +16,7 @@ namespace chromeos { -namespace multidevice { - -using EventType = multidevice_setup::mojom::EventTypeForDebugging; +namespace multidevice_setup { class MultiDeviceSetupServiceTest : public testing::Test { protected: @@ -33,14 +31,13 @@ std::make_unique<MultiDeviceSetupService>()); } - multidevice_setup::mojom::MultiDeviceSetup* GetMultiDeviceSetup() { + mojom::MultiDeviceSetup* GetMultiDeviceSetup() { if (!multidevice_setup_) { EXPECT_EQ(nullptr, connector_); // Create the Connector and bind it to |multidevice_setup_|. connector_ = connector_factory_->CreateConnector(); - connector_->BindInterface(multidevice_setup::mojom::kServiceName, - &multidevice_setup_); + connector_->BindInterface(mojom::kServiceName, &multidevice_setup_); // Set |fake_multidevice_setup_observer_|. CallSetObserver(); @@ -63,7 +60,7 @@ run_loop.Run(); } - void CallTriggerEventForDebugging(EventType type) { + void CallTriggerEventForDebugging(mojom::EventTypeForDebugging type) { base::RunLoop run_loop; GetMultiDeviceSetup()->TriggerEventForDebugging( type, base::BindRepeating( @@ -92,14 +89,15 @@ std::unique_ptr<FakeMultiDeviceSetupObserver> fake_multidevice_setup_observer_; - multidevice_setup::mojom::MultiDeviceSetupPtr multidevice_setup_; + mojom::MultiDeviceSetupPtr multidevice_setup_; DISALLOW_COPY_AND_ASSIGN(MultiDeviceSetupServiceTest); }; TEST_F(MultiDeviceSetupServiceTest, TriggerEventForDebugging_kNewUserPotentialHostExists) { - CallTriggerEventForDebugging(EventType::kNewUserPotentialHostExists); + CallTriggerEventForDebugging( + mojom::EventTypeForDebugging::kNewUserPotentialHostExists); EXPECT_EQ(1u, fake_multidevice_setup_observer()->num_new_user_events_handled()); @@ -107,7 +105,8 @@ TEST_F(MultiDeviceSetupServiceTest, TriggerEventForDebugging_kExistingUserConnectedHostSwitched) { - CallTriggerEventForDebugging(EventType::kExistingUserConnectedHostSwitched); + CallTriggerEventForDebugging( + mojom::EventTypeForDebugging::kExistingUserConnectedHostSwitched); EXPECT_EQ(1u, fake_multidevice_setup_observer() ->num_existing_user_host_switched_events_handled()); @@ -115,12 +114,13 @@ TEST_F(MultiDeviceSetupServiceTest, TriggerEventForDebugging_kExistingUserNewChromebookAdded) { - CallTriggerEventForDebugging(EventType::kExistingUserNewChromebookAdded); + CallTriggerEventForDebugging( + mojom::EventTypeForDebugging::kExistingUserNewChromebookAdded); EXPECT_EQ(1u, fake_multidevice_setup_observer() ->num_existing_user_chromebook_added_events_handled()); } -} // namespace multidevice +} // namespace multidevice_setup } // namespace chromeos
diff --git a/chromeos/services/multidevice_setup/public/mojom/constants.mojom b/chromeos/services/multidevice_setup/public/mojom/constants.mojom index ccdc66d..f52c026d 100644 --- a/chromeos/services/multidevice_setup/public/mojom/constants.mojom +++ b/chromeos/services/multidevice_setup/public/mojom/constants.mojom
@@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module multidevice_setup.mojom; +module chromeos.multidevice_setup.mojom; const string kServiceName = "multidevice_setup";
diff --git a/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom b/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom index c8da6e8..121207e 100644 --- a/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom +++ b/chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module multidevice_setup.mojom; +module chromeos.multidevice_setup.mojom; // Handles events dispatched by MultiDeviceSetup. interface MultiDeviceSetupObserver {
diff --git a/components/BUILD.gn b/components/BUILD.gn index 72c7ace2..a534eb37 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -287,7 +287,6 @@ # Desktop-only deps. if (!is_android && !is_ios) { deps += [ - "//components/cryptauth:unit_tests", "//components/feedback:unit_tests", # See comment in components/guest_view/browser/BUILD.gn for why @@ -306,6 +305,7 @@ if (is_chromeos) { deps += [ "//components/arc:unit_tests", + "//components/cryptauth:unit_tests", "//components/ownership:unit_tests", "//components/pairing:unit_tests", "//components/proximity_auth:unit_tests",
diff --git a/components/autofill/ios/browser/resources/autofill_controller.js b/components/autofill/ios/browser/resources/autofill_controller.js index 455fa6d..a6d2f79 100644 --- a/components/autofill/ios/browser/resources/autofill_controller.js +++ b/components/autofill/ios/browser/resources/autofill_controller.js
@@ -270,7 +270,8 @@ // Skip non-empty fields unless this is the forceFillFieldName or it's a // 'select-one' element. 'select-one' elements are always autofilled even // if non-empty; see AutofillManager::FillOrPreviewDataModelForm(). - if (element.value && !sanitizedFieldIsEmpty_(element.value) && + if (element.value && + !__gCrWeb.autofill.sanitizedFieldIsEmpty(element.value) && !__gCrWeb.fill.isSelectElement(element) && fieldIdentifier !== forceFillFieldIdentifier) { continue;
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index f995b99..e75266b 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -101,8 +101,6 @@ namespace { -using AuthError = GoogleServiceAuthError; - const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors"; const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { @@ -146,7 +144,9 @@ init_params.base_directory, init_params.debug_identifier), OAuth2TokenService::Consumer("sync"), - last_auth_error_(AuthError::AuthErrorNone()), + signin_scoped_device_id_callback_( + init_params.signin_scoped_device_id_callback), + last_auth_error_(GoogleServiceAuthError::AuthErrorNone()), sync_service_url_( syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), init_params.channel)), @@ -171,6 +171,7 @@ sync_enabled_weak_factory_(this), weak_factory_(this) { DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK(signin_scoped_device_id_callback_); DCHECK(sync_client_); std::string last_version = sync_prefs_.GetLastRunVersion(); std::string current_version = PRODUCT_VERSION; @@ -650,6 +651,8 @@ sync_error_controller_.reset(); } + signin_scoped_device_id_callback_.Reset(); + if (sync_thread_) sync_thread_->Stop(); } @@ -889,17 +892,9 @@ sync_js_controller_.AttachJsBackend(js_backend); debug_info_listener_ = debug_info_listener; - std::string signin_scoped_device_id; - if (IsLocalSyncEnabled()) { - signin_scoped_device_id = "local_device"; - } else { - SigninClient* signin_client = signin_->GetOriginal()->signin_client(); - DCHECK(signin_client); - signin_scoped_device_id = signin_client->GetSigninScopedDeviceId(); - } - // Initialize local device info. - local_device_->Initialize(cache_guid, signin_scoped_device_id); + local_device_->Initialize(cache_guid, + signin_scoped_device_id_callback_.Run()); if (protocol_event_observers_.might_have_observers()) { engine_->RequestBufferedProtocolEventsAndEnableForwarding(); @@ -986,7 +981,8 @@ experiments.gcm_invalidations_enabled); } -void ProfileSyncService::UpdateAuthErrorState(const AuthError& error) { +void ProfileSyncService::UpdateAuthErrorState( + const GoogleServiceAuthError& error) { is_auth_in_progress_ = false; last_auth_error_ = error; @@ -995,22 +991,23 @@ namespace { -AuthError ConnectionStatusToAuthError(syncer::ConnectionStatus status) { +GoogleServiceAuthError ConnectionStatusToAuthError( + syncer::ConnectionStatus status) { switch (status) { case syncer::CONNECTION_OK: - return AuthError::AuthErrorNone(); + return GoogleServiceAuthError::AuthErrorNone(); break; case syncer::CONNECTION_AUTH_ERROR: - return AuthError(AuthError::FromInvalidGaiaCredentialsReason( - AuthError::InvalidGaiaCredentialsReason:: - CREDENTIALS_REJECTED_BY_SERVER)); + return GoogleServiceAuthError::FromInvalidGaiaCredentialsReason( + GoogleServiceAuthError::InvalidGaiaCredentialsReason:: + CREDENTIALS_REJECTED_BY_SERVER); break; case syncer::CONNECTION_SERVER_ERROR: - return AuthError(AuthError::CONNECTION_FAILED); + return GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED); break; default: NOTREACHED(); - return AuthError(AuthError::CONNECTION_FAILED); + return GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED); } } @@ -1344,7 +1341,7 @@ return false; } -const AuthError& ProfileSyncService::GetAuthError() const { +const GoogleServiceAuthError& ProfileSyncService::GetAuthError() const { DCHECK(thread_checker_.CalledOnValidThread()); return last_auth_error_; } @@ -1895,7 +1892,8 @@ void ProfileSyncService::GoogleSigninSucceeded(const std::string& account_id, const std::string& username) { DCHECK(thread_checker_.CalledOnValidThread()); - if (!IsEngineInitialized() || GetAuthError().state() != AuthError::NONE) { + if (!IsEngineInitialized() || + GetAuthError().state() != GoogleServiceAuthError::NONE) { // Track the fact that we're still waiting for auth to complete. is_auth_in_progress_ = true; } @@ -2362,4 +2360,5 @@ ReconfigureDatatypeManager(); NotifyObservers(); } + } // namespace browser_sync
diff --git a/components/browser_sync/profile_sync_service.h b/components/browser_sync/profile_sync_service.h index 391a6c7..7cc42542 100644 --- a/components/browser_sync/profile_sync_service.h +++ b/components/browser_sync/profile_sync_service.h
@@ -174,7 +174,8 @@ public GaiaCookieManagerService::Observer { public: using Status = syncer::SyncEngine::Status; - using PlatformSyncAllowedProvider = base::Callback<bool(void)>; + using PlatformSyncAllowedProvider = base::RepeatingCallback<bool()>; + using SigninScopedDeviceIdCallback = base::RepeatingCallback<std::string()>; enum SyncEventCodes { MIN_SYNC_EVENT_CODE = 0, @@ -229,6 +230,7 @@ std::unique_ptr<syncer::SyncClient> sync_client; std::unique_ptr<SigninManagerWrapper> signin_wrapper; + SigninScopedDeviceIdCallback signin_scoped_device_id_callback; ProfileOAuth2TokenService* oauth2_token_service = nullptr; GaiaCookieManagerService* gaia_cookie_manager_service = nullptr; StartBehavior start_behavior = MANUAL_START; @@ -745,6 +747,8 @@ // Called when a SetupInProgressHandle issued by this instance is destroyed. virtual void OnSetupInProgressHandleDestroyed(); + SigninScopedDeviceIdCallback signin_scoped_device_id_callback_; + // This is a cache of the last authentication response we received from the // sync server. The UI queries this to display appropriate messaging to the // user.
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc index 3c5ca1c..f97d173 100644 --- a/components/browser_sync/profile_sync_service_unittest.cc +++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -859,12 +859,13 @@ EXPECT_EQ(syncer::CONFIGURE_REASON_CATCH_UP, configure_reason); // Simulate browser restart. First configuration is a regular one. - service()->Shutdown(); + ShutdownAndDeleteService(); + CreateService(ProfileSyncService::AUTO_START); base::Closure captured_callback; ExpectSyncEngineCreationCaptureClearServerData(&captured_callback); ExpectDataTypeManagerCreation( 1, GetRecordingConfigureCalledCallback(&configure_reason)); - service()->RequestStart(); + InitializeForNthSync(); testing::Mock::VerifyAndClearExpectations(component_factory()); EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, configure_reason); EXPECT_TRUE(captured_callback.is_null()); @@ -913,11 +914,12 @@ captured_callback.Reset(); // Simulate browser restart. First configuration is a regular one. - service()->Shutdown(); + ShutdownAndDeleteService(); + CreateService(ProfileSyncService::AUTO_START); ExpectSyncEngineCreationCaptureClearServerData(&captured_callback); ExpectDataTypeManagerCreation( 1, GetRecordingConfigureCalledCallback(&configure_reason)); - service()->RequestStart(); + InitializeForNthSync(); testing::Mock::VerifyAndClearExpectations(component_factory()); EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, configure_reason); EXPECT_TRUE(captured_callback.is_null());
diff --git a/components/browser_sync/profile_sync_test_util.cc b/components/browser_sync/profile_sync_test_util.cc index 249c55b..b4515c2d 100644 --- a/components/browser_sync/profile_sync_test_util.cc +++ b/components/browser_sync/profile_sync_test_util.cc
@@ -4,6 +4,7 @@ #include "components/browser_sync/profile_sync_test_util.h" +#include <string> #include <utility> #include "base/bind.h" @@ -251,9 +252,12 @@ init_params.sync_client = std::move(sync_client); init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(signin_manager()); + init_params.signin_scoped_device_id_callback = + base::BindRepeating([]() { return std::string(); }); init_params.oauth2_token_service = auth_service(); init_params.network_time_update_callback = base::DoNothing(); - EXPECT_TRUE(base_directory_.CreateUniqueTempDir()); + if (!base_directory_.IsValid()) + EXPECT_TRUE(base_directory_.CreateUniqueTempDir()); init_params.base_directory = base_directory_.GetPath(); init_params.url_request_context = url_request_context(); init_params.debug_identifier = "dummyDebugName";
diff --git a/components/cbor/cbor_reader.cc b/components/cbor/cbor_reader.cc index 1c63f85..de0c40a 100644 --- a/components/cbor/cbor_reader.cc +++ b/components/cbor/cbor_reader.cc
@@ -158,7 +158,6 @@ base::Optional<CBORReader::DataItemHeader> CBORReader::DecodeDataItemHeader() { if (!CanConsume(1)) { - error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; } @@ -193,7 +192,6 @@ } if (!CanConsume(additional_bytes)) { - error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return false; } @@ -252,7 +250,6 @@ const CBORReader::DataItemHeader& header) { uint64_t num_bytes = header.value; if (!CanConsume(num_bytes)) { - error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; } @@ -268,7 +265,6 @@ const CBORReader::DataItemHeader& header) { uint64_t num_bytes = header.value; if (!CanConsume(num_bytes)) { - error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; }
diff --git a/components/cryptauth/BUILD.gn b/components/cryptauth/BUILD.gn index 7e2c290..3a7612e5 100644 --- a/components/cryptauth/BUILD.gn +++ b/components/cryptauth/BUILD.gn
@@ -6,6 +6,8 @@ # user's account. This component both sends data about the current device and # requets data about associated devices. +assert(is_chromeos, "CryptAuth is Chrome OS only") + static_library("cryptauth") { sources = [ "authenticator.cc",
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index 2696dcf..cc50e772 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -1194,8 +1194,6 @@ } bool ShellSurfaceBase::IsResizing() const { - if (!resizer_) - return false; ash::wm::WindowState* window_state = ash::wm::GetWindowState(widget_->GetNativeWindow()); if (!window_state->is_dragged())
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index c7c275b9..c8f8805 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc
@@ -548,7 +548,6 @@ client_->ShowManualFallbackForSaving(std::move(provisional_save_manager_), has_generated_password, is_update); } else { - provisional_save_manager_.reset(); HideManualFallbackForSaving(); } }
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.cc b/components/password_manager/core/browser/password_manager_metrics_util.cc index 9a2eda5..fc38608 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.cc +++ b/components/password_manager/core/browser/password_manager_metrics_util.cc
@@ -32,12 +32,22 @@ histogram->AddBoolean(sample); } -void LogUIDismissalReason(UIDismissalReason reason) { +void LogGeneralUIDismissalReason(UIDismissalReason reason) { UMA_HISTOGRAM_ENUMERATION("PasswordManager.UIDismissalReason", reason, NUM_UI_RESPONSES); } +void LogSaveUIDismissalReason(UIDismissalReason reason) { + UMA_HISTOGRAM_ENUMERATION("PasswordManager.SaveUIDismissalReason", reason, + NUM_UI_RESPONSES); +} + +void LogUpdateUIDismissalReason(UIDismissalReason reason) { + UMA_HISTOGRAM_ENUMERATION("PasswordManager.UpdateUIDismissalReason", reason, + NUM_UI_RESPONSES); +} + void LogUIDisplayDisposition(UIDisplayDisposition disposition) { UMA_HISTOGRAM_ENUMERATION("PasswordBubble.DisplayDisposition", disposition, @@ -71,19 +81,6 @@ event, SUBMISSION_EVENT_ENUM_COUNT); } -void LogUpdatePasswordSubmissionEvent(UpdatePasswordSubmissionEvent event) { - DCHECK_LT(event, UPDATE_PASSWORD_EVENT_COUNT); - UMA_HISTOGRAM_ENUMERATION("PasswordManager.UpdatePasswordSubmissionEvent", - event, UPDATE_PASSWORD_EVENT_COUNT); -} - -void LogMultiAccountUpdateBubbleUserAction( - MultiAccountUpdateBubbleUserAction action) { - UMA_HISTOGRAM_ENUMERATION("PasswordManager.MultiAccountPasswordUpdateAction", - action, - MULTI_ACCOUNT_UPDATE_BUBBLE_USER_ACTION_COUNT); -} - void LogAutoSigninPromoUserAction(AutoSigninPromoUserAction action) { UMA_HISTOGRAM_ENUMERATION("PasswordManager.AutoSigninFirstRunDialog", action, AUTO_SIGNIN_PROMO_ACTION_COUNT);
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.h b/components/password_manager/core/browser/password_manager_metrics_util.h index 26c26a70..33ed6c37 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.h +++ b/components/password_manager/core/browser/password_manager_metrics_util.h
@@ -44,7 +44,7 @@ // Metrics: "PasswordManager.UIDismissalReason" enum UIDismissalReason { // We use this to mean both "Bubble lost focus" and "No interaction with the - // infobar", depending on which experiment is active. + // infobar". NO_DIRECT_INTERACTION = 0, CLICKED_SAVE, CLICKED_CANCEL, @@ -91,37 +91,6 @@ SUBMISSION_EVENT_ENUM_COUNT }; -enum UpdatePasswordSubmissionEvent { - NO_ACCOUNTS_CLICKED_UPDATE, - NO_ACCOUNTS_CLICKED_NOPE, - NO_ACCOUNTS_NO_INTERACTION, - ONE_ACCOUNT_CLICKED_UPDATE, - ONE_ACCOUNT_CLICKED_NOPE, - ONE_ACCOUNT_NO_INTERACTION, - MULTIPLE_ACCOUNTS_CLICKED_UPDATE, - MULTIPLE_ACCOUNTS_CLICKED_NOPE, - MULTIPLE_ACCOUNTS_NO_INTERACTION, - PASSWORD_OVERRIDDEN_CLICKED_UPDATE, - PASSWORD_OVERRIDDEN_CLICKED_NOPE, - PASSWORD_OVERRIDDEN_NO_INTERACTION, - UPDATE_PASSWORD_EVENT_COUNT, - - NO_UPDATE_SUBMISSION -}; - -enum MultiAccountUpdateBubbleUserAction { - DEFAULT_ACCOUNT_MATCHED_BY_PASSWORD_USER_CHANGED, - DEFAULT_ACCOUNT_MATCHED_BY_PASSWORD_USER_NOT_CHANGED, - DEFAULT_ACCOUNT_MATCHED_BY_PASSWORD_USER_REJECTED_UPDATE, - DEFAULT_ACCOUNT_PREFERRED_USER_CHANGED, - DEFAULT_ACCOUNT_PREFERRED_USER_NOT_CHANGED, - DEFAULT_ACCOUNT_PREFERRED_USER_REJECTED_UPDATE, - DEFAULT_ACCOUNT_FIRST_USER_CHANGED, - DEFAULT_ACCOUNT_FIRST_USER_NOT_CHANGED, - DEFAULT_ACCOUNT_FIRST_USER_REJECTED_UPDATE, - MULTI_ACCOUNT_UPDATE_BUBBLE_USER_ACTION_COUNT -}; - enum AutoSigninPromoUserAction { AUTO_SIGNIN_NO_ACTION, AUTO_SIGNIN_TURN_OFF, @@ -287,8 +256,15 @@ // to vary over the program's runtime. void LogUMAHistogramBoolean(const std::string& name, bool sample); -// Log the |reason| a user dismissed the password manager UI. -void LogUIDismissalReason(UIDismissalReason reason); +// Log the |reason| a user dismissed the password manager UI except save/update +// bubbles. +void LogGeneralUIDismissalReason(UIDismissalReason reason); + +// Log the |reason| a user dismissed the save password bubble. +void LogSaveUIDismissalReason(UIDismissalReason reason); + +// Log the |reason| a user dismissed the update password bubble. +void LogUpdateUIDismissalReason(UIDismissalReason reason); // Log the appropriate display disposition. void LogUIDisplayDisposition(UIDisplayDisposition disposition); @@ -309,14 +285,6 @@ void LogPasswordGenerationAvailableSubmissionEvent( PasswordSubmissionEvent event); -// Log submission events related to password update. -void LogUpdatePasswordSubmissionEvent(UpdatePasswordSubmissionEvent event); - -// Log a user action on showing an update password bubble with multiple -// accounts. -void LogMultiAccountUpdateBubbleUserAction( - MultiAccountUpdateBubbleUserAction action); - // Log a user action on showing the autosignin first run experience. void LogAutoSigninPromoUserAction(AutoSigninPromoUserAction action);
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index c5cd07b..062b2a0 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -16,6 +16,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/test/user_action_tester.h" #include "build/build_config.h" #include "components/password_manager/core/browser/form_fetcher_impl.h" #include "components/password_manager/core/browser/mock_password_store.h" @@ -533,6 +534,8 @@ EXPECT_THAT(form_manager_to_save->pending_credentials(), FormMatches(incomplete_match)); + base::UserActionTester user_action_tester; + // The user completes typing the credential. No fallback should be available, // because the credential is already in the store. EXPECT_CALL(client_, ShowManualFallbackForSavingPtr(_, false, true)).Times(0); @@ -547,6 +550,8 @@ observed.clear(); manager()->OnPasswordFormsParsed(&driver_, observed); manager()->OnPasswordFormsRendered(&driver_, observed, true); + EXPECT_EQ(1, + user_action_tester.GetActionCount("PasswordManager_LoginPassed")); } TEST_F(PasswordManagerTest, FormSeenThenLeftPage) {
diff --git a/components/policy/BUILD.gn b/components/policy/BUILD.gn index a17bc37..87b81de 100644 --- a/components/policy/BUILD.gn +++ b/components/policy/BUILD.gn
@@ -308,7 +308,7 @@ testonly = true public_deps = [ ":chrome_settings_proto_generated_compile_proto", - ":cloud_policy_proto_generated_compile_proto", + ":cloud_policy_proto_generated_compile", ] } proto_library("chrome_settings_proto_generated_compile_proto") { @@ -319,14 +319,14 @@ ] proto_out_dir = "components/policy/proto" - cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" + cc_generator_options = "dllexport_decl=POLICY_CHROME_SETTINGS_PROTO_EXPORT:" cc_include = "components/policy/proto/policy_proto_export.h" component_build_force_source_set = true - defines = [ "POLICY_PROTO_COMPILATION" ] + defines = [ "POLICY_CHROME_SETTINGS_PROTO_COMPILATION" ] deps = [ ":cloud_policy_code_generate", - ":cloud_policy_proto_generated_compile_proto", + ":cloud_policy_proto_generated_compile", ] }
diff --git a/components/policy/proto/policy_proto_export.h b/components/policy/proto/policy_proto_export.h index 3407b65..c8240ce7 100644 --- a/components/policy/proto/policy_proto_export.h +++ b/components/policy/proto/policy_proto_export.h
@@ -15,6 +15,12 @@ #define POLICY_PROTO_EXPORT __declspec(dllimport) #endif // defined(POLICY_PROTO_COMPILATION) +#if defined(POLICY_CHROME_SETTINGS_PROTO_COMPILATION) +#define POLICY_CHROME_SETTINGS_PROTO_EXPORT __declspec(dllexport) +#else +#define POLICY_CHROME_SETTINGS_PROTO_EXPORT __declspec(dllimport) +#endif // defined(POLICY_PROTO_COMPILATION) + #else // defined(WIN32) #if defined(POLICY_PROTO_COMPILATION) @@ -23,11 +29,19 @@ #define POLICY_PROTO_EXPORT #endif // defined(POLICY_PROTO_COMPILATION) +#if defined(POLICY_CHROME_SETTINGS_PROTO_COMPILATION) +#define POLICY_CHROME_SETTINGS_PROTO_EXPORT \ + __attribute__((visibility("default"))) +#else +#define POLICY_CHROME_SETTINGS_PROTO_EXPORT +#endif // defined(POLICY_PROTO_COMPILATION) + #endif // defined(WIN32) #else // defined(COMPONENT_BUILD) #define POLICY_PROTO_EXPORT +#define POLICY_CHROME_SETTINGS_PROTO_EXPORT #endif // defined(COMPONENT_BUILD)
diff --git a/components/policy/tools/generate_extension_admx.py b/components/policy/tools/generate_extension_admx.py index ffdf0a9..ba0db85 100755 --- a/components/policy/tools/generate_extension_admx.py +++ b/components/policy/tools/generate_extension_admx.py
@@ -2,7 +2,6 @@ # 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. - '''Creates a ADMX group policy template file from an extension schema.json file. generate_extension_admx.py --name <name> --id <id> --schema <schema_file> @@ -33,6 +32,7 @@ from optparse import OptionParser from xml.dom import minidom + class AdmxGenerator(object): '''Generates ADMX and ADML templates''' @@ -68,12 +68,12 @@ properties = self._schema['properties'] for policy_name, policy_schema in properties.items(): - self._AddPolicy(policy_name, policy_schema) + self._AddPolicy(policy_name, policy_schema, 'extension', + self._REGISTRY_KEY) return self._ToPrettyXml(self._admx_doc.toxml()), \ self._adml_doc.toxml() - def _AddElement(self, parent, name): ''' Adds an element named |name| as child of |parent|. @@ -86,8 +86,7 @@ parent.appendChild(element) return element - - def _SetAttribute(self, elem, name, value, string_id = None): + def _SetAttribute(self, elem, name, value, string_id=None): ''' Sets the attribute |name| = |value| on the element |elem|. If |string_id| is given, a new string with that ID is added to the strings table in the @@ -101,7 +100,6 @@ else: elem.setAttribute(name, value) - def _ToId(self, id_str): ''' Replaces all non-alphanumeric characters by underscores. @@ -109,7 +107,6 @@ ''' return re.sub('[^0-9a-zA-Z]+', '_', id_str) if id_str else None - def _AddString(self, string_id, text): ''' Adds a string with ID |string_id| to the strings table in the ADML doc or @@ -125,7 +122,6 @@ self._SetAttribute(string_elem, 'id', string_id) string_elem.appendChild(self._adml_doc.createTextNode(text)) - def _AddNamespace(self, namespaces_elem, elem_name, namespace, prefix): ''' Adds an ADMX namespace node. @@ -135,19 +131,17 @@ self._SetAttribute(namespace_elem, 'namespace', namespace) self._SetAttribute(namespace_elem, 'prefix', prefix) - - def _AddCategory(self, categories_elem, display_name, name, parent_category): + def _AddCategory(self, display_name, name, parent_category): ''' Adds an ADMX category. ''' - category_elem = self._AddElement(categories_elem, 'category') + category_elem = self._AddElement(self.categories_elem_, 'category') self._SetAttribute(category_elem, 'displayName', display_name, name) self._SetAttribute(category_elem, 'name', name) parent_category_elem = self._AddElement(category_elem, 'parentCategory') self._SetAttribute(parent_category_elem, 'ref', parent_category) - def _BeginAdmlTemplate(self): ''' Writes the header of the ADML doc. @@ -165,8 +159,7 @@ resources_elem = self._AddElement(root_elem, 'resources') self._string_table_elem = self._AddElement(resources_elem, 'stringTable') self._presentation_table_elem = self._AddElement(resources_elem, - 'presentationTable') - + 'presentationTable') def _BeginAdmxTemplate(self): ''' @@ -194,42 +187,22 @@ definitions_elem = self._AddElement(supported_on_elem, 'definitions') definition_elem = self._AddElement(definitions_elem, 'definition') self._SetAttribute(definition_elem, 'displayName', - 'Microsoft Windows 7 or later', - 'SUPPORTED_WIN7') + 'Microsoft Windows 7 or later', 'SUPPORTED_WIN7') self._SetAttribute(definition_elem, 'name', 'SUPPORTED_WIN7') - categories_elem = self._AddElement(root_elem, 'categories') - self._AddCategory(categories_elem, - self._extension_name, 'extension', 'Google:Cat_Google') + self.categories_elem_ = self._AddElement(root_elem, 'categories') + self._AddCategory(self._extension_name, 'extension', 'Google:Cat_Google') self._policies_elem = self._AddElement(root_elem, 'policies') - - def _AddPolicy(self, policy_name, policy_schema): + def _AddPolicy(self, policy_name, policy_schema, parent_category, parent_key): ''' Adds a policy with name |policy_name| and schema data |policy_schema| to the ADMX/ADML docs. ''' policy_id = self._ToId(policy_name) - policy_elem = self._AddElement(self._policies_elem, 'policy') - policy_title = policy_schema['title'] - policy_desc = policy_schema['description'] - self._SetAttribute(policy_elem, 'name', policy_name) - self._SetAttribute(policy_elem, 'class', 'Both') - self._SetAttribute(policy_elem, 'displayName', policy_title, - policy_id) - self._SetAttribute(policy_elem, 'explainText', policy_desc, - policy_id + '_Explain') - self._SetAttribute(policy_elem, 'presentation', - '$(presentation.%s)' % policy_id) - self._SetAttribute(policy_elem, 'key', self._REGISTRY_KEY) - - parent_category_elem = self._AddElement(policy_elem, 'parentCategory') - self._SetAttribute(parent_category_elem, 'ref', 'extension') - - supported_on_elem = self._AddElement(policy_elem, 'supportedOn') - self._SetAttribute(supported_on_elem, 'ref', 'SUPPORTED_WIN7') + policy_title = policy_schema.get('title', policy_name) if 'id' in policy_schema: # Keep id map for referenced schema. @@ -241,53 +214,81 @@ if not key in policy_schema: policy_schema[key] = value - desc_id = policy_id + '_Part' - presentation_elem = self._AddElement(self._presentation_table_elem, - 'presentation') - self._SetAttribute(presentation_elem, 'id', policy_id) - if (policy_schema['type'] == 'boolean'): - self._SetAttribute(policy_elem, 'valueName', policy_id) - - enabled_value_elem = self._AddElement(policy_elem, 'enabledValue') - decimal_elem = self._AddElement(enabled_value_elem, 'decimal') - self._SetAttribute(decimal_elem, 'value', '1') - - disabled_value_elem = self._AddElement(policy_elem, 'disabledValue') - decimal_elem = self._AddElement(disabled_value_elem, 'decimal') - self._SetAttribute(decimal_elem, 'value', '0') - elif (policy_schema['type'] == 'integer'): - elements_elem = self._AddElement(policy_elem, 'elements') - decimal_elem = self._AddElement(elements_elem, 'decimal') - self._SetAttribute(decimal_elem, 'id', desc_id) - self._SetAttribute(decimal_elem, 'valueName', policy_id) - - textbox_elem = self._AddElement(presentation_elem, 'decimalTextBox') - self._SetAttribute(textbox_elem, 'refId', desc_id) - textbox_elem.appendChild(self._adml_doc.createTextNode(policy_title)) - elif (policy_schema['type'] == 'string'): - elements_elem = self._AddElement(policy_elem, 'elements') - text_elem = self._AddElement(elements_elem, 'text') - self._SetAttribute(text_elem, 'id', desc_id) - self._SetAttribute(text_elem, 'valueName', policy_id) - - textbox_elem = self._AddElement(presentation_elem, 'textBox') - self._SetAttribute(textbox_elem, 'refId', desc_id) - label_elem = self._AddElement(textbox_elem, 'label') - label_elem.appendChild(self._adml_doc.createTextNode(policy_title)) - elif (policy_schema['type'] == 'array'): - elements_elem = self._AddElement(policy_elem, 'elements') - list_elem = self._AddElement(elements_elem, 'list') - self._SetAttribute(list_elem, 'id', desc_id) - self._SetAttribute(list_elem, 'key', - self._REGISTRY_KEY + '\\' + policy_name) - self._SetAttribute(list_elem, 'valuePrefix', None) - - listbox_elem = self._AddElement(presentation_elem, 'listBox') - self._SetAttribute(listbox_elem, 'refId', desc_id) - listbox_elem.appendChild(self._adml_doc.createTextNode(policy_title)) + # For 'object' type items create a new category (folder) and add children. + if (policy_schema['type'] == 'object'): + self._AddCategory(policy_title, policy_id, parent_category) + properties = policy_schema['properties'] + for child_policy_name, child_policy_schema in properties.items(): + self._AddPolicy(child_policy_name, child_policy_schema, policy_id, + parent_key + '\\' + policy_name) else: - raise Exception('Unhandled schema type "%s"' % policy_schema['type']) + policy_elem = self._AddElement(self._policies_elem, 'policy') + policy_desc = policy_schema.get('description', None) + self._SetAttribute(policy_elem, 'name', policy_name) + self._SetAttribute(policy_elem, 'class', 'Both') + self._SetAttribute(policy_elem, 'displayName', policy_title, policy_id) + if policy_desc: + self._SetAttribute(policy_elem, 'explainText', policy_desc, + policy_id + '_Explain') + self._SetAttribute(policy_elem, 'presentation', + '$(presentation.%s)' % policy_id) + self._SetAttribute(policy_elem, 'key', parent_key) + parent_category_elem = self._AddElement(policy_elem, 'parentCategory') + self._SetAttribute(parent_category_elem, 'ref', parent_category) + + supported_on_elem = self._AddElement(policy_elem, 'supportedOn') + self._SetAttribute(supported_on_elem, 'ref', 'SUPPORTED_WIN7') + + desc_id = policy_id + '_Part' + presentation_elem = self._AddElement(self._presentation_table_elem, + 'presentation') + self._SetAttribute(presentation_elem, 'id', policy_id) + if policy_schema['type'] == 'boolean': + self._SetAttribute(policy_elem, 'valueName', policy_id) + + enabled_value_elem = self._AddElement(policy_elem, 'enabledValue') + decimal_elem = self._AddElement(enabled_value_elem, 'decimal') + self._SetAttribute(decimal_elem, 'value', '1') + + disabled_value_elem = self._AddElement(policy_elem, 'disabledValue') + decimal_elem = self._AddElement(disabled_value_elem, 'decimal') + self._SetAttribute(decimal_elem, 'value', '0') + elif policy_schema['type'] == 'integer': + elements_elem = self._AddElement(policy_elem, 'elements') + decimal_elem = self._AddElement(elements_elem, 'decimal') + self._SetAttribute(decimal_elem, 'id', desc_id) + self._SetAttribute(decimal_elem, 'valueName', policy_id) + + textbox_elem = self._AddElement(presentation_elem, 'decimalTextBox') + self._SetAttribute(textbox_elem, 'refId', desc_id) + textbox_elem.appendChild(self._adml_doc.createTextNode(policy_title)) + elif (policy_schema['type'] == 'string' or + policy_schema['type'] == 'number'): + # Note: 'number' are doubles, but ADMX only supports integers + # (decimal), thus use 'string' and rely on string-to-double + # conversion in RegistryDict. + elements_elem = self._AddElement(policy_elem, 'elements') + text_elem = self._AddElement(elements_elem, 'text') + self._SetAttribute(text_elem, 'id', desc_id) + self._SetAttribute(text_elem, 'valueName', policy_id) + + textbox_elem = self._AddElement(presentation_elem, 'textBox') + self._SetAttribute(textbox_elem, 'refId', desc_id) + label_elem = self._AddElement(textbox_elem, 'label') + label_elem.appendChild(self._adml_doc.createTextNode(policy_title)) + elif policy_schema['type'] == 'array': + elements_elem = self._AddElement(policy_elem, 'elements') + list_elem = self._AddElement(elements_elem, 'list') + self._SetAttribute(list_elem, 'id', desc_id) + self._SetAttribute(list_elem, 'key', parent_key + '\\' + policy_name) + self._SetAttribute(list_elem, 'valuePrefix', None) + + listbox_elem = self._AddElement(presentation_elem, 'listBox') + self._SetAttribute(listbox_elem, 'refId', desc_id) + listbox_elem.appendChild(self._adml_doc.createTextNode(policy_title)) + else: + raise Exception('Unhandled schema type "%s"' % policy_schema['type']) def _ToPrettyXml(self, xml): # return doc.toprettyxml(indent=' ') @@ -348,17 +349,23 @@ def main(): '''Main function, usage see top of file.''' parser = OptionParser(usage=__doc__) - parser.add_option('--name', dest='extension_name', - help='extension name (e.g. Managed Bookmarks)') - parser.add_option('--id', dest='extension_id', - help='extension id (e.g. gihmafigllmhbppdfjnfecimiohcljba)') - parser.add_option('--schema', dest='schema_file', - help='Input schema.json file for the extension', - metavar='FILE') - parser.add_option('--admx', dest='admx_file', help='Output ADMX file', - metavar='FILE') - parser.add_option('--adml', dest='adml_file', help='Output ADML file', - metavar='FILE') + parser.add_option( + '--name', + dest='extension_name', + help='extension name (e.g. Managed Bookmarks)') + parser.add_option( + '--id', + dest='extension_id', + help='extension id (e.g. gihmafigllmhbppdfjnfecimiohcljba)') + parser.add_option( + '--schema', + dest='schema_file', + help='Input schema.json file for the extension', + metavar='FILE') + parser.add_option( + '--admx', dest='admx_file', help='Output ADMX file', metavar='FILE') + parser.add_option( + '--adml', dest='adml_file', help='Output ADML file', metavar='FILE') (options, args) = parser.parse_args() if not options.extension_name or not options.extension_id or \
diff --git a/components/proximity_auth/webui/proximity_auth_ui.cc b/components/proximity_auth/webui/proximity_auth_ui.cc index 39e1347..1816a6d 100644 --- a/components/proximity_auth/webui/proximity_auth_ui.cc +++ b/components/proximity_auth/webui/proximity_auth_ui.cc
@@ -21,8 +21,8 @@ ProximityAuthUI::ProximityAuthUI(content::WebUI* web_ui, ProximityAuthClient* delegate) - : ui::MojoWebUIController<multidevice_setup::mojom::MultiDeviceSetup>( - web_ui) { + : ui::MojoWebUIController< + chromeos::multidevice_setup::mojom::MultiDeviceSetup>(web_ui) { content::WebUIDataSource* source = content::WebUIDataSource::Create(kChromeUIProximityAuthHost); source->SetDefaultResource(IDR_PROXIMITY_AUTH_INDEX_HTML); @@ -57,13 +57,13 @@ ProximityAuthUI::~ProximityAuthUI() = default; void ProximityAuthUI::BindUIHandler( - multidevice_setup::mojom::MultiDeviceSetupRequest request) { + chromeos::multidevice_setup::mojom::MultiDeviceSetupRequest request) { service_manager::Connector* connector = content::BrowserContext::GetConnectorFor( web_ui()->GetWebContents()->GetBrowserContext()); DCHECK(connector); - connector->BindInterface(multidevice_setup::mojom::kServiceName, + connector->BindInterface(chromeos::multidevice_setup::mojom::kServiceName, std::move(request)); }
diff --git a/components/proximity_auth/webui/proximity_auth_ui.h b/components/proximity_auth/webui/proximity_auth_ui.h index 6cbb63a..a166090 100644 --- a/components/proximity_auth/webui/proximity_auth_ui.h +++ b/components/proximity_auth/webui/proximity_auth_ui.h
@@ -17,8 +17,9 @@ class ProximityAuthClient; // The WebUI controller for chrome://proximity-auth. -class ProximityAuthUI : public ui::MojoWebUIController< - multidevice_setup::mojom::MultiDeviceSetup> { +class ProximityAuthUI + : public ui::MojoWebUIController< + chromeos::multidevice_setup::mojom::MultiDeviceSetup> { public: // Note: |web_ui| and |delegate| are not owned by this instance and must // outlive this instance. @@ -27,8 +28,8 @@ protected: // ui::MojoWebUIController overrides: - void BindUIHandler( - multidevice_setup::mojom::MultiDeviceSetupRequest request) override; + void BindUIHandler(chromeos::multidevice_setup::mojom::MultiDeviceSetupRequest + request) override; private: DISALLOW_COPY_AND_ASSIGN(ProximityAuthUI);
diff --git a/components/proximity_auth/webui/resources/proximity_auth.js b/components/proximity_auth/webui/resources/proximity_auth.js index 21f8e36..dbad4364 100644 --- a/components/proximity_auth/webui/resources/proximity_auth.js +++ b/components/proximity_auth/webui/resources/proximity_auth.js
@@ -53,9 +53,10 @@ this.elements_.existingUserNewChromebookNotifButton.onclick = this.showExistingUserNewChromebookNotification_.bind(this); - this.multiDeviceSetup = new multideviceSetup.mojom.MultiDeviceSetupPtr(); + this.multiDeviceSetup = + new chromeos.multideviceSetup.mojom.MultiDeviceSetupPtr(); Mojo.bindInterface( - multideviceSetup.mojom.MultiDeviceSetup.name, + chromeos.multideviceSetup.mojom.MultiDeviceSetup.name, mojo.makeRequest(this.multiDeviceSetup).handle); } @@ -158,7 +159,7 @@ */ showNewUserNotification_() { this.showMultiDeviceSetupPromoNotification_( - multideviceSetup.mojom.EventTypeForDebugging. + chromeos.multideviceSetup.mojom.EventTypeForDebugging. kNewUserPotentialHostExists); } @@ -167,7 +168,7 @@ */ showExistingUserNewHostNotification_() { this.showMultiDeviceSetupPromoNotification_( - multideviceSetup.mojom.EventTypeForDebugging. + chromeos.multideviceSetup.mojom.EventTypeForDebugging. kExistingUserConnectedHostSwitched); } @@ -176,7 +177,7 @@ */ showExistingUserNewChromebookNotification_() { this.showMultiDeviceSetupPromoNotification_( - multideviceSetup.mojom.EventTypeForDebugging. + chromeos.multideviceSetup.mojom.EventTypeForDebugging. kExistingUserNewChromebookAdded); }
diff --git a/components/signin/core/browser/profile_management_switches.cc b/components/signin/core/browser/profile_management_switches.cc index 7900941..5cd71e95 100644 --- a/components/signin/core/browser/profile_management_switches.cc +++ b/components/signin/core/browser/profile_management_switches.cc
@@ -74,6 +74,9 @@ const char kAccountConsistencyFeatureMethodDiceMigration[] = "dice_migration"; const char kAccountConsistencyFeatureMethodDice[] = "dice"; +const base::Feature kUnifiedConsent{"UnifiedConsent", + base::FEATURE_DISABLED_BY_DEFAULT}; + bool DiceMethodGreaterOrEqual(AccountConsistencyMethod a, AccountConsistencyMethod b) { DCHECK_NE(AccountConsistencyMethod::kMirror, a);
diff --git a/components/signin/core/browser/profile_management_switches.h b/components/signin/core/browser/profile_management_switches.h index 330a1a3..abc74d6 100644 --- a/components/signin/core/browser/profile_management_switches.h +++ b/components/signin/core/browser/profile_management_switches.h
@@ -37,6 +37,9 @@ extern const char kAccountConsistencyFeatureMethodDiceMigration[]; extern const char kAccountConsistencyFeatureMethodDice[]; +// Improved and unified consent for privacy-related features. +extern const base::Feature kUnifiedConsent; + // TODO(https://crbug.com/777774): Cleanup this enum and remove related // functions once Dice is fully rolled out, and/or Mirror code is removed on // desktop.
diff --git a/components/sync/driver/sync_api_component_factory_mock.cc b/components/sync/driver/sync_api_component_factory_mock.cc index 4697cab..351f45d6 100644 --- a/components/sync/driver/sync_api_component_factory_mock.cc +++ b/components/sync/driver/sync_api_component_factory_mock.cc
@@ -16,15 +16,13 @@ namespace syncer { -SyncApiComponentFactoryMock::SyncApiComponentFactoryMock() - : local_device_(new LocalDeviceInfoProviderMock()) {} +SyncApiComponentFactoryMock::SyncApiComponentFactoryMock() = default; SyncApiComponentFactoryMock::SyncApiComponentFactoryMock( AssociatorInterface* model_associator, ChangeProcessor* change_processor) : model_associator_(model_associator), - change_processor_(change_processor), - local_device_(new LocalDeviceInfoProviderMock()) {} + change_processor_(change_processor) {} SyncApiComponentFactoryMock::~SyncApiComponentFactoryMock() {} @@ -43,7 +41,9 @@ std::unique_ptr<LocalDeviceInfoProvider> SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() { - return std::move(local_device_); + if (local_device_) + return std::move(local_device_); + return std::make_unique<LocalDeviceInfoProviderMock>(); } void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider(
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc index 6b4070c..55aa22f 100644 --- a/components/sync/engine_impl/model_type_worker.cc +++ b/components/sync/engine_impl/model_type_worker.cc
@@ -392,26 +392,19 @@ WorkerEntityTracker* entity = kv.second.get(); if (entity->HasEncryptedUpdate()) { const UpdateResponseData& encrypted_update = entity->GetEncryptedUpdate(); - const EntityData& data = encrypted_update.entity.value(); - DCHECK(data.specifics.has_encrypted()); + EntityDataPtr data = encrypted_update.entity; + DCHECK(data->specifics.has_encrypted()); - if (cryptographer_->CanDecrypt(data.specifics.encrypted())) { - EntityData decrypted_data; - if (DecryptSpecifics(*cryptographer_, data.specifics, - &decrypted_data.specifics)) { - // Copy other fields one by one since EntityData doesn't allow - // copying. - decrypted_data.id = data.id; - decrypted_data.client_tag_hash = data.client_tag_hash; - decrypted_data.non_unique_name = data.non_unique_name; - decrypted_data.creation_time = data.creation_time; - decrypted_data.modification_time = data.modification_time; - + if (cryptographer_->CanDecrypt(data->specifics.encrypted())) { + sync_pb::EntitySpecifics specifics; + if (DecryptSpecifics(*cryptographer_, data->specifics, &specifics)) { UpdateResponseData decrypted_update; - decrypted_update.entity = decrypted_data.PassToPtr(); decrypted_update.response_version = encrypted_update.response_version; + // Copy the encryption_key_name from data->specifics before it gets + // overriden in data->UpdateSpecifics(). decrypted_update.encryption_key_name = - data.specifics.encrypted().key_name(); + data->specifics.encrypted().key_name(); + decrypted_update.entity = data->UpdateSpecifics(specifics); pending_updates_.push_back(decrypted_update); entity->ClearEncryptedUpdate();
diff --git a/components/sync/model/entity_data.cc b/components/sync/model/entity_data.cc index 931c75ea..c5fee64 100644 --- a/components/sync/model/entity_data.cc +++ b/components/sync/model/entity_data.cc
@@ -60,6 +60,15 @@ return target; } +EntityDataPtr EntityData::UpdateSpecifics( + const sync_pb::EntitySpecifics& new_specifics) const { + EntityData entity_data(*this); + entity_data.specifics = new_specifics; + EntityDataPtr target; + target.swap_value(&entity_data); + return target; +} + #define ADD_TO_DICT(dict, value) \ dict->SetString(base::ToUpperASCII(#value), value);
diff --git a/components/sync/model/entity_data.h b/components/sync/model/entity_data.h index d3884d2..e5bfda0d 100644 --- a/components/sync/model/entity_data.h +++ b/components/sync/model/entity_data.h
@@ -83,6 +83,12 @@ // local change is cached in ProcessorEntityTracker. EntityDataPtr UpdateId(const std::string& new_id) const WARN_UNUSED_RESULT; + // Makes a copy of EntityData and updates its specifics to |new_specifics|. + // This is needed when specifics is updated after decryption in the + // ModelTypeWorker::DecryptStoredEntities(). + EntityDataPtr UpdateSpecifics( + const sync_pb::EntitySpecifics& new_specifics) const WARN_UNUSED_RESULT; + // Dumps all info into a DictionaryValue and returns it. std::unique_ptr<base::DictionaryValue> ToDictionaryValue(); @@ -94,7 +100,8 @@ // Used to transfer the data without copying. void Swap(EntityData* other); - // Allow copy ctor so that UpdateId can make a copy of this EntityData. + // Allow copy ctor so that UpdateId and UpdateSpecifics can make a copy of + // this EntityData. EntityData(const EntityData& src); DISALLOW_ASSIGN(EntityData);
diff --git a/components/zucchini/BUILD.gn b/components/zucchini/BUILD.gn index e8eee3ae..37a548d 100644 --- a/components/zucchini/BUILD.gn +++ b/components/zucchini/BUILD.gn
@@ -24,6 +24,8 @@ "crc32.h", "disassembler.cc", "disassembler.h", + "disassembler_dex.cc", + "disassembler_dex.h", "disassembler_no_op.cc", "disassembler_no_op.h", "disassembler_win32.cc", @@ -61,6 +63,7 @@ "target_pool.h", "targets_affinity.cc", "targets_affinity.h", + "type_dex.h", "type_win_pe.h", "typed_value.h", "zucchini.h",
diff --git a/components/zucchini/buffer_view.h b/components/zucchini/buffer_view.h index a7dfd17..8dbe817e 100644 --- a/components/zucchini/buffer_view.h +++ b/components/zucchini/buffer_view.h
@@ -105,6 +105,14 @@ return region.FitsIn(size()); } + // Returns whether the buffer is large enough to cover an array starting at + // |offset| with |num| elements, each taking |elt_size| bytes. + bool covers_array(size_t offset, size_t num, size_t elt_size) { + DCHECK_GT(elt_size, 0U); + // Use subtraction and division to avoid overflow. + return offset < size() && (size() - offset) / elt_size >= num; + } + // Element access // Returns the raw value at specified location |pos|.
diff --git a/components/zucchini/buffer_view_unittest.cc b/components/zucchini/buffer_view_unittest.cc index cfb3d9b..1d3ccb85 100644 --- a/components/zucchini/buffer_view_unittest.cc +++ b/components/zucchini/buffer_view_unittest.cc
@@ -176,6 +176,40 @@ EXPECT_FALSE(view.covers({size_t(-1), size_t(-1)})); } +TEST_F(BufferViewTest, CoversArray) { + ConstBufferView view(bytes_.data(), bytes_.size()); + + for (uint32_t i = 1; i <= bytes_.size(); ++i) { + EXPECT_TRUE(view.covers_array(0, 1, i)); + EXPECT_TRUE(view.covers_array(0, i, 1)); + EXPECT_TRUE(view.covers_array(0, i, bytes_.size() / i)); + EXPECT_TRUE(view.covers_array(0, bytes_.size() / i, i)); + if (i < bytes_.size()) { + EXPECT_TRUE(view.covers_array(i, 1, bytes_.size() - i)); + EXPECT_TRUE(view.covers_array(i, bytes_.size() - i, 1)); + } + EXPECT_TRUE(view.covers_array(bytes_.size() - (bytes_.size() / i) * i, 1, + bytes_.size() / i)); + } + + EXPECT_TRUE(view.covers_array(0, 0, bytes_.size())); + EXPECT_TRUE(view.covers_array(bytes_.size() - 1, 0, bytes_.size())); + EXPECT_FALSE(view.covers_array(bytes_.size(), 0, bytes_.size())); + EXPECT_TRUE(view.covers_array(0, 0, 0x10000)); + EXPECT_TRUE(view.covers_array(bytes_.size() - 1, 0, 0x10000)); + EXPECT_FALSE(view.covers_array(bytes_.size(), 0, 0x10000)); + + EXPECT_FALSE(view.covers_array(0, 1, bytes_.size() + 1)); + EXPECT_FALSE(view.covers_array(0, 2, bytes_.size())); + EXPECT_FALSE(view.covers_array(0, bytes_.size() + 11, 1)); + EXPECT_FALSE(view.covers_array(0, bytes_.size(), 2)); + EXPECT_FALSE(view.covers_array(1, bytes_.size(), 1)); + + EXPECT_FALSE(view.covers_array(bytes_.size(), 1, 1)); + EXPECT_FALSE(view.covers_array(bytes_.size(), 0, 1)); + EXPECT_FALSE(view.covers_array(0, 0x10000, 0x10000)); +} + TEST_F(BufferViewTest, Equals) { // Almost identical to |bytes_|, except at 2 places: v v std::vector<uint8_t> bytes2 = ParseHexString("10 32 54 76 98 AB CD FE 10 00");
diff --git a/components/zucchini/disassembler_dex.cc b/components/zucchini/disassembler_dex.cc new file mode 100644 index 0000000..23198cc --- /dev/null +++ b/components/zucchini/disassembler_dex.cc
@@ -0,0 +1,307 @@ +// Copyright 2018 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 "components/zucchini/disassembler_dex.h" + +#include <cmath> +#include <set> +#include <utility> + +#include "base/logging.h" +#include "base/numerics/safe_conversions.h" +#include "base/strings/stringprintf.h" +#include "components/zucchini/buffer_source.h" +#include "components/zucchini/buffer_view.h" + +namespace zucchini { + +namespace { + +// Size of a Dalvik instruction unit. Need to cast to signed int because +// sizeof() gives size_t, which dominates when operated on ptrdiff_t, then +// wrecks havoc for base::checked_cast<int16_t>(). +constexpr int kInstrUnitSize = static_cast<int>(sizeof(uint16_t)); + +// Buffer for ReadDexHeader() to optionally return results. +struct ReadDexHeaderResults { + BufferSource source; + const dex::HeaderItem* header; + int dex_version; +}; + +// Returns whether |image| points to a DEX file. If this is a possibility and +// |opt_results| is not null, then uses it to pass extracted data to enable +// further parsing. +bool ReadDexHeader(ConstBufferView image, ReadDexHeaderResults* opt_results) { + // This part needs to be fairly efficient since it may be called many times. + BufferSource source(image); + const dex::HeaderItem* header = source.GetPointer<dex::HeaderItem>(); + if (!header) + return false; + if (header->magic[0] != 'd' || header->magic[1] != 'e' || + header->magic[2] != 'x' || header->magic[3] != '\n' || + header->magic[7] != '\0') { + return false; + } + + // Magic matches: More detailed tests can be conducted. + int dex_version = 0; + for (int i = 4; i < 7; ++i) { + if (!isdigit(header->magic[i])) + return false; + dex_version = dex_version * 10 + (header->magic[i] - '0'); + } + if (dex_version != 35 && dex_version != 37) + return false; + + if (header->file_size > image.size() || + header->file_size < sizeof(dex::HeaderItem) || + header->map_off < sizeof(dex::HeaderItem)) { + return false; + } + + if (opt_results) + *opt_results = {source, header, dex_version}; + return true; +} + +} // namespace + +/******** CodeItemParser ********/ + +// A parser to extract successive code items from a DEX image whose header has +// been parsed. +class CodeItemParser { + public: + using size_type = BufferSource::size_type; + + explicit CodeItemParser(ConstBufferView image) : image_(image) {} + + // Initializes the parser, returns true on success and false on error. + bool Init(const dex::MapItem& code_map_item) { + // Sanity check to quickly fail if |code_map_item.offset| or + // |code_map_item.size| is too large. This is a heuristic because code item + // sizes need to be parsed (sizeof(dex::CodeItem) is a lower bound). + if (!image_.covers_array(code_map_item.offset, code_map_item.size, + sizeof(dex::CodeItem))) { + return false; + } + source_ = std::move(BufferSource(image_).Skip(code_map_item.offset)); + return true; + } + + // Extracts the header of the next code item, and skips the variable-length + // data. Returns the offset of the code item if successful. Otherwise returns + // kInvalidOffset, and thereafter the parser becomes valid. For reference, + // here's a pseudo-struct of a complete code item: + // + // struct code_item { + // // 4-byte aligned here. + // // 16-byte header defined (dex::CodeItem). + // uint16_t registers_size; + // uint16_t ins_size; + // uint16_t outs_size; + // uint16_t tries_size; + // uint32_t debug_info_off; + // uint32_t insns_size; + // + // // Variable-length data follow. + // uint16_t insns[insns_size]; // Instruction bytes. + // uint16_t padding[(tries_size > 0 && insns_size % 2 == 1) ? 1 : 0]; + // + // if (tries_size > 0) { + // // 4-byte aligned here. + // struct try_item { // dex::TryItem. + // uint32_t start_addr; + // uint16_t insn_count; + // uint16_t handler_off; + // } tries[tries_size]; + // + // struct encoded_catch_handler_list { + // uleb128 handlers_size; + // struct encoded_catch_handler { + // sleb128 encoded_catch_handler_size; + // struct encoded_type_addr_pair { + // uleb128 type_idx; + // uleb128 addr; + // } handlers[abs(encoded_catch_handler_size)]; + // if (encoded_catch_handler_size <= 0) { + // uleb128 catch_all_addr; + // } + // } handlers_list[handlers_size]; + // } handlers_group; // Confusingly called "handlers" in DEX doc. + // } + // + // // Padding to 4-bytes align next code_item *only if more exist*. + // } + offset_t GetNext() { + // Read header CodeItem. + if (!source_.AlignOn(image_, 4U)) + return kInvalidOffset; + const offset_t code_item_offset = + base::checked_cast<offset_t>(source_.begin() - image_.begin()); + const auto* code_item = source_.GetPointer<const dex::CodeItem>(); + if (!code_item) + return kInvalidOffset; + DCHECK_EQ(0U, code_item_offset % 4U); + + // Skip instruction bytes. + if (!source_.GetArray<uint16_t>(code_item->insns_size)) + return kInvalidOffset; + // Skip padding if present. + if (code_item->tries_size > 0 && !source_.AlignOn(image_, 4U)) + return kInvalidOffset; + + // Skip tries[] and handlers_group to arrive at the next code item. Parsing + // is nontrivial due to use of uleb128 / sleb128. + if (code_item->tries_size > 0) { + // Skip (try_item) tries[]. + if (!source_.GetArray<dex::TryItem>(code_item->tries_size)) + return kInvalidOffset; + + // Skip handlers_group. + uint32_t handlers_size = 0; + if (!source_.GetUleb128(&handlers_size)) + return kInvalidOffset; + // Sanity check to quickly reject excessively large |handlers_size|. + if (source_.Remaining() < static_cast<size_type>(handlers_size)) + return kInvalidOffset; + + // Skip (encoded_catch_handler) handlers_list[]. + for (uint32_t k = 0; k < handlers_size; ++k) { + int32_t encoded_catch_handler_size = 0; + if (!source_.GetSleb128(&encoded_catch_handler_size)) + return kInvalidOffset; + const size_type abs_size = std::abs(encoded_catch_handler_size); + if (source_.Remaining() < abs_size) // Sanity check. + return kInvalidOffset; + // Skip (encoded_type_addr_pair) handlers[]. + for (size_type j = 0; j < abs_size; ++j) { + if (!source_.SkipLeb128() || !source_.SkipLeb128()) + return kInvalidOffset; + } + // Skip catch_all_addr. + if (encoded_catch_handler_size <= 0) { + if (!source_.SkipLeb128()) + return kInvalidOffset; + } + } + } + // Success! |code_item->insns_size| is validated, but its content is still + // considered unsafe and requires validation. + return code_item_offset; + } + + // Given |code_item_offset| that points to the start of a valid code item in + // |image|, returns |insns| bytes as ConstBufferView. + static ConstBufferView GetCodeItemInsns(ConstBufferView image, + offset_t code_item_offset) { + BufferSource source(BufferSource(image).Skip(code_item_offset)); + const auto* code_item = source.GetPointer<const dex::CodeItem>(); + DCHECK(code_item); + BufferRegion insns{0, code_item->insns_size * kInstrUnitSize}; + DCHECK(source.covers(insns)); + return source[insns]; + } + + private: + ConstBufferView image_; + BufferSource source_; +}; + +/******** DisassemblerDex ********/ + +DisassemblerDex::DisassemblerDex() : Disassembler(4) {} + +DisassemblerDex::~DisassemblerDex() = default; + +// static. +bool DisassemblerDex::QuickDetect(ConstBufferView image) { + return ReadDexHeader(image, nullptr); +} + +ExecutableType DisassemblerDex::GetExeType() const { + return kExeTypeDex; +} + +std::string DisassemblerDex::GetExeTypeString() const { + return base::StringPrintf("DEX (version %d)", dex_version_); +} + +std::vector<ReferenceGroup> DisassemblerDex::MakeReferenceGroups() const { + return {}; +} + +bool DisassemblerDex::Parse(ConstBufferView image) { + image_ = image; + return ParseHeader(); +} + +bool DisassemblerDex::ParseHeader() { + ReadDexHeaderResults results; + if (!ReadDexHeader(image_, &results)) + return false; + + header_ = results.header; + dex_version_ = results.dex_version; + BufferSource source = results.source; + + // DEX header contains file size, so use it to resize |image_| right away. + image_.shrink(header_->file_size); + + // Read map list. This is not a fixed-size array, so instead of reading + // MapList directly, read |MapList::size| first, then visit elements in + // |MapList::list|. + static_assert( + offsetof(dex::MapList, list) == sizeof(decltype(dex::MapList::size)), + "MapList size error."); + source = std::move(BufferSource(image_).Skip(header_->map_off)); + decltype(dex::MapList::size) list_size = 0; + if (!source.GetValue(&list_size) || list_size > dex::kMaxItemListSize) + return false; + const auto* item_list = source.GetArray<const dex::MapItem>(list_size); + if (!item_list) + return false; + + // Read and validate map list, ensuring that required item types are present. + std::set<uint16_t> required_item_types = { + dex::kTypeStringIdItem, dex::kTypeTypeIdItem, dex::kTypeFieldIdItem, + dex::kTypeMethodIdItem, dex::kTypeCodeItem}; + for (offset_t i = 0; i < list_size; ++i) { + const dex::MapItem* item = &item_list[i]; + // Sanity check to reject unreasonably large |item->size|. + // TODO(huangs): Implement a more stringent check. + if (!image_.covers({item->offset, item->size})) + return false; + if (!map_item_map_.insert(std::make_pair(item->type, item)).second) + return false; // A given type must appear at most once. + required_item_types.erase(item->type); + } + if (!required_item_types.empty()) + return false; + + // Make local copies of main map items. + string_map_item_ = *map_item_map_[dex::kTypeStringIdItem]; + type_map_item_ = *map_item_map_[dex::kTypeTypeIdItem]; + field_map_item_ = *map_item_map_[dex::kTypeFieldIdItem]; + method_map_item_ = *map_item_map_[dex::kTypeMethodIdItem]; + code_map_item_ = *map_item_map_[dex::kTypeCodeItem]; + + // Iteratively extract variable-length code items blocks. Any failure would + // indicate invalid DEX. Success indicates that no structural problem is + // found. However, contained instructions still need validation on use. + CodeItemParser code_item_parser(image_); + if (!code_item_parser.Init(code_map_item_)) + return false; + code_item_offsets_.resize(code_map_item_.size); + for (size_t i = 0; i < code_map_item_.size; ++i) { + const offset_t code_item_offset = code_item_parser.GetNext(); + if (code_item_offset == kInvalidOffset) + return false; + code_item_offsets_[i] = code_item_offset; + } + return true; +} + +} // namespace zucchini
diff --git a/components/zucchini/disassembler_dex.h b/components/zucchini/disassembler_dex.h new file mode 100644 index 0000000..7bbe5d10 --- /dev/null +++ b/components/zucchini/disassembler_dex.h
@@ -0,0 +1,65 @@ +// Copyright 2018 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 COMPONENTS_ZUCCHINI_DISASSEMBLER_DEX_H_ +#define COMPONENTS_ZUCCHINI_DISASSEMBLER_DEX_H_ + +#include <stdint.h> + +#include <map> +#include <string> +#include <vector> + +#include "base/macros.h" +#include "components/zucchini/disassembler.h" +#include "components/zucchini/image_utils.h" +#include "components/zucchini/type_dex.h" + +namespace zucchini { + +// For consistency, let "canonical order" of DEX data types be the order defined +// in https://source.android.com/devices/tech/dalvik/dex-format "Type Codes" +// section. + +class DisassemblerDex : public Disassembler { + public: + DisassemblerDex(); + ~DisassemblerDex() override; + + // Applies quick checks to determine if |image| *may* point to the start of an + // executable. Returns true on success. + static bool QuickDetect(ConstBufferView image); + + // Disassembler: + ExecutableType GetExeType() const override; + std::string GetExeTypeString() const override; + std::vector<ReferenceGroup> MakeReferenceGroups() const override; + + private: + friend Disassembler; + using MapItemMap = std::map<uint16_t, const dex::MapItem*>; + + // Disassembler: + bool Parse(ConstBufferView image) override; + + bool ParseHeader(); + + const dex::HeaderItem* header_ = nullptr; + int dex_version_ = 0; + MapItemMap map_item_map_ = {}; + dex::MapItem string_map_item_ = {}; + dex::MapItem type_map_item_ = {}; + dex::MapItem field_map_item_ = {}; + dex::MapItem method_map_item_ = {}; + dex::MapItem code_map_item_ = {}; + + // Sorted list of offsets of code items in |image_|. + std::vector<offset_t> code_item_offsets_; + + DISALLOW_COPY_AND_ASSIGN(DisassemblerDex); +}; + +} // namespace zucchini + +#endif // COMPONENTS_ZUCCHINI_DISASSEMBLER_DEX_H_
diff --git a/components/zucchini/element_detection.cc b/components/zucchini/element_detection.cc index d6bba5fd..2fa3604 100644 --- a/components/zucchini/element_detection.cc +++ b/components/zucchini/element_detection.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "components/zucchini/disassembler.h" +#include "components/zucchini/disassembler_dex.h" #include "components/zucchini/disassembler_no_op.h" #include "components/zucchini/disassembler_win32.h" @@ -36,6 +37,12 @@ return disasm; } + if (DisassemblerDex::QuickDetect(image)) { + auto disasm = Disassembler::Make<DisassemblerDex>(image); + if (disasm && disasm->size() >= kMinProgramSize) + return disasm; + } + return nullptr; } @@ -46,6 +53,8 @@ return Disassembler::Make<DisassemblerWin32X86>(image); case kExeTypeWin32X64: return Disassembler::Make<DisassemblerWin32X64>(image); + case kExeTypeDex: + return Disassembler::Make<DisassemblerDex>(image); case kExeTypeNoOp: return Disassembler::Make<DisassemblerNoOp>(image); default:
diff --git a/components/zucchini/ensemble_matcher.cc b/components/zucchini/ensemble_matcher.cc index eebbae9b..37a7af9 100644 --- a/components/zucchini/ensemble_matcher.cc +++ b/components/zucchini/ensemble_matcher.cc
@@ -4,6 +4,7 @@ #include "components/zucchini/ensemble_matcher.h" +#include <algorithm> #include <limits> #include "base/logging.h" @@ -18,7 +19,21 @@ EnsembleMatcher::~EnsembleMatcher() = default; void EnsembleMatcher::Trim() { - // TODO(huangs): Add MultiDex handling logic when we add DEX support. + // Trim rule: If > 1 DEX files are found then ignore all DEX. This is done + // because we do not yet support MultiDex, under which contents can move + // across file boundary between "old" and "new" archives. When this occurs, + // forcing matches of DEX files and patching them separately can result in + // larger patches than naive patching. + auto is_match_dex = [](const ElementMatch& match) { + return match.exe_type() == kExeTypeDex; + }; + auto num_dex = std::count_if(matches_.begin(), matches_.end(), is_match_dex); + if (num_dex > 1) { + LOG(WARNING) << "Found " << num_dex << " DEX: Ignoring all."; + matches_.erase( + std::remove_if(matches_.begin(), matches_.end(), is_match_dex), + matches_.end()); + } } } // namespace zucchini
diff --git a/components/zucchini/type_dex.h b/components/zucchini/type_dex.h new file mode 100644 index 0000000..508d331 --- /dev/null +++ b/components/zucchini/type_dex.h
@@ -0,0 +1,261 @@ +// Copyright 2018 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 COMPONENTS_ZUCCHINI_TYPE_DEX_H_ +#define COMPONENTS_ZUCCHINI_TYPE_DEX_H_ + +#include <stdint.h> + +namespace zucchini { +namespace dex { +// Contains types that models DEX executable format data structures. +// See https://source.android.com/devices/tech/dalvik/dex-format + +// The supported versions are 035 and 037. + +enum class FormatId : uint8_t { + b, // 22b. + c, // 21c, 22c, 31c, 35c, 3rc. + h, // 21h. + i, // 31i. + l, // 51l. + n, // 11n. + s, // 21s, 22s. + t, // 10t, 20t, 21t, 22t, 30t, 31t. + x, // 10x, 11x, 12x, 22x, 23x, 32x. +}; + +struct Instruction { + Instruction() = default; + constexpr Instruction(uint8_t opcode_in, + uint8_t layout_in, + FormatId format_in, + uint8_t variant_in = 1) + : opcode(opcode_in), + layout(layout_in), + format(format_in), + variant(variant_in) {} + + // The opcode that identifies the instruction. + uint8_t opcode; + // Number of uint16_t units for the instruction. + uint8_t layout; + // Identifier that groups similar instructions, as quick filter. + FormatId format; + // Number of successive opcodes that have the same format. + uint8_t variant = 1; +}; + +constexpr Instruction kByteCode[] = { + {0x00, 1, FormatId::x}, + {0x01, 1, FormatId::x}, + {0x02, 2, FormatId::x}, + {0x03, 3, FormatId::x}, + {0x04, 1, FormatId::x}, + {0x05, 2, FormatId::x}, + {0x06, 3, FormatId::x}, + {0x07, 1, FormatId::x}, + {0x08, 2, FormatId::x}, + {0x09, 3, FormatId::x}, + {0x0A, 1, FormatId::x}, + {0x0B, 1, FormatId::x}, + {0x0C, 1, FormatId::x}, + {0x0D, 1, FormatId::x}, + {0x0E, 1, FormatId::x}, + {0x0F, 1, FormatId::x}, + {0x10, 1, FormatId::x}, + {0x11, 1, FormatId::x}, + {0x12, 1, FormatId::n}, + {0x13, 2, FormatId::s}, + {0x14, 3, FormatId::i}, + {0x15, 2, FormatId::h}, + {0x16, 2, FormatId::s}, + {0x17, 3, FormatId::i}, + {0x18, 5, FormatId::l}, + {0x19, 2, FormatId::h}, + {0x1A, 2, FormatId::c}, + {0x1B, 3, FormatId::c}, + {0x1C, 2, FormatId::c}, + {0x1D, 1, FormatId::x}, + {0x1E, 1, FormatId::x}, + {0x1F, 2, FormatId::c}, + {0x20, 2, FormatId::c}, + {0x21, 1, FormatId::x}, + {0x22, 2, FormatId::c}, + {0x23, 2, FormatId::c}, + {0x24, 3, FormatId::c}, + {0x25, 3, FormatId::c}, + {0x26, 3, FormatId::t}, + {0x27, 1, FormatId::x}, + {0x28, 1, FormatId::t}, + {0x29, 2, FormatId::t}, + {0x2A, 3, FormatId::t}, + {0x2B, 3, FormatId::t}, + {0x2C, 3, FormatId::t}, + {0x2D, 2, FormatId::x, 5}, + {0x32, 2, FormatId::t, 6}, + {0x38, 2, FormatId::t, 6}, + // {0x3E, 1, FormatId::x, 6}, unused + {0x44, 2, FormatId::x, 14}, + {0x52, 2, FormatId::c, 14}, + {0x60, 2, FormatId::c, 14}, + {0x6E, 3, FormatId::c, 5}, + // {0x73, 1, FormatId::x}, unused + {0x74, 3, FormatId::c, 5}, + // {0x79, 1, FormatId::x, 2}, unused + {0x7B, 1, FormatId::x, 21}, + {0x90, 2, FormatId::x, 32}, + {0xB0, 1, FormatId::x, 32}, + {0xD0, 2, FormatId::s, 8}, + {0xD8, 2, FormatId::b, 11}, + // {0xE3, 1, FormatId::x, 29}, unused +}; + +// Supported by MSVC, g++, and clang++. Ensures no gaps in packing. +#pragma pack(push, 1) + +// header_item: Appears in the header section. +struct HeaderItem { + uint8_t magic[8]; + uint32_t checksum; + uint8_t signature[20]; + uint32_t file_size; + uint32_t header_size; + uint32_t endian_tag; + uint32_t link_size; + uint32_t link_off; + uint32_t map_off; + uint32_t string_ids_size; + uint32_t string_ids_off; + uint32_t type_ids_size; + uint32_t type_ids_off; + uint32_t proto_ids_size; + uint32_t proto_ids_off; + uint32_t field_ids_size; + uint32_t field_ids_off; + uint32_t method_ids_size; + uint32_t method_ids_off; + uint32_t class_defs_size; + uint32_t class_defs_off; + uint32_t data_size; + uint32_t data_off; +}; + +// string_id_item: String identifiers list. +struct StringIdItem { + uint32_t string_data_off; +}; + +// type_id_item: Type identifiers list. +struct TypeIdItem { + uint32_t descriptor_idx; +}; + +// proto_id_item: Method prototype identifiers list. +struct ProtoIdItem { + uint32_t shorty_idx; + uint32_t return_type_idx; + uint32_t parameters_off; +}; + +// field_id_item: Field identifiers list. +struct FieldIdItem { + uint16_t class_idx; + uint16_t type_idx; + uint32_t name_idx; +}; + +// method_id_item: Method identifiers list. +struct MethodIdItem { + uint16_t class_idx; + uint16_t proto_idx; + uint32_t name_idx; +}; + +// class_def_item: Class definitions list. +struct ClassDefItem { + uint32_t class_idx; + uint32_t access_flags; + uint32_t superclass_idx; + uint32_t interfaces_off; + uint32_t source_file_idx; + uint32_t annotations_off; + uint32_t class_data_off; + uint32_t static_values_off; +}; + +// code_item: Header of a code item. +struct CodeItem { + uint16_t registers_size; + uint16_t ins_size; + uint16_t outs_size; + uint16_t tries_size; + uint32_t debug_info_off; + uint32_t insns_size; + // Variable length data follow for complete code item. +}; + +constexpr uint32_t kMaxItemListSize = 18; + +// map_item +struct MapItem { + uint16_t type; + uint16_t unused; + uint32_t size; + uint32_t offset; +}; + +// map_list +struct MapList { + uint32_t size; + MapItem list[kMaxItemListSize]; +}; + +// type_item +struct TypeItem { + uint16_t type_idx; +}; + +// annotation_set_ref_item +struct AnnotationSetRefItem { + uint32_t annotations_off; +}; + +// annotation_off_item +struct AnnotationOffItem { + uint32_t annotation_off; +}; + +// try_item +struct TryItem { + uint32_t start_addr; + uint16_t insn_count; + uint16_t handler_off; +}; + +constexpr uint16_t kTypeHeaderItem = 0x0000; +constexpr uint16_t kTypeStringIdItem = 0x0001; +constexpr uint16_t kTypeTypeIdItem = 0x0002; +constexpr uint16_t kTypeProtoIdItem = 0x0003; +constexpr uint16_t kTypeFieldIdItem = 0x0004; +constexpr uint16_t kTypeMethodIdItem = 0x0005; +constexpr uint16_t kTypeClassDefItem = 0x0006; +constexpr uint16_t kTypeMapList = 0x1000; +constexpr uint16_t kTypeTypeList = 0x1001; +constexpr uint16_t kTypeAnnotationSetRefList = 0x1002; +constexpr uint16_t kTypeAnnotationSetItem = 0x1003; +constexpr uint16_t kTypeClassDataItem = 0x2000; +constexpr uint16_t kTypeCodeItem = 0x2001; +constexpr uint16_t kTypeStringDataItem = 0x2002; +constexpr uint16_t kTypeDebugInfoItem = 0x2003; +constexpr uint16_t kTypeAnnotationItem = 0x2004; +constexpr uint16_t kTypeEncodedArrayItem = 0x2005; +constexpr uint16_t kTypeAnnotationsDirectoryItem = 0x2006; + +#pragma pack(pop) + +} // namespace dex +} // namespace zucchini + +#endif // COMPONENTS_ZUCCHINI_TYPE_DEX_H_
diff --git a/content/browser/browser_process_sub_thread.cc b/content/browser/browser_process_sub_thread.cc index 3d931096..0902fb6 100644 --- a/content/browser/browser_process_sub_thread.cc +++ b/content/browser/browser_process_sub_thread.cc
@@ -144,13 +144,13 @@ MSVC_DISABLE_OPTIMIZE() MSVC_PUSH_DISABLE_WARNING(4748) -void BrowserProcessSubThread::UIThreadRun(base::RunLoop* run_loop) { +NOINLINE void BrowserProcessSubThread::UIThreadRun(base::RunLoop* run_loop) { const int line_number = __LINE__; Thread::Run(run_loop); base::debug::Alias(&line_number); } -void BrowserProcessSubThread::IOThreadRun(base::RunLoop* run_loop) { +NOINLINE void BrowserProcessSubThread::IOThreadRun(base::RunLoop* run_loop) { const int line_number = __LINE__; Thread::Run(run_loop); base::debug::Alias(&line_number);
diff --git a/content/browser/frame_host/frame_tree_unittest.cc b/content/browser/frame_host/frame_tree_unittest.cc index 075bca8..e3613842 100644 --- a/content/browser/frame_host/frame_tree_unittest.cc +++ b/content/browser/frame_host/frame_tree_unittest.cc
@@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors.All rights reserved. +// Copyright 2013 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. @@ -310,7 +310,8 @@ } // Ensure frames can be found by frame_tree_node_id, routing ID, or name. -TEST_F(FrameTreeTest, FindFrames) { +// Disabled due to flakiness: http://crbug.com/826599 +TEST_F(FrameTreeTest, DISABLED_FindFrames) { main_test_rfh()->InitializeRenderFrameIfNeeded(); // Add a few child frames to the main frame.
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc index c4ef2b4..5567359d3 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc
@@ -10,6 +10,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" +#include "build/build_config.h" #include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/public/common/content_features.h" #include "content/public/test/test_browser_thread.h" @@ -95,7 +96,22 @@ expected->video_type == arg.video_type; } -TEST_F(MediaStreamUIProxyTest, Deny) { +// These tests are flaky on Linux. https://crbug.com/826483 +#if defined(OS_LINUX) +#define MAYBE_DeleteBeforeAccepted DISABLED_DeleteBeforeAccepted +#define MAYBE_Deny DISABLED_Deny +#define MAYBE_AcceptAndStart DISABLED_AcceptAndStart +#define MAYBE_StopFromUI DISABLED_StopFromUI +#define MAYBE_WindowIdCallbackCalled DISABLED_WindowIdCallbackCalled +#else +#define MAYBE_DeleteBeforeAccepted DeleteBeforeAccepted +#define MAYBE_Deny Deny +#define MAYBE_AcceptAndStart AcceptAndStart +#define MAYBE_StopFromUI StopFromUI +#define MAYBE_WindowIdCallbackCalled WindowIdCallbackCalled +#endif + +TEST_F(MediaStreamUIProxyTest, MAYBE_Deny) { std::unique_ptr<MediaStreamRequest> request(new MediaStreamRequest( 0, 0, 0, GURL("http://origin/"), false, MEDIA_GENERATE_STREAM, std::string(), std::string(), MEDIA_DEVICE_AUDIO_CAPTURE, @@ -123,7 +139,7 @@ EXPECT_TRUE(response.empty()); } -TEST_F(MediaStreamUIProxyTest, AcceptAndStart) { +TEST_F(MediaStreamUIProxyTest, MAYBE_AcceptAndStart) { std::unique_ptr<MediaStreamRequest> request(new MediaStreamRequest( 0, 0, 0, GURL("http://origin/"), false, MEDIA_GENERATE_STREAM, std::string(), std::string(), MEDIA_DEVICE_AUDIO_CAPTURE, @@ -159,7 +175,7 @@ } // Verify that the proxy can be deleted before the request is processed. -TEST_F(MediaStreamUIProxyTest, DeleteBeforeAccepted) { +TEST_F(MediaStreamUIProxyTest, MAYBE_DeleteBeforeAccepted) { std::unique_ptr<MediaStreamRequest> request(new MediaStreamRequest( 0, 0, 0, GURL("http://origin/"), false, MEDIA_GENERATE_STREAM, std::string(), std::string(), MEDIA_DEVICE_AUDIO_CAPTURE, @@ -183,7 +199,7 @@ callback.Run(devices, MEDIA_DEVICE_OK, std::move(ui)); } -TEST_F(MediaStreamUIProxyTest, StopFromUI) { +TEST_F(MediaStreamUIProxyTest, MAYBE_StopFromUI) { std::unique_ptr<MediaStreamRequest> request(new MediaStreamRequest( 0, 0, 0, GURL("http://origin/"), false, MEDIA_GENERATE_STREAM, std::string(), std::string(), MEDIA_DEVICE_AUDIO_CAPTURE, @@ -229,7 +245,7 @@ base::RunLoop().RunUntilIdle(); } -TEST_F(MediaStreamUIProxyTest, WindowIdCallbackCalled) { +TEST_F(MediaStreamUIProxyTest, MAYBE_WindowIdCallbackCalled) { std::unique_ptr<MediaStreamRequest> request(new MediaStreamRequest( 0, 0, 0, GURL("http://origin/"), false, MEDIA_GENERATE_STREAM, std::string(), std::string(), MEDIA_NO_SERVICE,
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc index 5786d95c..a892fe9 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.cc +++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -9,6 +9,7 @@ #include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/stringprintf.h" #include "components/viz/common/features.h" #include "components/viz/common/quads/surface_draw_quad.h" #include "components/viz/host/host_frame_sink_manager.h" @@ -1077,6 +1078,11 @@ const blink::WebGestureEvent& gesture_event, const ui::LatencyInfo& latency, const base::Optional<gfx::PointF>& target_location) { + // Temporary logging for https://crbug.com/824774. + static auto* target_source_key = base::debug::AllocateCrashKeyString( + "touchscreen-gesture-target-source", base::debug::CrashKeySize::Size32); + base::debug::SetCrashKeyString(target_source_key, "input"); + if (gesture_event.GetType() == blink::WebInputEvent::kGesturePinchBegin) { in_touchscreen_gesture_pinch_ = true; // If the root view wasn't already receiving the gesture stream, then we @@ -1134,6 +1140,7 @@ // RenderWidgetTargeter. These gesture events should always have a // unique_touch_event_id of 0. touchscreen_gesture_target_.target = target; + base::debug::SetCrashKeyString(target_source_key, "touch_id=0"); DCHECK(target_location.has_value()); touchscreen_gesture_target_.delta = target_location.value() - gesture_event.PositionInWidget(); @@ -1158,6 +1165,7 @@ // don't worry about the fact we're ignoring |result.should_query_view|, as // this is the best we can do until we fix https://crbug.com/595422. touchscreen_gesture_target_.target = result.view; + base::debug::SetCrashKeyString(target_source_key, "no_matching_id"); touchscreen_gesture_target_.delta = transformed_point - original_point; } else if (is_gesture_start) { touchscreen_gesture_target_ = gesture_target_it->second; @@ -1183,6 +1191,12 @@ blink::WebGestureEvent event(gesture_event); event.SetPositionInWidget(event.PositionInWidget() + touchscreen_gesture_target_.delta); + // Temporary logging for https://crbug.com/824774. + static auto* target_ptr_key = base::debug::AllocateCrashKeyString( + "touchscreen-gesture-target-ptr", base::debug::CrashKeySize::Size64); + base::debug::SetCrashKeyString( + target_ptr_key, + base::StringPrintf("%p", touchscreen_gesture_target_.target)); touchscreen_gesture_target_.target->ProcessGestureEvent(event, latency); }
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 1bc228d..78dec3a 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -2129,6 +2129,9 @@ float x1, float y1) { SetTextHandlesHiddenForStylus(true); + // TODO(ajith.v) Refactor the event names as this is not really handle drag, + // but currently we use same for long press drag selection as well. + OnSelectionEvent(ui::SELECTION_HANDLE_DRAG_STARTED); SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); } @@ -2138,7 +2141,9 @@ void RenderWidgetHostViewAndroid::OnStylusSelectEnd(float x, float y) { SetTextHandlesHiddenForStylus(false); - ShowContextMenuAtPoint(gfx::Point(x, y), ui::MENU_SOURCE_STYLUS); + // TODO(ajith.v) Refactor the event names as this is not really handle drag, + // but currently we use same for long press drag selection as well. + OnSelectionEvent(ui::SELECTION_HANDLE_DRAG_STOPPED); } void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time,
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index f0f9e07..37f058c 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -2031,33 +2031,42 @@ IN_PROC_BROWSER_TEST_P( SitePerProcessMouseWheelHitTestBrowserTestWheelScrollLatchingDisabled, - SubframeWheelEventsOnMainThread) { + MultipleSubframeWheelEventsOnMainThread) { GURL main_url(embedded_test_server()->GetURL( - "/frame_tree/page_with_positioned_nested_frames.html")); + "/frame_tree/page_with_two_positioned_frames.html")); EXPECT_TRUE(NavigateToURL(shell(), main_url)); FrameTreeNode* root = web_contents()->GetFrameTree()->root(); - ASSERT_EQ(1U, root->child_count()); + ASSERT_EQ(2U, root->child_count()); GURL frame_url(embedded_test_server()->GetURL( "b.com", "/page_with_scrollable_div.html")); + // To test for https://bugs.chromium.org/p/chromium/issues/detail?id=820232 + // it's important that both subframes are in the same renderer process, so + // we load the same URL in each case. NavigateFrameToURL(root->child_at(0), frame_url); + NavigateFrameToURL(root->child_at(1), frame_url); - // Synchronize with the child and parent renderers to guarantee that the - // surface information required for event hit testing is ready. - RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( - root->child_at(0)->current_frame_host()->GetView()); + for (int frame_index = 0; frame_index < 2; frame_index++) { + // Synchronize with the child and parent renderers to guarantee that the + // surface information required for event hit testing is ready. + RenderWidgetHostViewBase* child_rwhv = + static_cast<RenderWidgetHostViewBase*>( + root->child_at(frame_index)->current_frame_host()->GetView()); - EXPECT_FALSE(child_rwhv->wheel_scroll_latching_enabled()); - WaitForChildFrameSurfaceReady(root->child_at(0)->current_frame_host()); + EXPECT_FALSE(child_rwhv->wheel_scroll_latching_enabled()); + WaitForChildFrameSurfaceReady( + root->child_at(frame_index)->current_frame_host()); - content::RenderFrameHostImpl* child = root->child_at(0)->current_frame_host(); - SetupWheelAndScrollHandlers(child); + content::RenderFrameHostImpl* child = + root->child_at(frame_index)->current_frame_host(); + SetupWheelAndScrollHandlers(child); - gfx::Rect bounds = child_rwhv->GetViewBounds(); - gfx::Point pos(bounds.x() + 10, bounds.y() + 10); + gfx::Rect bounds = child_rwhv->GetViewBounds(); + gfx::Point pos(bounds.x() + 10, bounds.y() + 10); - RunTest(pos, child_rwhv); + RunTest(pos, child_rwhv); + } } // Verifies that test in SubframeWheelEventsOnMainThread also makes sense for
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 257106a..6b372df7 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -754,7 +754,9 @@ if (interface_name == mojom::RouteProvider::Name_) { DCHECK(!route_provider_binding_.is_bound()); route_provider_binding_.Bind( - mojom::RouteProviderAssociatedRequest(std::move(handle))); + mojom::RouteProviderAssociatedRequest(std::move(handle)), + ipc_task_runner_ ? ipc_task_runner_ + : base::ThreadTaskRunnerHandle::Get()); } else { LOG(ERROR) << "Request for unknown Channel-associated interface: " << interface_name;
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 1dc3c151..d0572cb 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -81,10 +81,6 @@ #if !defined(OS_MACOSX) WebRuntimeFeatures::EnableNotificationContentImage(true); #endif - -#if defined(OS_ANDROID) - WebRuntimeFeatures::EnableDoubleTapToJumpOnVideo(true); -#endif } void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
diff --git a/content/common/associated_interface_provider_impl.cc b/content/common/associated_interface_provider_impl.cc index d587632..ba5ef404 100644 --- a/content/common/associated_interface_provider_impl.cc +++ b/content/common/associated_interface_provider_impl.cc
@@ -12,10 +12,12 @@ class AssociatedInterfaceProviderImpl::LocalProvider : public mojom::AssociatedInterfaceProvider { public: - explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) + LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) : associated_interface_provider_binding_(this) { associated_interface_provider_binding_.Bind( - mojo::MakeRequestAssociatedWithDedicatedPipe(proxy)); + mojo::MakeRequestAssociatedWithDedicatedPipe(proxy), + std::move(task_runner)); } ~LocalProvider() override {} @@ -46,13 +48,16 @@ }; AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl( - mojom::AssociatedInterfaceProviderAssociatedPtr proxy) - : proxy_(std::move(proxy)) { + mojom::AssociatedInterfaceProviderAssociatedPtr proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : proxy_(std::move(proxy)), task_runner_(std::move(task_runner)) { DCHECK(proxy_.is_bound()); } -AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl() - : local_provider_(std::make_unique<LocalProvider>(&proxy_)) {} +AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : local_provider_(std::make_unique<LocalProvider>(&proxy_, task_runner)), + task_runner_(std::move(task_runner)) {} AssociatedInterfaceProviderImpl::~AssociatedInterfaceProviderImpl() {} @@ -69,7 +74,7 @@ if (!local_provider_) { DCHECK(proxy_.is_bound()); proxy_.reset(); - local_provider_ = std::make_unique<LocalProvider>(&proxy_); + local_provider_ = std::make_unique<LocalProvider>(&proxy_, task_runner_); } local_provider_->SetBinderForName(name, binder); }
diff --git a/content/common/associated_interface_provider_impl.h b/content/common/associated_interface_provider_impl.h index b1fca44..acc4686 100644 --- a/content/common/associated_interface_provider_impl.h +++ b/content/common/associated_interface_provider_impl.h
@@ -19,12 +19,21 @@ : public blink::AssociatedInterfaceProvider { public: // Binds this to a remote mojom::AssociatedInterfaceProvider. + // + // |task_runner| must belong to the same thread. It will be used to dispatch + // all callbacks and connection error notification. explicit AssociatedInterfaceProviderImpl( - mojom::AssociatedInterfaceProviderAssociatedPtr proxy); + mojom::AssociatedInterfaceProviderAssociatedPtr proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr); + // Constructs a local provider with no remote interfaces. This is useful in // conjunction with OverrideBinderForTesting(), in test environments where // there may not be a remote |mojom::AssociatedInterfaceProvider| available. - AssociatedInterfaceProviderImpl(); + // + // |task_runner| must belong to the same thread. It will be used to dispatch + // all callbacks and connection error notification. + explicit AssociatedInterfaceProviderImpl( + scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~AssociatedInterfaceProviderImpl() override; // AssociatedInterfaceProvider: @@ -41,6 +50,7 @@ mojom::AssociatedInterfaceProviderAssociatedPtr proxy_; std::unique_ptr<LocalProvider> local_provider_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; DISALLOW_COPY_AND_ASSIGN(AssociatedInterfaceProviderImpl); };
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index b426c4a..af8df2b 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -519,7 +519,7 @@ // Use GpuMemoryBuffer backed VideoFrames in media streams. const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames{ - "WebRTC-UseGpuMemoryBufferVideoFrames", base::FEATURE_ENABLED_BY_DEFAULT}; + "WebRTC-UseGpuMemoryBufferVideoFrames", base::FEATURE_DISABLED_BY_DEFAULT}; // Controls whether the WebUSB API is enabled: // https://wicg.github.io/webusb
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index ffb09b0..4cfa3ac 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -2910,13 +2910,14 @@ mojom::AssociatedInterfaceProviderAssociatedPtr remote_interfaces; thread->GetRemoteRouteProvider()->GetRoute( routing_id_, mojo::MakeRequest(&remote_interfaces)); - remote_associated_interfaces_.reset( - new AssociatedInterfaceProviderImpl(std::move(remote_interfaces))); + remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl( + std::move(remote_interfaces), + GetTaskRunner(blink::TaskType::kInternalIPC))); } else { // In some tests the thread may be null, // so set up a self-contained interface provider instead. - remote_associated_interfaces_.reset( - new AssociatedInterfaceProviderImpl()); + remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl( + GetTaskRunner(blink::TaskType::kInternalIPC))); } } return remote_associated_interfaces_.get();
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index d2e9f5d..4a708d2 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -2535,6 +2535,10 @@ } void RenderWidget::HasTouchEventHandlers(bool has_handlers) { + if (has_touch_handlers_ && *has_touch_handlers_ == has_handlers) + return; + + has_touch_handlers_ = has_handlers; if (render_widget_scheduling_state_) render_widget_scheduling_state_->SetHasTouchHandler(has_handlers); Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers));
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index b97c5fb..94d077a 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -989,6 +989,11 @@ gfx::Rect viewport_intersection_; gfx::Rect compositor_visible_rect_; + // Cache whether or not we have touch handlers, to reduce IPCs sent. + // Different consumers in the browser process makes different assumptions, so + // must always send the first IPC regardless of value. + base::Optional<bool> has_touch_handlers_; + base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(RenderWidget);
diff --git a/content/shell/browser/layout_test/fake_bluetooth_chooser.cc b/content/shell/browser/layout_test/fake_bluetooth_chooser.cc index 3954286..b1070662 100644 --- a/content/shell/browser/layout_test/fake_bluetooth_chooser.cc +++ b/content/shell/browser/layout_test/fake_bluetooth_chooser.cc
@@ -41,30 +41,35 @@ } void FakeBluetoothChooser::SelectPeripheral( - const std::string& peripheral_address) { - event_handler_.Run(BluetoothChooser::Event::SELECTED, peripheral_address); + const std::string& peripheral_address, + SelectPeripheralCallback callback) { + // TODO(https://crbug.com/719826): Record the event and send a + // BluetoothChooser::SELECTED event to |event_handler_|. + NOTREACHED(); } -void FakeBluetoothChooser::Cancel() { - // TODO(https://crbug.com/719826): Run |event_handler_| with - // BluetoothChooser::CANCELLED. +void FakeBluetoothChooser::Cancel(CancelCallback callback) { + // TODO(https://crbug.com/719826): Record the event and send a + // BluetoothChooser::CANCELLED event to |event_handler_|. NOTREACHED(); } void FakeBluetoothChooser::Rescan(RescanCallback callback) { - // TODO(https://crbug.com/719826): Run |event_handler_| with - // BluetoothChooser::RESCAN. + // TODO(https://crbug.com/719826): Record the event and send a + // BluetoothChooser::RESCAN event to |event_handler_|. NOTREACHED(); } // BluetoothChooser overrides void FakeBluetoothChooser::SetAdapterPresence(AdapterPresence presence) { - // TODO(https://crbug.com/719826): Send the event to the client. + // TODO(https://crbug.com/719826): Record the event. + NOTREACHED(); } void FakeBluetoothChooser::ShowDiscoveryState(DiscoveryState state) { - // TODO(https://crbug.com/719826): Send the event to the client. + // TODO(https://crbug.com/719826): Record the event. + NOTREACHED(); } void FakeBluetoothChooser::AddOrUpdateDevice(const std::string& device_id, @@ -73,7 +78,8 @@ bool is_gatt_connected, bool is_paired, int signal_strength_level) { - // TODO(https://crbug.com/719826): Send the event to the client. + // TODO(https://crbug.com/719826): Record the event. + NOTREACHED(); } // private
diff --git a/content/shell/browser/layout_test/fake_bluetooth_chooser.h b/content/shell/browser/layout_test/fake_bluetooth_chooser.h index 5d8a08a5..e83cc14 100644 --- a/content/shell/browser/layout_test/fake_bluetooth_chooser.h +++ b/content/shell/browser/layout_test/fake_bluetooth_chooser.h
@@ -46,8 +46,9 @@ void WaitForEvents(uint32_t num_of_events, WaitForEventsCallback callback) override; - void SelectPeripheral(const std::string& peripheral_address) override; - void Cancel() override; + void SelectPeripheral(const std::string& peripheral_address, + SelectPeripheralCallback callback) override; + void Cancel(CancelCallback callback) override; void Rescan(RescanCallback callback) override; // BluetoothChooser overrides:
diff --git a/content/shell/common/layout_test/fake_bluetooth_chooser.mojom b/content/shell/common/layout_test/fake_bluetooth_chooser.mojom index bed17fc..7caf2e2 100644 --- a/content/shell/common/layout_test/fake_bluetooth_chooser.mojom +++ b/content/shell/common/layout_test/fake_bluetooth_chooser.mojom
@@ -45,10 +45,10 @@ // Simulates a user selecting the given |peripheral_address| in the Bluetooth // chooser. - SelectPeripheral(string peripheral_address); + SelectPeripheral(string peripheral_address) => (); // Calls the event handler function with the CANCELLED event. - Cancel(); + Cancel() => (); // Calls the event handler function with the RESCAN event. Rescan() => ();
diff --git a/content/test/data/frame_tree/page_with_two_positioned_frames.html b/content/test/data/frame_tree/page_with_two_positioned_frames.html new file mode 100644 index 0000000..2c3b436 --- /dev/null +++ b/content/test/data/frame_tree/page_with_two_positioned_frames.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<style> +.iframe1 { + position:absolute; + top: 50px; + left: 50px; + width: 200px; + height: 200px; +} +.iframe2 { + position:absolute; + top: 50px; + left: 300px; + width: 200px; + height: 200px; +} +</style> +<html> +<body> +<iframe class="iframe1"></iframe> +<iframe class="iframe2"></iframe> +This page contains two positioned cross-origin frames. +</body> +</html>
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h index 13a8758..69efd03 100644 --- a/device/bluetooth/bluetooth_device.h +++ b/device/bluetooth/bluetooth_device.h
@@ -580,7 +580,7 @@ // Helper class to easily update the sets of UUIDs and keep them in sync with // the set of all the device's UUIDs. - class DEVICE_BLUETOOTH_EXPORT DeviceUUIDs { + class DeviceUUIDs { public: DeviceUUIDs(); ~DeviceUUIDs();
diff --git a/device/bluetooth/test/fake_central.cc b/device/bluetooth/test/fake_central.cc index 080c685..1b5fdc0 100644 --- a/device/bluetooth/test/fake_central.cc +++ b/device/bluetooth/test/fake_central.cc
@@ -53,7 +53,8 @@ void FakeCentral::SimulateAdvertisementReceived( mojom::ScanResultPtr scan_result_ptr, SimulateAdvertisementReceivedCallback callback) { - DCHECK(has_pending_or_active_discovery_session_); + // TODO(https://crbug.com/719826): Add a DCHECK to proceed only if a scan is + // currently in progress. auto* fake_peripheral = GetFakePeripheral(scan_result_ptr->device_address); const bool is_new_device = fake_peripheral == nullptr; if (is_new_device) {
diff --git a/device/bluetooth/test/fake_peripheral.cc b/device/bluetooth/test/fake_peripheral.cc index a992fca..bf790f55 100644 --- a/device/bluetooth/test/fake_peripheral.cc +++ b/device/bluetooth/test/fake_peripheral.cc
@@ -181,19 +181,7 @@ } device::BluetoothDevice::UUIDSet FakePeripheral::GetUUIDs() const { - // Since the advertisement packets use the DeviceUUIDs helper class and the - // pre-connected devices use the service_uuids_ data member, it is necessary - // to combine the two so that the chooser can properly filter out devices. - // This is a temporary workaround until the class can be successfully - // refactored to use DeviceUUIDs to manage the service UUIDs. - // TODO(https://crbug.com/824704): This override should be removed once the - // class is refactored. - device::BluetoothDevice::UUIDSet services; - std::set_union(service_uuids_.begin(), service_uuids_.end(), - device_uuids_.GetUUIDs().begin(), - device_uuids_.GetUUIDs().end(), - std::inserter(services, services.begin())); - return services; + return service_uuids_; } bool FakePeripheral::ExpectingPinCode() const {
diff --git a/extensions/browser/api/alarms/alarm_manager.cc b/extensions/browser/api/alarms/alarm_manager.cc index 5017b3d2..f6f9171 100644 --- a/extensions/browser/api/alarms/alarm_manager.cc +++ b/extensions/browser/api/alarms/alarm_manager.cc
@@ -125,76 +125,81 @@ void AlarmManager::AddAlarm(const std::string& extension_id, std::unique_ptr<Alarm> alarm, - const AddAlarmCallback& callback) { - RunWhenReady(extension_id, - base::Bind(&AlarmManager::AddAlarmWhenReady, AsWeakPtr(), - base::Passed(std::move(alarm)), callback)); + AddAlarmCallback callback) { + RunWhenReady( + extension_id, + base::BindOnce(&AlarmManager::AddAlarmWhenReady, AsWeakPtr(), + base::Passed(std::move(alarm)), std::move(callback))); } void AlarmManager::GetAlarm(const std::string& extension_id, const std::string& name, - const GetAlarmCallback& callback) { - RunWhenReady(extension_id, base::Bind(&AlarmManager::GetAlarmWhenReady, - AsWeakPtr(), name, callback)); + GetAlarmCallback callback) { + RunWhenReady(extension_id, + base::BindOnce(&AlarmManager::GetAlarmWhenReady, AsWeakPtr(), + name, std::move(callback))); } void AlarmManager::GetAllAlarms(const std::string& extension_id, - const GetAllAlarmsCallback& callback) { - RunWhenReady(extension_id, base::Bind(&AlarmManager::GetAllAlarmsWhenReady, - AsWeakPtr(), callback)); + GetAllAlarmsCallback callback) { + RunWhenReady(extension_id, + base::BindOnce(&AlarmManager::GetAllAlarmsWhenReady, AsWeakPtr(), + std::move(callback))); } void AlarmManager::RemoveAlarm(const std::string& extension_id, const std::string& name, - const RemoveAlarmCallback& callback) { - RunWhenReady(extension_id, base::Bind(&AlarmManager::RemoveAlarmWhenReady, - AsWeakPtr(), name, callback)); + RemoveAlarmCallback callback) { + RunWhenReady(extension_id, + base::BindOnce(&AlarmManager::RemoveAlarmWhenReady, AsWeakPtr(), + name, std::move(callback))); } void AlarmManager::RemoveAllAlarms(const std::string& extension_id, - const RemoveAllAlarmsCallback& callback) { - RunWhenReady(extension_id, base::Bind(&AlarmManager::RemoveAllAlarmsWhenReady, - AsWeakPtr(), callback)); + RemoveAllAlarmsCallback callback) { + RunWhenReady(extension_id, + base::BindOnce(&AlarmManager::RemoveAllAlarmsWhenReady, + AsWeakPtr(), std::move(callback))); } void AlarmManager::AddAlarmWhenReady(std::unique_ptr<Alarm> alarm, - const AddAlarmCallback& callback, + AddAlarmCallback callback, const std::string& extension_id) { AddAlarmImpl(extension_id, std::move(alarm)); WriteToStorage(extension_id); - callback.Run(); + std::move(callback).Run(); } void AlarmManager::GetAlarmWhenReady(const std::string& name, - const GetAlarmCallback& callback, + GetAlarmCallback callback, const std::string& extension_id) { AlarmIterator it = GetAlarmIterator(extension_id, name); - callback.Run(it.first != alarms_.end() ? it.second->get() : nullptr); + std::move(callback).Run(it.first != alarms_.end() ? it.second->get() + : nullptr); } -void AlarmManager::GetAllAlarmsWhenReady(const GetAllAlarmsCallback& callback, +void AlarmManager::GetAllAlarmsWhenReady(GetAllAlarmsCallback callback, const std::string& extension_id) { AlarmMap::iterator list = alarms_.find(extension_id); - callback.Run(list != alarms_.end() ? &list->second : NULL); + std::move(callback).Run(list != alarms_.end() ? &list->second : NULL); } void AlarmManager::RemoveAlarmWhenReady(const std::string& name, - const RemoveAlarmCallback& callback, + RemoveAlarmCallback callback, const std::string& extension_id) { AlarmIterator it = GetAlarmIterator(extension_id, name); if (it.first == alarms_.end()) { - callback.Run(false); + std::move(callback).Run(false); return; } RemoveAlarmIterator(it); WriteToStorage(extension_id); - callback.Run(true); + std::move(callback).Run(true); } -void AlarmManager::RemoveAllAlarmsWhenReady( - const RemoveAllAlarmsCallback& callback, - const std::string& extension_id) { +void AlarmManager::RemoveAllAlarmsWhenReady(RemoveAllAlarmsCallback callback, + const std::string& extension_id) { AlarmMap::iterator list = alarms_.find(extension_id); if (list != alarms_.end()) { // Note: I'm using indices rather than iterators here because @@ -205,7 +210,7 @@ CHECK(alarms_.find(extension_id) == alarms_.end()); WriteToStorage(extension_id); } - callback.Run(); + std::move(callback).Run(); } AlarmManager::AlarmIterator AlarmManager::GetAlarmIterator( @@ -333,7 +338,7 @@ ReadyQueue& extension_ready_queue = ready_actions_[extension_id]; while (!extension_ready_queue.empty()) { - extension_ready_queue.front().Run(extension_id); + std::move(extension_ready_queue.front()).Run(extension_id); extension_ready_queue.pop(); } ready_actions_.erase(extension_id); @@ -420,13 +425,13 @@ } void AlarmManager::RunWhenReady(const std::string& extension_id, - const ReadyAction& action) { + ReadyAction action) { ReadyMap::iterator it = ready_actions_.find(extension_id); if (it == ready_actions_.end()) - action.Run(extension_id); + std::move(action).Run(extension_id); else - it->second.push(action); + it->second.push(std::move(action)); } void AlarmManager::OnExtensionLoaded(content::BrowserContext* browser_context,
diff --git a/extensions/browser/api/alarms/alarm_manager.h b/extensions/browser/api/alarms/alarm_manager.h index dbbd42f4..ab84025 100644 --- a/extensions/browser/api/alarms/alarm_manager.h +++ b/extensions/browser/api/alarms/alarm_manager.h
@@ -78,38 +78,38 @@ // Override the default delegate. Callee assumes onwership. Used for testing. void set_delegate(Delegate* delegate) { delegate_.reset(delegate); } - typedef base::Callback<void()> AddAlarmCallback; + using AddAlarmCallback = base::OnceClosure; // Adds |alarm| for the given extension, and starts the timer. Invokes // |callback| when done. void AddAlarm(const std::string& extension_id, std::unique_ptr<Alarm> alarm, - const AddAlarmCallback& callback); + AddAlarmCallback callback); - typedef base::Callback<void(Alarm*)> GetAlarmCallback; + using GetAlarmCallback = base::OnceCallback<void(Alarm*)>; // Passes the alarm with the given name, or NULL if none exists, to // |callback|. void GetAlarm(const std::string& extension_id, const std::string& name, - const GetAlarmCallback& callback); + GetAlarmCallback callback); - typedef base::Callback<void(const AlarmList*)> GetAllAlarmsCallback; + using GetAllAlarmsCallback = base::OnceCallback<void(const AlarmList*)>; // Passes the list of pending alarms for the given extension, or // NULL if none exist, to |callback|. void GetAllAlarms(const std::string& extension_id, - const GetAllAlarmsCallback& callback); + GetAllAlarmsCallback callback); - typedef base::Callback<void(bool)> RemoveAlarmCallback; + using RemoveAlarmCallback = base::OnceCallback<void(bool)>; // Cancels and removes the alarm with the given name. Invokes |callback| when // done. void RemoveAlarm(const std::string& extension_id, const std::string& name, - const RemoveAlarmCallback& callback); + RemoveAlarmCallback callback); - typedef base::Callback<void()> RemoveAllAlarmsCallback; + using RemoveAllAlarmsCallback = base::OnceClosure; // Cancels and removes all alarms for the given extension. Invokes |callback| // when done. void RemoveAllAlarms(const std::string& extension_id, - const RemoveAllAlarmsCallback& callback); + RemoveAllAlarmsCallback callback); // Replaces AlarmManager's clock with |clock|. void SetClockForTesting(base::Clock* clock); @@ -138,7 +138,7 @@ using AlarmMap = std::map<ExtensionId, AlarmList>; - using ReadyAction = base::Callback<void(const std::string&)>; + using ReadyAction = base::OnceCallback<void(const std::string&)>; using ReadyQueue = base::queue<ReadyAction>; using ReadyMap = std::map<ExtensionId, ReadyQueue>; @@ -148,25 +148,25 @@ // Part of AddAlarm that is executed after alarms are loaded. void AddAlarmWhenReady(std::unique_ptr<Alarm> alarm, - const AddAlarmCallback& callback, + AddAlarmCallback callback, const std::string& extension_id); // Part of GetAlarm that is executed after alarms are loaded. void GetAlarmWhenReady(const std::string& name, - const GetAlarmCallback& callback, + GetAlarmCallback callback, const std::string& extension_id); // Part of GetAllAlarms that is executed after alarms are loaded. - void GetAllAlarmsWhenReady(const GetAllAlarmsCallback& callback, + void GetAllAlarmsWhenReady(GetAllAlarmsCallback callback, const std::string& extension_id); // Part of RemoveAlarm that is executed after alarms are loaded. void RemoveAlarmWhenReady(const std::string& name, - const RemoveAlarmCallback& callback, + RemoveAlarmCallback callback, const std::string& extension_id); // Part of RemoveAllAlarms that is executed after alarms are loaded. - void RemoveAllAlarmsWhenReady(const RemoveAllAlarmsCallback& callback, + void RemoveAllAlarmsWhenReady(RemoveAllAlarmsCallback callback, const std::string& extension_id); // Helper to return the iterators within the AlarmMap and AlarmList for the @@ -206,7 +206,7 @@ // Executes |action| for given extension, making sure that the extension's // alarm data has been synced from the storage. - void RunWhenReady(const std::string& extension_id, const ReadyAction& action); + void RunWhenReady(const std::string& extension_id, ReadyAction action); // ExtensionRegistryObserver implementation. void OnExtensionLoaded(content::BrowserContext* browser_context,
diff --git a/extensions/browser/api/alarms/alarms_api.cc b/extensions/browser/api/alarms/alarms_api.cc index 3ea8f03..e9e4704 100644 --- a/extensions/browser/api/alarms/alarms_api.cc +++ b/extensions/browser/api/alarms/alarms_api.cc
@@ -114,7 +114,7 @@ new Alarm(alarm_name, params->alarm_info, granularity, clock_->Now())); AlarmManager::Get(browser_context()) ->AddAlarm(extension_id(), std::move(alarm), - base::Bind(&AlarmsCreateFunction::Callback, this)); + base::BindOnce(&AlarmsCreateFunction::Callback, this)); return true; } @@ -131,7 +131,7 @@ std::string name = params->name.get() ? *params->name : kDefaultAlarmName; AlarmManager::Get(browser_context()) ->GetAlarm(extension_id(), name, - base::Bind(&AlarmsGetFunction::Callback, this, name)); + base::BindOnce(&AlarmsGetFunction::Callback, this, name)); return true; } @@ -147,7 +147,7 @@ bool AlarmsGetAllFunction::RunAsync() { AlarmManager::Get(browser_context()) ->GetAllAlarms(extension_id(), - base::Bind(&AlarmsGetAllFunction::Callback, this)); + base::BindOnce(&AlarmsGetAllFunction::Callback, this)); return true; } @@ -169,7 +169,7 @@ std::string name = params->name.get() ? *params->name : kDefaultAlarmName; AlarmManager::Get(browser_context()) ->RemoveAlarm(extension_id(), name, - base::Bind(&AlarmsClearFunction::Callback, this, name)); + base::BindOnce(&AlarmsClearFunction::Callback, this, name)); return true; } @@ -181,8 +181,9 @@ bool AlarmsClearAllFunction::RunAsync() { AlarmManager::Get(browser_context()) - ->RemoveAllAlarms(extension_id(), - base::Bind(&AlarmsClearAllFunction::Callback, this)); + ->RemoveAllAlarms( + extension_id(), + base::BindOnce(&AlarmsClearAllFunction::Callback, this)); return true; }
diff --git a/extensions/browser/extension_registry_factory.cc b/extensions/browser/extension_registry_factory.cc index 61c3c803..679dbb8b 100644 --- a/extensions/browser/extension_registry_factory.cc +++ b/extensions/browser/extension_registry_factory.cc
@@ -4,6 +4,7 @@ #include "extensions/browser/extension_registry_factory.h" +#include "base/logging.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extensions_browser_client.h" @@ -41,7 +42,9 @@ BrowserContext* ExtensionRegistryFactory::GetBrowserContextToUse( BrowserContext* context) const { // Redirected in incognito. - return ExtensionsBrowserClient::Get()->GetOriginalContext(context); + auto* extension_browser_client = ExtensionsBrowserClient::Get(); + DCHECK(extension_browser_client); + return extension_browser_client->GetOriginalContext(context); } } // namespace extensions
diff --git a/gpu/command_buffer/service/decoder_context.h b/gpu/command_buffer/service/decoder_context.h index 696854f..4c12f14 100644 --- a/gpu/command_buffer/service/decoder_context.h +++ b/gpu/command_buffer/service/decoder_context.h
@@ -35,6 +35,7 @@ class ErrorState; class FeatureInfo; class GpuFenceManager; +class Texture; struct ContextState; struct DisallowedFeatures; } // namespace gles2 @@ -176,6 +177,42 @@ // virtual gles2::ContextGroup* GetContextGroup() = 0; virtual gles2::ErrorState* GetErrorState() = 0; + + // + // Methods required by Texture. + // + // Indicates whether a given internal format is one for a compressed + // texture. + virtual bool IsCompressedTextureFormat(unsigned format) = 0; + // Clears a level sub area of a 2D texture. + // Returns false if a GL error should be generated. + virtual bool ClearLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int xoffset, + int yoffset, + int width, + int height) = 0; + // Clears a level sub area of a compressed 2D texture. + // Returns false if a GL error should be generated. + virtual bool ClearCompressedTextureLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + int width, + int height) = 0; + // Clears a level of a 3D texture. + // Returns false if a GL error should be generated. + virtual bool ClearLevel3D(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int width, + int height, + int depth) = 0; }; } // namespace gpu
diff --git a/gpu/command_buffer/service/gl_utils.cc b/gpu/command_buffer/service/gl_utils.cc index 5b9e33c..5d859b98 100644 --- a/gpu/command_buffer/service/gl_utils.cc +++ b/gpu/command_buffer/service/gl_utils.cc
@@ -8,6 +8,7 @@ #include "base/metrics/histogram.h" #include "gpu/command_buffer/common/capabilities.h" +#include "gpu/command_buffer/service/error_state.h" #include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/logger.h" #include "ui/gl/gl_version_info.h" @@ -16,6 +17,25 @@ namespace gles2 { namespace { + +const int kASTCBlockSize = 16; +const int kS3TCBlockWidth = 4; +const int kS3TCBlockHeight = 4; +const int kS3TCDXT1BlockSize = 8; +const int kS3TCDXT3AndDXT5BlockSize = 16; +const int kEACAndETC2BlockSize = 4; + +typedef struct { + int blockWidth; + int blockHeight; +} ASTCBlockArray; + +const ASTCBlockArray kASTCBlockArray[] = { + {4, 4}, /* GL_COMPRESSED_RGBA_ASTC_4x4_KHR */ + {5, 4}, /* and GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR */ + {5, 5}, {6, 5}, {6, 6}, {8, 5}, {8, 6}, {8, 8}, + {10, 5}, {10, 6}, {10, 8}, {10, 10}, {12, 10}, {12, 12}}; + const char* GetDebugSourceString(GLenum source) { switch (source) { case GL_DEBUG_SOURCE_API: @@ -340,5 +360,136 @@ return error::kUnknown; } +bool GetCompressedTexSizeInBytes(const char* function_name, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLsizei* size_in_bytes, + ErrorState* error_state) { + base::CheckedNumeric<GLsizei> bytes_required(0); + + switch (format) { + case GL_ATC_RGB_AMD: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + case GL_ETC1_RGB8_OES: + bytes_required = (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; + bytes_required *= (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; + bytes_required *= kS3TCDXT1BlockSize; + break; + case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: + case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: + case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: + case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: + case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: + case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: + case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: + case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: + case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: + case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: + case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: + case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: + case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: + case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { + const int index = + (format < GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) + ? static_cast<int>(format - GL_COMPRESSED_RGBA_ASTC_4x4_KHR) + : static_cast<int>(format - + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR); + + const int kBlockWidth = kASTCBlockArray[index].blockWidth; + const int kBlockHeight = kASTCBlockArray[index].blockHeight; + + bytes_required = (width + kBlockWidth - 1) / kBlockWidth; + bytes_required *= (height + kBlockHeight - 1) / kBlockHeight; + + bytes_required *= kASTCBlockSize; + break; + } + case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: + case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + bytes_required = (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; + bytes_required *= (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; + bytes_required *= kS3TCDXT3AndDXT5BlockSize; + break; + case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: + case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: + bytes_required = std::max(width, 8); + bytes_required *= std::max(height, 8); + bytes_required *= 4; + bytes_required += 7; + bytes_required /= 8; + break; + case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: + case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: + bytes_required = std::max(width, 16); + bytes_required *= std::max(height, 8); + bytes_required *= 2; + bytes_required += 7; + bytes_required /= 8; + break; + + // ES3 formats. + case GL_COMPRESSED_R11_EAC: + case GL_COMPRESSED_SIGNED_R11_EAC: + case GL_COMPRESSED_RGB8_ETC2: + case GL_COMPRESSED_SRGB8_ETC2: + case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + bytes_required = + (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; + bytes_required *= + (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; + bytes_required *= 8; + bytes_required *= depth; + break; + case GL_COMPRESSED_RG11_EAC: + case GL_COMPRESSED_SIGNED_RG11_EAC: + case GL_COMPRESSED_RGBA8_ETC2_EAC: + case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: + bytes_required = + (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; + bytes_required *= + (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; + bytes_required *= 16; + bytes_required *= depth; + break; + default: + ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(error_state, function_name, format, + "format"); + return false; + } + + if (!bytes_required.IsValid()) { + ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_VALUE, function_name, + "invalid size"); + return false; + } + + *size_in_bytes = bytes_required.ValueOrDefault(0); + return true; +} + } // namespace gles2 } // namespace gpu
diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h index 34da7e7..ce78672d 100644 --- a/gpu/command_buffer/service/gl_utils.h +++ b/gpu/command_buffer/service/gl_utils.h
@@ -38,6 +38,7 @@ namespace gles2 { +class ErrorState; class FeatureInfo; class Logger; @@ -95,6 +96,14 @@ error::ContextLostReason GetContextLostReasonFromResetStatus( GLenum reset_status); +bool GetCompressedTexSizeInBytes(const char* function_name, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLsizei* size_in_bytes, + ErrorState* error_state); + } // namespace gles2 } // namespace gpu
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 5268c0c..7bf5f4d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2153,10 +2153,6 @@ void MarkContextLost(error::ContextLostReason reason) override; bool CheckResetStatus() override; - bool GetCompressedTexSizeInBytes( - const char* function_name, GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLsizei* size_in_bytes); - bool ValidateCompressedTexDimensions( const char* function_name, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum format); @@ -13220,9 +13216,9 @@ DCHECK(feature_info_->IsWebGL2OrES3Context()); GLsizei bytes_required = 0; - if (!GetCompressedTexSizeInBytes( - "ClearCompressedTextureLevel", width, height, 1, format, - &bytes_required)) { + if (!GetCompressedTexSizeInBytes("ClearCompressedTextureLevel", width, height, + 1, format, &bytes_required, + state_.GetErrorState())) { return false; } @@ -13378,12 +13374,7 @@ namespace { -const int kASTCBlockSize = 16; const int kS3TCBlockWidth = 4; -const int kS3TCBlockHeight = 4; -const int kS3TCDXT1BlockSize = 8; -const int kS3TCDXT3AndDXT5BlockSize = 16; -const int kEACAndETC2BlockSize = 4; typedef struct { int blockWidth; @@ -13561,135 +13552,6 @@ } // anonymous namespace. -bool GLES2DecoderImpl::GetCompressedTexSizeInBytes( - const char* function_name, GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLsizei* size_in_bytes) { - base::CheckedNumeric<GLsizei> bytes_required(0); - - switch (format) { - case GL_ATC_RGB_AMD: - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - case GL_ETC1_RGB8_OES: - bytes_required = - (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; - bytes_required *= - (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; - bytes_required *= kS3TCDXT1BlockSize; - break; - case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: - case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: - case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: - case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: - case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { - const int index = (format < GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) ? - static_cast<int>(format - GL_COMPRESSED_RGBA_ASTC_4x4_KHR) : - static_cast<int>(format - GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR); - - const int kBlockWidth = kASTCBlockArray[index].blockWidth; - const int kBlockHeight = kASTCBlockArray[index].blockHeight; - - bytes_required = - (width + kBlockWidth - 1) / kBlockWidth; - bytes_required *= - (height + kBlockHeight - 1) / kBlockHeight; - - bytes_required *= kASTCBlockSize; - break; - } - case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: - case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - bytes_required = - (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; - bytes_required *= - (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; - bytes_required *= kS3TCDXT3AndDXT5BlockSize; - break; - case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - bytes_required = std::max(width, 8); - bytes_required *= std::max(height, 8); - bytes_required *= 4; - bytes_required += 7; - bytes_required /= 8; - break; - case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: - case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: - bytes_required = std::max(width, 16); - bytes_required *= std::max(height, 8); - bytes_required *= 2; - bytes_required += 7; - bytes_required /= 8; - break; - - // ES3 formats. - case GL_COMPRESSED_R11_EAC: - case GL_COMPRESSED_SIGNED_R11_EAC: - case GL_COMPRESSED_RGB8_ETC2: - case GL_COMPRESSED_SRGB8_ETC2: - case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: - case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - bytes_required = - (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; - bytes_required *= - (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; - bytes_required *= 8; - bytes_required *= depth; - break; - case GL_COMPRESSED_RG11_EAC: - case GL_COMPRESSED_SIGNED_RG11_EAC: - case GL_COMPRESSED_RGBA8_ETC2_EAC: - case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: - bytes_required = - (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; - bytes_required *= - (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize; - bytes_required *= 16; - bytes_required *= depth; - break; - default: - LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, format, "format"); - return false; - } - - if (!bytes_required.IsValid()) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid size"); - return false; - } - - *size_in_bytes = bytes_required.ValueOrDefault(0); - return true; -} - bool GLES2DecoderImpl::ValidateCompressedTexFuncData(const char* function_name, GLsizei width, GLsizei height, @@ -13698,8 +13560,8 @@ GLsizei size, const GLvoid* data) { GLsizei bytes_required = 0; - if (!GetCompressedTexSizeInBytes( - function_name, width, height, depth, format, &bytes_required)) { + if (!GetCompressedTexSizeInBytes(function_name, width, height, depth, format, + &bytes_required, state_.GetErrorState())) { return false; } @@ -17918,7 +17780,7 @@ bool did_get_size = GetCompressedTexSizeInBytes( kFunctionName, source_width, source_height, 1, source_internal_format, - &source_size); + &source_size, state_.GetErrorState()); DCHECK(did_get_size); // Ensure that the glCompressedTexImage2D succeeds. @@ -18040,9 +17902,9 @@ uint32_t size; if (is_compressed_format) { GLsizei level_size; - if (!GetCompressedTexSizeInBytes(function_name, - level_width, level_height, level_depth, - internal_format, &level_size)) { + if (!GetCompressedTexSizeInBytes( + function_name, level_width, level_height, level_depth, + internal_format, &level_size, state_.GetErrorState())) { // GetCompressedTexSizeInBytes() already generates a GL error. return; }
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index ce8a0aa..e42f4f24 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -49,7 +49,6 @@ class Logger; class Outputter; class ShaderTranslatorInterface; -class Texture; class TransformFeedbackManager; class VertexArrayManager; @@ -179,42 +178,6 @@ virtual bool GetServiceTextureId(uint32_t client_texture_id, uint32_t* service_texture_id); - // Clears a level sub area of a 2D texture. - // Returns false if a GL error should be generated. - virtual bool ClearLevel(Texture* texture, - unsigned target, - int level, - unsigned format, - unsigned type, - int xoffset, - int yoffset, - int width, - int height) = 0; - - // Clears a level sub area of a compressed 2D texture. - // Returns false if a GL error should be generated. - virtual bool ClearCompressedTextureLevel(Texture* texture, - unsigned target, - int level, - unsigned format, - int width, - int height) = 0; - - // Indicates whether a given internal format is one for a compressed - // texture. - virtual bool IsCompressedTextureFormat(unsigned format) = 0; - - // Clears a level of a 3D texture. - // Returns false if a GL error should be generated. - virtual bool ClearLevel3D(Texture* texture, - unsigned target, - int level, - unsigned format, - unsigned type, - int width, - int height, - int depth) = 0; - virtual void WaitForReadPixels(base::OnceClosure callback) = 0; virtual Logger* GetLogger() = 0;
diff --git a/gpu/command_buffer/service/raster_decoder.cc b/gpu/command_buffer/service/raster_decoder.cc index e7f5a21..3fdff49 100644 --- a/gpu/command_buffer/service/raster_decoder.cc +++ b/gpu/command_buffer/service/raster_decoder.cc
@@ -30,6 +30,7 @@ #include "gpu/command_buffer/service/error_state.h" #include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/framebuffer_manager.h" +#include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/image_manager.h" #include "gpu/command_buffer/service/logger.h" #include "gpu/command_buffer/service/mailbox_manager.h" @@ -187,6 +188,28 @@ state_->RestoreActiveTexture(); } +// Temporarily changes a decoder's PIXEL_UNPACK_BUFFER to 0 and set pixel unpack +// params to default, and restore them when this object goes out of scope. +class ScopedPixelUnpackState { + public: + explicit ScopedPixelUnpackState(ContextState* state); + ~ScopedPixelUnpackState(); + + private: + ContextState* state_; + DISALLOW_COPY_AND_ASSIGN(ScopedPixelUnpackState); +}; + +ScopedPixelUnpackState::ScopedPixelUnpackState(ContextState* state) + : state_(state) { + DCHECK(state_); + state_->PushTextureUnpackState(); +} + +ScopedPixelUnpackState::~ScopedPixelUnpackState() { + state_->RestoreUnpackState(); +} + } // namespace class RasterDecoderImpl : public RasterDecoder, public gles2::ErrorStateClient { @@ -268,6 +291,33 @@ bool can_bind_to_sampler) override; gles2::ContextGroup* GetContextGroup() override; gles2::ErrorState* GetErrorState() override; + bool IsCompressedTextureFormat(unsigned format) override; + bool ClearLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int xoffset, + int yoffset, + int width, + int height) override; + bool ClearCompressedTextureLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + int width, + int height) override; + bool ClearLevel3D(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int width, + int height, + int depth) override { + NOTIMPLEMENTED(); + return false; + } // ErrorClientState implementation. void OnContextLostError() override; @@ -1126,6 +1176,132 @@ return state_.GetErrorState(); } +bool RasterDecoderImpl::IsCompressedTextureFormat(unsigned format) { + return feature_info_->validators()->compressed_texture_format.IsValid(format); +} + +bool RasterDecoderImpl::ClearLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int xoffset, + int yoffset, + int width, + int height) { + DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY && + target != GL_TEXTURE_EXTERNAL_OES); + uint32_t channels = GLES2Util::GetChannelsForFormat(format); + if (channels & GLES2Util::kDepth) { + DCHECK(false) << "depth not supported"; + return false; + } + + const uint32_t kMaxZeroSize = 1024 * 1024 * 4; + + uint32_t size; + uint32_t padded_row_size; + if (!GLES2Util::ComputeImageDataSizes(width, height, 1, format, type, + state_.unpack_alignment, &size, nullptr, + &padded_row_size)) { + return false; + } + + TRACE_EVENT1("gpu", "RasterDecoderImpl::ClearLevel", "size", size); + + int tile_height; + + if (size > kMaxZeroSize) { + if (kMaxZeroSize < padded_row_size) { + // That'd be an awfully large texture. + return false; + } + // We should never have a large total size with a zero row size. + DCHECK_GT(padded_row_size, 0U); + tile_height = kMaxZeroSize / padded_row_size; + if (!GLES2Util::ComputeImageDataSizes(width, tile_height, 1, format, type, + state_.unpack_alignment, &size, + nullptr, nullptr)) { + return false; + } + } else { + tile_height = height; + } + + api()->glBindTextureFn(texture->target(), texture->service_id()); + { + // Add extra scope to destroy zero and the object it owns right + // after its usage. + // Assumes the size has already been checked. + std::unique_ptr<char[]> zero(new char[size]); + memset(zero.get(), 0, size); + + ScopedPixelUnpackState reset_restore(&state_); + GLint y = 0; + while (y < height) { + GLint h = y + tile_height > height ? height - y : tile_height; + api()->glTexSubImage2DFn( + target, level, xoffset, yoffset + y, width, h, + TextureManager::AdjustTexFormat(feature_info_.get(), format), type, + zero.get()); + y += tile_height; + } + } + + TextureRef* bound_texture = + texture_manager()->GetTextureInfoForTarget(&state_, texture->target()); + api()->glBindTextureFn(texture->target(), + bound_texture ? bound_texture->service_id() : 0); + DCHECK(glGetError() == GL_NO_ERROR); + return true; +} + +bool RasterDecoderImpl::ClearCompressedTextureLevel(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + int width, + int height) { + DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY); + // This code path can only be called if the texture was originally + // allocated via TexStorage2D. Note that TexStorage2D is exposed + // internally for ES 2.0 contexts, but compressed texture support is + // not part of that exposure. + DCHECK(feature_info_->IsWebGL2OrES3Context()); + + GLsizei bytes_required = 0; + std::string error_str; + if (!GetCompressedTexSizeInBytes("ClearCompressedTextureLevel", width, height, + 1, format, &bytes_required, + state_.GetErrorState())) { + return false; + } + + TRACE_EVENT1("gpu", "RasterDecoderImpl::ClearCompressedTextureLevel", + "bytes_required", bytes_required); + + api()->glBindBufferFn(GL_PIXEL_UNPACK_BUFFER, 0); + { + // Add extra scope to destroy zero and the object it owns right + // after its usage. + std::unique_ptr<char[]> zero(new char[bytes_required]); + memset(zero.get(), 0, bytes_required); + api()->glBindTextureFn(texture->target(), texture->service_id()); + api()->glCompressedTexSubImage2DFn(target, level, 0, 0, width, height, + format, bytes_required, zero.get()); + } + TextureRef* bound_texture = + texture_manager()->GetTextureInfoForTarget(&state_, texture->target()); + api()->glBindTextureFn(texture->target(), + bound_texture ? bound_texture->service_id() : 0); + gles2::Buffer* bound_buffer = + buffer_manager()->GetBufferInfoForTarget(&state_, GL_PIXEL_UNPACK_BUFFER); + if (bound_buffer) { + api()->glBindBufferFn(GL_PIXEL_UNPACK_BUFFER, bound_buffer->service_id()); + } + return true; +} + void RasterDecoderImpl::OnContextLostError() { NOTIMPLEMENTED(); } @@ -1763,19 +1939,13 @@ for (int ii = 0; ii < levels; ++ii) { uint32_t size; if (is_compressed_format) { - DCHECK_EQ(static_cast<unsigned int>(GL_ETC1_RGB8_OES), internal_format); - base::CheckedNumeric<uint32_t> bytes_required(0); - const int kS3TCBlockWidth = 4; - const int kS3TCBlockHeight = 4; - const int kS3TCDXT1BlockSize = 8; - bytes_required = (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; - bytes_required *= (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; - bytes_required *= kS3TCDXT1BlockSize; - if (!bytes_required.IsValid()) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexStorage2D", "invalid size"); + GLsizei level_size; + if (!GetCompressedTexSizeInBytes("glTexStorage2D", level_width, + level_height, 1, internal_format, + &level_size, state_.GetErrorState())) { return; } - size = bytes_required.ValueOrDefault(0); + size = static_cast<uint32_t>(level_size); } else { if (!GLES2Util::ComputeImageDataSizesES3( level_width, level_height, 1 /* level_depth */, format, type,
diff --git a/gpu/command_buffer/service/raster_decoder_mock.h b/gpu/command_buffer/service/raster_decoder_mock.h index 5ca8960..fab7f08f 100644 --- a/gpu/command_buffer/service/raster_decoder_mock.h +++ b/gpu/command_buffer/service/raster_decoder_mock.h
@@ -31,12 +31,13 @@ namespace gles2 { class ContextGroup; class ErrorState; +class FeatureInfo; class GpuFenceManager; class GLES2Util; class ImageManager; -struct ContextState; -class FeatureInfo; class Logger; +class Texture; +struct ContextState; } // namespace gles2 namespace raster { @@ -113,6 +114,33 @@ uint32_t texture_target, gl::GLImage* image, bool can_bind_to_sampler)); + MOCK_METHOD1(IsCompressedTextureFormat, bool(unsigned format)); + MOCK_METHOD9(ClearLevel, + bool(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int xoffset, + int yoffset, + int width, + int height)); + MOCK_METHOD6(ClearCompressedTextureLevel, + bool(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + int width, + int height)); + MOCK_METHOD8(ClearLevel3D, + bool(gles2::Texture* texture, + unsigned target, + int level, + unsigned format, + unsigned type, + int width, + int height, + int depth)); private: base::WeakPtrFactory<MockRasterDecoder> weak_ptr_factory_;
diff --git a/gpu/command_buffer/service/raster_decoder_unittest.cc b/gpu/command_buffer/service/raster_decoder_unittest.cc index 8731b06..043d35e 100644 --- a/gpu/command_buffer/service/raster_decoder_unittest.cc +++ b/gpu/command_buffer/service/raster_decoder_unittest.cc
@@ -29,6 +29,7 @@ namespace { const GLsizei kWidth = 10; const GLsizei kHeight = 20; +const GLint kImageId = 1; class MockMemoryTracker : public gles2::MemoryTracker { public: @@ -357,7 +358,6 @@ } TEST_P(RasterDecoderTest, ReleaseTexImage2DCHROMIUM) { - const GLint kImageId = 1; scoped_refptr<gl::GLImage> image(new gl::GLImageStub); GetImageManagerForTest()->AddImage(image.get(), kImageId); EXPECT_FALSE(GetImageManagerForTest()->LookupImage(kImageId) == nullptr); @@ -400,5 +400,45 @@ EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == nullptr); } +// TODO(backer): Port CopyTexSubImage2DTwiceClearsUnclearedTexture) after +// CopyTexSubImage implemented. + +TEST_P(RasterDecoderTest, GLImageAttachedAfterClearLevel) { + scoped_refptr<gl::GLImage> image(new gl::GLImageStub); + GetImageManagerForTest()->AddImage(image.get(), kImageId); + + // Bind image to texture. + SetScopedTextureBinderExpectations(GL_TEXTURE_2D); + cmds::BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; + bind_tex_image_2d_cmd.Init(client_texture_id_, kImageId); + EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); + + // Check binding. + gles2::TextureRef* texture_ref = + group().texture_manager()->GetTexture(client_texture_id_); + ASSERT_TRUE(texture_ref != nullptr); + gles2::Texture* texture = texture_ref->texture(); + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); + + GLenum target = GL_TEXTURE_2D; + GLint level = 0; + GLint xoffset = 0; + GLint yoffset = 0; + GLsizei width = 1; + GLsizei height = 1; + GLenum format = GL_RGBA; + GLenum type = GL_UNSIGNED_BYTE; + + // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. + SetupClearTextureExpectations(kServiceTextureId, 0 /* old_service_id */, + GL_TEXTURE_2D, GL_TEXTURE_2D, level, format, + type, xoffset, yoffset, width, height, 0); + + GetDecoder()->ClearLevel(texture, target, level, format, type, xoffset, + yoffset, width, height); + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); +} + } // namespace raster } // namespace gpu
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_base.cc b/gpu/command_buffer/service/raster_decoder_unittest_base.cc index 0ed580da..3ad39e3 100644 --- a/gpu/command_buffer/service/raster_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/raster_decoder_unittest_base.cc
@@ -329,6 +329,50 @@ EXPECT_EQ(GL_NO_ERROR, GetGLError()); } +void RasterDecoderTestBase::SetupClearTextureExpectations( + GLuint service_id, + GLuint old_service_id, + GLenum bind_target, + GLenum target, + GLint level, + GLenum format, + GLenum type, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLuint bound_pixel_unpack_buffer) { + EXPECT_CALL(*gl_, BindTexture(bind_target, service_id)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, _)) + .Times(2) + .RetiresOnSaturation(); + if (bound_pixel_unpack_buffer) { + EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _)) + .Times(2) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ROW_LENGTH, _)) + .Times(2) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, _)) + .Times(2) + .RetiresOnSaturation(); + } + EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, + height, format, type, _)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, BindTexture(bind_target, old_service_id)) + .Times(1) + .RetiresOnSaturation(); +#if DCHECK_IS_ON() + EXPECT_CALL(*gl_, GetError()) + .WillOnce(Return(GL_NO_ERROR)) + .RetiresOnSaturation(); +#endif +} + // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator.
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_base.h b/gpu/command_buffer/service/raster_decoder_unittest_base.h index a934a5cc..bfeb11b 100644 --- a/gpu/command_buffer/service/raster_decoder_unittest_base.h +++ b/gpu/command_buffer/service/raster_decoder_unittest_base.h
@@ -181,6 +181,19 @@ GLsizei width, GLsizei height); + void SetupClearTextureExpectations(GLuint service_id, + GLuint old_service_id, + GLenum bind_target, + GLenum target, + GLint level, + GLenum format, + GLenum type, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLuint bound_pixel_unpack_buffer); + GLvoid* BufferOffset(unsigned i) { return static_cast<int8_t*>(NULL) + (i); } protected:
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index a672e35e..69507758 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc
@@ -21,11 +21,11 @@ #include "base/trace_event/memory_dump_manager.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/service/context_state.h" +#include "gpu/command_buffer/service/decoder_context.h" #include "gpu/command_buffer/service/error_state.h" #include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/framebuffer_manager.h" #include "gpu/command_buffer/service/gl_stream_texture_image.h" -#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/progress_reporter.h" @@ -1557,7 +1557,7 @@ completeness_dirty_ = false; } -bool Texture::ClearRenderableLevels(GLES2Decoder* decoder) { +bool Texture::ClearRenderableLevels(DecoderContext* decoder) { DCHECK(decoder); if (cleared_) { return true; @@ -1643,8 +1643,7 @@ glTexParameterfv(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, params); } -bool Texture::ClearLevel( - GLES2Decoder* decoder, GLenum target, GLint level) { +bool Texture::ClearLevel(DecoderContext* decoder, GLenum target, GLint level) { DCHECK(decoder); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); if (face_index >= face_infos_.size() || level < 0 || @@ -2144,15 +2143,16 @@ ref->texture()->SetLevelCleared(target, level, cleared); } -bool TextureManager::ClearRenderableLevels( - GLES2Decoder* decoder, TextureRef* ref) { +bool TextureManager::ClearRenderableLevels(DecoderContext* decoder, + TextureRef* ref) { DCHECK(ref); return ref->texture()->ClearRenderableLevels(decoder); } -bool TextureManager::ClearTextureLevel( - GLES2Decoder* decoder, TextureRef* ref, - GLenum target, GLint level) { +bool TextureManager::ClearTextureLevel(DecoderContext* decoder, + TextureRef* ref, + GLenum target, + GLint level) { DCHECK(ref); Texture* texture = ref->texture(); if (texture->num_uncleared_mips() == 0) { @@ -2962,7 +2962,7 @@ } void TextureManager::ValidateAndDoTexSubImage( - GLES2Decoder* decoder, + DecoderContext* decoder, DecoderTextureState* texture_state, ContextState* state, DecoderFramebufferState* framebuffer_state,
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h index 3fa41a3a..a0da346 100644 --- a/gpu/command_buffer/service/texture_manager.h +++ b/gpu/command_buffer/service/texture_manager.h
@@ -28,10 +28,10 @@ #include "ui/gl/gl_image.h" namespace gpu { +class DecoderContext; class ServiceDiscardableManager; namespace gles2 { -class GLES2Decoder; class GLStreamTextureImage; struct ContextState; struct DecoderFramebufferState; @@ -421,11 +421,11 @@ // Clears any renderable uncleared levels. // Returns false if a GL error was generated. - bool ClearRenderableLevels(GLES2Decoder* decoder); + bool ClearRenderableLevels(DecoderContext* decoder); // Clears the level. // Returns false if a GL error was generated. - bool ClearLevel(GLES2Decoder* decoder, GLenum target, GLint level); + bool ClearLevel(DecoderContext* decoder, GLenum target, GLint level); // Sets a texture parameter. // TODO(gman): Expand to SetParameteriv,fv @@ -692,7 +692,7 @@ // texture complete checking. // // NOTE: To support shared resources an instance of this class will need to be -// shared by multiple GLES2Decoders. +// shared by multiple DecoderContexts. class GPU_GLES2_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { public: @@ -862,11 +862,13 @@ void MarkMipmapsGenerated(TextureRef* ref); // Clears any uncleared renderable levels. - bool ClearRenderableLevels(GLES2Decoder* decoder, TextureRef* ref); + bool ClearRenderableLevels(DecoderContext* decoder, TextureRef* ref); // Clear a specific level. - bool ClearTextureLevel( - GLES2Decoder* decoder, TextureRef* ref, GLenum target, GLint level); + bool ClearTextureLevel(DecoderContext* decoder, + TextureRef* ref, + GLenum target, + GLint level); // Creates a new texture info. TextureRef* CreateTexture(GLuint client_id, GLuint service_id); @@ -1050,7 +1052,7 @@ // Presumes the pointer is valid. TextureRef** texture_ref); - void ValidateAndDoTexSubImage(GLES2Decoder* decoder, + void ValidateAndDoTexSubImage(DecoderContext* decoder, DecoderTextureState* texture_state, ContextState* state, DecoderFramebufferState* framebuffer_state,
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc index 3e259fca..d9a6ca6e 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -473,6 +473,8 @@ if (quit_closure_) { quit_closure_.Run(); quit_closure_ = base::Closure(); + } else { + browser_context()->DestroyWebContents(this); } }
diff --git a/ios/build/chrome_build.gni b/ios/build/chrome_build.gni index 408677eb..fc8866b 100644 --- a/ios/build/chrome_build.gni +++ b/ios/build/chrome_build.gni
@@ -28,6 +28,10 @@ # List of plist templates to merge when generating EarlGrey tests # entitlements. ios_egtests_entitlements_additions = [] + + # Overridable list of dependencies that are forbidden for + # //ios/chrome/app:chrome target. + ios_chrome_extra_assert_no_deps = [] } # Configure whether breakpad support is enabled.
diff --git a/ios/chrome/app/BUILD.gn b/ios/chrome/app/BUILD.gn index 5555448..9f7b32e3 100644 --- a/ios/chrome/app/BUILD.gn +++ b/ios/chrome/app/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/mac/base_rules.gni") import("//build/mac/tweak_info_plist.gni") import("//ios/build/chrome_build.gni") +import("//ios/build/config.gni") import("//ios/public/provider/chrome/browser/build_config.gni") import("//services/service_manager/public/service_manifest.gni") @@ -310,6 +311,8 @@ extra_substitutions += [ "ENCRYPTION_EXPORT_COMPLIANCE_CODE=" + ios_encryption_export_compliance_code ] } + + assert_no_deps = ios_assert_no_deps + ios_chrome_extra_assert_no_deps } if (current_toolchain == default_toolchain) {
diff --git a/ios/chrome/app/application_delegate/user_activity_handler.mm b/ios/chrome/app/application_delegate/user_activity_handler.mm index ada51d82..037e963 100644 --- a/ios/chrome/app/application_delegate/user_activity_handler.mm +++ b/ios/chrome/app/application_delegate/user_activity_handler.mm
@@ -118,25 +118,23 @@ return NO; } [startupInformation setStartupParameters:startupParams]; - } else if (!webpageURL && base::ios::IsRunningOnIOS10OrLater()) { - if (@available(iOS 10, *)) { - spotlight::GetURLForSpotlightItemID(itemID, ^(NSURL* contentURL) { - if (!contentURL) { - return; - } - dispatch_async(dispatch_get_main_queue(), ^{ - // Update the isActive flag as it may have changed during the async - // calls. - BOOL isActive = [[UIApplication sharedApplication] - applicationState] == UIApplicationStateActive; - [self continueUserActivityURL:contentURL - applicationIsActive:isActive - tabOpener:tabOpener - startupInformation:startupInformation]; - }); + } else if (!webpageURL) { + spotlight::GetURLForSpotlightItemID(itemID, ^(NSURL* contentURL) { + if (!contentURL) { + return; + } + dispatch_async(dispatch_get_main_queue(), ^{ + // Update the isActive flag as it may have changed during the async + // calls. + BOOL isActive = [[UIApplication sharedApplication] + applicationState] == UIApplicationStateActive; + [self continueUserActivityURL:contentURL + applicationIsActive:isActive + tabOpener:tabOpener + startupInformation:startupInformation]; }); - return YES; - } + }); + return YES; } } else { // Do nothing for unknown activity type.
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index a8ce923..d121ce8 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -35,6 +35,7 @@ #include "components/payments/core/features.h" #include "components/search_provider_logos/switches.h" #include "components/security_state/core/features.h" +#include "components/signin/core/browser/profile_management_switches.h" #include "components/signin/core/browser/signin_switches.h" #include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/browsing_data/browsing_data_features.h" @@ -268,6 +269,9 @@ {"search-icon-toggle", flag_descriptions::kSearchIconToggleName, flag_descriptions::kSearchIconToggleDescription, flags_ui::kOsIos, MULTI_VALUE_TYPE(kSearchButtonIconChoices)}, + {"unified-consent", flag_descriptions::kUnifiedConsentName, + flag_descriptions::kUnifiedConsentDescription, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(signin::kUnifiedConsent)}, }; // Add all switches from experimental flags to |command_line|.
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index ab98f3a..7ef62b1 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -138,6 +138,12 @@ const char kSearchIconToggleDescription[] = "Different icons for the search button."; +const char kUnifiedConsentName[] = "Unified Consent"; +const char kUnifiedConsentDescription[] = + "Enables a unified management of user consent for privacy-related " + "features. This includes new confirmation screens and improved settings " + "pages."; + const char kUseDdljsonApiName[] = "Use new ddljson API for Doodles"; const char kUseDdljsonApiDescription[] = "Enables the new ddljson API to fetch Doodles for the NTP.";
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index c0ce213..721ea75 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -127,6 +127,10 @@ extern const char kSearchIconToggleName[]; extern const char kSearchIconToggleDescription[]; +// Title and description for the flag to enable the unified consent. +extern const char kUnifiedConsentName[]; +extern const char kUnifiedConsentDescription[]; + // Title and description for the flag to enable the ddljson Doodle API. extern const char kUseDdljsonApiName[]; extern const char kUseDdljsonApiDescription[];
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_delegate.mm b/ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_delegate.mm index a3bdcfc..7c42302e 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_delegate.mm +++ b/ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_delegate.mm
@@ -23,9 +23,7 @@ #endif IOSChromePasswordManagerInfoBarDelegate:: - ~IOSChromePasswordManagerInfoBarDelegate() { - password_manager::metrics_util::LogUIDismissalReason(infobar_response_); -}; + ~IOSChromePasswordManagerInfoBarDelegate() = default; IOSChromePasswordManagerInfoBarDelegate:: IOSChromePasswordManagerInfoBarDelegate(
diff --git a/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm b/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm index 0690c35..d5b8444 100644 --- a/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm +++ b/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm
@@ -37,6 +37,7 @@ } IOSChromeSavePasswordInfoBarDelegate::~IOSChromeSavePasswordInfoBarDelegate() { + password_manager::metrics_util::LogSaveUIDismissalReason(infobar_response()); form_to_save()->metrics_recorder()->RecordUIDismissalReason( infobar_response()); }
diff --git a/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm b/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm index cea8d39..135782c 100644 --- a/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm +++ b/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm
@@ -47,6 +47,8 @@ IOSChromeUpdatePasswordInfoBarDelegate:: ~IOSChromeUpdatePasswordInfoBarDelegate() { + password_manager::metrics_util::LogUpdateUIDismissalReason( + infobar_response()); form_to_save()->metrics_recorder()->RecordUIDismissalReason( infobar_response()); }
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_launcher.mm b/ios/chrome/browser/payments/ios_payment_instrument_launcher.mm index a2ea27f..28fafbf 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_launcher.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_launcher.mm
@@ -126,24 +126,15 @@ universal_link, payments::kPaymentRequestDataExternal, base_64_params); NSURL* url = net::NSURLWithGURL(universal_link); - if (@available(iOS 10, *)) { - [[UIApplication sharedApplication] openURL:url - options:@{ - UIApplicationOpenURLOptionUniversalLinksOnly : @YES + [[UIApplication sharedApplication] openURL:url + options:@{ + UIApplicationOpenURLOptionUniversalLinksOnly : @YES + } + completionHandler:^(BOOL success) { + if (!success) { + CompleteLaunchRequest("", ""); } - completionHandler:^(BOOL success) { - if (!success) { - CompleteLaunchRequest("", ""); - } - }]; - } -#if !defined(__IPHONE_10_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0 - else { - if (![[UIApplication sharedApplication] openURL:url]) { - CompleteLaunchRequest("", ""); - } - } -#endif + }]; return true; }
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm index 4fe4b57..d5eb617 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm
@@ -169,32 +169,30 @@ // OnInstrumentDetailsError() function of the delegate. TEST_F(PaymentRequestIOSPaymentInstrumentLauncherTest, LaunchIOSPaymentInstrument_MalformedUniversalLink) { - if (base::ios::IsRunningOnIOS10OrLater()) { - std::unique_ptr<web::TestNavigationManager> navigation_manager = - std::make_unique<web::TestNavigationManager>(); - web_state_.SetNavigationManager(std::move(navigation_manager)); + std::unique_ptr<web::TestNavigationManager> navigation_manager = + std::make_unique<web::TestNavigationManager>(); + web_state_.SetNavigationManager(std::move(navigation_manager)); - WebPaymentRequest web_payment_request = - payment_request_test_util::CreateTestWebPaymentRequest(); - autofill::TestPersonalDataManager personal_data_manager; - TestPaymentRequest payment_request(web_payment_request, - chrome_browser_state_.get(), &web_state_, - &personal_data_manager); + WebPaymentRequest web_payment_request = + payment_request_test_util::CreateTestWebPaymentRequest(); + autofill::TestPersonalDataManager personal_data_manager; + TestPaymentRequest payment_request(web_payment_request, + chrome_browser_state_.get(), &web_state_, + &personal_data_manager); - FakePaymentInstrumentDelegate instrument_delegate; - IOSPaymentInstrumentLauncher launcher; + FakePaymentInstrumentDelegate instrument_delegate; + IOSPaymentInstrumentLauncher launcher; - EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsReadyCalled()); - EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsErrorCalled()); + EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsReadyCalled()); + EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsErrorCalled()); - GURL malformed_link = GURL("http://bad-link.com"); - launcher.LaunchIOSPaymentInstrument(&payment_request, &web_state_, - malformed_link, &instrument_delegate); - instrument_delegate.RunLoop(); + GURL malformed_link = GURL("http://bad-link.com"); + launcher.LaunchIOSPaymentInstrument(&payment_request, &web_state_, + malformed_link, &instrument_delegate); + instrument_delegate.RunLoop(); - EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsReadyCalled()); - EXPECT_TRUE(instrument_delegate.WasOnInstrumentDetailsErrorCalled()); - } + EXPECT_FALSE(instrument_delegate.WasOnInstrumentDetailsReadyCalled()); + EXPECT_TRUE(instrument_delegate.WasOnInstrumentDetailsErrorCalled()); } // Tests that if the response from the payment app is not a valid JSON
diff --git a/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.cc b/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.cc index 99a4f0e0..d5bd390 100644 --- a/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.cc +++ b/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.cc
@@ -123,6 +123,8 @@ SigninManagerBase* signin = ios::SigninManagerFactory::GetForBrowserState(browser_state); + SigninClient* signin_client = + SigninClientFactory::GetForBrowserState(browser_state); // Always create the GCMProfileService instance such that we can listen to // the profile notifications and purge the GCM store when the profile is @@ -135,6 +137,8 @@ ProfileSyncService::InitParams init_params; init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(signin); + init_params.signin_scoped_device_id_callback = base::BindRepeating( + &SigninClient::GetSigninScopedDeviceId, base::Unretained(signin_client)); init_params.oauth2_token_service = OAuth2TokenServiceFactory::GetForBrowserState(browser_state); init_params.start_behavior = ProfileSyncService::MANUAL_START;
diff --git a/ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.cc b/ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.cc index bc6551e..c5373bd 100644 --- a/ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.cc +++ b/ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.h" +#include <string> #include <utility> #include "base/bind.h" @@ -27,6 +28,8 @@ init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>( ios::SigninManagerFactory::GetForBrowserState(browser_state)); + init_params.signin_scoped_device_id_callback = + base::BindRepeating([]() { return std::string(); }); init_params.oauth2_token_service = OAuth2TokenServiceFactory::GetForBrowserState(browser_state); init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START;
diff --git a/ios/chrome/browser/translate/translate_egtest.mm b/ios/chrome/browser/translate/translate_egtest.mm index 600eae5..665cdb7 100644 --- a/ios/chrome/browser/translate/translate_egtest.mm +++ b/ios/chrome/browser/translate/translate_egtest.mm
@@ -115,21 +115,13 @@ // Returns a matcher for the button with label "Cancel" in the language picker. // The language picker uses the system accessibility labels, thus no IDS_CANCEL. id<GREYMatcher> LanguagePickerCancelButton() { - // Setting A11y id on this button doesn't work on iOS 9.0. - if (base::ios::IsRunningOnIOS10OrLater()) - return grey_accessibilityID(kLanguagePickerCancelButtonId); - - return chrome_test_util::ButtonWithAccessibilityLabel(@"Cancel"); + return grey_accessibilityID(kLanguagePickerCancelButtonId); } // Returns a matcher for the button with label "Done" in the language picker. // The language picker uses the system accessibility labels, thus no IDS_DONE. id<GREYMatcher> LanguagePickerDoneButton() { - // Setting A11y ID on this button doesn't work on iOS 9.0. - if (base::ios::IsRunningOnIOS10OrLater()) - return grey_accessibilityID(kLanguagePickerDoneButtonId); - - return chrome_test_util::ButtonWithAccessibilityLabel(@"Done"); + return grey_accessibilityID(kLanguagePickerDoneButtonId); } // Assigns the testing callback for the current WebState's language detection
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm index c704f38..3ac5fb5 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm
@@ -567,12 +567,10 @@ EARL_GREY_TEST_SKIPPED(@"Test not applicable for iPad"); } -// TODO(crbug.com/768339): This test is faling on devices with iOS > 9 because +// TODO(crbug.com/768339): This test is faling on devices because // grey_swipeFastInDirectionWithStartPoint does not work. #if !TARGET_IPHONE_SIMULATOR - if (@available(iOS 10.0, *)) { - EARL_GREY_TEST_DISABLED(@"Test disabled on iOS 10+ devices."); - } + EARL_GREY_TEST_DISABLED(@"Test disabled on devices."); #endif [BookmarksTestCase setupStandardBookmarks];
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index fa78d1b..1f4da2b7 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -4617,6 +4617,11 @@ _voiceSearchController->PrepareToAppear(); } +- (void)closeAllIncognitoTabs { + DCHECK(self.isOffTheRecord); + [self.tabModel closeAllTabs]; +} + #if !defined(NDEBUG) - (void)viewSource { Tab* tab = [_model currentTab];
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index 230c847..166949b3 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -220,9 +220,7 @@ - (void)viewDidLoad { [super viewDidLoad]; - if (@available(iOS 10, *)) { - self.collectionView.prefetchingEnabled = NO; - } + self.collectionView.prefetchingEnabled = NO; if (@available(iOS 11, *)) { // Use automatic behavior as each element takes the safe area into account // separately and the overscroll action does not work well with content
diff --git a/ios/chrome/browser/ui/download/download_manager_view_controller.mm b/ios/chrome/browser/ui/download/download_manager_view_controller.mm index cd4fa78..9421039 100644 --- a/ios/chrome/browser/ui/download/download_manager_view_controller.mm +++ b/ios/chrome/browser/ui/download/download_manager_view_controller.mm
@@ -413,6 +413,7 @@ _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _statusLabel.translatesAutoresizingMaskIntoConstraints = NO; _statusLabel.font = [MDCTypography body1Font]; + _statusLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; [_statusLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:
diff --git a/ios/chrome/browser/ui/history/history_panel_view_controller.mm b/ios/chrome/browser/ui/history/history_panel_view_controller.mm index 5bfe048..29b19bf7 100644 --- a/ios/chrome/browser/ui/history/history_panel_view_controller.mm +++ b/ios/chrome/browser/ui/history/history_panel_view_controller.mm
@@ -199,71 +199,6 @@ [_clearBrowsingBar updateHeight]; } -#pragma mark - Status bar - -- (BOOL)modalPresentationCapturesStatusBarAppearance { - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - return YES; - } else { - return [super modalPresentationCapturesStatusBarAppearance]; - } -} - -- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { - [super traitCollectionDidChange:previousTraitCollection]; - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - [self setNeedsStatusBarAppearanceUpdate]; - } -} - -- (UIViewController*)childViewControllerForStatusBarHidden { - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - return nil; - } else { - return _appBar.headerViewController; - } -} - -- (BOOL)prefersStatusBarHidden { - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - return NO; - } else { - return [super prefersStatusBarHidden]; - } -} - -- (UIViewController*)childViewControllerForStatusBarStyle { - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - return nil; - } else { - return _appBar.headerViewController; - } -} - -- (UIStatusBarStyle)preferredStatusBarStyle { - if (!base::ios::IsRunningOnIOS10OrLater()) { - // TODO(crbug.com/620361): Remove the entire method override when iOS 9 is - // dropped. - if (IsIPadIdiom() && !IsCompactWidth()) { - return UIStatusBarStyleLightContent; - } else { - return UIStatusBarStyleDefault; - } - } else { - return [super preferredStatusBarStyle]; - } -} - #pragma mark - HistoryCollectionViewControllerDelegate - (void)historyCollectionViewController:
diff --git a/ios/chrome/browser/ui/popup_menu/BUILD.gn b/ios/chrome/browser/ui/popup_menu/BUILD.gn index 3cc0d2d2..8e027ff7 100644 --- a/ios/chrome/browser/ui/popup_menu/BUILD.gn +++ b/ios/chrome/browser/ui/popup_menu/BUILD.gn
@@ -14,6 +14,7 @@ ":popup_menu_ui", "//base", "//ios/chrome/app/strings", + "//ios/chrome/browser/browser_state", "//ios/chrome/browser/find_in_page", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/activity_services",
diff --git a/ios/chrome/browser/ui/popup_menu/cells/popup_menu_item.h b/ios/chrome/browser/ui/popup_menu/cells/popup_menu_item.h index 60d9ff3..e46fa16a 100644 --- a/ios/chrome/browser/ui/popup_menu/cells/popup_menu_item.h +++ b/ios/chrome/browser/ui/popup_menu/cells/popup_menu_item.h
@@ -25,6 +25,8 @@ PopupMenuActionRecentTabs, PopupMenuActionHistory, PopupMenuActionSettings, + PopupMenuActionCloseTab, + PopupMenuActionCloseAllIncognitoTabs, }; // Protocol defining a popup item.
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm index d46da81..4e83f4b 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm
@@ -5,6 +5,9 @@ #import "ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.h" #include "base/logging.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/commands/popup_menu_commands.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_mediator.h" @@ -59,6 +62,8 @@ #pragma mark - PopupMenuCommands - (void)showNavigationHistoryBackPopupMenu { + base::RecordAction( + base::UserMetricsAction("MobileToolbarShowTabHistoryMenu")); UIViewController* viewController = [[UIViewController alloc] init]; UILabel* label = [[UILabel alloc] init]; label.text = @"Back"; @@ -68,6 +73,8 @@ } - (void)showNavigationHistoryForwardPopupMenu { + base::RecordAction( + base::UserMetricsAction("MobileToolbarShowTabHistoryMenu")); UIViewController* viewController = [[UIViewController alloc] init]; UILabel* label = [[UILabel alloc] init]; label.text = @"Forward"; @@ -85,8 +92,9 @@ static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher); tableViewController.baseViewController = self.baseViewController; - self.mediator = - [[PopupMenuMediator alloc] initWithType:PopupMenuTypeToolsMenu]; + self.mediator = [[PopupMenuMediator alloc] + initWithType:PopupMenuTypeToolsMenu + isIncognito:self.browserState->IsOffTheRecord()]; self.mediator.webStateList = self.webStateList; self.mediator.popupMenu = tableViewController; self.mediator.dispatcher = static_cast<id<BrowserCommands>>(self.dispatcher); @@ -96,13 +104,16 @@ } - (void)showTabGridButtonPopup { + base::RecordAction(base::UserMetricsAction("MobileToolbarShowTabGridMenu")); PopupMenuTableViewController* tableViewController = [[PopupMenuTableViewController alloc] init]; tableViewController.dispatcher = static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher); tableViewController.baseViewController = self.baseViewController; - self.mediator = [[PopupMenuMediator alloc] initWithType:PopupMenuTypeTabGrid]; + self.mediator = [[PopupMenuMediator alloc] + initWithType:PopupMenuTypeTabGrid + isIncognito:self.browserState->IsOffTheRecord()]; self.mediator.webStateList = self.webStateList; self.mediator.popupMenu = tableViewController; @@ -111,6 +122,7 @@ } - (void)searchButtonPopup { + base::RecordAction(base::UserMetricsAction("MobileToolbarShowSearchMenu")); UIViewController* viewController = [[UIViewController alloc] init]; UILabel* label = [[UILabel alloc] init]; label.text = @"Search";
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.h b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.h index 631c893..807c47f 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.h +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.h
@@ -24,7 +24,8 @@ // updating the items of the popup menu. @interface PopupMenuMediator : NSObject -- (instancetype)initWithType:(PopupMenuType)type NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithType:(PopupMenuType)type + isIncognito:(BOOL)isIncognito NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; // The WebStateList that this mediator listens for any changes on the current
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm index 48e98169..ee2e2f7b 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm
@@ -64,6 +64,9 @@ // The current web state associated with the toolbar. @property(nonatomic, assign) web::WebState* webState; +// Whether the popup menu is presented in incognito or not. +@property(nonatomic, assign) BOOL isIncognito; + #pragma mark*** Specific Items *** @property(nonatomic, strong) PopupMenuToolsItem* reloadStop; @@ -78,6 +81,7 @@ @implementation PopupMenuMediator @synthesize items = _items; +@synthesize isIncognito = _isIncognito; @synthesize popupMenu = _popupMenu; @synthesize dispatcher = _dispatcher; @synthesize type = _type; @@ -91,9 +95,10 @@ #pragma mark - Public -- (instancetype)initWithType:(PopupMenuType)type { +- (instancetype)initWithType:(PopupMenuType)type isIncognito:(BOOL)isIncognito { self = [super init]; if (self) { + _isIncognito = isIncognito; _type = type; _webStateObserver = std::make_unique<web::WebStateObserverBridge>(self); _webStateListObserver = std::make_unique<WebStateListObserverBridge>(self); @@ -222,14 +227,14 @@ if (!_items) { switch (self.type) { case PopupMenuTypeToolsMenu: - [self createToolsMenuItem]; + [self createToolsMenuItems]; break; case PopupMenuTypeNavigationForward: break; case PopupMenuTypeNavigationBackward: break; case PopupMenuTypeTabGrid: - self.items = @[ [self itemsForNewTab] ]; + [self createTabGridMenuItems]; break; case PopupMenuTypeSearch: break; @@ -317,8 +322,25 @@ #pragma mark - Item creation (Private) +// Creates the menu items for the tab grid menu. +- (void)createTabGridMenuItems { + NSMutableArray* items = [NSMutableArray arrayWithArray:[self itemsForNewTab]]; + if (self.isIncognito) { + [items addObject:CreateTableViewItem( + IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, + PopupMenuActionCloseAllIncognitoTabs, + kToolsMenuCloseAllIncognitoTabsId)]; + } + + [items addObject:CreateTableViewItem(IDS_IOS_TOOLS_MENU_CLOSE_TAB, + PopupMenuActionCloseTab, + kToolsMenuCloseTabId)]; + + self.items = @[ items ]; +} + // Creates the menu items for the tools menu. -- (void)createToolsMenuItem { +- (void)createToolsMenuItems { // Reload or stop page action, created as reload. self.reloadStop = CreateTableViewItem( IDS_IOS_TOOLS_MENU_RELOAD, PopupMenuActionReload, kToolsMenuReload);
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm index d8d3a41..1f335d1 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm
@@ -37,7 +37,12 @@ class PopupMenuMediatorTest : public PlatformTest { public: PopupMenuMediatorTest() { - mediator_ = [[PopupMenuMediator alloc] initWithType:PopupMenuTypeToolsMenu]; + mediator_incognito_ = + [[PopupMenuMediator alloc] initWithType:PopupMenuTypeToolsMenu + isIncognito:YES]; + mediator_non_incognito_ = + [[PopupMenuMediator alloc] initWithType:PopupMenuTypeToolsMenu + isIncognito:NO]; popup_menu_ = OCMClassMock([PopupMenuTableViewController class]); popup_menu_strict_ = OCMStrictClassMock([PopupMenuTableViewController class]); @@ -48,7 +53,10 @@ // Explicitly disconnect the mediator so there won't be any WebStateList // observers when web_state_list_ gets dealloc. - ~PopupMenuMediatorTest() override { [mediator_ disconnect]; } + ~PopupMenuMediatorTest() override { + [mediator_incognito_ disconnect]; + [mediator_non_incognito_ disconnect]; + } protected: void SetUpWebStateList() { @@ -81,7 +89,8 @@ void SetUpActiveWebState() { web_state_list_->ActivateWebStateAt(0); } - PopupMenuMediator* mediator_; + PopupMenuMediator* mediator_incognito_; + PopupMenuMediator* mediator_non_incognito_; ToolbarTestWebState* web_state_; ToolbarTestNavigationManager* navigation_manager_; std::unique_ptr<WebStateList> web_state_list_; @@ -92,14 +101,27 @@ }; // Test no setup is being done on the PopupMenu if there's no Webstate. -TEST_F(PopupMenuMediatorTest, TestPopupMenuSetupWithNoWebstate) { - mediator_.popupMenu = popup_menu_strict_; +TEST_F(PopupMenuMediatorTest, TestPopupMenuSetupWithNoWebstateIncognito) { + mediator_incognito_.popupMenu = popup_menu_strict_; EXPECT_OCMOCK_VERIFY(popup_menu_strict_); } -// Test no setup is being done on the LocationBar if there's no active Webstate. +// Test no setup is being done on the PopupMenu if there's no Webstate. +TEST_F(PopupMenuMediatorTest, TestPopupMenuSetupWithNoWebstate) { + mediator_non_incognito_.popupMenu = popup_menu_strict_; + EXPECT_OCMOCK_VERIFY(popup_menu_strict_); +} + +// Test no setup is being done on the PopupMenu if there's no active Webstate. +TEST_F(PopupMenuMediatorTest, TestPopupMenuSetupWithNoActiveWebstateIncognito) { + mediator_incognito_.webStateList = web_state_list_.get(); + mediator_incognito_.popupMenu = popup_menu_strict_; + EXPECT_OCMOCK_VERIFY(popup_menu_strict_); +} + +// Test no setup is being done on the PopupMenu if there's no active Webstate. TEST_F(PopupMenuMediatorTest, TestPopupMenuSetupWithNoActiveWebstate) { - mediator_.webStateList = web_state_list_.get(); - mediator_.popupMenu = popup_menu_strict_; + mediator_non_incognito_.webStateList = web_state_list_.get(); + mediator_non_incognito_.popupMenu = popup_menu_strict_; EXPECT_OCMOCK_VERIFY(popup_menu_strict_); }
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller.mm index 9aa34d31..d39cf8e 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller.mm
@@ -185,6 +185,14 @@ base::RecordAction(UserMetricsAction("MobileMenuSettings")); [self.dispatcher showSettingsFromViewController:self.baseViewController]; break; + case PopupMenuActionCloseTab: + base::RecordAction(UserMetricsAction("MobileMenuCloseTab")); + [self.dispatcher closeCurrentTab]; + break; + case PopupMenuActionCloseAllIncognitoTabs: + base::RecordAction(UserMetricsAction("MobileMenuCloseAllIncognitoTabs")); + [self.dispatcher closeAllIncognitoTabs]; + break; } // Close the tools menu.
diff --git a/ios/chrome/browser/ui/qr_scanner/camera_controller.mm b/ios/chrome/browser/ui/qr_scanner/camera_controller.mm index d27e3a5..2b426c0 100644 --- a/ios/chrome/browser/ui/qr_scanner/camera_controller.mm +++ b/ios/chrome/browser/ui/qr_scanner/camera_controller.mm
@@ -182,35 +182,27 @@ dispatch_async(_sessionQueue, ^{ // Get the back camera. NSArray* videoCaptureDevices = nil; - if (@available(iOS 10, *)) { - // Although Apple documentation claims that - // AVCaptureDeviceDiscoverySession etc. is available on iOS 10+, they are - // not really available on an app whose deployment target is iOS 10.0 - // (iOS 10.1+ are okay) and Chrome will fail at dynamic link time and - // instantly crash. NSClassFromString() checks if Objective-C run-time - // has the classes before using them. - Class discoverSessionClass = - NSClassFromString(@"AVCaptureDeviceDiscoverySession"); - if (discoverSessionClass) { - // Hardcoded value of AVCaptureDeviceTypeBuiltInWideAngleCamera here. - // When this @available(iOS 10, *) is deprecated, the unit test - // CameraControllerTest.TestAVCaptureDeviceValue can be removed. - // See https://crbug.com/826011 - NSString* cameraType = @"AVCaptureDeviceTypeBuiltInWideAngleCamera"; - AVCaptureDeviceDiscoverySession* discoverySession = - [discoverSessionClass - discoverySessionWithDeviceTypes:@[ cameraType ] - mediaType:AVMediaTypeVideo - position:AVCaptureDevicePositionBack]; - videoCaptureDevices = [discoverySession devices]; - } + + // Although Apple documentation claims that + // AVCaptureDeviceDiscoverySession etc. is available on iOS 10+, they are + // not really available on an app whose deployment target is iOS 10.0 + // (iOS 10.1+ are okay) and Chrome will fail at dynamic link time and + // instantly crash. NSClassFromString() checks if Objective-C run-time + // has the classes before using them. + Class discoverSessionClass = + NSClassFromString(@"AVCaptureDeviceDiscoverySession"); + if (discoverSessionClass) { + // Hardcoded value of AVCaptureDeviceTypeBuiltInWideAngleCamera here. + // When this @available(iOS 10, *) is deprecated, the unit test + // CameraControllerTest.TestAVCaptureDeviceValue can be removed. + // See https://crbug.com/826011 + NSString* cameraType = @"AVCaptureDeviceTypeBuiltInWideAngleCamera"; + AVCaptureDeviceDiscoverySession* discoverySession = [discoverSessionClass + discoverySessionWithDeviceTypes:@[ cameraType ] + mediaType:AVMediaTypeVideo + position:AVCaptureDevicePositionBack]; + videoCaptureDevices = [discoverySession devices]; } -#if !defined(__IPHONE_10_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0 - else { - videoCaptureDevices = - [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; - } -#endif if ([videoCaptureDevices count] == 0) { [self setCameraState:qr_scanner::CAMERA_UNAVAILABLE]; return;
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm index d2faed4..bd73103 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm
@@ -334,8 +334,8 @@ // Types JavaScript into Omnibox and verify that an alert is displayed. - (void)testTypeJavaScriptIntoOmnibox { // TODO(crbug.com/642544): Enable the test for iPad when typing bug is fixed. - if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) { - EARL_GREY_TEST_DISABLED(@"Disabled for iOS10 iPad due to a typing bug."); + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to a typing bug."); } std::map<GURL, std::string> responses; @@ -359,8 +359,8 @@ // script execution. - (void)testTypeJavaScriptIntoOmniboxWithWebUIPage { // TODO(crbug.com/642544): Enable the test for iPad when typing bug is fixed. - if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) { - EARL_GREY_TEST_DISABLED(@"Disabled for iOS10 iPad due to a typing bug."); + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to a typing bug."); } [ChromeEarlGrey loadURL:GURL("chrome://version")]; [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
diff --git a/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h b/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h index f1bde4c..74ee3470 100644 --- a/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h +++ b/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h
@@ -30,6 +30,8 @@ extern NSString* const kToolsMenuCloseAllTabsId; // Close all incognito Tabs item accessibility Identifier. extern NSString* const kToolsMenuCloseAllIncognitoTabsId; +// Close the current tab item accessibility Identifier. +extern NSString* const kToolsMenuCloseTabId; // Bookmarks item accessibility Identifier. extern NSString* const kToolsMenuBookmarksId; // Reading List item accessibility Identifier.
diff --git a/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.mm b/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.mm index f6c2f2f6..09b5843 100644 --- a/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.mm +++ b/ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.mm
@@ -26,6 +26,7 @@ NSString* const kToolsMenuCloseAllTabsId = @"kToolsMenuCloseAllTabsId"; NSString* const kToolsMenuCloseAllIncognitoTabsId = @"kToolsMenuCloseAllIncognitoTabsId"; +NSString* const kToolsMenuCloseTabId = @"kToolsMenuCloseTabId"; NSString* const kToolsMenuBookmarksId = @"kToolsMenuBookmarksId"; NSString* const kToolsMenuReadingListId = @"kToolsMenuReadingListId"; NSString* const kToolsMenuOtherDevicesId = @"kToolsMenuOtherDevicesId";
diff --git a/ios/chrome/browser/ui/uikit_ui_util.h b/ios/chrome/browser/ui/uikit_ui_util.h index 2b08768..c74c4806 100644 --- a/ios/chrome/browser/ui/uikit_ui_util.h +++ b/ios/chrome/browser/ui/uikit_ui_util.h
@@ -216,8 +216,8 @@ // Returns the current first responder. UIResponder* GetFirstResponder(); -// On iOS10 and above, trigger a haptic vibration for various types of -// actions. This is a no-op for devices that do not support haptic feedback. +// Trigger a haptic vibration for various types of actions. This is a no-op for +// devices that do not support haptic feedback. void TriggerHapticFeedbackForAction(); void TriggerHapticFeedbackForSelectionChange(); void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type);
diff --git a/ios/chrome/browser/ui/uikit_ui_util.mm b/ios/chrome/browser/ui/uikit_ui_util.mm index 96b4a76..01073370 100644 --- a/ios/chrome/browser/ui/uikit_ui_util.mm +++ b/ios/chrome/browser/ui/uikit_ui_util.mm
@@ -577,59 +577,51 @@ return firstResponder; } -// On iOS10 and above, trigger a haptic vibration for the user selecting an -// action. This is a no-op for devices that do not support it. +// Trigger a haptic vibration for the user selecting an action. This is a no-op +// for devices that do not support it. void TriggerHapticFeedbackForAction() { - if (@available(iOS 10, *)) { - // Although Apple documentation claims that UIFeedbackGenerator and its - // concrete subclasses are available on iOS 10+, they are not really - // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are - // okay) and Chrome will fail at dynamic link time and instantly crash. - // NSClassFromString() checks if Objective-C run-time has the class before - // using it. - Class generatorClass = NSClassFromString(@"UIImpactFeedbackGenerator"); - if (generatorClass) { - UIImpactFeedbackGenerator* generator = [[generatorClass alloc] init]; - [generator impactOccurred]; - } + // Although Apple documentation claims that UIFeedbackGenerator and its + // concrete subclasses are available on iOS 10+, they are not really + // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are + // okay) and Chrome will fail at dynamic link time and instantly crash. + // NSClassFromString() checks if Objective-C run-time has the class before + // using it. + Class generatorClass = NSClassFromString(@"UIImpactFeedbackGenerator"); + if (generatorClass) { + UIImpactFeedbackGenerator* generator = [[generatorClass alloc] init]; + [generator impactOccurred]; } } -// On iOS10 and above, trigger a haptic vibration for the change in selection. -// This is a no-op for devices that do not support it. +// Trigger a haptic vibration for the change in selection. This is a no-op for +// devices that do not support it. void TriggerHapticFeedbackForSelectionChange() { - if (@available(iOS 10, *)) { - // Although Apple documentation claims that UIFeedbackGenerator and its - // concrete subclasses are available on iOS 10+, they are not really - // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are - // okay) and Chrome will fail at dynamic link time and instantly crash. - // NSClassFromString() checks if Objective-C run-time has the class before - // using it. - Class generatorClass = NSClassFromString(@"UISelectionFeedbackGenerator"); - if (generatorClass) { - UISelectionFeedbackGenerator* generator = [[generatorClass alloc] init]; - [generator selectionChanged]; - } + // Although Apple documentation claims that UIFeedbackGenerator and its + // concrete subclasses are available on iOS 10+, they are not really + // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are + // okay) and Chrome will fail at dynamic link time and instantly crash. + // NSClassFromString() checks if Objective-C run-time has the class before + // using it. + Class generatorClass = NSClassFromString(@"UISelectionFeedbackGenerator"); + if (generatorClass) { + UISelectionFeedbackGenerator* generator = [[generatorClass alloc] init]; + [generator selectionChanged]; } } -// On iOS10 and above, trigger a haptic vibration for a notification. -// This is a no-op for devices that do not support it. +// Trigger a haptic vibration for a notification. This is a no-op for devices +// that do not support it. void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type) { - if (@available(iOS 10, *)) { - // Although Apple documentation claims that UIFeedbackGenerator and its - // concrete subclasses are available on iOS 10+, they are not really - // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are - // okay) and Chrome will fail at dynamic link time and instantly crash. - // NSClassFromString() checks if Objective-C run-time has the class before - // using it. - Class generatorClass = - NSClassFromString(@"UINotificationFeedbackGenerator"); - if (generatorClass) { - UINotificationFeedbackGenerator* generator = - [[generatorClass alloc] init]; - [generator notificationOccurred:type]; - } + // Although Apple documentation claims that UIFeedbackGenerator and its + // concrete subclasses are available on iOS 10+, they are not really + // available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are + // okay) and Chrome will fail at dynamic link time and instantly crash. + // NSClassFromString() checks if Objective-C run-time has the class before + // using it. + Class generatorClass = NSClassFromString(@"UINotificationFeedbackGenerator"); + if (generatorClass) { + UINotificationFeedbackGenerator* generator = [[generatorClass alloc] init]; + [generator notificationOccurred:type]; } }
diff --git a/ios/chrome/search_widget_extension/search_widget_view_controller.mm b/ios/chrome/search_widget_extension/search_widget_view_controller.mm index 4fe56774..d7a3aee2 100644 --- a/ios/chrome/search_widget_extension/search_widget_view_controller.mm +++ b/ios/chrome/search_widget_extension/search_widget_view_controller.mm
@@ -128,11 +128,8 @@ (id<UIViewControllerTransitionCoordinator>)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - BOOL isCompact = NO; - if (@available(iOS 10, *)) { - isCompact = [self.extensionContext widgetActiveDisplayMode] == - NCWidgetDisplayModeCompact; - } + BOOL isCompact = [self.extensionContext widgetActiveDisplayMode] == + NCWidgetDisplayModeCompact; [coordinator animateAlongsideTransition:^(
diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc index 13279ca8..5117cd0 100644 --- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
@@ -623,6 +623,14 @@ DVLOGF(3) << "All input frames needed to be flushed are enqueued."; encoder_input_queue_.pop(); + // If we are not streaming, the device is not running and there is no need + // to call V4L2_ENC_CMD_STOP to request a flush. This also means there is + // nothing left to process, so we can return flush success back to the + // client. + if (!input_streamon_) { + std::move(flush_callback_).Run(true); + return; + } struct v4l2_encoder_cmd cmd; memset(&cmd, 0, sizeof(cmd)); cmd.cmd = V4L2_ENC_CMD_STOP;
diff --git a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc index a6d995a8..85edbca 100644 --- a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
@@ -142,9 +142,7 @@ const MakeGLContextCurrentCallback& make_context_current_cb, const BindGLImageCallback& bind_image_cb) : state_(kUninitialized), - input_ready_(&lock_), vaapi_picture_factory_(new VaapiPictureFactory()), - surfaces_available_(&lock_), task_runner_(base::ThreadTaskRunnerHandle::Get()), decoder_thread_("VaapiDecoderThread"), num_frames_at_client_(0), @@ -299,20 +297,17 @@ } TRACE_COUNTER1("media,gpu", "Vaapi input buffers", input_buffers_.size()); - input_ready_.Signal(); switch (state_) { case kIdle: state_ = kDecoding; + FALLTHROUGH; + case kDecoding: decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, base::Unretained(this))); break; - case kDecoding: - // Decoder already running. - break; - case kResetting: // When resetting, allow accumulating bitstream buffers, so that // the client can queue after-seek-buffers while we are finishing with @@ -327,152 +322,87 @@ } } -bool VaapiVideoDecodeAccelerator::GetCurrInputBuffer_Locked() { - DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); - lock_.AssertAcquired(); - - if (curr_input_buffer_.get()) - return true; - - // Will only wait if it is expected that in current state new buffers will - // be queued from the client via Decode(). The state can change during wait. - while (input_buffers_.empty() && (state_ == kDecoding || state_ == kIdle)) - input_ready_.Wait(); - - // We could have got woken up in a different state or never got to sleep - // due to current state. - if (state_ != kDecoding && state_ != kIdle) - return false; - - DCHECK(!input_buffers_.empty()); - curr_input_buffer_ = std::move(input_buffers_.front()); - input_buffers_.pop(); - TRACE_COUNTER1("media,gpu", "Input buffers", input_buffers_.size()); - - if (curr_input_buffer_->IsFlushRequest()) { - VLOGF(4) << "New flush buffer"; - return true; - } - - VLOGF(4) << "New |curr_input_buffer_|, id: " << curr_input_buffer_->id() - << " size: " << curr_input_buffer_->shm()->size() << "B"; - decoder_->SetStream( - curr_input_buffer_->id(), - static_cast<uint8_t*>(curr_input_buffer_->shm()->memory()), - curr_input_buffer_->shm()->size()); - - return true; -} - -void VaapiVideoDecodeAccelerator::ReturnCurrInputBuffer_Locked() { - DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); - lock_.AssertAcquired(); - DCHECK(curr_input_buffer_.get()); - curr_input_buffer_.reset(); -} - -// TODO(posciak): refactor the whole class to remove sleeping in wait for -// surfaces, and reschedule DecodeTask instead. -bool VaapiVideoDecodeAccelerator::WaitForSurfaces_Locked() { - DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); - lock_.AssertAcquired(); - - while (available_va_surfaces_.empty() && - (state_ == kDecoding || state_ == kIdle)) { - surfaces_available_.Wait(); - } - - return state_ == kDecoding || state_ == kIdle; -} - void VaapiVideoDecodeAccelerator::DecodeTask() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); - base::AutoLock auto_lock(lock_); - if (state_ != kDecoding) + // Hold off any |decoder_| operations until a surface recycling finishes. + if (awaiting_va_surfaces_recycle_) return; - VLOGF(4) << "Decode task"; - // Try to decode what stream data is (still) in the decoder until we run out - // of it. - while (GetCurrInputBuffer_Locked()) { - DCHECK(curr_input_buffer_.get()); + { + base::AutoLock auto_lock(lock_); + if (state_ != kDecoding) + return; - if (curr_input_buffer_->IsFlushRequest()) { - FlushTask(); + // Extract |curr_input_buffer_| out of |input_buffers_| if we have none, and + // set it in |decoder_| if it isn't a Flush Request. + if (!curr_input_buffer_ && !input_buffers_.empty()) { + curr_input_buffer_ = std::move(input_buffers_.front()); + input_buffers_.pop(); + + if (curr_input_buffer_->IsFlushRequest()) { + VLOGF(4) << "New flush buffer"; + FlushTask(); + return; + } + + SharedMemoryRegion* const shm = curr_input_buffer_->shm(); + VLOGF(4) << "New |curr_input_buffer|, id " << curr_input_buffer_->id() + << " size: " << shm->size() << "B"; + decoder_->SetStream(curr_input_buffer_->id(), + static_cast<uint8_t*>(shm->memory()), shm->size()); + } + } + + AcceleratedVideoDecoder::DecodeResult res; + { + TRACE_EVENT0("media,gpu", "VAVDA::Decode"); + res = decoder_->Decode(); + } + switch (res) { + case AcceleratedVideoDecoder::kAllocateNewSurfaces: + VLOGF(2) << "Decoder requesting a new set of surfaces"; + // Mark immediately that we start a recycling operation to prevent decodes + // with the new resolution from being started. + DCHECK(!awaiting_va_surfaces_recycle_); + awaiting_va_surfaces_recycle_ = true; + + // |decoder_| has stopped running; wait until |pending_output_cbs_| is + // exhausted to guarantee that any decode frames in flight are processed + // before changing the resolution. + task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange, + weak_this_, decoder_->GetRequiredNumOfPictures(), + decoder_->GetPicSize())); + // We'll be rescheduled once TryFinishSurfaceSetChange() requests the + // |client_| to ProvidePictureBuffers() via AssignPictureBuffers(). + return; + + case AcceleratedVideoDecoder::kRanOutOfStreamData: + curr_input_buffer_.reset(); break; - } - AcceleratedVideoDecoder::DecodeResult res; - { - // We are OK releasing the lock here, as decoder never calls our methods - // directly and we will reacquire the lock before looking at state again. - // This is the main decode function of the decoder and while keeping - // the lock for its duration would be fine, it would defeat the purpose - // of having a separate decoder thread. - base::AutoUnlock auto_unlock(lock_); - TRACE_EVENT0("media,gpu", "VAVDA::Decode"); - res = decoder_->Decode(); - } + case AcceleratedVideoDecoder::kRanOutOfSurfaces: + // We'll be rescheduled once we get a VA Surface via RecycleVASurfaceID(). + break; - switch (res) { - case AcceleratedVideoDecoder::kAllocateNewSurfaces: - VLOGF(2) << "Decoder requesting a new set of surfaces"; - task_runner_->PostTask( - FROM_HERE, - base::Bind(&VaapiVideoDecodeAccelerator::InitiateSurfaceSetChange, - weak_this_, decoder_->GetRequiredNumOfPictures(), - decoder_->GetPicSize())); - // We'll get rescheduled once ProvidePictureBuffers() finishes. - return; + case AcceleratedVideoDecoder::kNeedContextUpdate: + // This shouldn't happen as we return false from IsFrameContextRequired(). + NOTREACHED() << "Context updates not supported"; + return; - case AcceleratedVideoDecoder::kRanOutOfStreamData: - ReturnCurrInputBuffer_Locked(); - break; - - case AcceleratedVideoDecoder::kRanOutOfSurfaces: - // No more output buffers in the decoder, try getting more or go to - // sleep waiting for them. - if (!WaitForSurfaces_Locked()) - return; - - break; - - case AcceleratedVideoDecoder::kNeedContextUpdate: - // This should not happen as we return false from - // IsFrameContextRequired(). - NOTREACHED() << "Context updates not supported"; - return; - - case AcceleratedVideoDecoder::kDecodeError: - RETURN_AND_NOTIFY_ON_FAILURE(false, "Error decoding stream", - PLATFORM_FAILURE, ); - return; - } + case AcceleratedVideoDecoder::kDecodeError: + RETURN_AND_NOTIFY_ON_FAILURE(false, "Error decoding stream", + PLATFORM_FAILURE, ); + return; } } -void VaapiVideoDecodeAccelerator::InitiateSurfaceSetChange(size_t num_pics, - gfx::Size size) { - DCHECK(task_runner_->BelongsToCurrentThread()); - DCHECK(!awaiting_va_surfaces_recycle_); - - // At this point decoder has stopped running and has already posted onto our - // loop any remaining output request callbacks, which executed before we got - // here. Some of them might have been pended though, because we might not - // have had enough TFPictures to output surfaces to. Initiate a wait cycle, - // which will wait for client to return enough PictureBuffers to us, so that - // we can finish all pending output callbacks, releasing associated surfaces. - VLOGF(2) << "Initiating surface set change"; - awaiting_va_surfaces_recycle_ = true; - - requested_num_pics_ = num_pics; - requested_pic_size_ = size; - - TryFinishSurfaceSetChange(); -} - -void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { +void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange( + size_t num_pics, + const gfx::Size& size) { DCHECK(task_runner_->BelongsToCurrentThread()); if (!awaiting_va_surfaces_recycle_) @@ -480,20 +410,21 @@ if (!pending_output_cbs_.empty() || pictures_.size() != available_va_surfaces_.size()) { - // Either: - // 1. Not all pending pending output callbacks have been executed yet. - // Wait for the client to return enough pictures and retry later. - // 2. The above happened and all surface release callbacks have been posted - // as the result, but not all have executed yet. Post ourselves after them - // to let them release surfaces. + // Either: Not all |pending_output_cbs_| have been executed yet + // (i.e. they're waiting for resources in TryOutputSurface()), or |client_| + // hasn't returned all the |available_va_surfaces_| (via + // RecycleVASurfaceID), In any case, give some time for both to happen. DVLOGF(2) << "Awaiting pending output/surface release callbacks to finish"; task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange, - weak_this_)); + weak_this_, num_pics, size)); return; } + requested_num_pics_ = num_pics; + requested_pic_size_ = size; + // All surfaces released, destroy them and dismiss all PictureBuffers. awaiting_va_surfaces_recycle_ = false; available_va_surfaces_.clear(); @@ -552,7 +483,9 @@ base::AutoLock auto_lock(lock_); available_va_surfaces_.push_back(va_surface_id); - surfaces_available_.Signal(); + decoder_thread_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&VaapiVideoDecodeAccelerator::DecodeTask, + base::Unretained(this))); } void VaapiVideoDecodeAccelerator::AssignPictureBuffers( @@ -577,6 +510,7 @@ buffers.size(), &va_surface_ids), "Failed creating VA Surfaces", PLATFORM_FAILURE, ); DCHECK_EQ(va_surface_ids.size(), buffers.size()); + available_va_surfaces_.assign(va_surface_ids.begin(), va_surface_ids.end()); for (size_t i = 0; i < buffers.size(); ++i) { uint32_t client_id = !buffers[i].client_texture_ids().empty() @@ -606,9 +540,6 @@ pictures_.insert(std::make_pair(buffers[i].id(), std::move(picture))) .second; DCHECK(inserted); - - available_va_surfaces_.push_back(va_surface_ids[i]); - surfaces_available_.Signal(); } // Resume DecodeTask if it is still in decoding state. @@ -759,7 +690,7 @@ // Return current input buffer, if present. if (curr_input_buffer_) - ReturnCurrInputBuffer_Locked(); + curr_input_buffer_.reset(); // And let client know that we are done with reset. task_runner_->PostTask( @@ -784,9 +715,6 @@ decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::ResetTask, base::Unretained(this))); - - input_ready_.Signal(); - surfaces_available_.Signal(); } void VaapiVideoDecodeAccelerator::FinishReset() { @@ -848,11 +776,6 @@ // TODO(mcasas): consider deleting |decoder_| on // |decoder_thread_task_runner_|, https://crbug.com/789160. - // Signal all potential waiters on the decoder_thread_, let them early-exit, - // as we've just moved to the kDestroying state, and wait for all tasks - // to finish. - input_ready_.Signal(); - surfaces_available_.Signal(); { base::AutoUnlock auto_unlock(lock_); decoder_thread_.Stop();
diff --git a/media/gpu/vaapi/vaapi_video_decode_accelerator.h b/media/gpu/vaapi/vaapi_video_decode_accelerator.h index e0e53e8..982bfc78 100644 --- a/media/gpu/vaapi/vaapi_video_decode_accelerator.h +++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.h
@@ -23,7 +23,6 @@ #include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" -#include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "media/base/bitstream_buffer.h" @@ -116,21 +115,6 @@ // Queue a input buffer for decode. void QueueInputBuffer(const BitstreamBuffer& bitstream_buffer); - // Gets a new |current_input_buffer_| from |input_buffers_| and sets it up in - // |decoder_|. This method will sleep if no |input_buffers_| are available. - // Returns true if a new buffer has been set up, false if an early exit has - // been requested (due to initiated reset/flush/destroy). - bool GetCurrInputBuffer_Locked(); - - // Signals the client that |curr_input_buffer_| has been read and can be - // returned. Will also release the mapping. - void ReturnCurrInputBuffer_Locked(); - - // Waits for more surfaces to become available. Returns true once they do or - // false if an early exit has been requested (due to an initiated - // reset/flush/destroy). - bool WaitForSurfaces_Locked(); - // Continue decoding given input buffers and sleep waiting for input/output // as needed. Will exit if a new set of surfaces or reset/flush/destroy // is requested. @@ -185,10 +169,7 @@ // Initiate wait cycle for surfaces to be released before we release them // and allocate new ones, as requested by the decoder. - void InitiateSurfaceSetChange(size_t num_pics, gfx::Size size); - - // Check if the surfaces have been released or post ourselves for later. - void TryFinishSurfaceSetChange(); + void TryFinishSurfaceSetChange(size_t num_pics, const gfx::Size& size); // VAVDA state. enum State { @@ -204,19 +185,21 @@ kDestroying, }; - // Protects input buffer and surface queues and state_. + // Protects input buffer and surface queues and |state_|. base::Lock lock_; State state_; Config::OutputMode output_mode_; - // Queue of available InputBuffers (picture_buffer_ids). + // Queue of input InputBuffers (PictureBuffer ids) to decode. base::queue<std::unique_ptr<InputBuffer>> input_buffers_; - // Signalled when input buffers are queued onto |input_buffers_| queue. - base::ConditionVariable input_ready_; - - // Current input buffer at decoder. + // Current InputBuffer at |decoder_|. + // Only accessed on |decoder_thread_task_runner_| (needs no |lock_|) std::unique_ptr<InputBuffer> curr_input_buffer_; + // VA Surfaces no longer in use that can be passed back to the decoder for + // reuse, once it requests them. + std::list<VASurfaceID> available_va_surfaces_; + // Queue for incoming output buffers (texture ids). using OutputBuffers = base::queue<int32_t>; OutputBuffers output_buffers_; @@ -237,13 +220,6 @@ // Return a VaapiPicture associated with given client-provided id. VaapiPicture* PictureById(int32_t picture_buffer_id); - // VA Surfaces no longer in use that can be passed back to the decoder for - // reuse, once it requests them. - std::list<VASurfaceID> available_va_surfaces_; - // Signalled when output surfaces are queued onto the available_va_surfaces_ - // queue. - base::ConditionVariable surfaces_available_; - // Pending output requests from the decoder. When it indicates that we should // output a surface and we have an available Picture (i.e. texture) ready // to use, we'll execute the callback passing the Picture. The callback
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 3d917cc..c5f72a9 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -740,6 +740,62 @@ EXPECT_TRUE(iter != retry_info.end()); } +// This test requests a stream for an https:// URL using an HTTP proxy. +// The proxy will fail to establish a tunnel via connect, and the resolved +// proxy list includes a fallback to DIRECT. +// +// The expected behavior is that proxy fallback does NOT occur, even though the +// request might work using the fallback. This is a regression test for +// https://crbug.com/680837. +TEST_F(HttpStreamFactoryTest, NoProxyFallbackOnTunnelFail) { + const char* kProxyString = "PROXY bad:99; DIRECT"; + SpdySessionDependencies session_deps( + ProxyResolutionService::CreateFixedFromPacResult( + kProxyString, TRAFFIC_ANNOTATION_FOR_TESTS)); + + // A 404 in response to a CONNECT will trigger + // ERR_TUNNEL_CONNECTION_FAILED. + MockRead data_reads[] = { + MockRead("HTTP/1.1 404 Not Found\r\n\r\n"), MockRead(SYNCHRONOUS, OK), + }; + + // Simulate a failure during CONNECT to bad:99. + StaticSocketDataProvider socket_data1(data_reads, arraysize(data_reads), + nullptr, 0); + socket_data1.set_connect_data(MockConnect(SYNCHRONOUS, OK)); + session_deps.socket_factory->AddSocketDataProvider(&socket_data1); + + std::unique_ptr<HttpNetworkSession> session( + SpdySessionDependencies::SpdyCreateSession(&session_deps)); + + // Request a stream for an https:// URL. The exact URL doesn't matter for + // this test, since it mocks a failure immediately when establishing a + // tunnel through the proxy. + HttpRequestInfo request_info; + request_info.method = "GET"; + request_info.url = GURL("https://www.google.com"); + request_info.traffic_annotation = + MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS); + + SSLConfig ssl_config; + StreamRequestWaiter waiter; + std::unique_ptr<HttpStreamRequest> request( + session->http_stream_factory()->RequestStream( + request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, + /* enable_ip_based_pooling = */ true, + /* enable_alternative_services = */ true, NetLogWithSource())); + waiter.WaitForStream(); + + // The stream should have failed, since the proxy server failed to + // establish a tunnel. + ASSERT_THAT(waiter.error_status(), IsError(ERR_TUNNEL_CONNECTION_FAILED)); + + // The proxy should NOT have been marked as bad. + const ProxyRetryInfoMap& retry_info = + session->proxy_resolution_service()->proxy_retry_info(); + EXPECT_EQ(0u, retry_info.size()); +} + // List of errors that are used in the tests related to QUIC proxy. const int quic_proxy_test_mock_errors[] = { ERR_PROXY_CONNECTION_FAILED, @@ -751,7 +807,6 @@ ERR_CONNECTION_REFUSED, ERR_CONNECTION_ABORTED, ERR_TIMED_OUT, - ERR_TUNNEL_CONNECTION_FAILED, ERR_SOCKS_CONNECTION_FAILED, ERR_PROXY_CERTIFICATE_INVALID, ERR_QUIC_PROTOCOL_ERROR,
diff --git a/net/http/proxy_fallback.cc b/net/http/proxy_fallback.cc index fb272aa8..0c43b2e 100644 --- a/net/http/proxy_fallback.cc +++ b/net/http/proxy_fallback.cc
@@ -16,6 +16,12 @@ // to proxy servers. The hostname in those URLs might fail to resolve if we // are still using a non-proxy config. We need to check if a proxy config // now exists that corresponds to a proxy server that could load the URL. + // + // A failure while establishing a tunnel to the proxy + // (ERR_TUNNEL_CONNECTION_FAILED) is NOT considered grounds for fallback. + // Other browsers similarly don't fallback, and some client's PAC + // configurations rely on this for some degree of content blocking. + // See https://crbug.com/680837 for details. switch (*error) { case ERR_PROXY_CONNECTION_FAILED: case ERR_NAME_NOT_RESOLVED: @@ -27,7 +33,6 @@ case ERR_CONNECTION_REFUSED: case ERR_CONNECTION_ABORTED: case ERR_TIMED_OUT: - case ERR_TUNNEL_CONNECTION_FAILED: case ERR_SOCKS_CONNECTION_FAILED: // ERR_PROXY_CERTIFICATE_INVALID can happen in the case of trying to talk to // a proxy using SSL, and ending up talking to a captive portal that
diff --git a/net/network_error_logging/network_error_logging_end_to_end_test.cc b/net/network_error_logging/network_error_logging_end_to_end_test.cc index d395643..b121a7f 100644 --- a/net/network_error_logging/network_error_logging_end_to_end_test.cc +++ b/net/network_error_logging/network_error_logging_end_to_end_test.cc
@@ -4,8 +4,10 @@ #include "base/macros.h" #include "base/run_loop.h" +#include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/test/values_test_util.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/values.h" #include "build/build_config.h" @@ -52,7 +54,8 @@ class NetworkErrorLoggingEndToEndTest : public ::testing::Test { protected: NetworkErrorLoggingEndToEndTest() - : test_server_(test_server::EmbeddedTestServer::TYPE_HTTPS), + : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), + test_server_(test_server::EmbeddedTestServer::TYPE_HTTPS), upload_should_hang_(false), upload_received_(false) { // Make report delivery happen instantly. @@ -83,6 +86,10 @@ EXPECT_TRUE(test_server_.Start()); } + ~NetworkErrorLoggingEndToEndTest() override { + EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); + } + GURL GetConfigureURL() { return test_server_.GetURL(kConfigurePath); } GURL GetFailURL() { return test_server_.GetURL(kFailPath); } @@ -123,14 +130,11 @@ if (request.relative_url != kReportPath) return nullptr; - EXPECT_FALSE(upload_received_); - upload_received_ = true; - EXPECT_TRUE(request.has_content); - upload_content_ = request.content; - - if (!upload_closure_.is_null()) - std::move(upload_closure_).Run(); + main_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&NetworkErrorLoggingEndToEndTest::OnUploadReceived, + base::Unretained(this), request.content)); if (upload_should_hang_) return std::make_unique<HungHttpResponse>(); @@ -141,13 +145,20 @@ return std::move(response); } + void OnUploadReceived(std::string content) { + upload_received_ = true; + upload_content_ = content; + upload_run_loop_.Quit(); + } + + scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; std::unique_ptr<URLRequestContext> url_request_context_; test_server::EmbeddedTestServer test_server_; bool upload_should_hang_; bool upload_received_; std::string upload_content_; - base::OnceClosure upload_closure_; + base::RunLoop upload_run_loop_; private: DISALLOW_COPY_AND_ASSIGN(NetworkErrorLoggingEndToEndTest); @@ -155,30 +166,24 @@ TEST_F(NetworkErrorLoggingEndToEndTest, ReportNetworkError) { TestDelegate configure_delegate; + configure_delegate.set_quit_on_complete(false); auto configure_request = url_request_context_->CreateRequest( GetConfigureURL(), DEFAULT_PRIORITY, &configure_delegate, TRAFFIC_ANNOTATION_FOR_TESTS); configure_request->set_method("GET"); configure_request->Start(); - base::RunLoop().Run(); - EXPECT_TRUE(configure_request->status().is_success()); TestDelegate fail_delegate; + fail_delegate.set_quit_on_complete(false); auto fail_request = url_request_context_->CreateRequest( GetFailURL(), DEFAULT_PRIORITY, &fail_delegate, TRAFFIC_ANNOTATION_FOR_TESTS); fail_request->set_method("GET"); fail_request->Start(); - base::RunLoop().Run(); - EXPECT_EQ(URLRequestStatus::FAILED, fail_request->status().status()); - EXPECT_EQ(ERR_EMPTY_RESPONSE, fail_request->status().error()); - if (!upload_received_) { - base::RunLoop run_loop; - upload_closure_ = run_loop.QuitClosure(); - run_loop.Run(); - } + upload_run_loop_.Run(); + EXPECT_TRUE(upload_received_); auto reports = base::test::ParseJson(upload_content_); base::ListValue* reports_list; @@ -199,26 +204,26 @@ // Make sure an upload that is in progress at shutdown does not crash. // This verifies that https://crbug.com/792978 is fixed. -// Disabled due to frequent timeouts - see https://crbug.com/820950 . -TEST_F(NetworkErrorLoggingEndToEndTest, DISABLED_UploadAtShutdown) { +TEST_F(NetworkErrorLoggingEndToEndTest, UploadAtShutdown) { upload_should_hang_ = true; TestDelegate configure_delegate; + configure_delegate.set_quit_on_complete(false); auto configure_request = url_request_context_->CreateRequest( GetConfigureURL(), DEFAULT_PRIORITY, &configure_delegate, TRAFFIC_ANNOTATION_FOR_TESTS); configure_request->set_method("GET"); configure_request->Start(); - base::RunLoop().Run(); - EXPECT_TRUE(configure_request->status().is_success()); TestDelegate fail_delegate; + fail_delegate.set_quit_on_complete(false); auto fail_request = url_request_context_->CreateRequest( GetFailURL(), DEFAULT_PRIORITY, &fail_delegate, TRAFFIC_ANNOTATION_FOR_TESTS); fail_request->set_method("GET"); fail_request->Start(); - base::RunLoop().RunUntilIdle(); + + upload_run_loop_.Run(); // Let Reporting and NEL shut down with the upload still pending to see if // they crash.
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn index 51ded00..207ef46 100644 --- a/sandbox/linux/BUILD.gn +++ b/sandbox/linux/BUILD.gn
@@ -149,6 +149,10 @@ "seccomp-bpf/trap_unittest.cc", ] deps += [ ":bpf_dsl_golden" ] + + if (is_android) { + sources += [ "seccomp-bpf-helpers/baseline_policy_android_unittest.cc" ] + } } if (compile_credentials) { sources += [
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.cc index 9a37225..f0b658d 100644 --- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.cc +++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.cc
@@ -170,6 +170,11 @@ return RestrictClockID(); } + // https://crbug.com/826289 + if (sysno == __NR_getrusage) { + return RestrictGetrusage(); + } + #if defined(__x86_64__) if (sysno == __NR_arch_prctl) { const Arg<int> code(0);
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android_unittest.cc new file mode 100644 index 0000000..ceecbaf --- /dev/null +++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android_unittest.cc
@@ -0,0 +1,25 @@ +// Copyright 2018 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/linux/seccomp-bpf-helpers/baseline_policy_android.h" + +#include <sys/resource.h> + +#include "sandbox/linux/seccomp-bpf/bpf_tests.h" + +namespace sandbox { +namespace { + +BPF_TEST_C(BaselinePolicyAndroid, Getrusage, BaselinePolicyAndroid) { + struct rusage usage{}; + + errno = 0; + BPF_ASSERT_EQ(0, getrusage(RUSAGE_SELF, &usage)); + + errno = 0; + BPF_ASSERT_EQ(0, getrusage(RUSAGE_THREAD, &usage)); +} + +} // namespace +} // namespace sandbox
diff --git a/services/network/public/cpp/cors/cors.cc b/services/network/public/cpp/cors/cors.cc index 81c480a..d1c607eb 100644 --- a/services/network/public/cpp/cors/cors.cc +++ b/services/network/public/cpp/cors/cors.cc
@@ -12,6 +12,7 @@ #include "net/http/http_request_headers.h" #include "url/gurl.h" #include "url/origin.h" +#include "url/url_constants.h" #include "url/url_util.h" namespace { @@ -40,6 +41,18 @@ return std::string(); } +// url::Origin::Serialize() serializes all Origins with a 'file' scheme to +// 'file://', but it isn't desirable for CORS check. Returns 'null' instead to +// be aligned with HTTP Origin header calculation in Blink SecurityOrigin. +// |allow_file_origin| is used to realize a behavior change that +// the --allow-file-access-from-files command-line flag needs. +// TODO(mkwst): Generalize and move to url/Origin. +std::string Serialize(const url::Origin& origin, bool allow_file_origin) { + if (!allow_file_origin && origin.scheme() == url::kFileScheme) + return "null"; + return origin.Serialize(); +} + } // namespace namespace network { @@ -64,7 +77,8 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, mojom::FetchCredentialsMode credentials_mode, - const url::Origin& origin) { + const url::Origin& origin, + bool allow_file_origin) { if (!response_status_code) return mojom::CORSError::kInvalidResponse; @@ -84,7 +98,7 @@ return mojom::CORSError::kWildcardOriginNotAllowed; } else if (!allow_origin_header) { return mojom::CORSError::kMissingAllowOriginHeader; - } else if (*allow_origin_header != origin.Serialize()) { + } else if (*allow_origin_header != Serialize(origin, allow_file_origin)) { // We do not use url::Origin::IsSameOriginWith() here for two reasons below. // 1. Allow "null" to match here. The latest spec does not have a clear // information about this (https://fetch.spec.whatwg.org/#cors-check),
diff --git a/services/network/public/cpp/cors/cors.h b/services/network/public/cpp/cors/cors.h index 7520257..c4a58fb 100644 --- a/services/network/public/cpp/cors/cors.h +++ b/services/network/public/cpp/cors/cors.h
@@ -44,7 +44,8 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, network::mojom::FetchCredentialsMode credentials_mode, - const url::Origin& origin); + const url::Origin& origin, + bool allow_file_origin = false); // Given a redirected-to URL, checks if the location is allowed // according to CORS. That is:
diff --git a/services/network/public/cpp/cors/cors_url_loader.cc b/services/network/public/cpp/cors/cors_url_loader.cc index 96d1183d..d35a72e 100644 --- a/services/network/public/cpp/cors/cors_url_loader.cc +++ b/services/network/public/cpp/cors/cors_url_loader.cc
@@ -132,6 +132,7 @@ DCHECK(forwarding_client_); DCHECK(!is_waiting_follow_redirect_call_); if (fetch_cors_flag_ && cors::IsCORSEnabledRequestMode(fetch_request_mode_)) { + // TODO(toyoshim): Reflect --allow-file-access-from-files flag. base::Optional<mojom::CORSError> cors_error = cors::CheckAccess( last_response_url_, response_head.headers->response_code(), GetHeaderString(response_head.headers,
diff --git a/styleguide/c++/blink-c++.md b/styleguide/c++/blink-c++.md index f66ee2c1..c505566 100644 --- a/styleguide/c++/blink-c++.md +++ b/styleguide/c++/blink-c++.md
@@ -196,26 +196,29 @@ } ``` -### Leave obvious parameter names out of function declarations -Leave obvious parameter names out of function declarations. A good rule of +### May leave obvious parameter names out of function declarations +[Google C++ Style Guide] allows us to leave parameter names out only if +the parameter is not used. In Blink, you may leave obvious parameter +names out of function declarations for historical reason. A good rule of thumb is if the parameter type name contains the parameter name (without trailing numbers or pluralization), then the parameter name isn’t needed. -`bool`, string, and numerical arguments should usually be named unless the -meaning is apparent from the function name. - **Good:** ```c++ class Node { public: - Node(TreeScope*, ConstructionType); + Node(TreeScope* tree_scope, ConstructionType construction_type); + // You may leave them out like: + // Node(TreeScope*, ConstructionType); // The function name makes the meaning of the parameters clear. void SetActive(bool); void SetDragged(bool); void SetHovered(bool); - // ... + // Parameters are not obvious. + DispatchEventResult DispatchDOMActivateEvent(int detail, + Event& underlying_event); }; ``` @@ -223,15 +226,10 @@ ```c++ class Node { public: - // Parameter names simply repeat the parameter types. - Node(TreeScope* tree_scope, ConstructionType construction_type); - - // Parameter names are redundant with function names. - void SetActive(bool is_active); - void SetDragged(bool is_dragged); - void SetHovered(bool is_hovered); - // ... + + // Parameters are not obvious. + DispatchEventResult DispatchDOMActivateEvent(int, Event&); }; ```
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 3c93d48..79b672a 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -4074,9 +4074,7 @@ { "args": [ "--xvfb", - "--extra-browser-args=--enable-features=VizDisplayCompositor", - "--skip=contrib.cluster_telemetry.screenshot_unittest.ScreenshotUnitTest.testScreenshot", - "--skip=measurements.tab_switching_unittest.TabSwitchingUnittest.testTabSwitching" + "--extra-browser-args=--enable-features=VizDisplayCompositor" ], "isolate_name": "telemetry_perf_unittests", "name": "telemetry_perf_unittests_viz", @@ -4096,12 +4094,7 @@ }, { "args": [ - "--extra-browser-args=--enable-features=VizDisplayCompositor", - "--skip=telemetry.internal.actions.scroll_unittest.ScrollActionTest.testWheelScrollDistanceWhileZoomed", - "--skip=telemetry.internal.backends.chrome_inspector.inspector_page_unittest.InspectorPageTest.testCaptureScreenshot", - "--skip=telemetry.internal.backends.chrome.tab_list_backend_unittest.TabListBackendTest.testNewTab", - "--skip=telemetry.internal.browser.tab_unittest.GpuTabTest.testScreenshot", - "--skip=telemetry.page.cache_temperature_unittest.CacheTemperatureTests.testEnsureHotAfterColdRun" + "--extra-browser-args=--enable-features=VizDisplayCompositor" ], "isolate_name": "telemetry_unittests", "name": "telemetry_unittests_viz",
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 8808ac10..cbaa8301 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -996,8 +996,6 @@ 'args': [ '--xvfb', '--extra-browser-args=--enable-features=VizDisplayCompositor', - '--skip=contrib.cluster_telemetry.screenshot_unittest.ScreenshotUnitTest.testScreenshot', - '--skip=measurements.tab_switching_unittest.TabSwitchingUnittest.testTabSwitching', ], 'swarming': { 'hard_timeout': 960, @@ -1008,11 +1006,6 @@ 'isolate_name': 'telemetry_unittests', 'args': [ '--extra-browser-args=--enable-features=VizDisplayCompositor', - '--skip=telemetry.internal.actions.scroll_unittest.ScrollActionTest.testWheelScrollDistanceWhileZoomed', - '--skip=telemetry.internal.backends.chrome_inspector.inspector_page_unittest.InspectorPageTest.testCaptureScreenshot', - '--skip=telemetry.internal.backends.chrome.tab_list_backend_unittest.TabListBackendTest.testNewTab', - '--skip=telemetry.internal.browser.tab_unittest.GpuTabTest.testScreenshot', - '--skip=telemetry.page.cache_temperature_unittest.CacheTemperatureTests.testEnsureHotAfterColdRun', ], 'swarming': { 'shards': 4,
diff --git a/testing/libfuzzer/getting_started.md b/testing/libfuzzer/getting_started.md index 74ed6922..fc6adc0 100644 --- a/testing/libfuzzer/getting_started.md +++ b/testing/libfuzzer/getting_started.md
@@ -6,7 +6,7 @@ This document will walk you through: -* setting up your build enviroment. +* setting up your build environment. * creating your first fuzz target. * running the fuzz target and verifying its vitals. @@ -29,7 +29,7 @@ | GN Argument | Description | |--------------|----| | `is_asan=true` | enables [Address Sanitizer] to catch problems like buffer overruns. | -| `is_msan=true` | enables [Memory Sanitizer] to catch problems like uninitialed reads<sup>\[[*](reference.md#MSan)\]</sup>. | +| `is_msan=true` | enables [Memory Sanitizer] to catch problems like uninitialized reads<sup>\[[*](reference.md#MSan)\]</sup>. | | `is_ubsan_security=true` | enables [Undefined Behavior Sanitizer] to catch<sup>\[[*](reference.md#UBSan)\]</sup> undefined behavior like integer overflow. | | | it is possible to run libfuzzer without any sanitizers; *probably not what you want*.| @@ -131,7 +131,7 @@ in [Seed Corpus] section of the [Efficient Fuzzer Guide]. *Make sure corpus files are appropriately licensed.* * Create mutation dictionary. With a `dict = "protocol.dict"` attribute and -`key=value` dicitionary file format, mutations can be more effective. +`key=value` dictionary file format, mutations can be more effective. See [Fuzzer Dictionary] section of the [Efficient Fuzzer Guide]. * Specify testcase length limits. By default, libFuzzer uses `-max_len=4096` or takes the longest testcase in the corpus if `-max_len` is not specified. @@ -213,7 +213,7 @@ ```cpp extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - // Don't forget to enfoce minimal data length. + // Don't forget to enforce minimal data length. if (size < 1) return 0; @@ -260,7 +260,7 @@ ```cpp extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - // Don't forget to enfoce minimal data length. + // Don't forget to enforce minimal data length. if (size < 1) return 0;
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/disable-blink-features=RootLayerScrolling b/third_party/WebKit/LayoutTests/FlagExpectations/disable-blink-features=RootLayerScrolling index 4cfb0a0..a62c534 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/disable-blink-features=RootLayerScrolling +++ b/third_party/WebKit/LayoutTests/FlagExpectations/disable-blink-features=RootLayerScrolling
@@ -2341,7 +2341,6 @@ crbug.com/652536 fast/events/mouse-cursor.html [ Pass Failure ] crbug.com/652536 virtual/mouseevent_fractional/fast/events/mouse-cursor.html [ Pass Failure ] -crbug.com/671478 fast/table/percent-height-replaced-content-in-cell.html [ Pass Failure ] crbug.com/663858 fast/text/selection/emphasis.html [ Pass Failure ] crbug.com/663858 fast/text/emphasis-vertical.html [ Pass Failure ] crbug.com/664816 http/tests/security/contentSecurityPolicy/require-sri-for/require-sri-for-script-reportonly-blocked.php [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 4c0a87a..cefca18 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -567,7 +567,7 @@ # Crashing tests in dictionary order. crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Failure Crash ] -crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event.https.html [ Crash ] +crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event.https.html [ Failure Crash ] crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-network-error.https.html [ Crash ] crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html [ Crash Failure ] crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html [ Crash ] @@ -1633,6 +1633,10 @@ crbug.com/805463 external/wpt/acid/acid3/numbered-tests.html [ Skip ] +# These tests have unstable error messages, so they can't be rebaselined. +crbug.com/626703 external/wpt/html/semantics/document-metadata/the-link-element/link-load-error-events.html [ Failure ] +crbug.com/626703 external/wpt/html/semantics/document-metadata/the-link-element/link-load-error-events.https.html [ Failure ] + # ====== New tests from wpt-importer added here ====== crbug.com/626703 external/wpt/css/css-transitions/transition-property-017.html [ Skip ] crbug.com/626703 external/wpt/css/css-transitions/transition-property-030.html [ Skip ] @@ -2423,7 +2427,6 @@ crbug.com/652536 fast/events/mouse-cursor.html [ Pass Failure ] crbug.com/652536 virtual/mouseevent_fractional/fast/events/mouse-cursor.html [ Pass Failure ] -crbug.com/671478 fast/table/percent-height-replaced-content-in-cell.html [ Pass Failure ] crbug.com/663858 fast/text/selection/emphasis.html [ Pass Failure ] crbug.com/663858 fast/text/emphasis-vertical.html [ Pass Failure ] crbug.com/664816 http/tests/security/contentSecurityPolicy/require-sri-for/require-sri-for-script-reportonly-blocked.php [ Pass Failure ] @@ -3276,6 +3279,9 @@ crbug.com/794338 [ Linux Win Android ] media/video-rotation.html [ Failure Pass ] crbug.com/811605 media/video-poster-after-loadedmetadata.html [ Failure Pass ] +# TODO(senorblanco): rebaseline after Skia roll +crbug.com/802896 virtual/gpu/fast/canvas/canvas-ellipse-circumference-fill.html [ Failure Pass ] + # TODO(lukasza): Remove these once CORB is enabled by default. crbug.com/802835 external/wpt/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html [ Failure ] crbug.com/802835 virtual/outofblink-cors/external/wpt/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html [ Failure ] @@ -3369,3 +3375,11 @@ # Sheriff 2018-03-26 crbug.com/825733 [ Win7 ] media/color-profile-video-seek-filter.html [ Pass Timeout Failure ] crbug.com/754986 media/video-transformed.html [ Pass Failure ] + +# Intent to Ship pending for this test +crbug.com/680741 external/wpt/uievents/mouse/mouse_buttons_back_forward-manual.html [ Skip ] + +# Sheriff 2018-03-29 +crbug.com/827088 bluetooth/requestDevice/chooser/new-scan-device-added.html [ Pass Crash ] +crbug.com/827209 [ Win7 ] fast/events/middleClickAutoscroll-latching.html [ Pass Failure ] +crbug.com/827209 [ Win7 ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-latching.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-chooser-test.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-chooser-test.html new file mode 100644 index 0000000..ce66e76 --- /dev/null +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-chooser-test.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<script src="../../../resources/testdriver.js"></script> +<script src="../../../resources/testdriver-vendor.js"></script> +<script src="../../../external/wpt/bluetooth/resources/bluetooth-helpers.js"></script> +<script> +'use strict'; +// TODO(https://crbug.com/719826): This is a temporary test to try the +// FakeBluetoothChooser API as it is implemented. This test should be delete after +// the feature is completed. The implementation details can be found in the design +// document. +// https://docs.google.com/document/d/1XFl_4ZAgO8ddM6U53A9AfUuZeWgJnlYD5wtbXqEpzeg +const test_desc = 'Ensure that the FakeBluetoothChooser API works correctly.'; + +bluetooth_test(() => navigator.bluetooth.test.simulateCentral({ + state: 'powered-on' +}) + .then(() => navigator.bluetooth.test.getManualChooser()) + .then(chooser => assert_true(typeof chooser !== 'undefined')), + test_desc); +</script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-simulate-advertisement-received-test.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-simulate-advertisement-received-test.html new file mode 100644 index 0000000..d3908803e --- /dev/null +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/fake-bluetooth-simulate-advertisement-received-test.html
@@ -0,0 +1,46 @@ +<!DOCTYPE html> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<script src="../../../resources/testdriver.js"></script> +<script src="../../../resources/testdriver-vendor.js"></script> +<script src="../../../external/wpt/bluetooth/resources/bluetooth-helpers.js"></script> +<script> +'use strict'; +// TODO(https://crbug.com/719826): This is a temporary test to try the +// FakeBluetoothChooser API as it is implemented. This test should be deleted +// after the feature is completed. +const test_desc = 'Ensure that the SimulateAdvertisementReceived API works ' + + 'correctly.'; +const company_id = '224'; +const data = new TextEncoder().encode('foo'); +const manufacturerDataMap = {[company_id]: data}; +const serviceDataMap = {[health_thermometer.uuid]: data}; +const scanRecord = { + name: 'Health Thermometer', + uuids: ['generic_access', health_thermometer.uuid], + txPower: 20, + appearance: 100, + manufacturerData: manufacturerDataMap, + serviceData: serviceDataMap, +}; +let fake_central; +let scanResult = { + deviceAddress: '09:09:09:09:09:09', + rssi: 100, + scanRecord: {}, +}; + +bluetooth_test(() => navigator.bluetooth.test.simulateCentral({ + state: 'powered-on' +}) + .then(_ => fake_central = _) + // Test that scanRecord fields are indeed optional. + .then(() => fake_central.simulateAdvertisementReceived(scanResult)) + .then(fake_peripheral => assert_true( + fake_peripheral.address === '09:09:09:09:09:09')) + // Test the scanRecord fields. + .then(() => { + scanResult.scanRecord = scanRecord; + return fake_central.simulateAdvertisementReceived(scanResult); + }), test_desc); +</script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html index a8a32c1..6c682d2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html
@@ -6,41 +6,23 @@ <script src="../../../external/wpt/bluetooth/resources/bluetooth-helpers.js"></script> <script> 'use strict'; -const test_desc = 'The chooser should display newly detected devices.'; -let fake_central, fake_chooser; +bluetooth_test(() => { + setBluetoothManualChooser(true); -bluetooth_test(() => navigator.bluetooth.test.simulateCentral({ - state: 'powered-on', -}) - .then(_ => fake_central = _) - .then(() => navigator.bluetooth.test.getManualChooser()) - .then(_ => fake_chooser = _) - .then(() => { - // 1. Open the chooser. - let requestDevicePromise = requestDeviceWithTrustedClick({ - filters: [{services: ['health_thermometer']}] - }); - - // We can only simulate advertisements after the chooser is opened and a - // scan is active. There are currently no events to signal that the - // chooser is opened , so we wait a second before we try to simulate an - // advertisement. - // TODO(https://crbug.com/719827): Once the chooser can send events, - // replace this with a promise that resolves when the chooser sends the - // 'chooser-opened' and 'discovering' events. - // 2. Send the advertisement packet to central. - setTimeout(() => fake_central.simulateAdvertisementReceived( - health_thermometer_ad_packet) - // 3. Select the device on the chooser. - .then(fake_peripheral => fake_chooser.selectPeripheral( - fake_peripheral)), - 1000); - - return requestDevicePromise; - }) - // 4. Check that the device and advertisement packet have the same name. - .then(device => assert_equals( - device.name, - health_thermometer_ad_packet.scanRecord.name)), - test_desc); + let requestDevicePromise = + setBluetoothFakeAdapter('DeviceEventAdapter') + .then(() => requestDeviceWithTrustedClick({ + filters: [{services: ['glucose']}]})); + return getBluetoothManualChooserEvents(4).then(events => { + assert_equals(events[0], 'chooser-opened(file://)'); + assert_equals(events[1], 'discovering'); + let idsByName = new AddDeviceEventSet(); + idsByName.assert_add_device_event(events[2]); + assert_true(idsByName.has('New Glucose Device')); + assert_equals(events[3], 'discovery-idle'); + sendBluetoothManualChooserEvent( + 'selected', idsByName.get('New Glucose Device')); + return requestDevicePromise; + }); +}); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/bluetooth/resources/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/external/wpt/bluetooth/resources/bluetooth-helpers.js index 1a5dec5..7b23742 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/bluetooth/resources/bluetooth-helpers.js +++ b/third_party/WebKit/LayoutTests/external/wpt/bluetooth/resources/bluetooth-helpers.js
@@ -477,15 +477,6 @@ })); } -const health_thermometer_ad_packet = { - deviceAddress: '09:09:09:09:09:09', - rssi: -10, - scanRecord: { - name: 'Health Thermometer', - uuids: [health_thermometer.uuid], - }, -}; - // Returns a FakePeripheral that corresponds to a simulated pre-connected device // called 'Health Thermometer'. The device has two known serviceUUIDs: // 'generic_access' and 'health_thermometer'.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/fake_bluetooth_chooser.mojom.js b/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/fake_bluetooth_chooser.mojom.js index 7a5c40c..535a90a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/fake_bluetooth_chooser.mojom.js +++ b/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/fake_bluetooth_chooser.mojom.js
@@ -305,6 +305,52 @@ encoder.writeUint32(0); encoder.encodeStruct(codec.String, val.peripheralAddress); }; + function FakeBluetoothChooser_SelectPeripheral_ResponseParams(values) { + this.initDefaults_(); + this.initFields_(values); + } + + + FakeBluetoothChooser_SelectPeripheral_ResponseParams.prototype.initDefaults_ = function() { + }; + FakeBluetoothChooser_SelectPeripheral_ResponseParams.prototype.initFields_ = function(fields) { + for(var field in fields) { + if (this.hasOwnProperty(field)) + this[field] = fields[field]; + } + }; + + FakeBluetoothChooser_SelectPeripheral_ResponseParams.validate = function(messageValidator, offset) { + var err; + err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize); + if (err !== validator.validationError.NONE) + return err; + + var kVersionSizes = [ + {version: 0, numBytes: 8} + ]; + err = messageValidator.validateStructVersion(offset, kVersionSizes); + if (err !== validator.validationError.NONE) + return err; + + return validator.validationError.NONE; + }; + + FakeBluetoothChooser_SelectPeripheral_ResponseParams.encodedSize = codec.kStructHeaderSize + 0; + + FakeBluetoothChooser_SelectPeripheral_ResponseParams.decode = function(decoder) { + var packed; + var val = new FakeBluetoothChooser_SelectPeripheral_ResponseParams(); + var numberOfBytes = decoder.readUint32(); + var version = decoder.readUint32(); + return val; + }; + + FakeBluetoothChooser_SelectPeripheral_ResponseParams.encode = function(encoder, val) { + var packed; + encoder.writeUint32(FakeBluetoothChooser_SelectPeripheral_ResponseParams.encodedSize); + encoder.writeUint32(0); + }; function FakeBluetoothChooser_Cancel_Params(values) { this.initDefaults_(); this.initFields_(values); @@ -351,6 +397,52 @@ encoder.writeUint32(FakeBluetoothChooser_Cancel_Params.encodedSize); encoder.writeUint32(0); }; + function FakeBluetoothChooser_Cancel_ResponseParams(values) { + this.initDefaults_(); + this.initFields_(values); + } + + + FakeBluetoothChooser_Cancel_ResponseParams.prototype.initDefaults_ = function() { + }; + FakeBluetoothChooser_Cancel_ResponseParams.prototype.initFields_ = function(fields) { + for(var field in fields) { + if (this.hasOwnProperty(field)) + this[field] = fields[field]; + } + }; + + FakeBluetoothChooser_Cancel_ResponseParams.validate = function(messageValidator, offset) { + var err; + err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize); + if (err !== validator.validationError.NONE) + return err; + + var kVersionSizes = [ + {version: 0, numBytes: 8} + ]; + err = messageValidator.validateStructVersion(offset, kVersionSizes); + if (err !== validator.validationError.NONE) + return err; + + return validator.validationError.NONE; + }; + + FakeBluetoothChooser_Cancel_ResponseParams.encodedSize = codec.kStructHeaderSize + 0; + + FakeBluetoothChooser_Cancel_ResponseParams.decode = function(decoder) { + var packed; + var val = new FakeBluetoothChooser_Cancel_ResponseParams(); + var numberOfBytes = decoder.readUint32(); + var version = decoder.readUint32(); + return val; + }; + + FakeBluetoothChooser_Cancel_ResponseParams.encode = function(encoder, val) { + var packed; + encoder.writeUint32(FakeBluetoothChooser_Cancel_ResponseParams.encodedSize); + encoder.writeUint32(0); + }; function FakeBluetoothChooser_Rescan_Params(values) { this.initDefaults_(); this.initFields_(values); @@ -443,10 +535,10 @@ encoder.writeUint32(FakeBluetoothChooser_Rescan_ResponseParams.encodedSize); encoder.writeUint32(0); }; - var kFakeBluetoothChooser_WaitForEvents_Name = 1899695487; - var kFakeBluetoothChooser_SelectPeripheral_Name = 728735403; - var kFakeBluetoothChooser_Cancel_Name = 246208861; - var kFakeBluetoothChooser_Rescan_Name = 1031326211; + var kFakeBluetoothChooser_WaitForEvents_Name = 457051710; + var kFakeBluetoothChooser_SelectPeripheral_Name = 1924310743; + var kFakeBluetoothChooser_Cancel_Name = 1388880682; + var kFakeBluetoothChooser_Rescan_Name = 2112671529; function FakeBluetoothChooserPtr(handleOrPtrInfo) { this.ptr = new bindings.InterfacePtrController(FakeBluetoothChooser, @@ -499,12 +591,22 @@ FakeBluetoothChooserProxy.prototype.selectPeripheral = function(peripheralAddress) { var params = new FakeBluetoothChooser_SelectPeripheral_Params(); params.peripheralAddress = peripheralAddress; - var builder = new codec.MessageV0Builder( - kFakeBluetoothChooser_SelectPeripheral_Name, - codec.align(FakeBluetoothChooser_SelectPeripheral_Params.encodedSize)); - builder.encodeStruct(FakeBluetoothChooser_SelectPeripheral_Params, params); - var message = builder.finish(); - this.receiver_.accept(message); + return new Promise(function(resolve, reject) { + var builder = new codec.MessageV1Builder( + kFakeBluetoothChooser_SelectPeripheral_Name, + codec.align(FakeBluetoothChooser_SelectPeripheral_Params.encodedSize), + codec.kMessageExpectsResponse, 0); + builder.encodeStruct(FakeBluetoothChooser_SelectPeripheral_Params, params); + var message = builder.finish(); + this.receiver_.acceptAndExpectResponse(message).then(function(message) { + var reader = new codec.MessageReader(message); + var responseParams = + reader.decodeStruct(FakeBluetoothChooser_SelectPeripheral_ResponseParams); + resolve(responseParams); + }).catch(function(result) { + reject(Error("Connection error: " + result)); + }); + }.bind(this)); }; FakeBluetoothChooserPtr.prototype.cancel = function() { return FakeBluetoothChooserProxy.prototype.cancel @@ -513,12 +615,22 @@ FakeBluetoothChooserProxy.prototype.cancel = function() { var params = new FakeBluetoothChooser_Cancel_Params(); - var builder = new codec.MessageV0Builder( - kFakeBluetoothChooser_Cancel_Name, - codec.align(FakeBluetoothChooser_Cancel_Params.encodedSize)); - builder.encodeStruct(FakeBluetoothChooser_Cancel_Params, params); - var message = builder.finish(); - this.receiver_.accept(message); + return new Promise(function(resolve, reject) { + var builder = new codec.MessageV1Builder( + kFakeBluetoothChooser_Cancel_Name, + codec.align(FakeBluetoothChooser_Cancel_Params.encodedSize), + codec.kMessageExpectsResponse, 0); + builder.encodeStruct(FakeBluetoothChooser_Cancel_Params, params); + var message = builder.finish(); + this.receiver_.acceptAndExpectResponse(message).then(function(message) { + var reader = new codec.MessageReader(message); + var responseParams = + reader.decodeStruct(FakeBluetoothChooser_Cancel_ResponseParams); + resolve(responseParams); + }).catch(function(result) { + reject(Error("Connection error: " + result)); + }); + }.bind(this)); }; FakeBluetoothChooserPtr.prototype.rescan = function() { return FakeBluetoothChooserProxy.prototype.rescan @@ -564,14 +676,6 @@ FakeBluetoothChooserStub.prototype.accept = function(message) { var reader = new codec.MessageReader(message); switch (reader.messageName) { - case kFakeBluetoothChooser_SelectPeripheral_Name: - var params = reader.decodeStruct(FakeBluetoothChooser_SelectPeripheral_Params); - this.selectPeripheral(params.peripheralAddress); - return true; - case kFakeBluetoothChooser_Cancel_Name: - var params = reader.decodeStruct(FakeBluetoothChooser_Cancel_Params); - this.cancel(); - return true; default: return false; } @@ -597,6 +701,36 @@ responder.accept(message); }); return true; + case kFakeBluetoothChooser_SelectPeripheral_Name: + var params = reader.decodeStruct(FakeBluetoothChooser_SelectPeripheral_Params); + this.selectPeripheral(params.peripheralAddress).then(function(response) { + var responseParams = + new FakeBluetoothChooser_SelectPeripheral_ResponseParams(); + var builder = new codec.MessageV1Builder( + kFakeBluetoothChooser_SelectPeripheral_Name, + codec.align(FakeBluetoothChooser_SelectPeripheral_ResponseParams.encodedSize), + codec.kMessageIsResponse, reader.requestID); + builder.encodeStruct(FakeBluetoothChooser_SelectPeripheral_ResponseParams, + responseParams); + var message = builder.finish(); + responder.accept(message); + }); + return true; + case kFakeBluetoothChooser_Cancel_Name: + var params = reader.decodeStruct(FakeBluetoothChooser_Cancel_Params); + this.cancel().then(function(response) { + var responseParams = + new FakeBluetoothChooser_Cancel_ResponseParams(); + var builder = new codec.MessageV1Builder( + kFakeBluetoothChooser_Cancel_Name, + codec.align(FakeBluetoothChooser_Cancel_ResponseParams.encodedSize), + codec.kMessageIsResponse, reader.requestID); + builder.encodeStruct(FakeBluetoothChooser_Cancel_ResponseParams, + responseParams); + var message = builder.finish(); + responder.accept(message); + }); + return true; case kFakeBluetoothChooser_Rescan_Name: var params = reader.decodeStruct(FakeBluetoothChooser_Rescan_Params); this.rescan().then(function(response) { @@ -626,11 +760,11 @@ paramsClass = FakeBluetoothChooser_WaitForEvents_Params; break; case kFakeBluetoothChooser_SelectPeripheral_Name: - if (!message.expectsResponse() && !message.isResponse()) + if (message.expectsResponse()) paramsClass = FakeBluetoothChooser_SelectPeripheral_Params; break; case kFakeBluetoothChooser_Cancel_Name: - if (!message.expectsResponse() && !message.isResponse()) + if (message.expectsResponse()) paramsClass = FakeBluetoothChooser_Cancel_Params; break; case kFakeBluetoothChooser_Rescan_Name: @@ -651,6 +785,14 @@ if (message.isResponse()) paramsClass = FakeBluetoothChooser_WaitForEvents_ResponseParams; break; + case kFakeBluetoothChooser_SelectPeripheral_Name: + if (message.isResponse()) + paramsClass = FakeBluetoothChooser_SelectPeripheral_ResponseParams; + break; + case kFakeBluetoothChooser_Cancel_Name: + if (message.isResponse()) + paramsClass = FakeBluetoothChooser_Cancel_ResponseParams; + break; case kFakeBluetoothChooser_Rescan_Name: if (message.isResponse()) paramsClass = FakeBluetoothChooser_Rescan_ResponseParams;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/web-bluetooth-test.js b/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/web-bluetooth-test.js index 6dd176f4..e08c8c4a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/web-bluetooth-test.js +++ b/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/web-bluetooth-test.js
@@ -489,21 +489,6 @@ Mojo.bindInterface(content.mojom.FakeBluetoothChooser.name, mojo.makeRequest(this.fake_bluetooth_chooser_ptr_).handle, 'process'); } - - async selectPeripheral(peripheral) { - if (!(peripheral instanceof FakePeripheral)) { - throw '|peripheral| must be an instance of FakePeripheral'; - } - await this.fake_bluetooth_chooser_ptr_.selectPeripheral(peripheral.address); - } - - async cancel() { - await this.fake_bluetooth_chooser_ptr_.cancel(); - } - - async rescan() { - await this.fake_bluetooth_chooser_ptr_.rescan(); - } } // If this line fails, it means that current environment does not support the
diff --git a/third_party/WebKit/LayoutTests/external/wpt/uievents/mouse/mouse_buttons_back_forward-manual.html b/third_party/WebKit/LayoutTests/external/wpt/uievents/mouse/mouse_buttons_back_forward-manual.html new file mode 100644 index 0000000..7a676db --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/uievents/mouse/mouse_buttons_back_forward-manual.html
@@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Mouse Button Back/Forward</title> + <link rel="author" title="Google" href="http://www.google.com/" /> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script> + var testMouseUp = async_test('Tests that the mouseup is preventable.'); + var received_back = false; + var received_forward = false; + window.addEventListener('mouseup', function(e) { + if (e.button == 3) { + received_back = true; + e.preventDefault(); + } else if (e.button == 4) { + received_forward = true; + e.preventDefault(); + } + if (received_back && received_forward) { + testMouseUp.done(); + } + }); + </script> + + </head> + <body id="target"> + <h4>Test Description: Tests that the mouseup event is prevented. + <ol> + <li>Click the back mouse button</li> + <li>Click the back mouse forward</li> + </ol> + </h4> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https-expected.txt index 4f08050..69dc790 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https-expected.txt
@@ -12,5 +12,6 @@ PASS replaceTrack() after answer: new track attachment stats present FAIL replaceTrack(): original track attachment stats present after replacing assert_true: Has stats for original track expected true got false PASS RTCRtpSender.getStats() contains only outbound-rtp and related stats +PASS RTCRtpReceiver.getStats() contains only inbound-rtp and related stats Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https.html b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https.html index 04d4ded..c6c8ce3 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-track-stats.https.html
@@ -424,6 +424,52 @@ 'senderReport should contain remote-candidate stats'); }, 'RTCRtpSender.getStats() contains only outbound-rtp and related stats'); + promise_test(async function() { + const caller = new RTCPeerConnection(); + const callee = new RTCPeerConnection(); + let [tracks, streams] = await getUserMediaTracksAndStreams(2); + let sender = caller.addTrack(tracks[0], streams[0]); + callee.addTrack(tracks[1], streams[1]); + exchangeIceCandidates(caller, callee); + await doSignalingHandshake(caller, callee); + await onIceConnectionStateCompleted(caller); + let receiver = caller.getReceivers()[0]; + + // Obtain inbound and outbound RTP stream stats on a full stats report. + let fullReport = await caller.getStats(); + let outboundTrackStats = findStatsByTypeAndId( + fullReport, 'track', sender.track.id); + let outboundStats = findStatsByTypeAndMember( + fullReport, 'outbound-rtp', 'trackId', outboundTrackStats.id); + assert_true(outboundStats != null, 'Has stats for outbound RTP stream'); + let inboundTrackStats = findStatsByTypeAndId( + fullReport, 'track', receiver.track.id); + let inboundStats = findStatsByTypeAndMember( + fullReport, 'inbound-rtp', 'trackId', inboundTrackStats.id); + assert_true(inboundStats != null, 'Has stats for inbound RTP stream'); + + // Perform stats selection algorithm with receiver selector. The result + // should contain the inbound-rtp but not the outbound-rtp. + let receiverReport = await receiver.getStats(); + assert_true(receiverReport.has(inboundStats.id)); + assert_false(receiverReport.has(outboundStats.id)); + + // Validate the stats graph, ensuring all stats objects are reachable and + // valid from the outbound-rtp stats. + validateStatsGraph(receiverReport, receiverReport.get(inboundStats.id)); + // Ensure that the stats graph contains some expected dictionaries. + assert_equals(findStatsOfType(receiverReport, 'track').length, 1, + 'receiverReport should contain track stats'); + assert_equals(findStatsOfType(receiverReport, 'transport').length, 1, + 'receiverReport should contain transport stats'); + assert_equals(findStatsOfType(receiverReport, 'candidate-pair').length, 1, + 'receiverReport should contain candidate-pair stats'); + assert_equals(findStatsOfType(receiverReport, 'local-candidate').length, 1, + 'receiverReport should contain local-candidate stats'); + assert_equals(findStatsOfType(receiverReport, 'remote-candidate').length, 1, + 'receiverReport should contain remote-candidate stats'); + }, 'RTCRtpReceiver.getStats() contains only inbound-rtp and related stats'); + // Helpers. function findStatsByTypeAndId(report, type, identifier) {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats-expected.txt deleted file mode 100644 index 7ea9273..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL receiver.getStats() should return stats report containing inbound-rtp stats pc.addTransceiver is not a function -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.html b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.html deleted file mode 100644 index c30c9613..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title>RTCRtpReceiver.prototype.getStats</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="dictionary-helper.js"></script> -<script src="RTCStats-helper.js"></script> -<script> - 'use strict'; - - // Test is based on the following editor draft: - // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html - // https://w3c.github.io/webrtc-stats/archives/20170614/webrtc-stats.html - - // The following helper function is called from RTCStats-helper.js - // validateStatsReport - // assert_stats_report_has_stats - - /* - 5.3. RTCRtpReceiver Interface - interface RTCRtpReceiver { - Promise<RTCStatsReport> getStats(); - ... - }; - - getStats - 1. Let selector be the RTCRtpReceiver object on which the method was invoked. - 2. Let p be a new promise, and run the following steps in parallel: - 1. Gather the stats indicated by selector according to the stats selection - algorithm. - 2. Resolve p with the resulting RTCStatsReport object, containing the - gathered stats. - 3. Return p. - - 8.5. The stats selection algorithm - 4. If selector is an RTCRtpReceiver, gather stats for and add the following objects - to result: - - All RTCInboundRTPStreamStats objects corresponding to selector. - - All stats objects referenced directly or indirectly by the RTCInboundRTPStreamStats - added. - */ - - promise_test(() => { - const pc = new RTCPeerConnection(); - const { receiver } = pc.addTransceiver('audio'); - - return receiver.getStats() - .then(statsReport => { - validateStatsReport(statsReport); - assert_stats_report_has_stats(statsReport, ['inbound-rtp']); - }); - }, 'receiver.getStats() should return stats report containing inbound-rtp stats'); - -</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https-expected.txt new file mode 100644 index 0000000..3e65fc5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats promise_test: Unhandled rejection with value: object "TypeError: caller.addTransceiver is not a function" +FAIL receiver.getStats() via addTrack should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https.html b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https.html new file mode 100644 index 0000000..f36c859 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCRtpReceiver-getStats.https.html
@@ -0,0 +1,72 @@ +<!doctype html> +<meta charset=utf-8> +<title>RTCRtpReceiver.prototype.getStats</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="RTCPeerConnection-helper.js"></script> +<script src="dictionary-helper.js"></script> +<script src="RTCStats-helper.js"></script> +<script> + 'use strict'; + + // Test is based on the following editor draft: + // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html + // https://w3c.github.io/webrtc-stats/archives/20170614/webrtc-stats.html + + // The following helper functions are called from RTCPeerConnection-helper.js: + // doSignalingHandshake + + // The following helper function is called from RTCStats-helper.js + // validateStatsReport + // assert_stats_report_has_stats + + /* + 5.3. RTCRtpReceiver Interface + interface RTCRtpReceiver { + Promise<RTCStatsReport> getStats(); + ... + }; + + getStats + 1. Let selector be the RTCRtpReceiver object on which the method was invoked. + 2. Let p be a new promise, and run the following steps in parallel: + 1. Gather the stats indicated by selector according to the stats selection + algorithm. + 2. Resolve p with the resulting RTCStatsReport object, containing the + gathered stats. + 3. Return p. + + 8.5. The stats selection algorithm + 4. If selector is an RTCRtpReceiver, gather stats for and add the following objects + to result: + - All RTCInboundRTPStreamStats objects corresponding to selector. + - All stats objects referenced directly or indirectly by the RTCInboundRTPStreamStats + added. + */ + + promise_test(async () => { + const caller = new RTCPeerConnection(); + const callee = new RTCPeerConnection(); + const { receiver } = caller.addTransceiver('audio'); + + await doSignalingHandshake(caller, callee); + const statsReport = await receiver.getStats(); + validateStatsReport(statsReport); + assert_stats_report_has_stats(statsReport, ['inbound-rtp']); + }, 'receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats'); + + promise_test(async () => { + const caller = new RTCPeerConnection(); + const callee = new RTCPeerConnection(); + const stream = await navigator.mediaDevices.getUserMedia({audio:true}); + const [track] = stream.getTracks(); + caller.addTrack(track, stream); + + await doSignalingHandshake(caller, callee); + const receiver = callee.getReceivers()[0]; + const statsReport = await receiver.getStats(); + validateStatsReport(statsReport); + assert_stats_report_has_stats(statsReport, ['inbound-rtp']); + }, 'receiver.getStats() via addTrack should return stats report containing inbound-rtp stats'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/uievents/mouse/mouse_buttons_back_forward-manual-automation.js b/third_party/WebKit/LayoutTests/external/wpt_automation/uievents/mouse/mouse_buttons_back_forward-manual-automation.js new file mode 100644 index 0000000..3c11548b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/uievents/mouse/mouse_buttons_back_forward-manual-automation.js
@@ -0,0 +1,6 @@ +importAutomationScript('/pointerevents/pointerevent_common_input.js'); +function inject_input() { + return mouseClickInTarget('#target', undefined, "back").then(function() { + return mouseClickInTarget('#target', undefined, "forward"); + }); +}
diff --git a/third_party/WebKit/LayoutTests/fast/block/margin-collapse/103.html b/third_party/WebKit/LayoutTests/fast/block/margin-collapse/103.html index d53c9eb..62c76643 100644 --- a/third_party/WebKit/LayoutTests/fast/block/margin-collapse/103.html +++ b/third_party/WebKit/LayoutTests/fast/block/margin-collapse/103.html
@@ -17,7 +17,7 @@ p,ul,ol,a,span { -font: 10pt/20px "trebuchet ms", verdana, helvetica, arial, sans-serif; +font: 10pt/20px arial, sans-serif; color: #333; } h1,h2,h3
diff --git a/third_party/WebKit/LayoutTests/fast/table/percent-height-replaced-content-in-cell-expected.txt b/third_party/WebKit/LayoutTests/fast/table/percent-height-replaced-content-in-cell-expected.txt index d1995e4..5f13d83 100644 --- a/third_party/WebKit/LayoutTests/fast/table/percent-height-replaced-content-in-cell-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/percent-height-replaced-content-in-cell-expected.txt
@@ -1,5 +1,6 @@ -crbug.com/637811: Percent height replaced content in a cell should flex the height of the cell. +crbug.com/637811: Percent height replaced content in a cell should not flex the height or width of the cell. PASS PASS +PASS
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt index cedf448..3cf6933e 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. FAIL Service worker controlled navigation timing assert_unreached: unexpected rejection: assert_true: Expected workerStart <= fetchStart expected true got false Reached unreachable code PASS Service worker controlled navigation timing network fallback -FAIL Service worker controlled navigation timing redirect assert_unreached: unexpected rejection: assert_true: Expected fetchStart <= requestStart expected true got false Reached unreachable code +PASS Service worker controlled navigation timing redirect Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt index ead8b008..7392266d 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. FAIL Service worker controlled navigation timing assert_unreached: unexpected rejection: assert_true: Expected workerStart <= fetchStart expected true got false Reached unreachable code FAIL Service worker controlled navigation timing network fallback assert_unreached: unexpected rejection: assert_true: Expected workerStart <= fetchStart expected true got false Reached unreachable code -FAIL Service worker controlled navigation timing redirect assert_unreached: unexpected rejection: assert_true: Expected fetchStart <= requestStart expected true got false Reached unreachable code +PASS Service worker controlled navigation timing redirect Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/outofblink-cors/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/outofblink-cors/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt index ead8b008..7392266d 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/outofblink-cors/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-features=NetworkService/virtual/outofblink-cors/external/wpt/service-workers/service-worker/navigation-timing.https-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. FAIL Service worker controlled navigation timing assert_unreached: unexpected rejection: assert_true: Expected workerStart <= fetchStart expected true got false Reached unreachable code FAIL Service worker controlled navigation timing network fallback assert_unreached: unexpected rejection: assert_true: Expected workerStart <= fetchStart expected true got false Reached unreachable code -FAIL Service worker controlled navigation timing redirect assert_unreached: unexpected rejection: assert_true: Expected fetchStart <= requestStart expected true got false Reached unreachable code +PASS Service worker controlled navigation timing redirect Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/1x1-blue.png b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/1x1-blue.png deleted file mode 100644 index c4d0639..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/1x1-blue.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/Ahem.ttf b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/Ahem.ttf deleted file mode 100644 index ac81cb0..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/Ahem.ttf +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green.htm deleted file mode 100644 index b8a1947..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green.htm +++ /dev/null
@@ -1,10 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <title>Green Test Page</title> - </head> - <body style="background-color:#00FF00;"> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_allow_timing.php b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_allow_timing.php deleted file mode 100644 index 8d65da7b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_allow_timing.php +++ /dev/null
@@ -1,14 +0,0 @@ -<?php - $origin = $_GET["origin"] ? $_GET["origin"] : ""; - header("timing-allow-origin: $origin"); -?> -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <title>Green Test Page</title> - </head> - <body style="background-color:#00FF00;"> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_onunload.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_onunload.htm deleted file mode 100644 index 2f40174..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_green_with_onunload.htm +++ /dev/null
@@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <title>Green Test Page</title> - </head> - <!-- use onunload to ensure this does not trigger bfcache --> - <body style="background-color:#00FF00;" onunload="1;"> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_meta_redirect.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_meta_redirect.htm deleted file mode 100644 index 5fbeb22d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_meta_redirect.htm +++ /dev/null
@@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <meta http-equiv="refresh" content="1;URL='blank_page_green.htm'" /> - <title>Redirect Placeholder</title> - </head> - <body style="background-color:#FFFF00";> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_unload.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_unload.htm deleted file mode 100644 index 223630f..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_unload.htm +++ /dev/null
@@ -1,25 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - - <title>Yellow Test Page</title> - - <script type="text/javascript"> - function onbeforeunload_handler() - { - var temp = "onbeforeunload"; - } - - function onunload_handler() - { - var temp = "onunload"; - } - </script> - </head> - <body onbeforeunload="onbeforeunload_handler();" - onunload="onunload_handler();" - style="background-color:#FFFF00;"> - <h1>Unload</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow.htm deleted file mode 100644 index 846c60c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow.htm +++ /dev/null
@@ -1,10 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <title>Yellow Test Page</title> - </head> - <body style="background-color:#FFFF00;"> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow_with_onunload.htm b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow_with_onunload.htm deleted file mode 100644 index 2bc88e13..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/blank_page_yellow_with_onunload.htm +++ /dev/null
@@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - <title>Yellow Test Page</title> - </head> - <!-- use onunload to ensure this does not trigger bfcache --> - <body style="background-color:#FFFF00;" onunload="1;"> - <h1>Placeholder</h1> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty.js b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty.js deleted file mode 100644 index 3b44754..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty.js +++ /dev/null
@@ -1 +0,0 @@ -/* Nothing here */
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty_script.js b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty_script.js deleted file mode 100644 index 092bc2b0..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/empty_script.js +++ /dev/null
@@ -1 +0,0 @@ -;
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php deleted file mode 100644 index 974e14af..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/generate_resource.php +++ /dev/null
@@ -1,62 +0,0 @@ -<?php - if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { - header('HTTP/1.1 304 Not Modified'); - exit; - } - - $type = $_GET["type"]; - - $response_code = 200; - $body = ""; - $content_type = "text/plain"; - - switch ($type) { - case "audio": - $body = file_get_contents("silence.wav"); - $content_type = "audio/wav"; - break; - - case "css": - $body = file_get_contents("gray_bg.css"); - $content_type = "text/css"; - break; - - case "font": - $body = file_get_contents("Ahem.ttf"); - $content_type = "application/octet-stream"; - break; - - case "iframe": - $body = file_get_contents("blank_page_green.htm"); - $content_type = "text/html"; - break; - - case "image": - $body = file_get_contents("1x1-blue.png"); - $content_type = "image/png"; - break; - - case "script": - $body = file_get_contents("empty_script.js"); - $content_type = "text/javascript"; - break; - - default: - $response_code = 404; - break; - } - - header("HTTP/1.1 $response_code"); - header("Content-type: $content_type"); - if (isset($_GET["cacheable"])) { - if ($_GET["cacheable"] == 1) { - header("Cache-control: max-age=120"); - } else { - header("Etag: 7"); - } - } else { - header("Cache-control: no-cache"); - } - print($body); - exit; -?>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/gray_bg.css b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/gray_bg.css deleted file mode 100644 index c705145..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/gray_bg.css +++ /dev/null
@@ -1 +0,0 @@ -body { background-color: #bbbbbb; }
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/inject_resource_test.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/inject_resource_test.html deleted file mode 100644 index 95672b97..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/inject_resource_test.html +++ /dev/null
@@ -1,5 +0,0 @@ -<body> -<script> -window.parent.setup_iframe(); -</script> -</body>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/pagevistestharness.js b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/pagevistestharness.js deleted file mode 100644 index d53d73b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/pagevistestharness.js +++ /dev/null
@@ -1,121 +0,0 @@ -/* -Distributed under both the W3C Test Suite License [1] and the W3C -3-clause BSD License [2]. To contribute to a W3C Test Suite, see the -policies and contribution forms [3]. - -[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license -[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license -[3] http://www.w3.org/2004/10/27-testcases -*/ - -// -// Helper Functions for PageVisibility W3C tests -// -var VISIBILITY_STATES = -{ - HIDDEN: "hidden", - VISIBLE: "visible" -}; - -var feature_check = false; - -// -// All test() functions in the WebPerf PageVis test suite should use pv_test() instead. -// -// pv_test() validates the document.hidden and document.visibilityState attributes -// exist prior to running tests and immediately shows a failure if they do not. -// - -function pv_test(func, msg, doc) -{ - if (!doc) - { - doc = document; - } - - // only run the feature check once, unless func == null, in which case, - // this call is intended as a feature check - if (!feature_check) - { - feature_check = true; - - var hiddenVal = doc.hidden; - var visStateVal = doc.visibilityState; - - // show a single error that the Page Visibility feature is undefined - test(function() - { - assert_true(hiddenVal !== undefined && hiddenVal != null, - "document.hidden is defined and not null.");}, - "document.hidden is defined and not null."); - - test(function() - { - assert_true(visStateVal !== undefined && hiddenVal != null, - "document.visibilityState is defined and not null.");}, - "document.visibilityState is defined and not null."); - - } - - if (func) - { - test(func, msg); - } -} - - -function test_feature_exists(doc, msg) -{ - if (!msg) - { - msg = ""; - } - var hiddenMsg = "document.hidden is defined" + msg + "."; - var stateMsg = "document.visibilityState is defined" + msg + "."; - pv_test(function(){assert_true(document.hidden !== undefined, hiddenMsg);}, hiddenMsg, doc); - pv_test(function(){assert_true(document.visibilityState !== undefined, stateMsg);}, stateMsg, doc); -} - -// -// Common helper functions -// - -function test_true(value, msg) -{ - pv_test(function() { assert_true(value, msg); }, msg); -} - -function test_equals(value, equals, msg) -{ - pv_test(function() { assert_equals(value, equals, msg); }, msg); -} - -// -// asynchronous test helper functions -// - -function add_async_result(test_obj, pass_state) -{ - // add assertion to manual test for the pass state - test_obj.step(function() { assert_true(pass_state) }); - - // end manual test - test_obj.done(); -} - -function add_async_result_assert(test_obj, func) -{ - // add assertion to manual test for the pass state - test_obj.step(func); - - // end manual test - test_obj.done(); -} - -var open_link; -function TabSwitch() -{ - //var open_link = window.open("http://www.bing.com"); - open_link = window.open('', '_blank'); - setTimeout(function() { open_link.close(); }, 2000); -}
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect-opt-in.php b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect-opt-in.php deleted file mode 100644 index 2b75da0a..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect-opt-in.php +++ /dev/null
@@ -1,9 +0,0 @@ -<?php - $code = ctype_digit($_GET["code"]) ? $_GET["code"] : "302"; - $location = $_GET["location"] ? $_GET["location"] : $_SERVER["SCRIPT_NAME"] . "?followed"; - - header("HTTP/1.1 $code"); - header("Location: $location"); - header("Timing-Allow-Origin: *"); - exit; -?>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect.php b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect.php deleted file mode 100644 index 0d86e96..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/redirect.php +++ /dev/null
@@ -1,8 +0,0 @@ -<?php - $code = ctype_digit($_GET["code"]) ? $_GET["code"] : "302"; - $location = $_GET["location"] ? $_GET["location"] : $_SERVER["SCRIPT_NAME"] . "?followed"; - - header("HTTP/1.1 $code"); - header("Location: $location"); - exit; -?>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/resource_timing_test0.js b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/resource_timing_test0.js deleted file mode 100644 index 0843cc1..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/resource_timing_test0.js +++ /dev/null
@@ -1 +0,0 @@ -const testDummyValue = 0;
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/worker.js b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/worker.js deleted file mode 100644 index 1e3e58cf6..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/resources/worker.js +++ /dev/null
@@ -1,26 +0,0 @@ -function runTests(event) { - var tests = event.data; - var results = []; - for (var i = 0; i < tests.length; i++) { - try { - results.push(eval(tests[i])); - } catch(e) { - results.push(e); - } - } - return results; -} - -self.onmessage = function(event) { - var results = runTests(event); - postMessage(results); - self.close(); -}; - -self.addEventListener("connect", function(event) { - var port = event.ports[0]; - port.onmessage = function(event) { - var results = runTests(event); - port.postMessage(results); - }; -});
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_memory_cached-expected.txt b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_memory_cached-expected.txt deleted file mode 100644 index 7398a7d8..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_memory_cached-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = 1 duplicate test name: "There should be only one entry" -PASS There should be only one entry -PASS http://127.0.0.1:8000/w3c/webperf/resources/generate_resource.php?type=image&cacheable=1&id=cached is expected to have initiatorType img -PASS requestStart should non-zero on the same-origin request -PASS responseEnd should not be before startTime -PASS duration should not be negative -PASS There should be only one entry -PASS http://localhost:8000/w3c/webperf/resources/generate_resource.php?type=image&cacheable=1&id=cached should be present -PASS requestStart should be 0 on the cross-origin request -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards-at-start.html b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards-at-start.html index 0bcdb2b..1d1a5e2 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards-at-start.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards-at-start.html
@@ -7,8 +7,6 @@ <video controls width=400 src="../../content/60_sec_video.webm"></video> <script> async_test(t => { - enableDoubleTapToJumpForTest(t); - const video = document.querySelector('video'); let count = 0; @@ -16,7 +14,7 @@ // Double tap in the top left hand corner const coordinates = coordinatesOutsideElement(mediaControlsOverlayPlayButton(video)); - doubleTapAtCoordinates(coordinates[0] + 1, coordinates[1] + 1); + doubleTouchAtCoordinates(coordinates[0] + 1, coordinates[1] + 1); }), { once: true }); video.ontimeupdate = t.step_func(() => {
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards.html b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards.html index ec5f56f..8db7734 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-backwards.html
@@ -7,8 +7,6 @@ <video controls width=400 src="../../content/60_sec_video.webm"></video> <script> async_test(t => { - enableDoubleTapToJumpForTest(t); - const video = document.querySelector('video'); let time = 0; @@ -30,7 +28,7 @@ time = currentTime; const coordinates = coordinatesOutsideElement(mediaControlsOverlayPlayButton(video)); - doubleTapAtCoordinates(coordinates[0] + 1, coordinates[1] + 1); + doubleTouchAtCoordinates(coordinates[0] + 1, coordinates[1] + 1); } else if (time > 0) { // Check the video went back 10 seconds assert_greater_than(time, 0);
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards-too-short.html b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards-too-short.html index a1e05e0..e0c8406 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards-too-short.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards-too-short.html
@@ -7,8 +7,6 @@ <video controls width=400 src="../../content/60_sec_video.webm"></video> <script> async_test(t => { - enableDoubleTapToJumpForTest(t); - const video = document.querySelector('video'); video.addEventListener('playing', () => { @@ -19,7 +17,7 @@ // Double tap in the top right hand corner const coordinates = coordinatesOutsideElement(mediaControlsOverlayPlayButton(video)); - doubleTapAtCoordinates(coordinates[0] + video.width, coordinates[1] + 1); + doubleTouchAtCoordinates(coordinates[0] + video.width, coordinates[1] + 1); } }, { once: true });
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards.html b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards.html index f601632..0eb5529 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/doubletap-to-jump-forwards.html
@@ -7,8 +7,6 @@ <video controls width=400 src="../../content/60_sec_video.webm"></video> <script> async_test(t => { - enableDoubleTapToJumpForTest(t); - const video = document.querySelector('video'); let time = 0; @@ -17,7 +15,7 @@ time = Math.round(video.currentTime); const coordinates = coordinatesOutsideElement(mediaControlsOverlayPlayButton(video)); - doubleTapAtCoordinates(coordinates[0] + video.width, coordinates[1] + 1); + doubleTouchAtCoordinates(coordinates[0] + video.width, coordinates[1] + 1); }), { once: true }); video.ontimeupdate = t.step_func(() => {
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing-touch.html b/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing-touch.html index 1a896cca..a40b4d88 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing-touch.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing-touch.html
@@ -10,6 +10,7 @@ const video = document.querySelector('video'); const timeline = timelineElement(video); const thumb = timelineThumb(video); + const scrubbingMessage = scrubbingMessageElement(video); video.addEventListener('playing', t.step_func(() => { // Get the coordinates of the thumb and the timeline. @@ -30,12 +31,18 @@ // Check the scrubbing UI is shown with the correct time. checkControlsClassName(video, 'phase-ready state-scrubbing'); + // Check the scrubbing message is shown. + assert_true(isControlVisible(scrubbingMessage)); + // Ensure that the timeline now has a value in the middle. assert_equals(30, Math.round(timeline.value)); // Add an event listener for when we start playing again after seeking. video.addEventListener('playing', t.step_func_done(() => { checkControlsClassName(video, 'phase-ready state-playing'); + + // Check the scrubbing message is no longer shown. + assert_false(isControlVisible(scrubbingMessage)); }), { once: true }); // Release the touch.
diff --git a/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing.html b/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing.html index 4d5224ba..8c8f084 100644 --- a/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing.html +++ b/third_party/WebKit/LayoutTests/media/controls/modern/scrubbing.html
@@ -4,20 +4,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../media-controls.js"></script> -<body></body> +<video controls width=400 src="../../content/60_sec_video.webm"></video> <script> async_test(t => { - // Need to enable double-tap to check the scrubbing message. - enableDoubleTapToJumpForTest(t); - - // We create the video on the fly, since we need double-tap to jump enabled - // before the video is created. - let video = document.createElement('video'); - video.controls = true; - video.width = 400; - video.src = "../../content/60_sec_video.webm"; - document.body.appendChild(video); - + const video = document.querySelector('video'); const timeline = timelineElement(video); const thumb = timelineThumb(video); const scrubbingMessage = scrubbingMessageElement(video); @@ -34,7 +24,7 @@ assert_true(seeked); checkControlsClassName(video, 'phase-ready state-playing'); - // Check the scrubbing message is no longer shown. + // Check the scrubbing message not shown. assert_false(isControlVisible(scrubbingMessage)); }), { once: true }); @@ -56,8 +46,8 @@ video.addEventListener('seeking', t.step_func(() => { checkControlsClassName(video, 'phase-ready state-scrubbing'); - // Check the scrubbing message is shown. - assert_true(isControlVisible(scrubbingMessage)); + // Check the scrubbing message is not shown since we're scrubbing with the mouse. + assert_false(isControlVisible(scrubbingMessage)); }), { once: true }); video.addEventListener('seeked', t.step_func(() => {
diff --git a/third_party/WebKit/LayoutTests/media/media-controls.js b/third_party/WebKit/LayoutTests/media/media-controls.js index 93d31aa..7a20040 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls.js +++ b/third_party/WebKit/LayoutTests/media/media-controls.js
@@ -371,8 +371,7 @@ } function doubleTapAtCoordinates(x, y, timeout, callback) { - if (timeout == undefined) - timeout = 100; + timeout = timeout == undefined ? 100 : timeout; chrome.gpuBenchmarking.pointerActionSequence([ { @@ -417,15 +416,21 @@ ], callback); } -function enableDoubleTapToJumpForTest(t) { - var doubleTapToJumpOnVideoEnabledValue = - internals.runtimeFlags.doubleTapToJumpOnVideoEnabled; - internals.runtimeFlags.doubleTapToJumpOnVideoEnabled = true; +function doubleTouchAtCoordinates(x, y, timeout, callback) { + timeout = timeout == undefined ? 100 : timeout; - t.add_cleanup(() => { - internals.runtimeFlags.doubleTapToJumpOnVideoEnabled = - doubleTapToJumpOnVideoEnabledValue; - }); + chrome.gpuBenchmarking.pointerActionSequence([ + { + source: 'touch', + actions: [ + { name: 'pointerDown', x: x, y: y }, + { name: 'pointerUp' }, + { name: 'pause', duration: timeout / 1000 }, + { name: 'pointerDown', x: x, y: y }, + { name: 'pointerUp' } + ] + } + ], callback); } function enablePictureInPictureForTest(t) {
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/block/margin-collapse/103-expected.png index 7736f52..fdc1256 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text-control-intrinsic-widths-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text-control-intrinsic-widths-expected.txt index 7448917..a63af872 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text-control-intrinsic-widths-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text-control-intrinsic-widths-expected.txt
@@ -302,30 +302,30 @@ Trebuchet MS input -size=1 clientWidth=16 -size=2 clientWidth=22 -size=3 clientWidth=28 -size=4 clientWidth=34 -size=5 clientWidth=40 -size=10 clientWidth=70 +size=1 clientWidth=35 +size=2 clientWidth=40 +size=3 clientWidth=45 +size=4 clientWidth=50 +size=5 clientWidth=55 +size=10 clientWidth=80 size=20 clientWidth=130 -size=50 clientWidth=310 -size=100 clientWidth=610 -size=500 clientWidth=3010 -size=1000 clientWidth=6010 +size=50 clientWidth=280 +size=100 clientWidth=530 +size=500 clientWidth=2530 +size=1000 clientWidth=5030 textarea -cols=1 clientWidth=23 -cols=2 clientWidth=29 -cols=3 clientWidth=35 -cols=4 clientWidth=41 -cols=5 clientWidth=47 -cols=10 clientWidth=77 -cols=20 clientWidth=137 -cols=50 clientWidth=317 -cols=100 clientWidth=617 -cols=500 clientWidth=3017 -cols=1000 clientWidth=6017 +cols=1 clientWidth=22 +cols=2 clientWidth=27 +cols=3 clientWidth=32 +cols=4 clientWidth=37 +cols=5 clientWidth=42 +cols=10 clientWidth=67 +cols=20 clientWidth=117 +cols=50 clientWidth=267 +cols=100 clientWidth=517 +cols=500 clientWidth=2517 +cols=1000 clientWidth=5017 Verdana input
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/fast/block/margin-collapse/103-expected.png index 7736f52..fdc1256 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/block/margin-collapse/103-expected.png index aaf272e..9419997 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/margin-collapse/103-expected.png index a79a9b1..4c085e06 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/block/margin-collapse/103-expected.png new file mode 100644 index 0000000..9b1b229 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.png deleted file mode 100644 index dc1da62..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.txt deleted file mode 100644 index 73a4622..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls/lazy-loaded-style-expected.txt +++ /dev/null
@@ -1,51 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x320 - LayoutBlockFlow {HTML} at (0,0) size 800x320 - LayoutBlockFlow {BODY} at (8,8) size 784x304 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,8) size 400x300 - LayoutVideo {VIDEO} at (0,0) size 400x300 -layer at (8,8) size 400x300 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x300 - LayoutBlockFlow {DIV} at (0,268) size 400x32 -layer at (8,8) size 400x258 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x258 -layer at (8,276) size 400x32 scrollHeight 40 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x32 [bgcolor=#FAFAFA] - LayoutButton {INPUT} at (0,0) size 32x32 - LayoutFlexibleBox {DIV} at (32,0) size 23.36x32 [color=#5A5A5A] - LayoutBlockFlow (anonymous) at (0,0) size 23.36x32 - LayoutText {#text} at (0,9) size 24x14 - text run at (0,9) width 24: "0:00" - LayoutFlexibleBox {DIV} at (55.36,0) size 34.69x32 [color=#5A5A5A] - LayoutBlockFlow (anonymous) at (4,0) size 30.69x32 - LayoutText {#text} at (0,9) size 31x14 - text run at (0,9) width 31: "/ 0:06" - LayoutSlider {INPUT} at (108.05,1) size 116.67x30 - LayoutFlexibleBox {DIV} at (0,14) size 116.67x2 - LayoutButton {INPUT} at (242.72,0) size 32x32 - LayoutSlider {INPUT} at (292.72,1) size 57.28x30 - LayoutFlexibleBox {DIV} at (0,14) size 57.28x2 -layer at (376,276) size 32x32 - LayoutButton {INPUT} at (368,0) size 32x32 -layer at (98,292) size 153x0 - LayoutBlockFlow (relative positioned) {DIV} at (-18,1) size 152.67x0 -layer at (116,291) size 117x2 - LayoutBlockFlow (positioned) {DIV} at (18,-1) size 116.67x2 [bgcolor=#DADADA] -layer at (283,292) size 93x0 - LayoutBlockFlow (relative positioned) {DIV} at (-18,1) size 93.28x0 -layer at (301,291) size 57x2 - LayoutBlockFlow (positioned) {DIV} at (18,-1) size 57.28x2 [bgcolor=#DADADA] -layer at (116,291) size 117x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 117x2 [bgcolor=#5A5A5A] -layer at (116,291) size 0x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 0x2 [bgcolor=#4285F4] -layer at (301,291) size 0x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 0x2 [bgcolor=#5A5A5A] -layer at (301,291) size 57x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 57x2 [bgcolor=#4285F4] -layer at (98,268) size 36x48 backgroundClip at (8,276) size 400x32 clip at (8,276) size 400x32 - LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,-24) size 36x48 -layer at (340,268) size 36x48 backgroundClip at (8,276) size 400x32 clip at (8,276) size 400x32 - LayoutBlockFlow (positioned) zI: 2 {DIV} at (57.28,-24) size 36x48
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.png deleted file mode 100644 index dc1da62..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt deleted file mode 100644 index 73a4622..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt +++ /dev/null
@@ -1,51 +0,0 @@ -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x320 - LayoutBlockFlow {HTML} at (0,0) size 800x320 - LayoutBlockFlow {BODY} at (8,8) size 784x304 - LayoutText {#text} at (0,0) size 0x0 -layer at (8,8) size 400x300 - LayoutVideo {VIDEO} at (0,0) size 400x300 -layer at (8,8) size 400x300 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x300 - LayoutBlockFlow {DIV} at (0,268) size 400x32 -layer at (8,8) size 400x258 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x258 -layer at (8,276) size 400x32 scrollHeight 40 - LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 400x32 [bgcolor=#FAFAFA] - LayoutButton {INPUT} at (0,0) size 32x32 - LayoutFlexibleBox {DIV} at (32,0) size 23.36x32 [color=#5A5A5A] - LayoutBlockFlow (anonymous) at (0,0) size 23.36x32 - LayoutText {#text} at (0,9) size 24x14 - text run at (0,9) width 24: "0:00" - LayoutFlexibleBox {DIV} at (55.36,0) size 34.69x32 [color=#5A5A5A] - LayoutBlockFlow (anonymous) at (4,0) size 30.69x32 - LayoutText {#text} at (0,9) size 31x14 - text run at (0,9) width 31: "/ 0:06" - LayoutSlider {INPUT} at (108.05,1) size 116.67x30 - LayoutFlexibleBox {DIV} at (0,14) size 116.67x2 - LayoutButton {INPUT} at (242.72,0) size 32x32 - LayoutSlider {INPUT} at (292.72,1) size 57.28x30 - LayoutFlexibleBox {DIV} at (0,14) size 57.28x2 -layer at (376,276) size 32x32 - LayoutButton {INPUT} at (368,0) size 32x32 -layer at (98,292) size 153x0 - LayoutBlockFlow (relative positioned) {DIV} at (-18,1) size 152.67x0 -layer at (116,291) size 117x2 - LayoutBlockFlow (positioned) {DIV} at (18,-1) size 116.67x2 [bgcolor=#DADADA] -layer at (283,292) size 93x0 - LayoutBlockFlow (relative positioned) {DIV} at (-18,1) size 93.28x0 -layer at (301,291) size 57x2 - LayoutBlockFlow (positioned) {DIV} at (18,-1) size 57.28x2 [bgcolor=#DADADA] -layer at (116,291) size 117x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 117x2 [bgcolor=#5A5A5A] -layer at (116,291) size 0x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 0x2 [bgcolor=#4285F4] -layer at (301,291) size 0x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 0x2 [bgcolor=#5A5A5A] -layer at (301,291) size 57x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 57x2 [bgcolor=#4285F4] -layer at (98,268) size 36x48 backgroundClip at (8,276) size 400x32 clip at (8,276) size 400x32 - LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,-24) size 36x48 -layer at (340,268) size 36x48 backgroundClip at (8,276) size 400x32 clip at (8,276) size 400x32 - LayoutBlockFlow (positioned) zI: 2 {DIV} at (57.28,-24) size 36x48
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png index 9b1b229..8995b40 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.png index 7fbb666b..dc1da62 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt index 9632bf9..73a4622 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt
@@ -37,8 +37,8 @@ LayoutBlockFlow (relative positioned) {DIV} at (-18,1) size 93.28x0 layer at (301,291) size 57x2 LayoutBlockFlow (positioned) {DIV} at (18,-1) size 57.28x2 [bgcolor=#DADADA] -layer at (116,291) size 116x2 - LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 116x2 [bgcolor=#5A5A5A] +layer at (116,291) size 117x2 + LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 117x2 [bgcolor=#5A5A5A] layer at (116,291) size 0x2 LayoutBlockFlow (positioned) zI: 1 {DIV} at (0,0) size 0x2 [bgcolor=#4285F4] layer at (301,291) size 0x2
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/block/margin-collapse/103-expected.png index ca1da14d..229738eeec 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/block/margin-collapse/103-expected.png deleted file mode 100644 index 7d0ecf4..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/block/margin-collapse/103-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/layout_ng/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/layout_ng/fast/block/margin-collapse/103-expected.png deleted file mode 100644 index 7d0ecf4..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/virtual/layout_ng/fast/block/margin-collapse/103-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 8063f88..530de08 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -5395,6 +5395,7 @@ getter track method constructor method getContributingSources + method getStats interface RTCRtpSender attribute @@toStringTag getter dtmf
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp index 7825f57..1ea6e98b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp
@@ -70,7 +70,7 @@ Vector<String> logged_activities_; }; -class ActivityLoggerTest : public ::testing::Test { +class ActivityLoggerTest : public testing::Test { protected: ActivityLoggerTest() { activity_logger_ = new TestActivityLogger();
diff --git a/third_party/WebKit/Source/bindings/core/v8/BindingSecurityTest.cpp b/third_party/WebKit/Source/bindings/core/v8/BindingSecurityTest.cpp index 3bf5a68..9685b62 100644 --- a/third_party/WebKit/Source/bindings/core/v8/BindingSecurityTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/BindingSecurityTest.cpp
@@ -22,7 +22,7 @@ class BindingSecurityCounterTest : public SimTest, - public ::testing::WithParamInterface<const char*> { + public testing::WithParamInterface<const char*> { public: enum class OriginDisposition { CrossOrigin, SameOrigin }; @@ -90,19 +90,19 @@ INSTANTIATE_TEST_CASE_P(WindowProperties, BindingSecurityCounterTest, - ::testing::Values("window", - "self", - "location", - "close", - "closed", - "focus", - "blur", - "frames", - "length", - "top", - "opener", - "parent", - "postMessage")); + testing::Values("window", + "self", + "location", + "close", + "closed", + "focus", + "blur", + "frames", + "length", + "top", + "opener", + "parent", + "postMessage")); TEST_P(BindingSecurityCounterTest, CrossOriginWindow) { LoadWindowAndAccessProperty(OriginDisposition::CrossOrigin, GetParam());
diff --git a/third_party/WebKit/Source/bindings/core/v8/DictionaryTest.cpp b/third_party/WebKit/Source/bindings/core/v8/DictionaryTest.cpp index 8ecdab21..be157e4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DictionaryTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DictionaryTest.cpp
@@ -15,7 +15,7 @@ namespace { -class V8DictionaryTest : public ::testing::Test { +class V8DictionaryTest : public testing::Test { protected: static Dictionary CreateDictionary(ScriptState* script_state, const char* s) { v8::Local<v8::String> source =
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModuleTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptModuleTest.cpp index 785c8ae..5e4701be 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptModuleTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModuleTest.cpp
@@ -162,7 +162,7 @@ ASSERT_FALSE(module.IsNull()); auto requests = module.ModuleRequests(scope.GetScriptState()); - EXPECT_THAT(requests, ::testing::ContainerEq<Vector<String>>({"a", "b"})); + EXPECT_THAT(requests, testing::ContainerEq<Vector<String>>({"a", "b"})); } TEST(ScriptModuleTest, instantiateNoDeps) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp index 6d0b4bf..79dc966 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -163,7 +163,7 @@ // test on this class. class ScriptPromisePropertyGarbageCollectedTest : public ScriptPromisePropertyTestBase, - public ::testing::Test { + public testing::Test { public: typedef GarbageCollectedHolder::Property Property; @@ -184,7 +184,7 @@ // target. class ScriptPromisePropertyNonScriptWrappableResolutionTargetTest : public ScriptPromisePropertyTestBase, - public ::testing::Test { + public testing::Test { public: template <typename T> void Test(const T& value,
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp index ab72aa9..08f591a8 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
@@ -42,7 +42,7 @@ String* value_; }; -class ScriptPromiseResolverTest : public ::testing::Test { +class ScriptPromiseResolverTest : public testing::Test { public: ScriptPromiseResolverTest() : page_holder_(DummyPageHolder::Create()) {}
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index f6a19c0..e7c2ea0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -33,7 +33,7 @@ namespace { -class ScriptStreamingTest : public ::testing::Test { +class ScriptStreamingTest : public testing::Test { public: ScriptStreamingTest() : loading_task_runner_(scheduler::GetSingleThreadTaskRunnerForTesting()), @@ -43,11 +43,10 @@ // Basically we are not interested in ScriptElementBase* calls, just making // the method(s) to return default values. EXPECT_CALL(*element, IntegrityAttributeValue()) - .WillRepeatedly(::testing::Return(String())); + .WillRepeatedly(testing::Return(String())); EXPECT_CALL(*element, GetDocument()) - .WillRepeatedly( - ::testing::ReturnRef(dummy_page_holder_->GetDocument())); - EXPECT_CALL(*element, Loader()).WillRepeatedly(::testing::Return(nullptr)); + .WillRepeatedly(testing::ReturnRef(dummy_page_holder_->GetDocument())); + EXPECT_CALL(*element, Loader()).WillRepeatedly(testing::Return(nullptr)); KURL url("http://www.streaming-test.com/"); Platform::Current()->GetURLLoaderMockFactory()->RegisterURL(
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp index f30ff02..9ee23fe8 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
@@ -21,7 +21,7 @@ namespace { -class V8ScriptRunnerTest : public ::testing::Test { +class V8ScriptRunnerTest : public testing::Test { public: V8ScriptRunnerTest() = default; ~V8ScriptRunnerTest() override = default;
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp index e57239f..38cb6e3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
@@ -123,20 +123,20 @@ } // Checks for a DOM exception, including a rethrown one. -::testing::AssertionResult HadDOMExceptionInCoreTest( +testing::AssertionResult HadDOMExceptionInCoreTest( const StringView& name, ScriptState* script_state, ExceptionState& exception_state) { if (!exception_state.HadException()) - return ::testing::AssertionFailure() << "no exception thrown"; + return testing::AssertionFailure() << "no exception thrown"; DOMException* dom_exception = V8DOMException::ToImplWithTypeCheck( script_state->GetIsolate(), exception_state.GetException()); if (!dom_exception) - return ::testing::AssertionFailure() + return testing::AssertionFailure() << "exception thrown was not a DOMException"; if (dom_exception->name() != name) - return ::testing::AssertionFailure() << "was " << dom_exception->name(); - return ::testing::AssertionSuccess(); + return testing::AssertionFailure() << "was " << dom_exception->name(); + return testing::AssertionSuccess(); } namespace { @@ -982,7 +982,7 @@ ->readPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), &pixel, 4, 3, 3)); - ASSERT_THAT(pixel, ::testing::ElementsAre(255, 0, 0, 255)); + ASSERT_THAT(pixel, testing::ElementsAre(255, 0, 0, 255)); } TEST(V8ScriptValueSerializerTest, RoundTripImageBitmapWithColorSpaceInfo) { @@ -1070,7 +1070,7 @@ ->readPixels(SkImageInfo::Make(2, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), &pixels, 8, 0, 0)); - ASSERT_THAT(pixels, ::testing::ElementsAre(255, 0, 0, 255, 0, 255, 0, 255)); + ASSERT_THAT(pixels, testing::ElementsAre(255, 0, 0, 255, 0, 255, 0, 255)); } TEST(V8ScriptValueSerializerTest, DecodeImageBitmapV18) { @@ -1105,8 +1105,8 @@ ->readPixels(info, &pixel, 8, 1, 0)); // The reference values are the hex representation of red in P3 (as stored // in half floats by Skia). - ASSERT_THAT(pixel, ::testing::ElementsAre(0x94, 0x3A, 0x3F, 0x28, 0x5F, 0x24, - 0x0, 0x3C)); + ASSERT_THAT(pixel, testing::ElementsAre(0x94, 0x3A, 0x3F, 0x28, 0x5F, 0x24, + 0x0, 0x3C)); } TEST(V8ScriptValueSerializerTest, InvalidImageBitmapDecode) { @@ -1245,7 +1245,7 @@ ASSERT_TRUE(new_image->readPixels( SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), &pixel, 4, 3, 3)); - ASSERT_THAT(pixel, ::testing::ElementsAre(255, 0, 0, 255)); + ASSERT_THAT(pixel, testing::ElementsAre(255, 0, 0, 255)); // Check also that the underlying image contents were transferred. EXPECT_EQ(image, new_image);
diff --git a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp index 7e4bec9..3b307b8 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp
@@ -26,9 +26,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; -using ::testing::ElementsAreArray; -using ::testing::UnorderedElementsAre; +using testing::ElementsAre; +using testing::ElementsAreArray; +using testing::UnorderedElementsAre; namespace blink { namespace { @@ -51,21 +51,21 @@ } // Checks for a DOM exception, including a rethrown one. -::testing::AssertionResult HadDOMExceptionInModulesTest( +testing::AssertionResult HadDOMExceptionInModulesTest( const StringView& name, ScriptState* script_state, ExceptionState& exception_state) { if (!exception_state.HadException()) - return ::testing::AssertionFailure() << "no exception thrown"; + return testing::AssertionFailure() << "no exception thrown"; DOMException* dom_exception = V8DOMException::ToImplWithTypeCheck( script_state->GetIsolate(), exception_state.GetException()); if (!dom_exception) { - return ::testing::AssertionFailure() + return testing::AssertionFailure() << "exception thrown was not a DOMException"; } if (dom_exception->name() != name) - return ::testing::AssertionFailure() << "was " << dom_exception->name(); - return ::testing::AssertionSuccess(); + return testing::AssertionFailure() << "was " << dom_exception->name(); + return testing::AssertionSuccess(); } static const char kEcdsaPrivateKey[] =
diff --git a/third_party/WebKit/Source/controller/OomInterventionImplTest.cpp b/third_party/WebKit/Source/controller/OomInterventionImplTest.cpp index 37f7024a..48fbe75 100644 --- a/third_party/WebKit/Source/controller/OomInterventionImplTest.cpp +++ b/third_party/WebKit/Source/controller/OomInterventionImplTest.cpp
@@ -33,7 +33,7 @@ } // namespace -class OomInterventionImplTest : public ::testing::Test { +class OomInterventionImplTest : public testing::Test { public: size_t MockMemoryWorkloadCalculator() { return memory_workload_; }
diff --git a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp index 3ca5dbdc..6814273 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
@@ -34,7 +34,7 @@ namespace blink { -class AnimationAnimationClockTest : public ::testing::Test { +class AnimationAnimationClockTest : public testing::Test { public: AnimationAnimationClockTest() : animation_clock(MockTimeFunction) {}
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp index 3d21a2593d..10dd9161 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
@@ -14,7 +14,7 @@ namespace blink { -class AnimationInterpolableValueTest : public ::testing::Test { +class AnimationInterpolableValueTest : public testing::Test { protected: double InterpolateNumbers(int a, int b, double progress) { // We require a property that maps to CSSNumberInterpolationType. 'z-index'
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp index 3bfc60a0..26e2c5b0 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp
@@ -583,7 +583,7 @@ namespace blink { -class KeyframeEffectModelTest : public ::testing::Test { +class KeyframeEffectModelTest : public testing::Test { public: static Vector<double> GetComputedOffsets(const KeyframeVector& keyframes) { return KeyframeEffectModelBase::GetComputedOffsets(keyframes);
diff --git a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp index f906c13..dd7144b 100644 --- a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp +++ b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
@@ -12,7 +12,7 @@ using SVGNames::amplitudeAttr; using SVGNames::exponentAttr; -class PropertyHandleTest : public ::testing::Test {}; +class PropertyHandleTest : public testing::Test {}; TEST_F(PropertyHandleTest, Equality) { AtomicString name_a = "--a";
diff --git a/third_party/WebKit/Source/core/animation/README.md b/third_party/WebKit/Source/core/animation/README.md index 6a64431..6a2aa7a 100644 --- a/third_party/WebKit/Source/core/animation/README.md +++ b/third_party/WebKit/Source/core/animation/README.md
@@ -358,7 +358,7 @@ where you can load HTML, [enable compositing][] if necessary, and run assertions about the state. -[extending Test]: https://cs.chromium.org/search/?q=public%5C+::testing::Test+file:core%5C/Animation&sq=package:chromium&type=cs +[extending Test]: https://cs.chromium.org/search/?q=public%5C+testing::Test+file:core%5C/Animation&sq=package:chromium&type=cs [extending RenderingTest]: https://cs.chromium.org/search/?q=public%5C+RenderingTest+file:core%5C/animation&type=cs [enable compositing]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp?type=cs&sq=package:chromium&q=file:core%5C/animation%5C/.*Test%5C.cpp+EnableCompositing
diff --git a/third_party/WebKit/Source/core/animation/TimingInputTest.cpp b/third_party/WebKit/Source/core/animation/TimingInputTest.cpp index 16c96e97..b45431a 100644 --- a/third_party/WebKit/Source/core/animation/TimingInputTest.cpp +++ b/third_party/WebKit/Source/core/animation/TimingInputTest.cpp
@@ -15,7 +15,7 @@ namespace blink { -class AnimationTimingInputTest : public ::testing::Test { +class AnimationTimingInputTest : public testing::Test { public: Timing ApplyTimingInputNumber(v8::Isolate*, String timing_property,
diff --git a/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp b/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp index 513aff03..9c47d913 100644 --- a/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class DataObjectTest : public ::testing::Test { +class DataObjectTest : public testing::Test { public: DataObjectTest() : data_object_(DataObject::Create()) {}
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp index 49a5db55..5c126943 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp
@@ -19,7 +19,7 @@ typedef bool TestParamRootLayerScrolling; class DataTransferTest : public RenderingTest, - public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest { public: DataTransferTest() : ScopedRootLayerScrollingForTest(GetParam()) {} @@ -32,7 +32,7 @@ } }; -INSTANTIATE_TEST_CASE_P(All, DataTransferTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, DataTransferTest, testing::Bool()); TEST_P(DataTransferTest, NodeImage) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp index 479f1452..42742f44 100644 --- a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp +++ b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
@@ -19,7 +19,7 @@ namespace blink { -class RuleFeatureSetTest : public ::testing::Test { +class RuleFeatureSetTest : public testing::Test { public: RuleFeatureSetTest() = default;
diff --git a/third_party/WebKit/Source/core/css/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/css/SelectorQueryTest.cpp index d7c26771..04670ad4 100644 --- a/third_party/WebKit/Source/core/css/SelectorQueryTest.cpp +++ b/third_party/WebKit/Source/core/css/SelectorQueryTest.cpp
@@ -34,10 +34,10 @@ void RunTests(ContainerNode& scope, const QueryTest (&test_cases)[length]) { for (const auto& test_case : test_cases) { const char* selector = test_case.selector; - SCOPED_TRACE( - ::testing::Message() - << (test_case.query_all ? "querySelectorAll('" : "querySelector('") - << selector << "')"); + SCOPED_TRACE(testing::Message() + << (test_case.query_all ? "querySelectorAll('" + : "querySelector('") + << selector << "')"); if (test_case.query_all) { StaticElementList* match_all = scope.QuerySelectorAll(selector); EXPECT_EQ(test_case.matches, match_all->length());
diff --git a/third_party/WebKit/Source/core/css/StyleEngineTest.cpp b/third_party/WebKit/Source/core/css/StyleEngineTest.cpp index 389b8236..4215ee85 100644 --- a/third_party/WebKit/Source/core/css/StyleEngineTest.cpp +++ b/third_party/WebKit/Source/core/css/StyleEngineTest.cpp
@@ -30,7 +30,7 @@ namespace blink { -class StyleEngineTest : public ::testing::Test { +class StyleEngineTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h index e01c2da..d7b6066 100644 --- a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h +++ b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h
@@ -21,8 +21,6 @@ // StylePropertyMap.idl. The declared StylePropertyMap for an element is // accessed via CSSStyleRule.styleMap (see CSSStyleRule.idl) class CORE_EXPORT DeclaredStylePropertyMap final : public StylePropertyMap { - WTF_MAKE_NONCOPYABLE(DeclaredStylePropertyMap); - public: explicit DeclaredStylePropertyMap(CSSStyleRule* owner_rule); @@ -52,6 +50,8 @@ StyleRule* GetStyleRule() const; WeakMember<CSSStyleRule> owner_rule_; + + DISALLOW_COPY_AND_ASSIGN(DeclaredStylePropertyMap); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidatorTest.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidatorTest.cpp index 9d79de5f..80b5ef80 100644 --- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidatorTest.cpp +++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidatorTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class StyleInvalidatorTest : public ::testing::Test { +class StyleInvalidatorTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp index 6f49f4f..cce0ad8 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp
@@ -17,7 +17,7 @@ namespace blink { -class CSSLazyParsingTest : public ::testing::Test { +class CSSLazyParsingTest : public testing::Test { public: bool HasParsedProperties(StyleRule* rule) { return rule->HasParsedProperties();
diff --git a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp index c66d58a3..0caa100 100644 --- a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp +++ b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
@@ -39,10 +39,9 @@ BuilderFunc set_value; }; -class FontBuilderInitTest : public FontBuilderTest, public ::testing::Test {}; +class FontBuilderInitTest : public FontBuilderTest, public testing::Test {}; class FontBuilderAdditiveTest : public FontBuilderTest, - public ::testing::TestWithParam<FunctionPair> { -}; + public testing::TestWithParam<FunctionPair> {}; TEST_F(FontBuilderInitTest, InitialFontSizeNotScaled) { scoped_refptr<ComputedStyle> initial = ComputedStyle::Create(); @@ -194,7 +193,7 @@ INSTANTIATE_TEST_CASE_P( AllFields, FontBuilderAdditiveTest, - ::testing::Values( + testing::Values( FunctionPair(FontWeightBase, FontWeightValue), FunctionPair(FontStretchBase, FontStretchValue), FunctionPair(FontFamilyBase, FontFamilyValue),
diff --git a/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp b/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp index b526f14..c0f15b0 100644 --- a/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp +++ b/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class MatchResultTest : public ::testing::Test { +class MatchResultTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/css/threaded/MultiThreadedTestUtil.h b/third_party/WebKit/Source/core/css/threaded/MultiThreadedTestUtil.h index 99d2387..8d7e345 100644 --- a/third_party/WebKit/Source/core/css/threaded/MultiThreadedTestUtil.h +++ b/third_party/WebKit/Source/core/css/threaded/MultiThreadedTestUtil.h
@@ -27,12 +27,12 @@ // instead of the normal gtest macros for MultiThreadedTests. // It guarantees that those tests are only run on Thread Sanitizer enabled // builds. -// Also, TSAN_TEST subclasses MultiThreadTest instead of ::testing::Test. +// Also, TSAN_TEST subclasses MultiThreadTest instead of testing::Test. #if defined(THREAD_SANITIZER) #define TSAN_TEST(test_case_name, test_name) \ GTEST_TEST_(test_case_name, test_name, ::blink::MultiThreadedTest, \ - ::testing::internal::GetTypeId<::blink::MultiThreadedTest>()) + testing::internal::GetTypeId<::blink::MultiThreadedTest>()) #define TSAN_TEST_F(test_fixture, test_name) TEST_F(test_fixture, test_name) @@ -41,14 +41,14 @@ #define TSAN_TEST(test_case_name, test_name) \ GTEST_TEST_(test_case_name, DISABLED_##test_name, \ ::blink::MultiThreadedTest, \ - ::testing::internal::GetTypeId<::blink::MultiThreadedTest>()) + testing::internal::GetTypeId<::blink::MultiThreadedTest>()) #define TSAN_TEST_F(test_fixture, test_name) \ TEST_F(test_fixture, DISABLED_##test_name) #endif -class MultiThreadedTest : public ::testing::Test { +class MultiThreadedTest : public testing::Test { public: // RunOnThreads run a closure num_threads * callbacks_per_thread times. // The default for this is 10*100 = 1000 times.
diff --git a/third_party/WebKit/Source/core/css/threaded/TextRendererThreadedTest.cpp b/third_party/WebKit/Source/core/css/threaded/TextRendererThreadedTest.cpp index 2a2384d92..ceb206e6 100644 --- a/third_party/WebKit/Source/core/css/threaded/TextRendererThreadedTest.cpp +++ b/third_party/WebKit/Source/core/css/threaded/TextRendererThreadedTest.cpp
@@ -18,8 +18,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::Return; +using testing::_; +using testing::Return; using blink::test::CreateTestFont;
diff --git a/third_party/WebKit/Source/core/dom/AttrTest.cpp b/third_party/WebKit/Source/core/dom/AttrTest.cpp index 1ef0c75..3c0d67d 100644 --- a/third_party/WebKit/Source/core/dom/AttrTest.cpp +++ b/third_party/WebKit/Source/core/dom/AttrTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class AttrTest : public ::testing::Test { +class AttrTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp index f0742d1..ab088a9b 100644 --- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -947,14 +947,14 @@ typedef bool TestParamRootLayerScrolling; class ParameterizedDocumentTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public DocumentTest { public: ParameterizedDocumentTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, ParameterizedDocumentTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedDocumentTest, testing::Bool()); // Android does not support non-overlay top-level scrollbars. #if !defined(OS_ANDROID)
diff --git a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElementTest.cpp b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElementTest.cpp index 546c616..8b583435 100644 --- a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElementTest.cpp
@@ -8,7 +8,7 @@ namespace blink { -class FirstLetterPseudoElementTest : public ::testing::Test {}; +class FirstLetterPseudoElementTest : public testing::Test {}; TEST_F(FirstLetterPseudoElementTest, DoesNotBreakEmoji) { const UChar emoji[] = {0xD83D, 0xDE31, 0};
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp b/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp index 6b4b9dab..b27170bc 100644 --- a/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp +++ b/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp
@@ -75,7 +75,7 @@ } // namespace -class IdleDeadlineTest : public ::testing::Test { +class IdleDeadlineTest : public testing::Test { public: void SetUp() override { original_time_function_ = SetTimeFunctionsForTesting([] { return 1.0; });
diff --git a/third_party/WebKit/Source/core/dom/PausableObjectTest.cpp b/third_party/WebKit/Source/core/dom/PausableObjectTest.cpp index 3812c54..66cb2cf0 100644 --- a/third_party/WebKit/Source/core/dom/PausableObjectTest.cpp +++ b/third_party/WebKit/Source/core/dom/PausableObjectTest.cpp
@@ -56,7 +56,7 @@ MOCK_METHOD1(ContextDestroyed, void(ExecutionContext*)); }; -class PausableObjectTest : public ::testing::Test { +class PausableObjectTest : public testing::Test { protected: PausableObjectTest();
diff --git a/third_party/WebKit/Source/core/dom/ScriptedAnimationControllerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptedAnimationControllerTest.cpp index fef6985..fbb75c8 100644 --- a/third_party/WebKit/Source/core/dom/ScriptedAnimationControllerTest.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptedAnimationControllerTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class ScriptedAnimationControllerTest : public ::testing::Test { +class ScriptedAnimationControllerTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskControllerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskControllerTest.cpp index 0d3b9773..040c598 100644 --- a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskControllerTest.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskControllerTest.cpp
@@ -100,7 +100,7 @@ }; } // namespace -class ScriptedIdleTaskControllerTest : public ::testing::Test { +class ScriptedIdleTaskControllerTest : public testing::Test { public: void SetUp() override { execution_context_ = new NullExecutionContext(); } @@ -122,9 +122,9 @@ EXPECT_TRUE(platform->HasIdleTask()); EXPECT_NE(0, id); - EXPECT_CALL(*idle_task, invoke(::testing::_)); + EXPECT_CALL(*idle_task, invoke(testing::_)); platform->RunIdleTask(); - ::testing::Mock::VerifyAndClearExpectations(idle_task); + testing::Mock::VerifyAndClearExpectations(idle_task); EXPECT_FALSE(platform->HasIdleTask()); } @@ -140,9 +140,9 @@ int id = controller->RegisterCallback(idle_task, options); EXPECT_NE(0, id); - EXPECT_CALL(*idle_task, invoke(::testing::_)).Times(0); + EXPECT_CALL(*idle_task, invoke(testing::_)).Times(0); platform->RunIdleTask(); - ::testing::Mock::VerifyAndClearExpectations(idle_task); + testing::Mock::VerifyAndClearExpectations(idle_task); // The idle task should have been reposted. EXPECT_TRUE(platform->HasIdleTask());
diff --git a/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp b/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp index 317ed2c..743a843 100644 --- a/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp +++ b/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp
@@ -22,7 +22,7 @@ namespace blink { -class StaticRangeTest : public ::testing::Test { +class StaticRangeTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/dom/events/ListenerLeakTest.cpp b/third_party/WebKit/Source/core/dom/events/ListenerLeakTest.cpp index 1251943..4d7b14c 100644 --- a/third_party/WebKit/Source/core/dom/events/ListenerLeakTest.cpp +++ b/third_party/WebKit/Source/core/dom/events/ListenerLeakTest.cpp
@@ -84,7 +84,7 @@ return count; } -class ListenerLeakTest : public ::testing::Test { +class ListenerLeakTest : public testing::Test { public: void RunTest(const std::string& filename) { std::string base_url("http://www.example.com/");
diff --git a/third_party/WebKit/Source/core/dom/ng/slot_assignment_test.cpp b/third_party/WebKit/Source/core/dom/ng/slot_assignment_test.cpp index c28f28e..aaed502 100644 --- a/third_party/WebKit/Source/core/dom/ng/slot_assignment_test.cpp +++ b/third_party/WebKit/Source/core/dom/ng/slot_assignment_test.cpp
@@ -79,7 +79,7 @@ } // namespace -class SlotAssignmentTest : public ::testing::Test, +class SlotAssignmentTest : public testing::Test, private ScopedIncrementalShadowDOMForTest { public: SlotAssignmentTest() : ScopedIncrementalShadowDOMForTest(true) {}
diff --git a/third_party/WebKit/Source/core/editing/BUILD.gn b/third_party/WebKit/Source/core/editing/BUILD.gn index 33ae5d1..3905b02 100644 --- a/third_party/WebKit/Source/core/editing/BUILD.gn +++ b/third_party/WebKit/Source/core/editing/BUILD.gn
@@ -177,6 +177,7 @@ "commands/SplitTextNodeCommand.h", "commands/SplitTextNodeContainingElementCommand.cpp", "commands/SplitTextNodeContainingElementCommand.h", + "commands/StyleCommands.h", "commands/TypingCommand.cpp", "commands/TypingCommand.h", "commands/UndoStack.cpp",
diff --git a/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp b/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp index 577bca0..137f9a8 100644 --- a/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp +++ b/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp
@@ -79,10 +79,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - CaretDisplayItemClientTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + CaretDisplayItemClientTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(CaretDisplayItemClientTest, CaretPaintInvalidation) { GetDocument().body()->setContentEditable("true", ASSERT_NO_EXCEPTION);
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp index 2628a29..968c335 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -37,6 +37,7 @@ #include "core/editing/Editor.h" #include "core/editing/EphemeralRange.h" #include "core/editing/FrameSelection.h" +#include "core/editing/LocalCaretRect.h" #include "core/editing/PlainTextRange.h" #include "core/editing/PositionIterator.h" #include "core/editing/PositionWithAffinity.h" @@ -1573,6 +1574,11 @@ position.ComputeOffsetInContainerNode()); } +FloatQuad LocalToAbsoluteQuadOf(const LocalCaretRect& caret_rect) { + return caret_rect.layout_object->LocalToAbsoluteQuad( + FloatRect(caret_rect.rect)); +} + const StaticRangeVector* TargetRangesForInputEvent(const Node& node) { // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. see http://crbug.com/590369 for more details.
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.h b/third_party/WebKit/Source/core/editing/EditingUtilities.h index 1372329b..c9821066 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilities.h +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.h
@@ -30,6 +30,7 @@ #include "core/editing/EditingBoundary.h" #include "core/editing/Forward.h" #include "core/events/InputEvent.h" +#include "platform/geometry/FloatQuad.h" #include "platform/text/TextDirection.h" #include "platform/wtf/Forward.h" #include "platform/wtf/text/CharacterNames.h" @@ -53,6 +54,7 @@ class Element; class HTMLElement; class HTMLSpanElement; +struct LocalCaretRect; class Node; class Pasteboard; @@ -359,6 +361,12 @@ size_t ComputeDistanceToRightGraphemeBoundary(const Position&); // ------------------------------------------------------------------------- +// LocalCaretRect conversions +// ------------------------------------------------------------------------- + +FloatQuad LocalToAbsoluteQuadOf(const LocalCaretRect&); + +// ------------------------------------------------------------------------- // Events // -------------------------------------------------------------------------
diff --git a/third_party/WebKit/Source/core/editing/KeyboardTest.cpp b/third_party/WebKit/Source/core/editing/KeyboardTest.cpp index c4ca7eb..9ca3c7e4 100644 --- a/third_party/WebKit/Source/core/editing/KeyboardTest.cpp +++ b/third_party/WebKit/Source/core/editing/KeyboardTest.cpp
@@ -44,7 +44,7 @@ namespace blink { -class KeyboardTest : public ::testing::Test { +class KeyboardTest : public testing::Test { public: // Pass a WebKeyboardEvent into the EditorClient and get back the string // name of which editing event that key causes.
diff --git a/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp b/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp index a2f91f4..262ec00 100644 --- a/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp +++ b/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp
@@ -19,7 +19,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; +using testing::_; namespace blink { @@ -28,7 +28,7 @@ return p; } -class LinkSelectionTestBase : public ::testing::Test { +class LinkSelectionTestBase : public testing::Test { protected: enum DragFlag { kSendDownEvent = 1, kSendUpEvent = 1 << 1 }; using DragFlags = unsigned; @@ -314,7 +314,7 @@ double_click_event ? EventTypeNames::dblclick : EventTypeNames::click, event_handler); - ::testing::InSequence s; + testing::InSequence s; EXPECT_CALL(*event_handler, handleEvent(_, _)).Times(1); const auto& elem_bounds = element.BoundsInViewport();
diff --git a/third_party/WebKit/Source/core/editing/LocalCaretRect.cpp b/third_party/WebKit/Source/core/editing/LocalCaretRect.cpp index c83625a..dd1a246 100644 --- a/third_party/WebKit/Source/core/editing/LocalCaretRect.cpp +++ b/third_party/WebKit/Source/core/editing/LocalCaretRect.cpp
@@ -154,11 +154,6 @@ LayoutSize(box->Root().SelectionHeight(), rect.Height()))); } -FloatQuad LocalToAbsoluteQuadOf(const LocalCaretRect& caret_rect) { - return caret_rect.layout_object->LocalToAbsoluteQuad( - FloatRect(caret_rect.rect)); -} - } // namespace LocalCaretRect LocalCaretRectOfPosition(
diff --git a/third_party/WebKit/Source/core/editing/LocalCaretRectTest.cpp b/third_party/WebKit/Source/core/editing/LocalCaretRectTest.cpp index 4c31dd03..a767b2b 100644 --- a/third_party/WebKit/Source/core/editing/LocalCaretRectTest.cpp +++ b/third_party/WebKit/Source/core/editing/LocalCaretRectTest.cpp
@@ -28,7 +28,7 @@ // Helper class to run the same test code with and without LayoutNG class ParameterizedLocalCaretRectTest - : public ::testing::WithParamInterface<bool>, + : public testing::WithParamInterface<bool>, private ScopedLayoutNGForTest, public LocalCaretRectTest { public: @@ -38,9 +38,7 @@ bool LayoutNGEnabled() const { return GetParam(); } }; -INSTANTIATE_TEST_CASE_P(All, - ParameterizedLocalCaretRectTest, - ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedLocalCaretRectTest, testing::Bool()); TEST_P(ParameterizedLocalCaretRectTest, DOMAndFlatTrees) { const char* body_content =
diff --git a/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp b/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp index e1ba05e..a70b047 100644 --- a/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp +++ b/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class RenderedPositionTest : public ::testing::WithParamInterface<bool>, +class RenderedPositionTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public EditingTestBase { public: @@ -48,7 +48,7 @@ UseMockScrollbarSettings mock_scrollbars_; }; -INSTANTIATE_TEST_CASE_P(All, RenderedPositionTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, RenderedPositionTest, testing::Bool()); TEST_P(RenderedPositionTest, ComputeCompositedSelection) { SetBodyContent(R"HTML(
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp index fce89277..a38b8aed 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -739,11 +739,6 @@ *anchor_node, text_offset)); } -static FloatQuad LocalToAbsoluteQuadOf(const LocalCaretRect& caret_rect) { - return caret_rect.layout_object->LocalToAbsoluteQuad( - FloatRect(caret_rect.rect)); -} - bool RendersInDifferentPosition(const Position& position1, const Position& position2) { if (position1.IsNull() || position2.IsNull())
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp index 680ef78..2ac748f 100644 --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -56,6 +56,7 @@ #include "core/editing/commands/InsertCommands.h" #include "core/editing/commands/MoveCommands.h" #include "core/editing/commands/RemoveFormatCommand.h" +#include "core/editing/commands/StyleCommands.h" #include "core/editing/commands/TypingCommand.h" #include "core/editing/commands/UnlinkCommand.h" #include "core/editing/iterators/TextIterator.h" @@ -253,9 +254,9 @@ static const bool kNotTextInsertion = false; static const bool kIsTextInsertion = true; -static void ApplyStyle(LocalFrame& frame, - CSSPropertyValueSet* style, - InputEvent::InputType input_type) { +void StyleCommands::ApplyStyle(LocalFrame& frame, + CSSPropertyValueSet* style, + InputEvent::InputType input_type) { const VisibleSelection& selection = frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated(); if (selection.IsNone()) @@ -273,19 +274,19 @@ ->Apply(); } -static void ApplyStyleToSelection(LocalFrame& frame, - CSSPropertyValueSet* style, - InputEvent::InputType input_type) { +void StyleCommands::ApplyStyleToSelection(LocalFrame& frame, + CSSPropertyValueSet* style, + InputEvent::InputType input_type) { if (!style || style->IsEmpty() || !frame.GetEditor().CanEditRichly()) return; ApplyStyle(frame, style, input_type); } -static bool ApplyCommandToFrame(LocalFrame& frame, - EditorCommandSource source, - InputEvent::InputType input_type, - CSSPropertyValueSet* style) { +bool StyleCommands::ApplyCommandToFrame(LocalFrame& frame, + EditorCommandSource source, + InputEvent::InputType input_type, + CSSPropertyValueSet* style) { // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a // good reason for that? switch (source) { @@ -300,11 +301,11 @@ return false; } -static bool ExecuteApplyStyle(LocalFrame& frame, - EditorCommandSource source, - InputEvent::InputType input_type, - CSSPropertyID property_id, - const String& property_value) { +bool StyleCommands::ExecuteApplyStyle(LocalFrame& frame, + EditorCommandSource source, + InputEvent::InputType input_type, + CSSPropertyID property_id, + const String& property_value) { DCHECK(frame.GetDocument()); MutableCSSPropertyValueSet* style = MutableCSSPropertyValueSet::Create(kHTMLQuirksMode); @@ -313,11 +314,11 @@ return ApplyCommandToFrame(frame, source, input_type, style); } -static bool ExecuteApplyStyle(LocalFrame& frame, - EditorCommandSource source, - InputEvent::InputType input_type, - CSSPropertyID property_id, - CSSValueID property_value) { +bool StyleCommands::ExecuteApplyStyle(LocalFrame& frame, + EditorCommandSource source, + InputEvent::InputType input_type, + CSSPropertyID property_id, + CSSValueID property_value) { MutableCSSPropertyValueSet* style = MutableCSSPropertyValueSet::Create(kHTMLQuirksMode); style->SetProperty(property_id, property_value); @@ -328,11 +329,11 @@ // <b><u>hello</u>world</b> properly. This function must use // EditingStyle::SelectionHasStyle to determine the current style but we cannot // fix this until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. -static bool ExecuteToggleStyleInList(LocalFrame& frame, - EditorCommandSource source, - InputEvent::InputType input_type, - CSSPropertyID property_id, - CSSValue* value) { +bool StyleCommands::ExecuteToggleStyleInList(LocalFrame& frame, + EditorCommandSource source, + InputEvent::InputType input_type, + CSSPropertyID property_id, + CSSValue* value) { EditingStyle* selection_style = EditingStyleUtilities::CreateStyleAtSelectionStart( frame.Selection().ComputeVisibleSelectionInDOMTree()); @@ -363,9 +364,9 @@ return ApplyCommandToFrame(frame, source, input_type, new_mutable_style); } -static bool SelectionStartHasStyle(LocalFrame& frame, - CSSPropertyID property_id, - const String& value) { +bool StyleCommands::SelectionStartHasStyle(LocalFrame& frame, + CSSPropertyID property_id, + const String& value) { const SecureContextMode secure_context_mode = frame.GetDocument()->GetSecureContextMode(); @@ -379,12 +380,12 @@ EditingTriState::kFalse; } -static bool ExecuteToggleStyle(LocalFrame& frame, - EditorCommandSource source, - InputEvent::InputType input_type, - CSSPropertyID property_id, - const char* off_value, - const char* on_value) { +bool StyleCommands::ExecuteToggleStyle(LocalFrame& frame, + EditorCommandSource source, + InputEvent::InputType input_type, + CSSPropertyID property_id, + const char* off_value, + const char* on_value) { // Style is considered present when // Mac: present at the beginning of selection // other: present throughout the selection @@ -478,9 +479,9 @@ return EditingTriState::kFalse; } -static EditingTriState StateStyle(LocalFrame& frame, - CSSPropertyID property_id, - const char* desired_value) { +EditingTriState StyleCommands::StateStyle(LocalFrame& frame, + CSSPropertyID property_id, + const char* desired_value) { frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (frame.GetEditor().Behavior().ShouldToggleStyleBasedOnStartOfSelection()) { return SelectionStartHasStyle(frame, property_id, desired_value) @@ -490,8 +491,9 @@ return EditingStyle::SelectionHasStyle(frame, property_id, desired_value); } -static String SelectionStartCSSPropertyValue(LocalFrame& frame, - CSSPropertyID property_id) { +String StyleCommands::SelectionStartCSSPropertyValue( + LocalFrame& frame, + CSSPropertyID property_id) { EditingStyle* const selection_style = EditingStyleUtilities::CreateStyleAtSelectionStart( frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated(), @@ -504,7 +506,7 @@ return selection_style->Style()->GetPropertyValue(property_id); } -static String ValueStyle(LocalFrame& frame, CSSPropertyID property_id) { +String StyleCommands::ValueStyle(LocalFrame& frame, CSSPropertyID property_id) { frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); // FIXME: Rather than retrieving the style at the start of the current @@ -513,7 +515,8 @@ return SelectionStartCSSPropertyValue(frame, property_id); } -static bool IsUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID value_id) { +bool StyleCommands::IsUnicodeBidiNestedOrMultipleEmbeddings( + CSSValueID value_id) { return value_id == CSSValueEmbed || value_id == CSSValueBidiOverride || value_id == CSSValueWebkitIsolate || value_id == CSSValueWebkitIsolateOverride || @@ -523,7 +526,7 @@ // TODO(editing-dev): We should make |textDirectionForSelection()| to take // |selectionInDOMTree|. -static WritingDirection TextDirectionForSelection( +WritingDirection StyleCommands::TextDirectionForSelection( const VisibleSelection& selection, EditingStyle* typing_style, bool& has_nested_or_multiple_embeddings) { @@ -627,8 +630,9 @@ return found_direction; } -static EditingTriState StateTextWritingDirection(LocalFrame& frame, - WritingDirection direction) { +EditingTriState StyleCommands::StateTextWritingDirection( + LocalFrame& frame, + WritingDirection direction) { frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); bool has_nested_or_multiple_embeddings; @@ -658,10 +662,10 @@ // Execute command functions -static bool ExecuteBackColor(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String& value) { +bool StyleCommands::ExecuteBackColor(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String& value) { return ExecuteApplyStyle(frame, source, InputEvent::InputType::kNone, CSSPropertyBackgroundColor, value); } @@ -925,18 +929,18 @@ return frame.GetEditor().FindString(value, kCaseInsensitive | kWrapAround); } -static bool ExecuteFontName(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String& value) { +bool StyleCommands::ExecuteFontName(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String& value) { return ExecuteApplyStyle(frame, source, InputEvent::InputType::kNone, CSSPropertyFontFamily, value); } -static bool ExecuteFontSize(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String& value) { +bool StyleCommands::ExecuteFontSize(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String& value) { CSSValueID size; if (!HTMLFontElement::CssValueFromFontSizeNumber(value, size)) return false; @@ -944,18 +948,18 @@ CSSPropertyFontSize, size); } -static bool ExecuteFontSizeDelta(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String& value) { +bool StyleCommands::ExecuteFontSizeDelta(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String& value) { return ExecuteApplyStyle(frame, source, InputEvent::InputType::kNone, CSSPropertyWebkitFontSizeDelta, value); } -static bool ExecuteForeColor(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String& value) { +bool StyleCommands::ExecuteForeColor(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String& value) { return ExecuteApplyStyle(frame, source, InputEvent::InputType::kNone, CSSPropertyColor, value); } @@ -1061,10 +1065,11 @@ CSSPropertyTextAlign, "right"); } -static bool ExecuteMakeTextWritingDirectionLeftToRight(LocalFrame& frame, - Event*, - EditorCommandSource, - const String&) { +bool StyleCommands::ExecuteMakeTextWritingDirectionLeftToRight( + LocalFrame& frame, + Event*, + EditorCommandSource, + const String&) { MutableCSSPropertyValueSet* style = MutableCSSPropertyValueSet::Create(kHTMLQuirksMode); style->SetProperty(CSSPropertyUnicodeBidi, CSSValueIsolate); @@ -1073,10 +1078,10 @@ return true; } -static bool ExecuteMakeTextWritingDirectionNatural(LocalFrame& frame, - Event*, - EditorCommandSource, - const String&) { +bool StyleCommands::ExecuteMakeTextWritingDirectionNatural(LocalFrame& frame, + Event*, + EditorCommandSource, + const String&) { MutableCSSPropertyValueSet* style = MutableCSSPropertyValueSet::Create(kHTMLQuirksMode); style->SetProperty(CSSPropertyUnicodeBidi, CSSValueNormal); @@ -1084,10 +1089,11 @@ return true; } -static bool ExecuteMakeTextWritingDirectionRightToLeft(LocalFrame& frame, - Event*, - EditorCommandSource, - const String&) { +bool StyleCommands::ExecuteMakeTextWritingDirectionRightToLeft( + LocalFrame& frame, + Event*, + EditorCommandSource, + const String&) { MutableCSSPropertyValueSet* style = MutableCSSPropertyValueSet::Create(kHTMLQuirksMode); style->SetProperty(CSSPropertyUnicodeBidi, CSSValueIsolate); @@ -1255,10 +1261,10 @@ return true; } -static bool ExecuteStrikethrough(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteStrikethrough(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { CSSIdentifierValue* line_through = CSSIdentifierValue::Create(CSSValueLineThrough); return ExecuteToggleStyleInList( @@ -1266,37 +1272,37 @@ CSSPropertyWebkitTextDecorationsInEffect, line_through); } -static bool ExecuteStyleWithCSS(LocalFrame& frame, - Event*, - EditorCommandSource, - const String& value) { +bool StyleCommands::ExecuteStyleWithCSS(LocalFrame& frame, + Event*, + EditorCommandSource, + const String& value) { frame.GetEditor().SetShouldStyleWithCSS( !DeprecatedEqualIgnoringCase(value, "false")); return true; } -static bool ExecuteUseCSS(LocalFrame& frame, - Event*, - EditorCommandSource, - const String& value) { +bool StyleCommands::ExecuteUseCSS(LocalFrame& frame, + Event*, + EditorCommandSource, + const String& value) { frame.GetEditor().SetShouldStyleWithCSS( DeprecatedEqualIgnoringCase(value, "false")); return true; } -static bool ExecuteSubscript(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteSubscript(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { return ExecuteToggleStyle(frame, source, InputEvent::InputType::kFormatSubscript, CSSPropertyVerticalAlign, "baseline", "sub"); } -static bool ExecuteSuperscript(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteSuperscript(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { return ExecuteToggleStyle(frame, source, InputEvent::InputType::kFormatSuperscript, CSSPropertyVerticalAlign, "baseline", "super"); @@ -1321,18 +1327,18 @@ return true; } -static bool ExecuteToggleBold(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteToggleBold(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { return ExecuteToggleStyle(frame, source, InputEvent::InputType::kFormatBold, CSSPropertyFontWeight, "normal", "bold"); } -static bool ExecuteToggleItalic(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteToggleItalic(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { return ExecuteToggleStyle(frame, source, InputEvent::InputType::kFormatItalic, CSSPropertyFontStyle, "normal", "italic"); } @@ -1401,10 +1407,10 @@ return true; } -static bool ExecuteUnderline(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteUnderline(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { CSSIdentifierValue* underline = CSSIdentifierValue::Create(CSSValueUnderline); return ExecuteToggleStyleInList( frame, source, InputEvent::InputType::kFormatUnderline, @@ -1427,10 +1433,10 @@ return UnlinkCommand::Create(*frame.GetDocument())->Apply(); } -static bool ExecuteUnscript(LocalFrame& frame, - Event*, - EditorCommandSource source, - const String&) { +bool StyleCommands::ExecuteUnscript(LocalFrame& frame, + Event*, + EditorCommandSource source, + const String&) { return ExecuteApplyStyle(frame, source, InputEvent::InputType::kNone, CSSPropertyVerticalAlign, "baseline"); } @@ -1676,52 +1682,55 @@ return EditingTriState::kFalse; } -static EditingTriState StateBold(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateBold(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyFontWeight, "bold"); } -static EditingTriState StateItalic(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateItalic(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyFontStyle, "italic"); } -static EditingTriState StateOrderedList(LocalFrame& frame, Event*) { +EditingTriState StateOrderedList(LocalFrame& frame, Event*) { return SelectionListState(frame.Selection(), olTag); } -static EditingTriState StateStrikethrough(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateStrikethrough(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "line-through"); } -static EditingTriState StateStyleWithCSS(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateStyleWithCSS(LocalFrame& frame, Event*) { return frame.GetEditor().ShouldStyleWithCSS() ? EditingTriState::kTrue : EditingTriState::kFalse; } -static EditingTriState StateSubscript(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateSubscript(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyVerticalAlign, "sub"); } -static EditingTriState StateSuperscript(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateSuperscript(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyVerticalAlign, "super"); } -static EditingTriState StateTextWritingDirectionLeftToRight(LocalFrame& frame, - Event*) { +EditingTriState StyleCommands::StateTextWritingDirectionLeftToRight( + LocalFrame& frame, + Event*) { return StateTextWritingDirection(frame, LeftToRightWritingDirection); } -static EditingTriState StateTextWritingDirectionNatural(LocalFrame& frame, - Event*) { +EditingTriState StyleCommands::StateTextWritingDirectionNatural( + LocalFrame& frame, + Event*) { return StateTextWritingDirection(frame, NaturalWritingDirection); } -static EditingTriState StateTextWritingDirectionRightToLeft(LocalFrame& frame, - Event*) { +EditingTriState StyleCommands::StateTextWritingDirectionRightToLeft( + LocalFrame& frame, + Event*) { return StateTextWritingDirection(frame, RightToLeftWritingDirection); } -static EditingTriState StateUnderline(LocalFrame& frame, Event*) { +EditingTriState StyleCommands::StateUnderline(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "underline"); } @@ -1731,19 +1740,19 @@ } static EditingTriState StateJustifyCenter(LocalFrame& frame, Event*) { - return StateStyle(frame, CSSPropertyTextAlign, "center"); + return StyleCommands::StateStyle(frame, CSSPropertyTextAlign, "center"); } static EditingTriState StateJustifyFull(LocalFrame& frame, Event*) { - return StateStyle(frame, CSSPropertyTextAlign, "justify"); + return StyleCommands::StateStyle(frame, CSSPropertyTextAlign, "justify"); } static EditingTriState StateJustifyLeft(LocalFrame& frame, Event*) { - return StateStyle(frame, CSSPropertyTextAlign, "left"); + return StyleCommands::StateStyle(frame, CSSPropertyTextAlign, "left"); } static EditingTriState StateJustifyRight(LocalFrame& frame, Event*) { - return StateStyle(frame, CSSPropertyTextAlign, "right"); + return StyleCommands::StateStyle(frame, CSSPropertyTextAlign, "right"); } // Value functions @@ -1765,9 +1774,9 @@ return g_empty_string; } -static String ValueBackColor(const EditorInternalCommand&, - LocalFrame& frame, - Event*) { +String StyleCommands::ValueBackColor(const EditorInternalCommand&, + LocalFrame& frame, + Event*) { return ValueStyle(frame, CSSPropertyBackgroundColor); } @@ -1785,27 +1794,27 @@ return String(); } -static String ValueFontName(const EditorInternalCommand&, - LocalFrame& frame, - Event*) { +String StyleCommands::ValueFontName(const EditorInternalCommand&, + LocalFrame& frame, + Event*) { return ValueStyle(frame, CSSPropertyFontFamily); } -static String ValueFontSize(const EditorInternalCommand&, - LocalFrame& frame, - Event*) { +String StyleCommands::ValueFontSize(const EditorInternalCommand&, + LocalFrame& frame, + Event*) { return ValueStyle(frame, CSSPropertyFontSize); } -static String ValueFontSizeDelta(const EditorInternalCommand&, - LocalFrame& frame, - Event*) { +String StyleCommands::ValueFontSizeDelta(const EditorInternalCommand&, + LocalFrame& frame, + Event*) { return ValueStyle(frame, CSSPropertyWebkitFontSizeDelta); } -static String ValueForeColor(const EditorInternalCommand&, - LocalFrame& frame, - Event*) { +String StyleCommands::ValueForeColor(const EditorInternalCommand&, + LocalFrame& frame, + Event*) { return ValueStyle(frame, CSSPropertyColor); } @@ -1848,16 +1857,17 @@ {WebEditingCommandType::kAlignRight, ExecuteJustifyRight, SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kBackColor, ExecuteBackColor, Supported, - EnabledInRichlyEditableText, StateNone, ValueBackColor, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kBackColor, StyleCommands::ExecuteBackColor, + Supported, EnabledInRichlyEditableText, StateNone, + StyleCommands::ValueBackColor, kNotTextInsertion, + CanNotExecuteWhenDisabled}, // FIXME: remove BackwardDelete when Safari for Windows stops using it. {WebEditingCommandType::kBackwardDelete, ExecuteDeleteBackward, SupportedFromMenuOrKeyBinding, EnabledInEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kBold, ExecuteToggleBold, Supported, - EnabledInRichlyEditableText, StateBold, ValueStateOrNull, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kBold, StyleCommands::ExecuteToggleBold, + Supported, EnabledInRichlyEditableText, StyleCommands::StateBold, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kCopy, ClipboardCommands::ExecuteCopy, Supported, ClipboardCommands::EnabledCopy, StateNone, ValueStateOrNull, kNotTextInsertion, ClipboardCommands::CanWriteClipboard}, @@ -1911,26 +1921,31 @@ {WebEditingCommandType::kFindString, ExecuteFindString, Supported, Enabled, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kFontName, ExecuteFontName, Supported, - EnabledInRichlyEditableText, StateNone, ValueFontName, kNotTextInsertion, + {WebEditingCommandType::kFontName, StyleCommands::ExecuteFontName, + Supported, EnabledInRichlyEditableText, StateNone, + StyleCommands::ValueFontName, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kFontSize, ExecuteFontSize, Supported, - EnabledInRichlyEditableText, StateNone, ValueFontSize, kNotTextInsertion, + {WebEditingCommandType::kFontSize, StyleCommands::ExecuteFontSize, + Supported, EnabledInRichlyEditableText, StateNone, + StyleCommands::ValueFontSize, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kFontSizeDelta, ExecuteFontSizeDelta, Supported, - EnabledInRichlyEditableText, StateNone, ValueFontSizeDelta, - kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kForeColor, ExecuteForeColor, Supported, - EnabledInRichlyEditableText, StateNone, ValueForeColor, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kFontSizeDelta, + StyleCommands::ExecuteFontSizeDelta, Supported, + EnabledInRichlyEditableText, StateNone, + StyleCommands::ValueFontSizeDelta, kNotTextInsertion, + CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kForeColor, StyleCommands::ExecuteForeColor, + Supported, EnabledInRichlyEditableText, StateNone, + StyleCommands::ValueForeColor, kNotTextInsertion, + CanNotExecuteWhenDisabled}, {WebEditingCommandType::kFormatBlock, ExecuteFormatBlock, Supported, EnabledInRichlyEditableText, StateNone, ValueFormatBlock, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kForwardDelete, ExecuteForwardDelete, Supported, EnabledInEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kHiliteColor, ExecuteBackColor, Supported, - EnabledInRichlyEditableText, StateNone, ValueStateOrNull, + {WebEditingCommandType::kHiliteColor, StyleCommands::ExecuteBackColor, + Supported, EnabledInRichlyEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kIgnoreSpelling, ExecuteIgnoreSpelling, SupportedFromMenuOrKeyBinding, EnabledInEditableText, StateNone, @@ -1982,9 +1997,9 @@ InsertCommands::ExecuteInsertUnorderedList, Supported, EnabledInRichlyEditableText, StateUnorderedList, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kItalic, ExecuteToggleItalic, Supported, - EnabledInRichlyEditableText, StateItalic, ValueStateOrNull, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kItalic, StyleCommands::ExecuteToggleItalic, + Supported, EnabledInRichlyEditableText, StyleCommands::StateItalic, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kJustifyCenter, ExecuteJustifyCenter, Supported, EnabledInRichlyEditableText, StateJustifyCenter, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, @@ -2001,18 +2016,19 @@ EnabledInRichlyEditableText, StateJustifyRight, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kMakeTextWritingDirectionLeftToRight, - ExecuteMakeTextWritingDirectionLeftToRight, + StyleCommands::ExecuteMakeTextWritingDirectionLeftToRight, SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, - StateTextWritingDirectionLeftToRight, ValueStateOrNull, + StyleCommands::StateTextWritingDirectionLeftToRight, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kMakeTextWritingDirectionNatural, - ExecuteMakeTextWritingDirectionNatural, SupportedFromMenuOrKeyBinding, - EnabledInRichlyEditableText, StateTextWritingDirectionNatural, - ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kMakeTextWritingDirectionRightToLeft, - ExecuteMakeTextWritingDirectionRightToLeft, + StyleCommands::ExecuteMakeTextWritingDirectionNatural, SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, - StateTextWritingDirectionRightToLeft, ValueStateOrNull, + StyleCommands::StateTextWritingDirectionNatural, ValueStateOrNull, + kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kMakeTextWritingDirectionRightToLeft, + StyleCommands::ExecuteMakeTextWritingDirectionRightToLeft, + SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, + StyleCommands::StateTextWritingDirectionRightToLeft, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kMoveBackward, MoveCommands::ExecuteMoveBackward, SupportedFromMenuOrKeyBinding, EnabledInEditableText, StateNone, @@ -2266,51 +2282,54 @@ {WebEditingCommandType::kSetMark, ExecuteSetMark, SupportedFromMenuOrKeyBinding, EnabledVisibleSelection, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kStrikethrough, ExecuteStrikethrough, Supported, - EnabledInRichlyEditableText, StateStrikethrough, ValueStateOrNull, + {WebEditingCommandType::kStrikethrough, + StyleCommands::ExecuteStrikethrough, Supported, + EnabledInRichlyEditableText, StyleCommands::StateStrikethrough, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kStyleWithCSS, StyleCommands::ExecuteStyleWithCSS, + Supported, Enabled, StyleCommands::StateStyleWithCSS, ValueEmpty, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kStyleWithCSS, ExecuteStyleWithCSS, Supported, - Enabled, StateStyleWithCSS, ValueEmpty, kNotTextInsertion, - CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kSubscript, ExecuteSubscript, Supported, - EnabledInRichlyEditableText, StateSubscript, ValueStateOrNull, - kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kSuperscript, ExecuteSuperscript, Supported, - EnabledInRichlyEditableText, StateSuperscript, ValueStateOrNull, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kSubscript, StyleCommands::ExecuteSubscript, + Supported, EnabledInRichlyEditableText, StyleCommands::StateSubscript, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kSuperscript, StyleCommands::ExecuteSuperscript, + Supported, EnabledInRichlyEditableText, StyleCommands::StateSuperscript, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kSwapWithMark, ExecuteSwapWithMark, SupportedFromMenuOrKeyBinding, EnabledVisibleSelectionAndMark, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kToggleBold, ExecuteToggleBold, - SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, StateBold, - ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kToggleItalic, ExecuteToggleItalic, - SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, StateItalic, - ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kToggleUnderline, ExecuteUnderline, + {WebEditingCommandType::kToggleBold, StyleCommands::ExecuteToggleBold, SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, - StateUnderline, ValueStateOrNull, kNotTextInsertion, + StyleCommands::StateBold, ValueStateOrNull, kNotTextInsertion, + CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kToggleItalic, StyleCommands::ExecuteToggleItalic, + SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, + StyleCommands::StateItalic, ValueStateOrNull, kNotTextInsertion, + CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kToggleUnderline, StyleCommands::ExecuteUnderline, + SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, + StyleCommands::StateUnderline, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kTranspose, ExecuteTranspose, Supported, EnableCaretInEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kUnderline, ExecuteUnderline, Supported, - EnabledInRichlyEditableText, StateUnderline, ValueStateOrNull, - kNotTextInsertion, CanNotExecuteWhenDisabled}, + {WebEditingCommandType::kUnderline, StyleCommands::ExecuteUnderline, + Supported, EnabledInRichlyEditableText, StyleCommands::StateUnderline, + ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kUndo, ExecuteUndo, Supported, EnabledUndo, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kUnlink, ExecuteUnlink, Supported, EnabledRangeInRichlyEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kUnscript, ExecuteUnscript, + {WebEditingCommandType::kUnscript, StyleCommands::ExecuteUnscript, SupportedFromMenuOrKeyBinding, EnabledInRichlyEditableText, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kUnselect, ExecuteUnselect, Supported, EnabledUnselect, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, - {WebEditingCommandType::kUseCSS, ExecuteUseCSS, Supported, Enabled, - StateNone, ValueStateOrNull, kNotTextInsertion, + {WebEditingCommandType::kUseCSS, StyleCommands::ExecuteUseCSS, Supported, + Enabled, StateNone, ValueStateOrNull, kNotTextInsertion, CanNotExecuteWhenDisabled}, {WebEditingCommandType::kYank, ExecuteYank, SupportedFromMenuOrKeyBinding, EnabledInEditableText, StateNone, ValueStateOrNull, kNotTextInsertion,
diff --git a/third_party/WebKit/Source/core/editing/commands/StyleCommands.h b/third_party/WebKit/Source/core/editing/commands/StyleCommands.h new file mode 100644 index 0000000..07a6838f --- /dev/null +++ b/third_party/WebKit/Source/core/editing/commands/StyleCommands.h
@@ -0,0 +1,212 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Copyright 2018 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 StyleCommands_h +#define StyleCommands_h + +#include "core/editing/WritingDirection.h" +#include "core/events/InputEvent.h" +#include "platform/wtf/Allocator.h" +#include "platform/wtf/Forward.h" + +namespace blink { + +class CSSPropertyValueSet; +class EditingStyle; +class EditorInternalCommand; +class Event; +class LocalFrame; + +enum class EditingTriState; +enum class EditorCommandSource; + +// This class provides static functions about commands related to style. +class StyleCommands { + STATIC_ONLY(StyleCommands); + + public: + // Returns |bool| value for Document#execCommand(). + static bool ExecuteBackColor(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteForeColor(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteFontName(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteFontSize(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteFontSizeDelta(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteToggleBold(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteToggleItalic(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteSubscript(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteSuperscript(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteUnscript(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteStrikethrough(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteUnderline(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteMakeTextWritingDirectionLeftToRight(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteMakeTextWritingDirectionNatural(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteMakeTextWritingDirectionRightToLeft(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteStyleWithCSS(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + static bool ExecuteUseCSS(LocalFrame&, + Event*, + EditorCommandSource, + const String&); + + // State functions + static EditingTriState StateStyle(LocalFrame&, CSSPropertyID, const char*); + static EditingTriState StateBold(LocalFrame&, Event*); + static EditingTriState StateItalic(LocalFrame&, Event*); + static EditingTriState StateStrikethrough(LocalFrame&, Event*); + static EditingTriState StateStyleWithCSS(LocalFrame&, Event*); + static EditingTriState StateSubscript(LocalFrame&, Event*); + static EditingTriState StateSuperscript(LocalFrame&, Event*); + static EditingTriState StateTextWritingDirectionLeftToRight(LocalFrame&, + Event*); + static EditingTriState StateTextWritingDirectionNatural(LocalFrame&, Event*); + static EditingTriState StateTextWritingDirectionRightToLeft(LocalFrame&, + Event*); + static EditingTriState StateUnderline(LocalFrame&, Event*); + + // Value functions + static String ValueBackColor(const EditorInternalCommand&, + LocalFrame&, + Event*); + static String ValueForeColor(const EditorInternalCommand&, + LocalFrame&, + Event*); + static String ValueFontName(const EditorInternalCommand&, + LocalFrame&, + Event*); + static String ValueFontSize(const EditorInternalCommand&, + LocalFrame&, + Event*); + static String ValueFontSizeDelta(const EditorInternalCommand&, + LocalFrame&, + Event*); + + private: + static void ApplyStyle(LocalFrame&, + CSSPropertyValueSet*, + InputEvent::InputType); + static void ApplyStyleToSelection(LocalFrame&, + CSSPropertyValueSet*, + InputEvent::InputType); + static bool ApplyCommandToFrame(LocalFrame&, + EditorCommandSource, + InputEvent::InputType, + CSSPropertyValueSet*); + static bool ExecuteApplyStyle(LocalFrame&, + EditorCommandSource, + InputEvent::InputType, + CSSPropertyID, + const String&); + static bool ExecuteApplyStyle(LocalFrame&, + EditorCommandSource, + InputEvent::InputType, + CSSPropertyID, + CSSValueID); + static bool ExecuteToggleStyle(LocalFrame&, + EditorCommandSource, + InputEvent::InputType, + CSSPropertyID, + const char* off_value, + const char* on_value); + + // FIXME: executeToggleStyleInList does not handle complicated cases such as + // <b><u>hello</u>world</b> properly. This function must use + // EditingStyle::SelectionHasStyle to determine the current style but we + // cannot fix this until https://bugs.webkit.org/show_bug.cgi?id=27818 is + // resolved. + static bool ExecuteToggleStyleInList(LocalFrame&, + EditorCommandSource, + InputEvent::InputType, + CSSPropertyID, + CSSValue*); + static bool SelectionStartHasStyle(LocalFrame&, CSSPropertyID, const String&); + static String SelectionStartCSSPropertyValue(LocalFrame&, CSSPropertyID); + static String ValueStyle(LocalFrame&, CSSPropertyID); + static bool IsUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID); + + // TODO(editing-dev): We should make |textDirectionForSelection()| to take + // |selectionInDOMTree|. + static WritingDirection TextDirectionForSelection(const VisibleSelection&, + EditingStyle*, + bool&); + static EditingTriState StateTextWritingDirection(LocalFrame&, + WritingDirection); +}; + +} // namespace blink + +#endif
diff --git a/third_party/WebKit/Source/core/editing/finder/TextFinderTest.cpp b/third_party/WebKit/Source/core/editing/finder/TextFinderTest.cpp index 767cb362..d35658cf 100644 --- a/third_party/WebKit/Source/core/editing/finder/TextFinderTest.cpp +++ b/third_party/WebKit/Source/core/editing/finder/TextFinderTest.cpp
@@ -30,7 +30,7 @@ namespace blink { -class TextFinderTest : public ::testing::Test { +class TextFinderTest : public testing::Test { protected: TextFinderTest() { web_view_helper_.Initialize();
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp index f62cf2f..b40e9d7f 100644 --- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp +++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
@@ -136,10 +136,9 @@ return range; } -class ParameterizedTextIteratorTest - : public ::testing::WithParamInterface<bool>, - private ScopedLayoutNGForTest, - public TextIteratorTest { +class ParameterizedTextIteratorTest : public testing::WithParamInterface<bool>, + private ScopedLayoutNGForTest, + public TextIteratorTest { public: ParameterizedTextIteratorTest() : ScopedLayoutNGForTest(GetParam()) {} @@ -152,7 +151,7 @@ } }; -INSTANTIATE_TEST_CASE_P(All, ParameterizedTextIteratorTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedTextIteratorTest, testing::Bool()); TEST_F(TextIteratorTest, BitStackOverflow) { const unsigned kBitsInWord = sizeof(unsigned) * 8;
diff --git a/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerTest.cpp index fdb00e8..9fb9cca 100644 --- a/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class ActiveSuggestionMarkerTest : public ::testing::Test {}; +class ActiveSuggestionMarkerTest : public testing::Test {}; TEST_F(ActiveSuggestionMarkerTest, MarkerType) { DocumentMarker* marker = new ActiveSuggestionMarker(
diff --git a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerTest.cpp index be2ac17b..2942b6b 100644 --- a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class CompositionMarkerTest : public ::testing::Test {}; +class CompositionMarkerTest : public testing::Test {}; TEST_F(CompositionMarkerTest, MarkerType) { DocumentMarker* marker =
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp index 4a9b876e..26285df 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp
@@ -11,7 +11,7 @@ using MarkerOffsets = DocumentMarker::MarkerOffsets; -class DocumentMarkerTest : public ::testing::Test { +class DocumentMarkerTest : public testing::Test { protected: DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { return new TextMatchMarker(startOffset, endOffset,
diff --git a/third_party/WebKit/Source/core/editing/markers/GrammarMarkerListImplTest.cpp b/third_party/WebKit/Source/core/editing/markers/GrammarMarkerListImplTest.cpp index be0ab1bb..1c7c931 100644 --- a/third_party/WebKit/Source/core/editing/markers/GrammarMarkerListImplTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/GrammarMarkerListImplTest.cpp
@@ -13,7 +13,7 @@ // Functionality implemented in SpellCheckMarkerListImpl is tested in // SpellingMarkerListImplTest.cpp. -class GrammarMarkerListImplTest : public ::testing::Test { +class GrammarMarkerListImplTest : public testing::Test { protected: GrammarMarkerListImplTest() : marker_list_(new GrammarMarkerListImpl()) {}
diff --git a/third_party/WebKit/Source/core/editing/markers/GrammarMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/GrammarMarkerTest.cpp index dd69d9d..9456db60 100644 --- a/third_party/WebKit/Source/core/editing/markers/GrammarMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/GrammarMarkerTest.cpp
@@ -10,7 +10,7 @@ const char* const kDescription = "Test description"; -class GrammarMarkerTest : public ::testing::Test {}; +class GrammarMarkerTest : public testing::Test {}; TEST_F(GrammarMarkerTest, MarkerType) { DocumentMarker* marker = new GrammarMarker(0, 1, kDescription);
diff --git a/third_party/WebKit/Source/core/editing/markers/SortedDocumentMarkerListEditorTest.cpp b/third_party/WebKit/Source/core/editing/markers/SortedDocumentMarkerListEditorTest.cpp index ba952032..0bce2d9 100644 --- a/third_party/WebKit/Source/core/editing/markers/SortedDocumentMarkerListEditorTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SortedDocumentMarkerListEditorTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class SortedDocumentMarkerListEditorTest : public ::testing::Test { +class SortedDocumentMarkerListEditorTest : public testing::Test { protected: DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { return new TextMatchMarker(startOffset, endOffset,
diff --git a/third_party/WebKit/Source/core/editing/markers/SpellingMarkerListImplTest.cpp b/third_party/WebKit/Source/core/editing/markers/SpellingMarkerListImplTest.cpp index a73974d..9db2596 100644 --- a/third_party/WebKit/Source/core/editing/markers/SpellingMarkerListImplTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SpellingMarkerListImplTest.cpp
@@ -14,7 +14,7 @@ // This test class tests functionality implemented by SpellingMarkerListImpl and // also functionality implemented by its parent class SpellCheckMarkerListImpl. -class SpellingMarkerListImplTest : public ::testing::Test { +class SpellingMarkerListImplTest : public testing::Test { protected: SpellingMarkerListImplTest() : marker_list_(new SpellingMarkerListImpl()) {}
diff --git a/third_party/WebKit/Source/core/editing/markers/SpellingMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/SpellingMarkerTest.cpp index 32d076c44..f9973792 100644 --- a/third_party/WebKit/Source/core/editing/markers/SpellingMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SpellingMarkerTest.cpp
@@ -10,7 +10,7 @@ const char* const kTestDescription = "Test description"; -class SpellingMarkerTest : public ::testing::Test {}; +class SpellingMarkerTest : public testing::Test {}; TEST_F(SpellingMarkerTest, MarkerType) { DocumentMarker* marker = new SpellingMarker(0, 1, kTestDescription);
diff --git a/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerListImplTest.cpp b/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerListImplTest.cpp index 5f13197..1a0830e8 100644 --- a/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerListImplTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerListImplTest.cpp
@@ -13,7 +13,7 @@ namespace blink { -class SuggestionMarkerListImplTest : public ::testing::Test { +class SuggestionMarkerListImplTest : public testing::Test { protected: SuggestionMarkerListImplTest() : marker_list_(new SuggestionMarkerListImpl()) {}
diff --git a/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerTest.cpp index 3ede37ea..0cf119b 100644 --- a/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SuggestionMarkerTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class SuggestionMarkerTest : public ::testing::Test {}; +class SuggestionMarkerTest : public testing::Test {}; TEST_F(SuggestionMarkerTest, MarkerType) { DocumentMarker* marker =
diff --git a/third_party/WebKit/Source/core/editing/markers/UnsortedDocumentMarkerListEditorTest.cpp b/third_party/WebKit/Source/core/editing/markers/UnsortedDocumentMarkerListEditorTest.cpp index 72436e2499..b340a08 100644 --- a/third_party/WebKit/Source/core/editing/markers/UnsortedDocumentMarkerListEditorTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/UnsortedDocumentMarkerListEditorTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class UnsortedDocumentMarkerListEditorTest : public ::testing::Test { +class UnsortedDocumentMarkerListEditorTest : public testing::Test { protected: DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { return new SuggestionMarker(start_offset, end_offset,
diff --git a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h index 96c9da5..db7705e 100644 --- a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h +++ b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h
@@ -16,7 +16,7 @@ class BackwardGraphemeBoundaryStateMachine; class ForwardGraphemeBoundaryStateMachine; -class GraphemeStateMachineTestBase : public ::testing::Test { +class GraphemeStateMachineTestBase : public testing::Test { protected: GraphemeStateMachineTestBase() = default; ~GraphemeStateMachineTestBase() override = default;
diff --git a/third_party/WebKit/Source/core/events/PointerEventFactoryTest.cpp b/third_party/WebKit/Source/core/events/PointerEventFactoryTest.cpp index 5042f3e..fcc58e9 100644 --- a/third_party/WebKit/Source/core/events/PointerEventFactoryTest.cpp +++ b/third_party/WebKit/Source/core/events/PointerEventFactoryTest.cpp
@@ -32,7 +32,7 @@ } } -class PointerEventFactoryTest : public ::testing::Test { +class PointerEventFactoryTest : public testing::Test { protected: void SetUp() override; PointerEvent* CreateAndCheckPointerCancel(WebPointerProperties::PointerType,
diff --git a/third_party/WebKit/Source/core/events/TouchEvent.cpp b/third_party/WebKit/Source/core/events/TouchEvent.cpp index a65b2a23..28fe1503 100644 --- a/third_party/WebKit/Source/core/events/TouchEvent.cpp +++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -263,7 +263,6 @@ // A common developer error is to wait too long before attempting to stop // scrolling by consuming a touchmove event. Generate a warning if this // event is uncancelable. - MessageSource message_source = kJSMessageSource; String warning_message; switch (HandlingPassive()) { case PassiveMode::kNotPassive: @@ -286,7 +285,6 @@ WebFeature:: kUncancelableTouchEventDueToMainThreadResponsivenessPreventDefaulted); } - message_source = kInterventionMessageSource; warning_message = "Ignored attempt to cancel a " + type() + " event with cancelable=false. This event was forced to be " @@ -306,7 +304,6 @@ // an author may use touch action but call preventDefault for interop with // browsers that don't support touch-action. if (current_touch_action_ == TouchAction::kTouchActionAuto) { - message_source = kInterventionMessageSource; warning_message = "Unable to preventDefault inside passive event listener due to " "target being treated as passive. See "
diff --git a/third_party/WebKit/Source/core/events/TouchEventTest.cpp b/third_party/WebKit/Source/core/events/TouchEventTest.cpp index d8ed314..e00876d 100644 --- a/third_party/WebKit/Source/core/events/TouchEventTest.cpp +++ b/third_party/WebKit/Source/core/events/TouchEventTest.cpp
@@ -11,7 +11,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink { @@ -131,7 +131,7 @@ EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); } -class TouchEventTestNoFrame : public ::testing::Test {}; +class TouchEventTestNoFrame : public testing::Test {}; TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { TouchEvent::Create()->preventDefault();
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp b/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp index c516471..40959c8 100644 --- a/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp +++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp
@@ -41,9 +41,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::Mock; -using ::testing::Return; +using testing::_; +using testing::Mock; +using testing::Return; namespace blink { namespace { @@ -56,7 +56,7 @@ MOCK_METHOD0(UserAgentOverride, WebString()); }; -class LocalFrameClientImplTest : public ::testing::Test { +class LocalFrameClientImplTest : public testing::Test { protected: void SetUp() override { ON_CALL(web_frame_client_, UserAgentOverride())
diff --git a/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp b/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp index 9a83759b..1df284a 100644 --- a/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp +++ b/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp
@@ -159,7 +159,7 @@ Vector<WebPrerender> abandoned_prerenders_; }; -class PrerenderingTest : public ::testing::Test { +class PrerenderingTest : public testing::Test { public: ~PrerenderingTest() override { Platform::Current()
diff --git a/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp b/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp index a983501..739f623 100644 --- a/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp
@@ -58,7 +58,7 @@ namespace blink { -class WebAssociatedURLLoaderTest : public ::testing::Test, +class WebAssociatedURLLoaderTest : public testing::Test, public WebAssociatedURLLoaderClient { public: WebAssociatedURLLoaderTest()
diff --git a/third_party/WebKit/Source/core/exported/WebDocumentSubresourceFilterTest.cpp b/third_party/WebKit/Source/core/exported/WebDocumentSubresourceFilterTest.cpp index 6df3a73c..ebd3a7a4 100644 --- a/third_party/WebKit/Source/core/exported/WebDocumentSubresourceFilterTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebDocumentSubresourceFilterTest.cpp
@@ -88,7 +88,7 @@ } // namespace -class WebDocumentSubresourceFilterTest : public ::testing::Test { +class WebDocumentSubresourceFilterTest : public testing::Test { protected: WebDocumentSubresourceFilterTest() : base_url_("http://internal.test/") { RegisterMockedHttpURLLoad("white-1x1.png"); @@ -120,7 +120,7 @@ WebString::FromUTF8(file_name)); } - // ::testing::Test: + // testing::Test: void TearDown() override { Platform::Current() ->GetURLLoaderMockFactory() @@ -137,7 +137,7 @@ ExpectSubresourceWasLoaded(true); // The filter should not be consulted for the main document resource. EXPECT_THAT(QueriedSubresourcePaths(), - ::testing::ElementsAre("/white-1x1.png")); + testing::ElementsAre("/white-1x1.png")); } TEST_F(WebDocumentSubresourceFilterTest, DisallowedSubresource) { @@ -147,7 +147,7 @@ TEST_F(WebDocumentSubresourceFilterTest, FilteringDecisionIsMadeLoadByLoad) { for (const bool allow_subresources : {false, true}) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "First load allows subresources = " << allow_subresources); LoadDocument(allow_subresources); @@ -156,7 +156,7 @@ LoadDocument(!allow_subresources); ExpectSubresourceWasLoaded(!allow_subresources); EXPECT_THAT(QueriedSubresourcePaths(), - ::testing::ElementsAre("/white-1x1.png")); + testing::ElementsAre("/white-1x1.png")); WebCache::Clear(); }
diff --git a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp index 0d6aa6c..14e7b80 100644 --- a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp
@@ -32,7 +32,7 @@ const char kDefaultOrigin[] = "https://example.test/"; const char kManifestDummyFilePath[] = "manifest-dummy.html"; -class WebDocumentTest : public ::testing::Test { +class WebDocumentTest : public testing::Test { protected: static void SetUpTestCase();
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp index 8853734..e77298b 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp
@@ -90,7 +90,7 @@ } // namespace -class WebFrameSerializerSanitizationTest : public ::testing::Test { +class WebFrameSerializerSanitizationTest : public testing::Test { protected: WebFrameSerializerSanitizationTest() { helper_.Initialize(); }
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializerTest.cpp index c8f161c..fbf4866 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameSerializerTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameSerializerTest.cpp
@@ -64,7 +64,7 @@ } // namespace -class WebFrameSerializerTest : public ::testing::Test { +class WebFrameSerializerTest : public testing::Test { protected: WebFrameSerializerTest() { helper_.Initialize(); }
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index ca308f0..cf60bca 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -168,9 +168,9 @@ using blink::URLTestHelpers::ToKURL; using blink::mojom::SelectionMenuBehavior; using blink::test::RunPendingTasks; -using ::testing::ElementsAre; -using ::testing::Mock; -using ::testing::_; +using testing::ElementsAre; +using testing::Mock; +using testing::_; namespace blink { @@ -184,7 +184,7 @@ const int kTouchPointPadding = 32; -class WebFrameTest : public ::testing::Test { +class WebFrameTest : public testing::Test { protected: WebFrameTest() : base_url_("http://internal.test/"), @@ -350,14 +350,14 @@ typedef bool TestParamRootLayerScrolling; class ParameterizedWebFrameTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public WebFrameTest { public: ParameterizedWebFrameTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, ParameterizedWebFrameTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedWebFrameTest, testing::Bool()); TEST_P(ParameterizedWebFrameTest, ContentText) { RegisterMockedHttpURLLoad("iframes_test.html"); @@ -898,7 +898,7 @@ } } -class WebFrameCSSCallbackTest : public ::testing::Test { +class WebFrameCSSCallbackTest : public testing::Test { protected: WebFrameCSSCallbackTest() { frame_ = helper_.InitializeAndLoad("about:blank", &client_) @@ -3279,7 +3279,7 @@ } }; -INSTANTIATE_TEST_CASE_P(All, WebFrameResizeTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, WebFrameResizeTest, testing::Bool()); TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForWidthEqualsDeviceWidth) { @@ -6417,7 +6417,7 @@ FrameTestHelpers::WebViewHelper web_view_helper_; }; -INSTANTIATE_TEST_CASE_P(All, CompositedSelectionBoundsTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, CompositedSelectionBoundsTest, testing::Bool()); TEST_P(CompositedSelectionBoundsTest, None) { RunTestWithNoSelection("composited_selection_bounds_none.html"); @@ -9267,7 +9267,7 @@ FrameTestHelpers::WebViewHelper web_view_helper_; }; -INSTANTIATE_TEST_CASE_P(All, WebFrameSwapTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, WebFrameSwapTest, testing::Bool()); TEST_P(WebFrameSwapTest, SwapMainFrame) { WebRemoteFrame* remote_frame = FrameTestHelpers::CreateRemote(); @@ -10292,7 +10292,7 @@ FrameTestHelpers::WebViewHelper web_view_helper_; }; -INSTANTIATE_TEST_CASE_P(All, DeviceEmulationTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, DeviceEmulationTest, testing::Bool()); TEST_P(DeviceEmulationTest, DeviceSizeInvalidatedOnResize) { WebDeviceEmulationParams params; @@ -10458,7 +10458,7 @@ typedef std::pair<bool, blink::WebGestureDevice> WebFrameOverscrollTestParam; class WebFrameOverscrollTest : public WebFrameTest, - public ::testing::WithParamInterface<WebFrameOverscrollTestParam>, + public testing::WithParamInterface<WebFrameOverscrollTestParam>, private ScopedRootLayerScrollingForTest { public: WebFrameOverscrollTest() @@ -10508,7 +10508,7 @@ INSTANTIATE_TEST_CASE_P( All, WebFrameOverscrollTest, - ::testing::Values( + testing::Values( WebFrameOverscrollTestParam(false, kWebGestureDeviceTouchpad), WebFrameOverscrollTestParam(false, kWebGestureDeviceTouchscreen), WebFrameOverscrollTestParam(true, kWebGestureDeviceTouchpad), @@ -11031,7 +11031,7 @@ Persistent<WebRemoteFrameImpl> web_remote_frame_; }; -INSTANTIATE_TEST_CASE_P(All, WebFrameVisibilityChangeTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, WebFrameVisibilityChangeTest, testing::Bool()); TEST_P(WebFrameVisibilityChangeTest, RemoteFrameVisibilityChange) { SwapLocalFrameToRemoteFrame(); @@ -11658,14 +11658,14 @@ document->GetFrame()->GetChromeClient().LastSetTooltipNodeForTesting()); } -class WebFrameSimTest : public ::testing::WithParamInterface<bool>, +class WebFrameSimTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { public: WebFrameSimTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, WebFrameSimTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, WebFrameSimTest, testing::Bool()); TEST_P(WebFrameSimTest, TestScrollFocusedEditableElementIntoView) { WebView().Resize(WebSize(500, 300)); @@ -12622,10 +12622,9 @@ std::unique_ptr<FrameTestHelpers::WebViewHelper> web_view_helper_; }; -INSTANTIATE_TEST_CASE_P( - All, - SlimmingPaintWebFrameTest, - ::testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + SlimmingPaintWebFrameTest, + testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); TEST_P(SlimmingPaintWebFrameTest, DidScrollCallbackAfterScrollableAreaChanges) { DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled());
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerTest.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerTest.cpp index 6396210..3647191 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerTest.cpp
@@ -76,7 +76,7 @@ namespace blink { -class WebPluginContainerTest : public ::testing::Test { +class WebPluginContainerTest : public testing::Test { public: WebPluginContainerTest() : base_url_("http://www.test.com/") {}
diff --git a/third_party/WebKit/Source/core/exported/WebSearchableFormDataTest.cpp b/third_party/WebKit/Source/core/exported/WebSearchableFormDataTest.cpp index 3637f9f..d0b68c2 100644 --- a/third_party/WebKit/Source/core/exported/WebSearchableFormDataTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebSearchableFormDataTest.cpp
@@ -55,7 +55,7 @@ WebString::FromUTF8(file_name)); } -class WebSearchableFormDataTest : public ::testing::Test { +class WebSearchableFormDataTest : public testing::Test { protected: WebSearchableFormDataTest() = default;
diff --git a/third_party/WebKit/Source/core/exported/WebSurroundingTextTest.cpp b/third_party/WebKit/Source/core/exported/WebSurroundingTextTest.cpp index 54fb543..c8a1554 100644 --- a/third_party/WebKit/Source/core/exported/WebSurroundingTextTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebSurroundingTextTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class WebSurroundingTextTest : public ::testing::Test { +class WebSurroundingTextTest : public testing::Test { protected: Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } void SetHTML(const String&);
diff --git a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp index ea6bc5a..b4f6b910 100644 --- a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
@@ -137,7 +137,7 @@ #include "platform/loader/fetch/UniqueIdentifier.h" #include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/wtf/AutoReset.h"
diff --git a/third_party/WebKit/Source/core/exported/WebViewTest.cpp b/third_party/WebKit/Source/core/exported/WebViewTest.cpp index 5fdd68e..febbdb8 100644 --- a/third_party/WebKit/Source/core/exported/WebViewTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewTest.cpp
@@ -246,8 +246,8 @@ typedef bool TestParamRootLayerScrolling; class WebViewTest - : public ::testing::Test, - public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::Test, + public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest { public: WebViewTest() @@ -306,7 +306,7 @@ return hit_test_result.GetNode().To<WebElement>().GetAttribute("id").Utf8(); } -INSTANTIATE_TEST_CASE_P(All, WebViewTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, WebViewTest, testing::Bool()); TEST_P(WebViewTest, HitTestVideo) { // Test that hit tests on parts of a video element result in hits on the video @@ -3858,11 +3858,15 @@ public: // WebWidgetClient methods void HasTouchEventHandlers(bool state) override { - has_touch_event_handler_count_[state]++; + // Only count the times the state changes. + if (state != has_touch_event_handler_) + has_touch_event_handler_count_[state]++; + has_touch_event_handler_ = state; } // Local methods - TouchEventHandlerWebWidgetClient() : has_touch_event_handler_count_() {} + TouchEventHandlerWebWidgetClient() + : has_touch_event_handler_count_(), has_touch_event_handler_(false) {} int GetAndResetHasTouchEventHandlerCallCount(bool state) { int value = has_touch_event_handler_count_[state]; @@ -3872,6 +3876,7 @@ private: int has_touch_event_handler_count_[2]; + bool has_touch_event_handler_; }; // This test verifies that WebWidgetClient::hasTouchEventHandlers is called @@ -3894,7 +3899,7 @@ // In practice we get two such calls because WebViewHelper::initializeAndLoad // first initializes an empty frame, and then loads a document into it, so // there are two FrameLoader::commitProvisionalLoad calls. - EXPECT_LT(0, client.GetAndResetHasTouchEventHandlerCallCount(false)); + EXPECT_EQ(0, client.GetAndResetHasTouchEventHandlerCallCount(false)); EXPECT_EQ(0, client.GetAndResetHasTouchEventHandlerCallCount(true)); // Adding the first document handler results in a has-handlers call. @@ -4448,7 +4453,7 @@ std::unique_ptr<MojoTestHelper> mojo_test_helper_; }; -INSTANTIATE_TEST_CASE_P(All, ShowUnhandledTapTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ShowUnhandledTapTest, testing::Bool()); TEST_P(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeeded) { // Scroll the bottom into view so we can distinguish window coordinates from
diff --git a/third_party/WebKit/Source/core/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/core/fetch/BodyStreamBufferTest.cpp index c4f7bd1..55c8296 100644 --- a/third_party/WebKit/Source/core/fetch/BodyStreamBufferTest.cpp +++ b/third_party/WebKit/Source/core/fetch/BodyStreamBufferTest.cpp
@@ -24,18 +24,18 @@ namespace { -using ::testing::ByMove; -using ::testing::InSequence; -using ::testing::Return; -using ::testing::_; -using ::testing::SaveArg; -using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; +using testing::ByMove; +using testing::InSequence; +using testing::Return; +using testing::_; +using testing::SaveArg; +using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; using BytesConsumerCommand = BytesConsumerTestUtil::Command; using ReplayingBytesConsumer = BytesConsumerTestUtil::ReplayingBytesConsumer; using MockFetchDataLoaderClient = BytesConsumerTestUtil::MockFetchDataLoaderClient; -class BodyStreamBufferTest : public ::testing::Test { +class BodyStreamBufferTest : public testing::Test { protected: ScriptValue Eval(ScriptState* script_state, const char* s) { v8::Local<v8::String> source; @@ -74,8 +74,8 @@ // Cancel() gets called during garbage collection after the test is // finished. Since most tests don't care about this, use NiceMock so that the // calls to Cancel() are ignored. - static ::testing::NiceMock<MockFetchDataLoader>* Create() { - return new ::testing::NiceMock<MockFetchDataLoader>(); + static testing::NiceMock<MockFetchDataLoader>* Create() { + return new testing::NiceMock<MockFetchDataLoader>(); } MOCK_METHOD2(Start, void(BytesConsumer*, FetchDataLoader::Client*));
diff --git a/third_party/WebKit/Source/core/fetch/BytesConsumerForDataConsumerHandleTest.cpp b/third_party/WebKit/Source/core/fetch/BytesConsumerForDataConsumerHandleTest.cpp index 8014935..76cf51ea 100644 --- a/third_party/WebKit/Source/core/fetch/BytesConsumerForDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/core/fetch/BytesConsumerForDataConsumerHandleTest.cpp
@@ -18,12 +18,12 @@ namespace { using DataConsumerCommand = DataConsumerHandleTestUtil::Command; -using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; +using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; using ReplayingHandle = DataConsumerHandleTestUtil::ReplayingHandle; using Result = BytesConsumer::Result; -using ::testing::ByMove; -using ::testing::InSequence; -using ::testing::Return; +using testing::ByMove; +using testing::InSequence; +using testing::Return; class BytesConsumerForDataConsumerHandleTest : public PageTestBase { protected: @@ -40,7 +40,7 @@ public: static MockBytesConsumerClient* Create() { - return new ::testing::StrictMock<MockBytesConsumerClient>(); + return new testing::StrictMock<MockBytesConsumerClient>(); } MOCK_METHOD0(OnStateChange, void()); String DebugName() const override { return "MockBytesConsumerClient"; }
diff --git a/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.cpp b/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.cpp index 989ed08..3ee6728 100644 --- a/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.cpp +++ b/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.cpp
@@ -14,11 +14,11 @@ namespace { using Result = BytesConsumer::Result; -using ::testing::_; -using ::testing::ByMove; -using ::testing::DoAll; -using ::testing::Return; -using ::testing::SetArgPointee; +using testing::_; +using testing::ByMove; +using testing::DoAll; +using testing::Return; +using testing::SetArgPointee; } // namespace BytesConsumerTestUtil::MockBytesConsumer::MockBytesConsumer() {
diff --git a/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.h b/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.h index 1e9ffd8..ff183c3 100644 --- a/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.h +++ b/third_party/WebKit/Source/core/fetch/BytesConsumerTestUtil.h
@@ -24,7 +24,7 @@ class MockBytesConsumer : public BytesConsumer { public: static MockBytesConsumer* Create() { - return new ::testing::StrictMock<MockBytesConsumer>(); + return new testing::StrictMock<MockBytesConsumer>(); } MOCK_METHOD2(BeginRead, Result(const char**, size_t*)); @@ -50,8 +50,8 @@ USING_GARBAGE_COLLECTED_MIXIN(MockFetchDataLoaderClient); public: - static ::testing::StrictMock<MockFetchDataLoaderClient>* Create() { - return new ::testing::StrictMock<MockFetchDataLoaderClient>; + static testing::StrictMock<MockFetchDataLoaderClient>* Create() { + return new testing::StrictMock<MockFetchDataLoaderClient>; } virtual void Trace(blink::Visitor* visitor) {
diff --git a/third_party/WebKit/Source/core/fetch/FetchDataLoaderTest.cpp b/third_party/WebKit/Source/core/fetch/FetchDataLoaderTest.cpp index d11db41..ffc889c 100644 --- a/third_party/WebKit/Source/core/fetch/FetchDataLoaderTest.cpp +++ b/third_party/WebKit/Source/core/fetch/FetchDataLoaderTest.cpp
@@ -16,15 +16,15 @@ namespace { -using ::testing::ByMove; -using ::testing::InSequence; -using ::testing::Return; -using ::testing::DoAll; -using ::testing::StrictMock; -using ::testing::_; -using ::testing::SaveArg; -using ::testing::SetArgPointee; -using Checkpoint = StrictMock<::testing::MockFunction<void(int)>>; +using testing::ByMove; +using testing::InSequence; +using testing::Return; +using testing::DoAll; +using testing::StrictMock; +using testing::_; +using testing::SaveArg; +using testing::SetArgPointee; +using Checkpoint = StrictMock<testing::MockFunction<void(int)>>; using MockFetchDataLoaderClient = BytesConsumerTestUtil::MockFetchDataLoaderClient; using MockBytesConsumer = BytesConsumerTestUtil::MockBytesConsumer;
diff --git a/third_party/WebKit/Source/core/fetch/FetchResponseDataTest.cpp b/third_party/WebKit/Source/core/fetch/FetchResponseDataTest.cpp index dfbc85c2..1709c408 100644 --- a/third_party/WebKit/Source/core/fetch/FetchResponseDataTest.cpp +++ b/third_party/WebKit/Source/core/fetch/FetchResponseDataTest.cpp
@@ -13,7 +13,7 @@ namespace blink { -class FetchResponseDataTest : public ::testing::Test { +class FetchResponseDataTest : public testing::Test { public: FetchResponseData* CreateInternalResponse() { FetchResponseData* internal_response = FetchResponseData::Create();
diff --git a/third_party/WebKit/Source/core/fetch/FormDataBytesConsumerTest.cpp b/third_party/WebKit/Source/core/fetch/FormDataBytesConsumerTest.cpp index 75134e9..f540924 100644 --- a/third_party/WebKit/Source/core/fetch/FormDataBytesConsumerTest.cpp +++ b/third_party/WebKit/Source/core/fetch/FormDataBytesConsumerTest.cpp
@@ -25,11 +25,11 @@ namespace { using Result = BytesConsumer::Result; -using ::testing::_; -using ::testing::DoAll; -using ::testing::InSequence; -using ::testing::Return; -using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; +using testing::_; +using testing::DoAll; +using testing::InSequence; +using testing::Return; +using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; using MockBytesConsumer = BytesConsumerTestUtil::MockBytesConsumer; class SimpleDataPipeGetter : public network::mojom::blink::DataPipeGetter {
diff --git a/third_party/WebKit/Source/core/fetch/ReadableStreamBytesConsumerTest.cpp b/third_party/WebKit/Source/core/fetch/ReadableStreamBytesConsumerTest.cpp index 12c84028..1fc65ec6 100644 --- a/third_party/WebKit/Source/core/fetch/ReadableStreamBytesConsumerTest.cpp +++ b/third_party/WebKit/Source/core/fetch/ReadableStreamBytesConsumerTest.cpp
@@ -23,9 +23,9 @@ namespace { -using ::testing::InSequence; -using ::testing::StrictMock; -using Checkpoint = StrictMock<::testing::MockFunction<void(int)>>; +using testing::InSequence; +using testing::StrictMock; +using Checkpoint = StrictMock<testing::MockFunction<void(int)>>; using Result = BytesConsumer::Result; using PublicState = BytesConsumer::PublicState; @@ -44,7 +44,7 @@ MockClient() = default; }; -class ReadableStreamBytesConsumerTest : public ::testing::Test { +class ReadableStreamBytesConsumerTest : public testing::Test { public: ReadableStreamBytesConsumerTest() : page_(DummyPageHolder::Create()) {}
diff --git a/third_party/WebKit/Source/core/fileapi/PublicURLManagerTest.cpp b/third_party/WebKit/Source/core/fileapi/PublicURLManagerTest.cpp index 4658227..00d22fd 100644 --- a/third_party/WebKit/Source/core/fileapi/PublicURLManagerTest.cpp +++ b/third_party/WebKit/Source/core/fileapi/PublicURLManagerTest.cpp
@@ -62,7 +62,7 @@ } // namespace -class PublicURLManagerTest : public ::testing::Test { +class PublicURLManagerTest : public testing::Test { public: PublicURLManagerTest() : url_store_binding_(&url_store_) {}
diff --git a/third_party/WebKit/Source/core/frame/AdTrackerTest.cpp b/third_party/WebKit/Source/core/frame/AdTrackerTest.cpp index 8ee4384..d730344 100644 --- a/third_party/WebKit/Source/core/frame/AdTrackerTest.cpp +++ b/third_party/WebKit/Source/core/frame/AdTrackerTest.cpp
@@ -13,7 +13,7 @@ namespace blink { -class AdTrackerTest : public ::testing::Test { +class AdTrackerTest : public testing::Test { protected: void SetUp() override; void TearDown() override;
diff --git a/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp b/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp index 2d793a3..3f88064 100644 --- a/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp +++ b/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp
@@ -53,7 +53,7 @@ // These tests cover browser controls scrolling on main-thread. // The animation for completing a partial show/hide is done in compositor so // it is not covered here. -class BrowserControlsTest : public ::testing::Test { +class BrowserControlsTest : public testing::Test { public: BrowserControlsTest() : base_url_("http://www.test.com/") { RegisterMockedHttpURLLoad("large-div.html");
diff --git a/third_party/WebKit/Source/core/frame/DOMTimerTest.cpp b/third_party/WebKit/Source/core/frame/DOMTimerTest.cpp index 5bbe3fc..291e615 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimerTest.cpp +++ b/third_party/WebKit/Source/core/frame/DOMTimerTest.cpp
@@ -17,9 +17,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::DoubleNear; -using ::testing::ElementsAreArray; -using ::testing::Matcher; +using testing::DoubleNear; +using testing::ElementsAreArray; +using testing::Matcher; namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/Deprecation.cpp b/third_party/WebKit/Source/core/frame/Deprecation.cpp index 64266384..20cc996 100644 --- a/third_party/WebKit/Source/core/frame/Deprecation.cpp +++ b/third_party/WebKit/Source/core/frame/Deprecation.cpp
@@ -25,67 +25,67 @@ namespace { -const char chromeLoadTimesNavigationTiming[] = +const char kChromeLoadTimesNavigationTiming[] = "chrome.loadTimes() is deprecated, instead use standardized API: " "Navigation Timing 2. " "https://www.chromestatus.com/features/5637885046816768."; -const char chromeLoadTimesNextHopProtocol[] = +const char kChromeLoadTimesNextHopProtocol[] = "chrome.loadTimes() is deprecated, instead use standardized API: " "nextHopProtocol in Navigation Timing 2. " "https://www.chromestatus.com/features/5637885046816768."; -const char chromeLoadTimesPaintTiming[] = +const char kChromeLoadTimesPaintTiming[] = "chrome.loadTimes() is deprecated, instead use standardized API: " "Paint Timing. " "https://www.chromestatus.com/features/5637885046816768."; enum Milestone { - Unknown, - M60, - M61, - M62, - M63, - M64, - M65, - M66, - M67, - M68, - M69, - M70, - M71, + kUnknown, + kM60, + kM61, + kM62, + kM63, + kM64, + kM65, + kM66, + kM67, + kM68, + kM69, + kM70, + kM71, }; // Returns estimated milestone dates as human-readable strings. -const char* milestoneString(Milestone milestone) { +const char* MilestoneString(Milestone milestone) { // These are the Estimated Stable Dates: // https://www.chromium.org/developers/calendar switch (milestone) { - case Unknown: + case kUnknown: return ""; - case M60: + case kM60: return "M60, around August 2017"; - case M61: + case kM61: return "M61, around September 2017"; - case M62: + case kM62: return "M62, around October 2017"; - case M63: + case kM63: return "M63, around December 2017"; - case M64: + case kM64: return "M64, around January 2018"; - case M65: + case kM65: return "M65, around March 2018"; - case M66: + case kM66: return "M66, around April 2018"; - case M67: + case kM67: return "M67, around May 2018"; - case M68: + case kM68: return "M68, around July 2018"; - case M69: + case kM69: return "M69, around September 2018"; - case M70: + case kM70: return "M70, around October 2018"; - case M71: + case kM71: return "M71, around December 2018"; } @@ -94,36 +94,36 @@ } // Returns estimated milestone dates as milliseconds since January 1, 1970. -double milestoneDate(Milestone milestone) { +double MilestoneDate(Milestone milestone) { // These are the Estimated Stable Dates: // https://www.chromium.org/developers/calendar switch (milestone) { - case Unknown: + case kUnknown: return 0; - case M60: + case kM60: return 1500955200000; // July 25, 2017. - case M61: + case kM61: return 1504584000000; // September 5, 2017. - case M62: + case kM62: return 1508212800000; // October 17, 2017. - case M63: + case kM63: return 1512450000000; // December 5, 2017. - case M64: + case kM64: return 1516683600000; // January 23, 2018. - case M65: + case kM65: return 1520312400000; // March 6, 2018. - case M66: + case kM66: return 1523937600000; // April 17, 2018. - case M67: + case kM67: return 1527566400000; // May 29, 2018. - case M68: + case kM68: return 1532404800000; // July 24, 2018. - case M69: + case kM69: return 1536033600000; // September 4, 2018. - case M70: + case kM70: return 1539662400000; // October 16, 2018. - case M71: + case kM71: return 1543899600000; // December 4, 2018. } @@ -133,32 +133,32 @@ struct DeprecationInfo { String id; - Milestone anticipatedRemoval; + Milestone anticipated_removal; String message; }; -String replacedBy(const char* feature, const char* replacement) { +String ReplacedBy(const char* feature, const char* replacement) { return String::Format("%s is deprecated. Please use %s instead.", feature, replacement); } -String willBeRemoved(const char* feature, +String WillBeRemoved(const char* feature, Milestone milestone, const char* details) { return String::Format( "%s is deprecated and will be removed in %s. See " "https://www.chromestatus.com/features/%s for more details.", - feature, milestoneString(milestone), details); + feature, MilestoneString(milestone), details); } -String replacedWillBeRemoved(const char* feature, +String ReplacedWillBeRemoved(const char* feature, const char* replacement, Milestone milestone, const char* details) { return String::Format( "%s is deprecated and will be removed in %s. Please use %s instead. See " "https://www.chromestatus.com/features/%s for more details.", - feature, milestoneString(milestone), replacement, details); + feature, MilestoneString(milestone), replacement, details); } String DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( @@ -170,97 +170,98 @@ "%s. To continue to use this feature, it must be enabled by the " "embedding document using Feature Policy, e.g. " "<iframe allow=\"%s\" ...>. See https://goo.gl/EuHzyv for more details.", - function, milestoneString(milestone), allow_string); + function, MilestoneString(milestone), allow_string); } DeprecationInfo GetDeprecationInfo(WebFeature feature) { switch (feature) { // Quota case WebFeature::kPrefixedStorageInfo: - return {"PrefixedStorageInfo", Unknown, - replacedBy("'window.webkitStorageInfo'", + return {"PrefixedStorageInfo", kUnknown, + ReplacedBy("'window.webkitStorageInfo'", "'navigator.webkitTemporaryStorage' or " "'navigator.webkitPersistentStorage'")}; case WebFeature::kConsoleMarkTimeline: - return {"ConsoleMarkTimeline", Unknown, - replacedBy("'console.markTimeline'", "'console.timeStamp'")}; + return {"ConsoleMarkTimeline", kUnknown, + ReplacedBy("'console.markTimeline'", "'console.timeStamp'")}; case WebFeature::kPrefixedVideoSupportsFullscreen: - return {"PrefixedVideoSupportsFullscreen", Unknown, - replacedBy("'HTMLVideoElement.webkitSupportsFullscreen'", + return {"PrefixedVideoSupportsFullscreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitSupportsFullscreen'", "'Document.fullscreenEnabled'")}; case WebFeature::kPrefixedVideoDisplayingFullscreen: - return {"PrefixedVideoDisplayingFullscreen", Unknown, - replacedBy("'HTMLVideoElement.webkitDisplayingFullscreen'", + return {"PrefixedVideoDisplayingFullscreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitDisplayingFullscreen'", "'Document.fullscreenElement'")}; case WebFeature::kPrefixedVideoEnterFullscreen: - return {"PrefixedVideoEnterFullscreen", Unknown, - replacedBy("'HTMLVideoElement.webkitEnterFullscreen()'", + return {"PrefixedVideoEnterFullscreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitEnterFullscreen()'", "'Element.requestFullscreen()'")}; case WebFeature::kPrefixedVideoExitFullscreen: - return {"PrefixedVideoExitFullscreen", Unknown, - replacedBy("'HTMLVideoElement.webkitExitFullscreen()'", + return {"PrefixedVideoExitFullscreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitExitFullscreen()'", "'Document.exitFullscreen()'")}; case WebFeature::kPrefixedVideoEnterFullScreen: - return {"PrefixedVideoEnterFullScreen", Unknown, - replacedBy("'HTMLVideoElement.webkitEnterFullScreen()'", + return {"PrefixedVideoEnterFullScreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitEnterFullScreen()'", "'Element.requestFullscreen()'")}; case WebFeature::kPrefixedVideoExitFullScreen: - return {"PrefixedVideoExitFullScreen", Unknown, - replacedBy("'HTMLVideoElement.webkitExitFullScreen()'", + return {"PrefixedVideoExitFullScreen", kUnknown, + ReplacedBy("'HTMLVideoElement.webkitExitFullScreen()'", "'Document.exitFullscreen()'")}; case WebFeature::kPrefixedRequestAnimationFrame: - return {"PrefixedRequestAnimationFrame", Unknown, + return {"PrefixedRequestAnimationFrame", kUnknown, "'webkitRequestAnimationFrame' is vendor-specific. Please use " "the standard 'requestAnimationFrame' instead."}; case WebFeature::kPrefixedCancelAnimationFrame: - return {"PrefixedCancelAnimationFrame", Unknown, + return {"PrefixedCancelAnimationFrame", kUnknown, "'webkitCancelAnimationFrame' is vendor-specific. Please use the " "standard 'cancelAnimationFrame' instead."}; case WebFeature::kPictureSourceSrc: - return {"PictureSourceSrc", Unknown, + return {"PictureSourceSrc", kUnknown, "<source src> with a <picture> parent is invalid and therefore " "ignored. Please use <source srcset> instead."}; case WebFeature::kConsoleTimeline: - return {"ConsoleTimeline", Unknown, - replacedBy("'console.timeline'", "'console.time'")}; + return {"ConsoleTimeline", kUnknown, + ReplacedBy("'console.timeline'", "'console.time'")}; case WebFeature::kConsoleTimelineEnd: - return {"ConsoleTimelineEnd", Unknown, - replacedBy("'console.timelineEnd'", "'console.timeEnd'")}; + return {"ConsoleTimelineEnd", kUnknown, + ReplacedBy("'console.timelineEnd'", "'console.timeEnd'")}; case WebFeature::kXMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload: return {"XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload", - Unknown, + kUnknown, "Synchronous XMLHttpRequest on the main thread is deprecated " "because of its detrimental effects to the end user's " "experience. For more help, check https://xhr.spec.whatwg.org/."}; case WebFeature::kGetMatchedCSSRules: - return {"GetMatchedCSSRules", M64, - willBeRemoved("document.getMatchedCSSRules()", M64, + return {"GetMatchedCSSRules", kM64, + WillBeRemoved("document.getMatchedCSSRules()", kM64, "4606972603138048")}; case WebFeature::kPrefixedWindowURL: - return {"PrefixedWindowURL", Unknown, replacedBy("'webkitURL'", "'URL'")}; + return {"PrefixedWindowURL", kUnknown, + ReplacedBy("'webkitURL'", "'URL'")}; case WebFeature::kRangeExpand: - return {"RangeExpand", Unknown, - replacedBy("'Range.expand()'", "'Selection.modify()'")}; + return {"RangeExpand", kUnknown, + ReplacedBy("'Range.expand()'", "'Selection.modify()'")}; // Blocked subresource requests: case WebFeature::kLegacyProtocolEmbeddedAsSubresource: - return {"LegacyProtocolEmbeddedAsSubresource", Unknown, + return {"LegacyProtocolEmbeddedAsSubresource", kUnknown, String::Format( "Subresource requests using legacy protocols (like `ftp:`) " "are blocked. Please deliver web-accessible resources over " @@ -269,7 +270,7 @@ "details.")}; case WebFeature::kRequestedSubresourceWithEmbeddedCredentials: - return {"RequestedSubresourceWithEmbeddedCredentials", Unknown, + return {"RequestedSubresourceWithEmbeddedCredentials", kUnknown, "Subresource requests whose URLs contain embedded credentials " "(e.g. `https://user:pass@host/`) are blocked. See " "https://www.chromestatus.com/feature/5669008342777856 for more " @@ -277,7 +278,7 @@ // Blocked `<meta http-equiv="set-cookie" ...>` case WebFeature::kMetaSetCookie: - return {"MetaSetCookie", M65, + return {"MetaSetCookie", kM65, String::Format( "Setting cookies via `<meta http-equiv='Set-Cookie' ...>` no " "longer works, as of M65. Consider switching to " @@ -287,21 +288,21 @@ // Powerful features on insecure origins (https://goo.gl/rStTGz) case WebFeature::kDeviceMotionInsecureOrigin: - return {"DeviceMotionInsecureOrigin", Unknown, + return {"DeviceMotionInsecureOrigin", kUnknown, "The devicemotion event is deprecated on insecure origins, and " "support will be removed in the future. You should consider " "switching your application to a secure origin, such as HTTPS. " "See https://goo.gl/rStTGz for more details."}; case WebFeature::kDeviceOrientationInsecureOrigin: - return {"DeviceOrientationInsecureOrigin", Unknown, + return {"DeviceOrientationInsecureOrigin", kUnknown, "The deviceorientation event is deprecated on insecure origins, " "and support will be removed in the future. You should consider " "switching your application to a secure origin, such as HTTPS. " "See https://goo.gl/rStTGz for more details."}; case WebFeature::kDeviceOrientationAbsoluteInsecureOrigin: - return {"DeviceOrientationAbsoluteInsecureOrigin", Unknown, + return {"DeviceOrientationAbsoluteInsecureOrigin", kUnknown, "The deviceorientationabsolute event is deprecated on insecure " "origins, and support will be removed in the future. You should " "consider switching your application to a secure origin, such as " @@ -309,7 +310,7 @@ case WebFeature::kGeolocationInsecureOrigin: case WebFeature::kGeolocationInsecureOriginIframe: - return {"GeolocationInsecureOrigin", Unknown, + return {"GeolocationInsecureOrigin", kUnknown, "getCurrentPosition() and watchPosition() no longer work on " "insecure origins. To use this feature, you should consider " "switching your application to a secure origin, such as HTTPS. " @@ -317,7 +318,7 @@ case WebFeature::kGeolocationInsecureOriginDeprecatedNotRemoved: case WebFeature::kGeolocationInsecureOriginIframeDeprecatedNotRemoved: - return {"GeolocationInsecureOriginDeprecatedNotRemoved", Unknown, + return {"GeolocationInsecureOriginDeprecatedNotRemoved", kUnknown, "getCurrentPosition() and watchPosition() are deprecated on " "insecure origins. To use this feature, you should consider " "switching your application to a secure origin, such as HTTPS. " @@ -326,7 +327,7 @@ case WebFeature::kGetUserMediaInsecureOrigin: case WebFeature::kGetUserMediaInsecureOriginIframe: return { - "GetUserMediaInsecureOrigin", Unknown, + "GetUserMediaInsecureOrigin", kUnknown, "getUserMedia() no longer works on insecure origins. To use this " "feature, you should consider switching your application to a " "secure origin, such as HTTPS. See https://goo.gl/rStTGz for more " @@ -334,7 +335,7 @@ case WebFeature::kMediaSourceAbortRemove: return { - "MediaSourceAbortRemove", Unknown, + "MediaSourceAbortRemove", kUnknown, "Using SourceBuffer.abort() to abort remove()'s asynchronous " "range removal is deprecated due to specification change. Support " "will be removed in the future. You should instead await " @@ -345,7 +346,7 @@ case WebFeature::kMediaSourceDurationTruncatingBuffered: return { - "MediaSourceDurationTruncatingBuffered", Unknown, + "MediaSourceDurationTruncatingBuffered", kUnknown, "Setting MediaSource.duration below the highest presentation " "timestamp of any buffered coded frames is deprecated due to " "specification change. Support for implicit removal of truncated " @@ -357,7 +358,7 @@ case WebFeature::kApplicationCacheManifestSelectInsecureOrigin: case WebFeature::kApplicationCacheAPIInsecureOrigin: - return {"ApplicationCacheAPIInsecureOrigin", Unknown, + return {"ApplicationCacheAPIInsecureOrigin", kUnknown, "Use of the Application Cache is deprecated on insecure origins. " "Support will be removed in the future. You should consider " "switching your application to a secure origin, such as HTTPS. " @@ -367,7 +368,7 @@ case WebFeature::kNotificationAPIInsecureOriginIframe: case WebFeature::kNotificationPermissionRequestedInsecureOrigin: return { - "NotificationInsecureOrigin", Unknown, + "NotificationInsecureOrigin", kUnknown, String::Format( "The Notification API may no longer be used from insecure " "origins. " @@ -377,7 +378,7 @@ case WebFeature::kNotificationPermissionRequestedIframe: return { - "NotificationPermissionRequestedIframe", Unknown, + "NotificationPermissionRequestedIframe", kUnknown, String::Format( "Permission for the Notification API may no longer be requested " "from " @@ -388,7 +389,7 @@ "details.")}; case WebFeature::kCSSDeepCombinator: - return {"CSSDeepCombinator", M65, + return {"CSSDeepCombinator", kM65, "/deep/ combinator is no longer supported in CSS dynamic profile." "It is now effectively no-op, acting as if it were a descendant " "combinator. /deep/ combinator will be removed, and will be " @@ -397,26 +398,26 @@ "details."}; case WebFeature::kVREyeParametersOffset: - return {"VREyeParametersOffset", Unknown, - replacedBy("VREyeParameters.offset", + return {"VREyeParametersOffset", kUnknown, + ReplacedBy("VREyeParameters.offset", "view matrices provided by VRFrameData")}; case WebFeature::kCSSSelectorInternalMediaControlsOverlayCastButton: return { - "CSSSelectorInternalMediaControlsOverlayCastButton", M61, - willBeRemoved("-internal-media-controls-overlay-cast-button selector", - M61, "5714245488476160")}; + "CSSSelectorInternalMediaControlsOverlayCastButton", kM61, + WillBeRemoved("-internal-media-controls-overlay-cast-button selector", + kM61, "5714245488476160")}; case WebFeature::kSelectionAddRangeIntersect: return { - "SelectionAddRangeIntersect", Unknown, + "SelectionAddRangeIntersect", kUnknown, "The behavior that Selection.addRange() merges existing Range and " "the specified Range was removed. See " "https://www.chromestatus.com/features/6680566019653632 for more " "details."}; case WebFeature::kRtcpMuxPolicyNegotiate: - return {"RtcpMuxPolicyNegotiate", M62, + return {"RtcpMuxPolicyNegotiate", kM62, String::Format("The rtcpMuxPolicy option is being considered for " "removal and may be removed no earlier than %s. " "If you depend on it, " @@ -424,17 +425,17 @@ "https://www.chromestatus.com/features/" "5654810086866944 " "for more details.", - milestoneString(M62))}; + MilestoneString(kM62))}; case WebFeature::kChildSrcAllowedWorkerThatScriptSrcBlocked: - return {"ChildSrcAllowedWorkerThatScriptSrcBlocked", M60, - replacedWillBeRemoved("The 'child-src' directive", + return {"ChildSrcAllowedWorkerThatScriptSrcBlocked", kM60, + ReplacedWillBeRemoved("The 'child-src' directive", "the 'script-src' directive for Workers", - M60, "5922594955984896")}; + kM60, "5922594955984896")}; case WebFeature::kCanRequestURLHTTPContainingNewline: return { - "CanRequestURLHTTPContainingNewline", Unknown, + "CanRequestURLHTTPContainingNewline", kUnknown, "Resource requests whose URLs contained both removed whitespace " "(`\\n`, `\\r`, `\\t`) characters and less-than characters (`<`) " "are blocked. Please remove newlines and encode less-than " @@ -445,24 +446,24 @@ case WebFeature::kPaymentRequestNetworkNameInSupportedMethods: return { - "PaymentRequestNetworkNameInSupportedMethods", M64, - replacedWillBeRemoved( + "PaymentRequestNetworkNameInSupportedMethods", kM64, + ReplacedWillBeRemoved( "Card issuer network (\"amex\", \"diners\", \"discover\", " "\"jcb\", " "\"mastercard\", \"mir\", \"unionpay\", \"visa\") as payment " "method", "payment method name \"basic-card\" with issuer network in the " "\"supportedNetworks\" field", - M64, "5725727580225536")}; + kM64, "5725727580225536")}; case WebFeature::kDeprecatedTimingFunctionStepMiddle: return { - "DeprecatedTimingFunctionStepMiddle", M62, - willBeRemoved("The step timing function with step position 'middle'", - M62, "5189363944128512")}; + "DeprecatedTimingFunctionStepMiddle", kM62, + WillBeRemoved("The step timing function with step position 'middle'", + kM62, "5189363944128512")}; case WebFeature::kHTMLImportsHasStyleSheets: - return {"HTMLImportsHasStyleSheets", Unknown, + return {"HTMLImportsHasStyleSheets", kUnknown, "Styling master document from stylesheets defined in " "HTML Imports is deprecated. " "Please refer to " @@ -470,40 +471,41 @@ case WebFeature:: kEncryptedMediaDisallowedByFeaturePolicyInCrossOriginIframe: - return {"EncryptedMediaDisallowedByFeaturePolicyInCrossOriginIframe", M64, + return {"EncryptedMediaDisallowedByFeaturePolicyInCrossOriginIframe", + kM64, DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( - "requestMediaKeySystemAccess", "encrypted-media", M64)}; + "requestMediaKeySystemAccess", "encrypted-media", kM64)}; case WebFeature::kGeolocationDisallowedByFeaturePolicyInCrossOriginIframe: - return {"GeolocationDisallowedByFeaturePolicyInCrossOriginIframe", M64, + return {"GeolocationDisallowedByFeaturePolicyInCrossOriginIframe", kM64, DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( - "getCurrentPosition and watchPosition", "geolocation", M64)}; + "getCurrentPosition and watchPosition", "geolocation", kM64)}; case WebFeature:: kGetUserMediaMicDisallowedByFeaturePolicyInCrossOriginIframe: return {"GetUserMediaMicDisallowedByFeaturePolicyInCrossOriginIframe", - M64, + kM64, DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( - "getUserMedia (microphone)", "microphone", M64)}; + "getUserMedia (microphone)", "microphone", kM64)}; case WebFeature:: kGetUserMediaCameraDisallowedByFeaturePolicyInCrossOriginIframe: return {"GetUserMediaCameraDisallowedByFeaturePolicyInCrossOriginIframe", - M64, + kM64, DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( - "getUserMedia (camera)", "camera", M64)}; + "getUserMedia (camera)", "camera", kM64)}; case WebFeature:: kRequestMIDIAccessDisallowedByFeaturePolicyInCrossOriginIframe: return {"RequestMIDIAccessDisallowedByFeaturePolicyInCrossOriginIframe", - M64, + kM64, DeprecatedWillBeDisabledByFeaturePolicyInCrossOriginIframe( - "requestMIDIAccess", "midi", M64)}; + "requestMIDIAccess", "midi", kM64)}; case WebFeature::kPresentationRequestStartInsecureOrigin: case WebFeature::kPresentationReceiverInsecureOrigin: return { - "PresentationInsecureOrigin", M68, + "PresentationInsecureOrigin", kM68, String("Using the Presentation API on insecure origins is " "deprecated and will be removed in M68. You should consider " "switching your application to a secure origin, such as " @@ -511,20 +513,20 @@ "https://goo.gl/rStTGz for more details.")}; case WebFeature::kPaymentRequestSupportedMethodsArray: - return {"PaymentRequestSupportedMethodsArray", M64, - replacedWillBeRemoved( + return {"PaymentRequestSupportedMethodsArray", kM64, + ReplacedWillBeRemoved( "PaymentRequest's supportedMethods taking an array", - "a single string", M64, "5177301645918208")}; + "a single string", kM64, "5177301645918208")}; case WebFeature::kLocalCSSFileExtensionRejected: - return {"LocalCSSFileExtensionRejected", M64, + return {"LocalCSSFileExtensionRejected", kM64, String("CSS cannot be loaded from `file:` URLs unless they end " "in a `.css` file extension.")}; case WebFeature::kCreateObjectURLMediaStream: - return {"CreateObjectURLMediaStreamDeprecated", M68, - replacedWillBeRemoved("URL.createObjectURL with media streams", - "HTMLMediaElement.srcObject", M68, + return {"CreateObjectURLMediaStreamDeprecated", kM68, + ReplacedWillBeRemoved("URL.createObjectURL with media streams", + "HTMLMediaElement.srcObject", kM68, "5618491470118912")}; case WebFeature::kChromeLoadTimesRequestTime: @@ -534,58 +536,58 @@ case WebFeature::kChromeLoadTimesFinishLoadTime: case WebFeature::kChromeLoadTimesNavigationType: case WebFeature::kChromeLoadTimesConnectionInfo: - return {"ChromeLoadTimesConnectionInfo", Unknown, - chromeLoadTimesNavigationTiming}; + return {"ChromeLoadTimesConnectionInfo", kUnknown, + kChromeLoadTimesNavigationTiming}; case WebFeature::kChromeLoadTimesFirstPaintTime: case WebFeature::kChromeLoadTimesFirstPaintAfterLoadTime: - return {"ChromeLoadTimesFirstPaintAfterLoadTime", Unknown, - chromeLoadTimesPaintTiming}; + return {"ChromeLoadTimesFirstPaintAfterLoadTime", kUnknown, + kChromeLoadTimesPaintTiming}; case WebFeature::kChromeLoadTimesWasFetchedViaSpdy: case WebFeature::kChromeLoadTimesWasNpnNegotiated: case WebFeature::kChromeLoadTimesNpnNegotiatedProtocol: case WebFeature::kChromeLoadTimesWasAlternateProtocolAvailable: - return {"ChromeLoadTimesWasAlternateProtocolAvailable", Unknown, - chromeLoadTimesNextHopProtocol}; + return {"ChromeLoadTimesWasAlternateProtocolAvailable", kUnknown, + kChromeLoadTimesNextHopProtocol}; case WebFeature::kDataUriHasOctothorpe: - return {"DataUriHasOctothorpe", M67, - replacedWillBeRemoved( + return {"DataUriHasOctothorpe", kM67, + ReplacedWillBeRemoved( "Using unescaped '#' characters in a data URI body", "'%23'", - M67, "5656049583390720")}; + kM67, "5656049583390720")}; case WebFeature::kThreeValuedPositionBasicShape: case WebFeature::kThreeValuedPositionGradient: case WebFeature::kThreeValuedPositionObjectPosition: case WebFeature::kThreeValuedPositionPerspectiveOrigin: return { - "ThreeValuedPosition", M68, - replacedWillBeRemoved("Expressing a position using 3 parts", - "<position> syntax", M68, "5116559680864256")}; + "ThreeValuedPosition", kM68, + ReplacedWillBeRemoved("Expressing a position using 3 parts", + "<position> syntax", kM68, "5116559680864256")}; case WebFeature::kImageInputTypeFormDataWithNonEmptyValue: - return {"ImageInputTypeFormDataWithNonEmptyValue", M68, - willBeRemoved("Extra form data if value attribute " + return {"ImageInputTypeFormDataWithNonEmptyValue", kM68, + WillBeRemoved("Extra form data if value attribute " "is present with non-empty " "value for <input type='image'>", - M68, "5672688152477696")}; + kM68, "5672688152477696")}; case WebFeature::kV8Document_CreateTouch_Method: - return {"V8Document_CreateTouch_Method", M68, - replacedWillBeRemoved("document.createTouch", - "TouchEvent constructor", M68, + return {"V8Document_CreateTouch_Method", kM68, + ReplacedWillBeRemoved("document.createTouch", + "TouchEvent constructor", kM68, "5668612064935936")}; case WebFeature::kV8Document_CreateTouchList_Method: - return {"V8Document_CreateTouchList_Method", M68, - replacedWillBeRemoved("document.createTouchList", - "TouchEvent constructor", M68, + return {"V8Document_CreateTouchList_Method", kM68, + ReplacedWillBeRemoved("document.createTouchList", + "TouchEvent constructor", kM68, "5668612064935936")}; // Features that aren't deprecated don't have a deprecation message. default: - return {"NotDeprecated", Unknown, ""}; + return {"NotDeprecated", kUnknown, ""}; } } @@ -762,9 +764,9 @@ Document* document = frame->GetDocument(); // Construct the deprecation report. - double removalDate = milestoneDate(info.anticipatedRemoval); + double removal_date = MilestoneDate(info.anticipated_removal); DeprecationReport* body = new DeprecationReport( - info.id, removalDate, info.message, SourceLocation::Capture()); + info.id, removal_date, info.message, SourceLocation::Capture()); Report* report = new Report("deprecation", document->Url().GetString(), body); // Send the deprecation report to any ReportingObservers. @@ -778,7 +780,7 @@ platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(), &service); service->QueueDeprecationReport(document->Url(), info.id, - WTF::Time::FromDoubleT(removalDate), + WTF::Time::FromDoubleT(removal_date), info.message, body->sourceFile(), body->lineNumber(), body->columnNumber()); }
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp index df77c43e..d1e53c2 100644 --- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp +++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
@@ -127,16 +127,16 @@ ChangeOperation op, EventHandlerClass handler_class, EventTarget* target) { - bool had_handlers = targets_[handler_class].size(); + unsigned old_num_handlers = targets_[handler_class].size(); bool target_set_changed = UpdateEventHandlerTargets(op, handler_class, target); - bool has_handlers = targets_[handler_class].size(); + unsigned new_num_handlers = targets_[handler_class].size(); - bool handlers_changed = had_handlers != has_handlers; + bool handlers_changed = old_num_handlers != new_num_handlers; if (op != kRemoveAll) { if (handlers_changed) - NotifyHasHandlersChanged(target, handler_class, has_handlers); + NotifyHasHandlersChanged(target, handler_class, new_num_handlers > 0); if (target_set_changed) { NotifyDidAddOrRemoveEventHandlerTarget(GetLocalFrameForTarget(target), @@ -224,7 +224,7 @@ for (size_t i = 0; i < kEventHandlerClassCount; ++i) { EventHandlerClass handler_class = static_cast<EventHandlerClass>(i); if (handlers_changed[i]) { - bool has_handlers = targets_[handler_class].size(); + bool has_handlers = targets_[handler_class].Contains(&target); NotifyHasHandlersChanged(&target, handler_class, has_handlers); } if (target_set_changed[i]) {
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp b/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp index 69ce9d4b..d108a3a 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp
@@ -56,7 +56,7 @@ namespace blink { -class FrameSerializerTest : public ::testing::Test, +class FrameSerializerTest : public testing::Test, public FrameSerializer::Delegate { public: FrameSerializerTest()
diff --git a/third_party/WebKit/Source/core/frame/HistoryTest.cpp b/third_party/WebKit/Source/core/frame/HistoryTest.cpp index 0403afb..57b684b8 100644 --- a/third_party/WebKit/Source/core/frame/HistoryTest.cpp +++ b/third_party/WebKit/Source/core/frame/HistoryTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class HistoryTest : public ::testing::Test {}; +class HistoryTest : public testing::Test {}; TEST_F(HistoryTest, CanChangeToURL) { struct TestCase {
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp index c62edf1a..e33b670 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp
@@ -18,8 +18,8 @@ #include "core/paint/PaintPropertyTreePrinter.h" -using ::testing::_; -using ::testing::AnyNumber; +using testing::_; +using testing::AnyNumber; namespace blink { namespace { @@ -46,7 +46,7 @@ typedef bool TestParamRootLayerScrolling; class LocalFrameViewTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public RenderingTest { protected: @@ -59,8 +59,7 @@ } ~LocalFrameViewTest() { - ::testing::Mock::VerifyAndClearExpectations( - &GetAnimationMockChromeClient()); + testing::Mock::VerifyAndClearExpectations(&GetAnimationMockChromeClient()); } ChromeClient& GetChromeClient() const override { return *chrome_client_; } @@ -78,7 +77,7 @@ Persistent<AnimationMockChromeClient> chrome_client_; }; -INSTANTIATE_TEST_CASE_P(All, LocalFrameViewTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, LocalFrameViewTest, testing::Bool()); TEST_P(LocalFrameViewTest, SetPaintInvalidationDuringUpdateAllLifecyclePhases) { SetBodyInnerHTML("<div id='a' style='color: blue'>A</div>");
diff --git a/third_party/WebKit/Source/core/frame/MHTMLArchiveTest.cpp b/third_party/WebKit/Source/core/frame/MHTMLArchiveTest.cpp index 6d494b2..8598791 100644 --- a/third_party/WebKit/Source/core/frame/MHTMLArchiveTest.cpp +++ b/third_party/WebKit/Source/core/frame/MHTMLArchiveTest.cpp
@@ -54,7 +54,7 @@ } // namespace -class MHTMLArchiveTest : public ::testing::Test { +class MHTMLArchiveTest : public testing::Test { public: MHTMLArchiveTest() { file_path_ = test::CoreTestDataPath("frameserializer/css/");
diff --git a/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp b/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp index 797284ee..574d9d9 100644 --- a/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp +++ b/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp
@@ -54,7 +54,7 @@ namespace blink { namespace test { -class MHTMLLoadingTest : public ::testing::Test { +class MHTMLLoadingTest : public testing::Test { public: MHTMLLoadingTest() = default;
diff --git a/third_party/WebKit/Source/core/frame/PerformanceMonitorTest.cpp b/third_party/WebKit/Source/core/frame/PerformanceMonitorTest.cpp index 9a29df81..ed2284f 100644 --- a/third_party/WebKit/Source/core/frame/PerformanceMonitorTest.cpp +++ b/third_party/WebKit/Source/core/frame/PerformanceMonitorTest.cpp
@@ -14,7 +14,7 @@ namespace blink { -class PerformanceMonitorTest : public ::testing::Test { +class PerformanceMonitorTest : public testing::Test { protected: void SetUp() override; void TearDown() override;
diff --git a/third_party/WebKit/Source/core/frame/PictureInPictureController.h b/third_party/WebKit/Source/core/frame/PictureInPictureController.h index 518731e..fedd1b0 100644 --- a/third_party/WebKit/Source/core/frame/PictureInPictureController.h +++ b/third_party/WebKit/Source/core/frame/PictureInPictureController.h
@@ -18,7 +18,6 @@ : public GarbageCollectedFinalized<PictureInPictureController>, public Supplement<Document> { USING_GARBAGE_COLLECTED_MIXIN(PictureInPictureController); - WTF_MAKE_NONCOPYABLE(PictureInPictureController); public: static const char kSupplementName[]; @@ -47,6 +46,8 @@ protected: explicit PictureInPictureController(Document&); + + DISALLOW_COPY_AND_ASSIGN(PictureInPictureController); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp index 8136884..3eb28808 100644 --- a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp +++ b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
@@ -200,7 +200,7 @@ float scale_; }; -class RootFrameViewportTest : public ::testing::Test { +class RootFrameViewportTest : public testing::Test { public: RootFrameViewportTest() = default;
diff --git a/third_party/WebKit/Source/core/frame/RotationViewportAnchorTest.cpp b/third_party/WebKit/Source/core/frame/RotationViewportAnchorTest.cpp index 51779f1..9e1ab38 100644 --- a/third_party/WebKit/Source/core/frame/RotationViewportAnchorTest.cpp +++ b/third_party/WebKit/Source/core/frame/RotationViewportAnchorTest.cpp
@@ -15,7 +15,7 @@ namespace { -class RotationViewportAnchorTest : public ::testing::WithParamInterface<bool>, +class RotationViewportAnchorTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { public: @@ -28,7 +28,7 @@ } }; -INSTANTIATE_TEST_CASE_P(All, RotationViewportAnchorTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, RotationViewportAnchorTest, testing::Bool()); TEST_P(RotationViewportAnchorTest, SimpleAbsolutePosition) { WebView().Resize(WebSize(400, 600));
diff --git a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp index 355a5e6..30a491fa 100644 --- a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp +++ b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
@@ -55,7 +55,7 @@ namespace blink { using WebFeature = mojom::WebFeature; -class UseCounterTest : public ::testing::Test { +class UseCounterTest : public testing::Test { public: UseCounterTest() : dummy_(DummyPageHolder::Create()) {} @@ -483,7 +483,7 @@ CSSPropertyFontWeight, 3); } -class DeprecationTest : public ::testing::Test { +class DeprecationTest : public testing::Test { public: DeprecationTest() : dummy_(DummyPageHolder::Create()),
diff --git a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp index 91f01aad..ff671f94 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp
@@ -48,9 +48,9 @@ #include <string> -using ::testing::_; -using ::testing::PrintToString; -using ::testing::Mock; +using testing::_; +using testing::PrintToString; +using testing::Mock; using blink::URLTestHelpers::ToKURL; namespace blink { @@ -72,7 +72,7 @@ } typedef bool TestParamRootLayerScrolling; -class VisualViewportTest : public ::testing::Test, +class VisualViewportTest : public testing::Test, public PaintTestConfigurations { public: VisualViewportTest() : base_url_("http://www.test.com/") {} @@ -144,10 +144,9 @@ FrameTestHelpers::WebViewHelper helper_; }; -INSTANTIATE_TEST_CASE_P( - All, - VisualViewportTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + VisualViewportTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); // Test that resizing the VisualViewport works as expected and that resizing the // WebView resizes the VisualViewport.
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp index 182606e..6919c64 100644 --- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp
@@ -16,7 +16,7 @@ namespace blink { -class CSPDirectiveListTest : public ::testing::Test { +class CSPDirectiveListTest : public testing::Test { public: CSPDirectiveListTest() : csp(ContentSecurityPolicy::Create()) {} @@ -159,7 +159,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "List: `" << test.list << "`, URL: `" << test.url << "`"); const KURL script_src(test.url); @@ -215,7 +215,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "List: `" << test.list << "`, URL: `" << test.url << "`"); const KURL resource(test.url); @@ -352,7 +352,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "List: `" << test.list << "`, URL: `" << test.url << "`, Integrity: `" << test.integrity << "`"); const KURL resource(test.url);
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp index 0aae265..246da70 100644 --- a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
@@ -13,7 +13,7 @@ namespace blink { -class CSPSourceTest : public ::testing::Test { +class CSPSourceTest : public testing::Test { public: CSPSourceTest() : csp(ContentSecurityPolicy::Create()) {}
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp index 1f66af92..61e953b 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
@@ -22,7 +22,7 @@ namespace blink { -class ContentSecurityPolicyTest : public ::testing::Test { +class ContentSecurityPolicyTest : public testing::Test { public: ContentSecurityPolicyTest() : csp(ContentSecurityPolicy::Create()), @@ -59,7 +59,7 @@ // Enforced for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "[Enforce] Header: `" << test.header << "`"); csp = ContentSecurityPolicy::Create(); csp->DidReceiveHeader(test.header, kContentSecurityPolicyHeaderTypeEnforce, @@ -80,7 +80,7 @@ // Report-Only for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "[Report-Only] Header: `" << test.header << "`"); csp = ContentSecurityPolicy::Create(); csp->DidReceiveHeader(test.header, kContentSecurityPolicyHeaderTypeReport, @@ -682,7 +682,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Policy: `" << test.policy << "`, URL: `" << test.url << "`, Nonce: `" << test.nonce << "`"); const KURL resource(test.url); @@ -742,8 +742,8 @@ document->SetSecurityOrigin(secure_origin); for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << "Policy: `" << test.policy - << "`, Nonce: `" << test.nonce << "`"); + SCOPED_TRACE(testing::Message() << "Policy: `" << test.policy + << "`, Nonce: `" << test.nonce << "`"); unsigned expected_reports = test.allowed ? 0u : 1u; auto* element = @@ -846,9 +846,9 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << "Policy: `" << test.policy1 << "`/`" - << test.policy2 << "`, URL: `" << test.url - << "`, Nonce: `" << test.nonce << "`"); + SCOPED_TRACE(testing::Message() << "Policy: `" << test.policy1 << "`/`" + << test.policy2 << "`, URL: `" << test.url + << "`, Nonce: `" << test.nonce << "`"); const KURL resource(test.url); unsigned expected_reports =
diff --git a/third_party/WebKit/Source/core/frame/csp/MediaListDirectiveTest.cpp b/third_party/WebKit/Source/core/frame/csp/MediaListDirectiveTest.cpp index 39f9f0ea..83f36ab 100644 --- a/third_party/WebKit/Source/core/frame/csp/MediaListDirectiveTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/MediaListDirectiveTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class MediaListDirectiveTest : public ::testing::Test { +class MediaListDirectiveTest : public testing::Test { public: MediaListDirectiveTest() : csp(ContentSecurityPolicy::Create()) {}
diff --git a/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp b/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp index a460d05c..4c1054d7 100644 --- a/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp
@@ -14,7 +14,7 @@ namespace blink { -class SourceListDirectiveTest : public ::testing::Test { +class SourceListDirectiveTest : public testing::Test { public: SourceListDirectiveTest() : csp(ContentSecurityPolicy::Create()) {}
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp index 6e5f04f..6a82b30 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class HTMLFrameElementTest : public ::testing::Test {}; +class HTMLFrameElementTest : public testing::Test {}; // Test that the correct container policy is constructed on a frame element. // Frame elements do not have any container-policy related attributes, but the
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElementTest.cpp index 29b06359..756ad2c 100644 --- a/third_party/WebKit/Source/core/html/HTMLIFrameElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLIFrameElementTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class HTMLIFrameElementTest : public ::testing::Test { +class HTMLIFrameElementTest : public testing::Test { public: scoped_refptr<const SecurityOrigin> GetOriginForFeaturePolicy( HTMLIFrameElement* element) {
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp index b50e6d30..3dba1ca 100644 --- a/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class HTMLLinkElementSizesAttributeTest : public ::testing::Test {}; +class HTMLLinkElementSizesAttributeTest : public testing::Test {}; TEST(HTMLLinkElementSizesAttributeTest, setSizesPropertyValue_updatesAttribute) {
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElementTest.cpp index 0be893e..47ede815 100644 --- a/third_party/WebKit/Source/core/html/HTMLSlotElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSlotElementTest.cpp
@@ -16,7 +16,7 @@ using Backtrack = std::pair<size_t, size_t>; } -class HTMLSlotElementTest : public ::testing::Test { +class HTMLSlotElementTest : public testing::Test { protected: HTMLSlotElementTest() = default; Seq LongestCommonSubsequence(const Seq& seq1, const Seq& seq2);
diff --git a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp index 985e38c4..fc17d3f8 100644 --- a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp +++ b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
@@ -71,7 +71,7 @@ float scale_factor_; }; -class ImageDocumentTest : public ::testing::Test { +class ImageDocumentTest : public testing::Test { protected: void TearDown() override { ThreadState::Current()->CollectAllGarbage(); }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp index d3dc575..1179f41 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
@@ -175,7 +175,7 @@ AsyncBlobCreator()->ScheduleAsyncBlobCreation(true); test::EnterRunLoop(); - ::testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); + testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); EXPECT_EQ(IdleTaskStatus::kIdleTaskSwitchedToImmediateTask, AsyncBlobCreator()->GetIdleTaskStatus()); } @@ -193,7 +193,7 @@ AsyncBlobCreator()->ScheduleAsyncBlobCreation(true); test::EnterRunLoop(); - ::testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); + testing::Mock::VerifyAndClearExpectations(AsyncBlobCreator()); EXPECT_EQ(IdleTaskStatus::kIdleTaskSwitchedToImmediateTask, AsyncBlobCreator()->GetIdleTaskStatus()); }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp index b28c0bf..a974a27c 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
@@ -15,7 +15,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/mojom/page/page_visibility_state.mojom-blink.h" -using ::testing::Mock; +using testing::Mock; namespace blink {
diff --git a/third_party/WebKit/Source/core/html/canvas/ImageDataTest.cpp b/third_party/WebKit/Source/core/html/canvas/ImageDataTest.cpp index 4fb9b3e..6c2ad78 100644 --- a/third_party/WebKit/Source/core/html/canvas/ImageDataTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/ImageDataTest.cpp
@@ -15,7 +15,7 @@ namespace blink { namespace { -class ImageDataTest : public ::testing::Test {}; +class ImageDataTest : public testing::Test {}; // Under asan_clang_phone, the test crashes after the memory allocation // is not successful. It is probably related to the value of
diff --git a/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp index 235ded4..06cf218 100644 --- a/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp
@@ -91,7 +91,7 @@ MockWebExternalPopupMenu mock_web_external_popup_menu_; }; -class ExternalPopupMenuTest : public ::testing::Test { +class ExternalPopupMenuTest : public testing::Test { public: ExternalPopupMenuTest() : base_url_("http://www.test.com") {}
diff --git a/third_party/WebKit/Source/core/html/forms/OptionListTest.cpp b/third_party/WebKit/Source/core/html/forms/OptionListTest.cpp index 7f44110..14c1a12 100644 --- a/third_party/WebKit/Source/core/html/forms/OptionListTest.cpp +++ b/third_party/WebKit/Source/core/html/forms/OptionListTest.cpp
@@ -19,7 +19,7 @@ } // namespace -class OptionListTest : public ::testing::Test { +class OptionListTest : public testing::Test { protected: void SetUp() override { HTMLDocument* document = HTMLDocument::CreateForTest();
diff --git a/third_party/WebKit/Source/core/html/forms/TextControlElementTest.cpp b/third_party/WebKit/Source/core/html/forms/TextControlElementTest.cpp index 1ee4ae3..41b46735 100644 --- a/third_party/WebKit/Source/core/html/forms/TextControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/forms/TextControlElementTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class TextControlElementTest : public ::testing::Test { +class TextControlElementTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelperTest.cpp b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelperTest.cpp index 18d5096..659b224 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelperTest.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelperTest.cpp
@@ -15,7 +15,7 @@ namespace blink { -using ::testing::Invoke; +using testing::Invoke; class MockAutoplayUmaHelper : public AutoplayUmaHelper { public: @@ -54,7 +54,7 @@ HTMLMediaElement& element = MediaElement(); uma_helper_ = new MockAutoplayUmaHelper(&element); element.autoplay_policy_->autoplay_uma_helper_ = uma_helper_; - ::testing::Mock::AllowLeak(&UmaHelper()); + testing::Mock::AllowLeak(&UmaHelper()); } void TearDown() override { uma_helper_.Clear(); } @@ -69,7 +69,7 @@ UmaHelper().OnAutoplayInitiated(AutoplaySource::kMethod); UmaHelper().HandlePlayingEvent(); PageTestBase::TearDown(); - ::testing::Mock::VerifyAndClear(&UmaHelper()); + testing::Mock::VerifyAndClear(&UmaHelper()); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/media/HTMLMediaElementEventListenersTest.cpp b/third_party/WebKit/Source/core/html/media/HTMLMediaElementEventListenersTest.cpp index 9c40c08..ee3925f 100644 --- a/third_party/WebKit/Source/core/html/media/HTMLMediaElementEventListenersTest.cpp +++ b/third_party/WebKit/Source/core/html/media/HTMLMediaElementEventListenersTest.cpp
@@ -92,10 +92,10 @@ } }; -using ::testing::_; -using ::testing::AtLeast; -using ::testing::Invoke; -using ::testing::Return; +using testing::_; +using testing::AtLeast; +using testing::Invoke; +using testing::Return; } // anonymous namespace @@ -273,7 +273,7 @@ }; TEST_F(HTMLMediaElementWithMockSchedulerTest, OneTimeupdatePerSeek) { - ::testing::InSequence dummy; + testing::InSequence dummy; GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); // Set a src to trigger WebMediaPlayer creation. @@ -322,7 +322,7 @@ } TEST_F(HTMLMediaElementWithMockSchedulerTest, PeriodicTimeupdateAfterSeek) { - ::testing::InSequence dummy; + testing::InSequence dummy; GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); // Set a src to trigger WebMediaPlayer creation.
diff --git a/third_party/WebKit/Source/core/html/media/HTMLMediaElementTest.cpp b/third_party/WebKit/Source/core/html/media/HTMLMediaElementTest.cpp index 87890f5..9c643fa40 100644 --- a/third_party/WebKit/Source/core/html/media/HTMLMediaElementTest.cpp +++ b/third_party/WebKit/Source/core/html/media/HTMLMediaElementTest.cpp
@@ -16,7 +16,7 @@ enum class MediaTestParam { kAudio, kVideo }; -class HTMLMediaElementTest : public ::testing::TestWithParam<MediaTestParam> { +class HTMLMediaElementTest : public testing::TestWithParam<MediaTestParam> { protected: void SetUp() override { dummy_page_holder_ = DummyPageHolder::Create(); @@ -42,10 +42,10 @@ INSTANTIATE_TEST_CASE_P(Audio, HTMLMediaElementTest, - ::testing::Values(MediaTestParam::kAudio)); + testing::Values(MediaTestParam::kAudio)); INSTANTIATE_TEST_CASE_P(Video, HTMLMediaElementTest, - ::testing::Values(MediaTestParam::kVideo)); + testing::Values(MediaTestParam::kVideo)); TEST_P(HTMLMediaElementTest, effectiveMediaVolume) { struct TestData {
diff --git a/third_party/WebKit/Source/core/html/media/HTMLVideoElementPersistentTest.cpp b/third_party/WebKit/Source/core/html/media/HTMLVideoElementPersistentTest.cpp index 33ff9b9..5004a34 100644 --- a/third_party/WebKit/Source/core/html/media/HTMLVideoElementPersistentTest.cpp +++ b/third_party/WebKit/Source/core/html/media/HTMLVideoElementPersistentTest.cpp
@@ -26,8 +26,8 @@ MOCK_METHOD1(ExitFullscreen, void(LocalFrame&)); }; -using ::testing::_; -using ::testing::Sequence; +using testing::_; +using testing::Sequence; } // anonymous namespace
diff --git a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp index c088c1a2..d854602 100644 --- a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp +++ b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp
@@ -24,7 +24,7 @@ } // anonymous namespace class MediaCustomControlsFullscreenDetectorTest - : public ::testing::Test, + : public testing::Test, private ScopedVideoFullscreenDetectionForTest { public: MediaCustomControlsFullscreenDetectorTest()
diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp index 53372d0..b49576f 100644 --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp
@@ -68,7 +68,7 @@ Vector<ReferrerPolicy> preload_referrer_policies_; }; -class CSSPreloadScannerTest : public ::testing::Test {}; +class CSSPreloadScannerTest : public testing::Test {}; } // namespace
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParserLoadingTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParserLoadingTest.cpp index f10c23d4..2cc605a 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParserLoadingTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParserLoadingTest.cpp
@@ -24,9 +24,8 @@ HistogramTester histogram_; }; -class HTMLDocumentParserLoadingTest - : public HTMLDocumentParserSimTest, - public ::testing::WithParamInterface<bool> { +class HTMLDocumentParserLoadingTest : public HTMLDocumentParserSimTest, + public testing::WithParamInterface<bool> { protected: HTMLDocumentParserLoadingTest() { Document::SetThreadedParsingEnabledForTesting(GetParam()); @@ -35,10 +34,10 @@ INSTANTIATE_TEST_CASE_P(Threaded, HTMLDocumentParserLoadingTest, - ::testing::Values(true)); + testing::Values(true)); INSTANTIATE_TEST_CASE_P(NotThreaded, HTMLDocumentParserLoadingTest, - ::testing::Values(false)); + testing::Values(false)); TEST_P(HTMLDocumentParserLoadingTest, ShouldNotPauseParsingForExternalStylesheetsInHead) {
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapTest.cpp index b5076dd..0e89c22f 100644 --- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapTest.cpp +++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapTest.cpp
@@ -59,7 +59,7 @@ class ExceptionState; -class ImageBitmapTest : public ::testing::Test { +class ImageBitmapTest : public testing::Test { protected: virtual void SetUp() { sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(10, 10);
diff --git a/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp b/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp index 5594699..7c12058 100644 --- a/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp +++ b/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp
@@ -41,7 +41,7 @@ int virtual_keyboard_request_count_; }; -class ImeOnFocusTest : public ::testing::Test { +class ImeOnFocusTest : public testing::Test { public: ImeOnFocusTest() : base_url_("http://www.test.com/") {}
diff --git a/third_party/WebKit/Source/core/input/TouchActionTest.cpp b/third_party/WebKit/Source/core/input/TouchActionTest.cpp index f2d217c3..74266a6 100644 --- a/third_party/WebKit/Source/core/input/TouchActionTest.cpp +++ b/third_party/WebKit/Source/core/input/TouchActionTest.cpp
@@ -90,7 +90,7 @@ TouchAction action_; }; -class TouchActionTest : public ::testing::Test { +class TouchActionTest : public testing::Test { public: TouchActionTest() : base_url_("http://www.test.com/") { URLTestHelpers::RegisterMockedURLLoadFromBase(
diff --git a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h index 42ea0b7..0690ec0 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h
@@ -10,7 +10,7 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Emulation.h" #include "core/loader/FrameLoaderTypes.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/wtf/Optional.h" #include "platform/wtf/Time.h"
diff --git a/third_party/WebKit/Source/core/layout/CollapsedBorderValueTest.cpp b/third_party/WebKit/Source/core/layout/CollapsedBorderValueTest.cpp index 7ed70df..ca6c92b0 100644 --- a/third_party/WebKit/Source/core/layout/CollapsedBorderValueTest.cpp +++ b/third_party/WebKit/Source/core/layout/CollapsedBorderValueTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class CollapsedBorderValueTest : public ::testing::Test { +class CollapsedBorderValueTest : public testing::Test { protected: void ExpectInvisible(const CollapsedBorderValue& v, unsigned expected_width = 0) {
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index a3fcb10..5b7fd6f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -655,19 +655,11 @@ LayoutBox* parent_box = nullptr; - bool restricted_by_line_clamp = false; - if (ContainingBlock()) { + if (ContainingBlock()) parent_box = ContainingBlock(); - restricted_by_line_clamp = ContainingBlock()->Style()->HasLineClamp(); - } LayoutRect absolute_rect_for_parent; - if (!IsLayoutView() && HasOverflowClip() && !restricted_by_line_clamp) { - // Don't scroll to reveal an overflow layer that is restricted by the - // -webkit-line-clamp property. This will prevent us from revealing text - // hidden by the slider in Safari RSS. - // TODO(eae): We probably don't need this any more as we don't share any - // code with the Safari RSS reeder. + if (!IsLayoutView() && HasOverflowClip()) { absolute_rect_for_parent = GetScrollableArea()->ScrollIntoView(absolute_rect_to_scroll, params); } else if (!parent_box && CanBeProgramaticallyScrolled()) { @@ -1137,11 +1129,7 @@ if (delta.IsZero()) return; - bool restricted_by_line_clamp = false; - if (Parent()) - restricted_by_line_clamp = Parent()->Style()->HasLineClamp(); - - if (HasOverflowClip() && !restricted_by_line_clamp) { + if (HasOverflowClip()) { PaintLayerScrollableArea* scrollable_area = GetScrollableArea(); DCHECK(scrollable_area);
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMapTest.cpp b/third_party/WebKit/Source/core/layout/LayoutGeometryMapTest.cpp index ca021c0..3612ea1 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMapTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMapTest.cpp
@@ -50,8 +50,8 @@ typedef bool TestParamRootLayerScrolling; class LayoutGeometryMapTest - : public ::testing::Test, - public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::Test, + public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest { public: LayoutGeometryMapTest() @@ -171,7 +171,7 @@ const std::string base_url_; }; -INSTANTIATE_TEST_CASE_P(All, LayoutGeometryMapTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, LayoutGeometryMapTest, testing::Bool()); TEST_P(LayoutGeometryMapTest, SimpleGeometryMapTest) { RegisterMockedHttpURLLoad("rgm_test.html");
diff --git a/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp b/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp index 48c2e72..75472f5c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp
@@ -15,10 +15,9 @@ class LayoutInlineTest : public RenderingTest {}; // Helper class to run the same test code with and without LayoutNG -class ParameterizedLayoutInlineTest - : public ::testing::WithParamInterface<bool>, - private ScopedLayoutNGForTest, - public LayoutInlineTest { +class ParameterizedLayoutInlineTest : public testing::WithParamInterface<bool>, + private ScopedLayoutNGForTest, + public LayoutInlineTest { public: ParameterizedLayoutInlineTest() : ScopedLayoutNGForTest(GetParam()) {} @@ -26,7 +25,7 @@ bool LayoutNGEnabled() const { return GetParam(); } }; -INSTANTIATE_TEST_CASE_P(All, ParameterizedLayoutInlineTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedLayoutInlineTest, testing::Bool()); TEST_P(ParameterizedLayoutInlineTest, LinesBoundingBox) { LoadAhem();
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp index 422a35d8..fc9dc71b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
@@ -17,7 +17,7 @@ namespace blink { -using ::testing::Return; +using testing::Return; class LayoutObjectTest : public RenderingTest { public:
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextFragmentTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTextFragmentTest.cpp index 5c74ce1..7d6e825 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTextFragmentTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTextFragmentTest.cpp
@@ -43,7 +43,7 @@ // Helper class to run the same test code with and without LayoutNG class ParameterizedLayoutTextFragmentTest - : public ::testing::WithParamInterface<bool>, + : public testing::WithParamInterface<bool>, private ScopedLayoutNGForTest, public LayoutTextFragmentTest { public: @@ -55,7 +55,7 @@ INSTANTIATE_TEST_CASE_P(All, ParameterizedLayoutTextFragmentTest, - ::testing::Bool()); + testing::Bool()); TEST_P(ParameterizedLayoutTextFragmentTest, Basics) { SetBasicBody("foo");
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp index a41fe46c..a3cd1fb 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp
@@ -38,7 +38,7 @@ const char kTacoText[] = "Los Compadres Taco Truck"; // Helper class to run the same test code with and without LayoutNG -class ParameterizedLayoutTextTest : public ::testing::WithParamInterface<bool>, +class ParameterizedLayoutTextTest : public testing::WithParamInterface<bool>, private ScopedLayoutNGForTest, public LayoutTextTest { public: @@ -48,7 +48,7 @@ bool LayoutNGEnabled() const { return GetParam(); } }; -INSTANTIATE_TEST_CASE_P(All, ParameterizedLayoutTextTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedLayoutTextTest, testing::Bool()); } // namespace @@ -175,14 +175,14 @@ class MapDOMOffsetToTextContentOffset : public LayoutTextTest, private ScopedLayoutNGForTest, - public ::testing::WithParamInterface<NGOffsetMappingTestData> { + public testing::WithParamInterface<NGOffsetMappingTestData> { public: MapDOMOffsetToTextContentOffset() : ScopedLayoutNGForTest(true) {} }; INSTANTIATE_TEST_CASE_P(LayoutTextTest, MapDOMOffsetToTextContentOffset, - ::testing::ValuesIn(offset_mapping_test_data)); + testing::ValuesIn(offset_mapping_test_data)); TEST_P(MapDOMOffsetToTextContentOffset, Basic) { const auto data = GetParam(); @@ -443,8 +443,8 @@ LayoutText* layout_text = GetLayoutTextById("target"); Vector<IntRect> rects; layout_text->AbsoluteRects(rects, {LayoutUnit(100), LayoutUnit(200)}); - EXPECT_THAT(rects, ::testing::ElementsAre(IntRect(130, 200, 30, 10), - IntRect(100, 210, 20, 10))); + EXPECT_THAT(rects, testing::ElementsAre(IntRect(130, 200, 30, 10), + IntRect(100, 210, 20, 10))); } TEST_P(ParameterizedLayoutTextTest, AbsoluteRectsVRL) { @@ -463,8 +463,8 @@ LayoutText* layout_text = GetLayoutTextById("target"); Vector<IntRect> rects; layout_text->AbsoluteRects(rects, {LayoutUnit(100), LayoutUnit(200)}); - EXPECT_THAT(rects, ::testing::ElementsAre(IntRect(100, 230, 10, 30), - IntRect(110, 200, 10, 20))); + EXPECT_THAT(rects, testing::ElementsAre(IntRect(100, 230, 10, 30), + IntRect(110, 200, 10, 20))); } TEST_P(ParameterizedLayoutTextTest, LinesBoundingBox) {
diff --git a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp index 7a5b0a3..325e6fd 100644 --- a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp +++ b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
@@ -13,7 +13,7 @@ typedef bool TestParamRootLayerScrolling; class MapCoordinatesTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public RenderingTest { public: @@ -113,7 +113,7 @@ return transform_state.LastPlanarQuad(); } -INSTANTIATE_TEST_CASE_P(All, MapCoordinatesTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, MapCoordinatesTest, testing::Bool()); TEST_P(MapCoordinatesTest, SimpleText) { SetBodyInnerHTML("<div id='container'><br>text</div>");
diff --git a/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp b/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp index 95ad342..e1dd6f0 100644 --- a/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp +++ b/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp
@@ -44,7 +44,7 @@ return LayoutRect(0, 0, 100, 100); } -class SimpleOverflowModelTest : public ::testing::Test { +class SimpleOverflowModelTest : public testing::Test { protected: SimpleOverflowModelTest() : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {} @@ -111,7 +111,7 @@ EXPECT_EQ(LayoutRect(500, 100, 100, 100), overflow_.VisualOverflowRect()); } -class BoxOverflowModelTest : public ::testing::Test { +class BoxOverflowModelTest : public testing::Test { protected: BoxOverflowModelTest() : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {}
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp index 3d4edab..8c4f1502c 100644 --- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
@@ -20,7 +20,7 @@ typedef bool TestParamRootLayerScrolling; class ScrollAnchorTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, private ScopedScrollAnchoringForTest, public RenderingTest { @@ -87,7 +87,7 @@ std::unique_ptr<ScopedScrollAnchoringForTest> scroll_anchoring_; }; -INSTANTIATE_TEST_CASE_P(All, ScrollAnchorTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollAnchorTest, testing::Bool()); // TODO(ymalik): Currently, this should be the first test in the file to avoid // failure when running with other tests. Dig into this more and fix.
diff --git a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp index cff8144c..a7b65978 100644 --- a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp
@@ -30,7 +30,7 @@ namespace { -class ScrollbarsTest : public ::testing::WithParamInterface<bool>, +class ScrollbarsTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { public: @@ -130,8 +130,8 @@ } }; -INSTANTIATE_TEST_CASE_P(All, ScrollbarsTest, ::testing::Bool()); -INSTANTIATE_TEST_CASE_P(All, ScrollbarsTestWithVirtualTimer, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollbarsTest, testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollbarsTestWithVirtualTimer, testing::Bool()); TEST_P(ScrollbarsTest, DocumentStyleRecalcPreservesScrollbars) { v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); @@ -1265,7 +1265,7 @@ typedef bool TestParamOverlayScrollbar; class ScrollbarAppearanceTest : public SimTest, - public ::testing::WithParamInterface<TestParamOverlayScrollbar> { + public testing::WithParamInterface<TestParamOverlayScrollbar> { public: // Use real scrollbars to ensure we're testing the real ScrollbarThemes. ScrollbarAppearanceTest() : mock_scrollbars_(false, GetParam()) {} @@ -1309,7 +1309,7 @@ }; // Test both overlay and non-overlay scrollbars. -INSTANTIATE_TEST_CASE_P(All, ScrollbarAppearanceTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollbarAppearanceTest, testing::Bool()); // Make sure native scrollbar can change by Emulator. // Disable on Android since Android always enable OverlayScrollbar. @@ -1879,7 +1879,7 @@ LayoutScrollbarPart* vertical_track_ = nullptr; }; -INSTANTIATE_TEST_CASE_P(All, ScrollbarTrackMarginsTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollbarTrackMarginsTest, testing::Bool()); TEST_P(ScrollbarTrackMarginsTest, CustomScrollbarFractionalMarginsWillNotCauseDCHECKFailure) {
diff --git a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp index bb92f989..9596446 100644 --- a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp +++ b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
@@ -102,10 +102,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - VisualRectMappingTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + VisualRectMappingTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(VisualRectMappingTest, LayoutText) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/layout/custom/CustomLayoutChild.h b/third_party/WebKit/Source/core/layout/custom/CustomLayoutChild.h index 9bee972..b90e062f 100644 --- a/third_party/WebKit/Source/core/layout/custom/CustomLayoutChild.h +++ b/third_party/WebKit/Source/core/layout/custom/CustomLayoutChild.h
@@ -23,7 +23,6 @@ // The represent all inflow children, out-of-flow children (fixed/absolute) do // not appear in the children list. class CustomLayoutChild : public ScriptWrappable { - WTF_MAKE_NONCOPYABLE(CustomLayoutChild); DEFINE_WRAPPERTYPEINFO(); public: @@ -51,6 +50,8 @@ private: LayoutBox* box_; Member<PrepopulatedComputedStylePropertyMap> style_map_; + + DISALLOW_COPY_AND_ASSIGN(CustomLayoutChild); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/custom/CustomLayoutConstraints.h b/third_party/WebKit/Source/core/layout/custom/CustomLayoutConstraints.h index 10b758c..66fe65d 100644 --- a/third_party/WebKit/Source/core/layout/custom/CustomLayoutConstraints.h +++ b/third_party/WebKit/Source/core/layout/custom/CustomLayoutConstraints.h
@@ -13,7 +13,6 @@ // Represents the constraints given to the layout by the parent that isn't // encapsulated by the style, or edges. class CustomLayoutConstraints : public ScriptWrappable { - WTF_MAKE_NONCOPYABLE(CustomLayoutConstraints); DEFINE_WRAPPERTYPEINFO(); public: @@ -26,6 +25,8 @@ private: double fixed_inline_size_; + + DISALLOW_COPY_AND_ASSIGN(CustomLayoutConstraints); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragment.h b/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragment.h index db779b15..4a792a2 100644 --- a/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragment.h +++ b/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragment.h
@@ -25,7 +25,6 @@ // This should eventually mirror the information in a NGFragment, it has the // additional capability that it is exposed to web developers. class CustomLayoutFragment : public ScriptWrappable { - WTF_MAKE_NONCOPYABLE(CustomLayoutFragment); DEFINE_WRAPPERTYPEINFO(); public: @@ -69,6 +68,8 @@ // The offset is relative to our parent, and in the parent's writing mode. double inline_offset_ = 0; double block_offset_ = 0; + + DISALLOW_COPY_AND_ASSIGN(CustomLayoutFragment); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragmentRequest.h b/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragmentRequest.h index c6f8bf2..c711f94 100644 --- a/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragmentRequest.h +++ b/third_party/WebKit/Source/core/layout/custom/CustomLayoutFragmentRequest.h
@@ -18,7 +18,6 @@ // This represents a request to perform layout on a child. It is an opaque // object from the web developers point of view. class CustomLayoutFragmentRequest : public ScriptWrappable { - WTF_MAKE_NONCOPYABLE(CustomLayoutFragmentRequest); DEFINE_WRAPPERTYPEINFO(); public: @@ -39,6 +38,8 @@ private: Member<CustomLayoutChild> child_; const CustomLayoutConstraintsOptions options_; + + DISALLOW_COPY_AND_ASSIGN(CustomLayoutFragmentRequest); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/custom/LayoutWorklet.h b/third_party/WebKit/Source/core/layout/custom/LayoutWorklet.h index 9aacf34..f8a4fe8 100644 --- a/third_party/WebKit/Source/core/layout/custom/LayoutWorklet.h +++ b/third_party/WebKit/Source/core/layout/custom/LayoutWorklet.h
@@ -26,7 +26,6 @@ class CORE_EXPORT LayoutWorklet : public Worklet, public Supplement<LocalDOMWindow> { USING_GARBAGE_COLLECTED_MIXIN(LayoutWorklet); - WTF_MAKE_NONCOPYABLE(LayoutWorklet); public: static const char kSupplementName[]; @@ -64,6 +63,8 @@ DocumentDefinitionMap document_definition_map_; Member<PendingLayoutRegistry> pending_layout_registry_; + + DISALLOW_COPY_AND_ASSIGN(LayoutWorklet); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/custom/PendingLayoutRegistry.h b/third_party/WebKit/Source/core/layout/custom/PendingLayoutRegistry.h index 6ea69d0..a2bd2cf 100644 --- a/third_party/WebKit/Source/core/layout/custom/PendingLayoutRegistry.h +++ b/third_party/WebKit/Source/core/layout/custom/PendingLayoutRegistry.h
@@ -18,8 +18,6 @@ // re-attached when a custom layout is registered. This is primarily owned by // the LayoutWorklet instance. class PendingLayoutRegistry : public GarbageCollected<PendingLayoutRegistry> { - WTF_MAKE_NONCOPYABLE(PendingLayoutRegistry); - public: PendingLayoutRegistry() = default; @@ -40,6 +38,8 @@ using PendingSet = HeapHashSet<WeakMember<Node>>; using PendingLayoutMap = HeapHashMap<AtomicString, Member<PendingSet>>; PendingLayoutMap pending_layouts_; + + DISALLOW_COPY_AND_ASSIGN(PendingLayoutRegistry); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect_test.cc b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect_test.cc index ab80d1bf..da2369ab 100644 --- a/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect_test.cc
@@ -38,12 +38,12 @@ } class NGLogicalRectUniteTest - : public ::testing::Test, - public ::testing::WithParamInterface<LogicalRectUniteTestData> {}; + : public testing::Test, + public testing::WithParamInterface<LogicalRectUniteTestData> {}; INSTANTIATE_TEST_CASE_P(NGGeometryUnitsTest, NGLogicalRectUniteTest, - ::testing::ValuesIn(logical_rect_unite_test_data)); + testing::ValuesIn(logical_rect_unite_test_data)); TEST_P(NGLogicalRectUniteTest, Data) { const auto& data = GetParam();
diff --git a/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset_rect_test.cc b/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset_rect_test.cc index 02ca7160..eb316230 100644 --- a/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset_rect_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset_rect_test.cc
@@ -38,13 +38,13 @@ } class NGPhysicalOffsetRectUniteTest - : public ::testing::Test, - public ::testing::WithParamInterface<PhysicalOffsetRectUniteTestData> {}; + : public testing::Test, + public testing::WithParamInterface<PhysicalOffsetRectUniteTestData> {}; INSTANTIATE_TEST_CASE_P( NGGeometryUnitsTest, NGPhysicalOffsetRectUniteTest, - ::testing::ValuesIn(physical_offset_rect_unite_test_data)); + testing::ValuesIn(physical_offset_rect_unite_test_data)); TEST_P(NGPhysicalOffsetRectUniteTest, Data) { const auto& data = GetParam();
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder_test.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder_test.cc index 270f30b..613b09e 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder_test.cc
@@ -47,7 +47,7 @@ return result.ToString(); } -class NGInlineItemsBuilderTest : public ::testing::Test { +class NGInlineItemsBuilderTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::Create(); } @@ -402,13 +402,13 @@ } class CollapsibleSpaceTest : public NGInlineItemsBuilderTest, - public ::testing::WithParamInterface<UChar> {}; + public testing::WithParamInterface<UChar> {}; INSTANTIATE_TEST_CASE_P(NGInlineItemsBuilderTest, CollapsibleSpaceTest, - ::testing::Values(kSpaceCharacter, - kTabulationCharacter, - kNewlineCharacter)); + testing::Values(kSpaceCharacter, + kTabulationCharacter, + kNewlineCharacter)); TEST_P(CollapsibleSpaceTest, CollapsedSpaceAfterNoWrap) { UChar space = GetParam();
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc index b5bffb48..e8a086a 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc
@@ -89,15 +89,13 @@ // TODO(layout-dev): Remove this unused parameterization. class ParameterizedNGOffsetMappingTest - : public ::testing::WithParamInterface<bool>, + : public testing::WithParamInterface<bool>, public NGOffsetMappingTest { public: ParameterizedNGOffsetMappingTest() {} }; -INSTANTIATE_TEST_CASE_P(All, - ParameterizedNGOffsetMappingTest, - ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ParameterizedNGOffsetMappingTest, testing::Bool()); #define TEST_UNIT(unit, type, owner, dom_start, dom_end, text_content_start, \ text_content_end) \
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils_test.cc index 8418397..245ffcd 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils_test.cc
@@ -15,7 +15,7 @@ #define NGAuto LayoutUnit(-1) -class NGAbsoluteUtilsTest : public ::testing::Test { +class NGAbsoluteUtilsTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::Create();
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.h b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.h index b6611a80..1e09eb0 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.h
@@ -23,7 +23,7 @@ // Base class for all LayoutNG Algorithms unit test classes. typedef bool TestParamLayoutNG; class NGBaseLayoutAlgorithmTest - : public ::testing::WithParamInterface<TestParamLayoutNG>, + : public testing::WithParamInterface<TestParamLayoutNG>, public NGLayoutTest { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc index 958bc53..a759421 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -24,8 +24,8 @@ namespace blink { namespace { -using ::testing::ElementsAre; -using ::testing::Pointee; +using testing::ElementsAre; +using testing::Pointee; class NGBlockLayoutAlgorithmTest : public NGBaseLayoutAlgorithmTest { protected:
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc index b20a1f6..bb4f44c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
@@ -16,7 +16,7 @@ namespace blink { namespace { -class NGLengthUtilsTest : public ::testing::Test { +class NGLengthUtilsTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::Create(); }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_relative_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_relative_utils_test.cc index 264e0010..c02c69c1f 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_relative_utils_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_relative_utils_test.cc
@@ -20,7 +20,7 @@ const LayoutUnit kAuto{-1}; const LayoutUnit kZero{0}; -class NGRelativeUtilsTest : public ::testing::Test { +class NGRelativeUtilsTest : public testing::Test { protected: void SetUp() override { style_ = ComputedStyle::Create();
diff --git a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp index 4a7bd21..0821a9c 100644 --- a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
@@ -35,7 +35,7 @@ namespace blink { -class BoxShapeTest : public ::testing::Test { +class BoxShapeTest : public testing::Test { protected: BoxShapeTest() = default;
diff --git a/third_party/WebKit/Source/core/loader/AllowedByNosniffTest.cpp b/third_party/WebKit/Source/core/loader/AllowedByNosniffTest.cpp index 88040e5..58ef1085 100644 --- a/third_party/WebKit/Source/core/loader/AllowedByNosniffTest.cpp +++ b/third_party/WebKit/Source/core/loader/AllowedByNosniffTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class AllowedByNosniffTest : public ::testing::Test { +class AllowedByNosniffTest : public testing::Test { public: void SetUp() override { // Create a new dummy page holder for each test, so that we get a fresh @@ -82,7 +82,7 @@ }; for (auto& testcase : data) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "\n mime type: " << testcase.mimetype << "\n allowed: " << (testcase.allowed ? "true" : "false")); @@ -129,10 +129,10 @@ for (auto& testcase : data) { SetUp(); - SCOPED_TRACE(::testing::Message() - << "\n url: " << testcase.url << "\n origin: " - << testcase.origin << "\n mime type: " << testcase.mimetype - << "\n webfeature: " << testcase.expected); + SCOPED_TRACE(testing::Message() << "\n url: " << testcase.url + << "\n origin: " << testcase.origin + << "\n mime type: " << testcase.mimetype + << "\n webfeature: " << testcase.expected); doc()->SetSecurityOrigin(SecurityOrigin::Create(KURL(testcase.origin))); ResourceResponse response(KURL(testcase.url)); response.SetHTTPHeaderField("Content-Type", testcase.mimetype);
diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp index daf66cf..7cd16e060c 100644 --- a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp
@@ -107,7 +107,7 @@ bool is_detached_ = false; }; -class BaseFetchContextTest : public ::testing::Test { +class BaseFetchContextTest : public testing::Test { protected: void SetUp() override { execution_context_ = new NullExecutionContext();
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp index 4bf3b31..4309009 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class DocumentLoadTimingTest : public ::testing::Test {}; +class DocumentLoadTimingTest : public testing::Test {}; TEST_F(DocumentLoadTimingTest, ensureValidNavigationStartAfterEmbedder) { std::unique_ptr<DummyPageHolder> dummy_page = DummyPageHolder::Create();
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoaderTest.cpp b/third_party/WebKit/Source/core/loader/DocumentLoaderTest.cpp index 159fab4..dfe9c2a 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoaderTest.cpp
@@ -20,7 +20,7 @@ // TODO(dcheng): Ideally, enough of FrameTestHelpers would be in core/ that // placing a test for a core/ class in web/ wouldn't be necessary. -class DocumentLoaderTest : public ::testing::Test { +class DocumentLoaderTest : public testing::Test { protected: void SetUp() override { web_view_helper_.Initialize();
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp index 87c824e6..a7c3bf9 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -68,7 +68,7 @@ namespace blink { -using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; +using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; class StubLocalFrameClientWithParent final : public EmptyLocalFrameClient { public: @@ -132,7 +132,7 @@ bool is_associated_with_ad_subframe_; }; -class FrameFetchContextTest : public ::testing::Test { +class FrameFetchContextTest : public testing::Test { protected: void SetUp() override { RecreateFetchContext(); } @@ -274,7 +274,7 @@ http_url = KURL("http://example.test/foo"); main_resource_url = KURL("https://example.test"); different_host_url = KURL("https://different.example.test/foo"); - client = new ::testing::NiceMock<FrameFetchContextMockLocalFrameClient>(); + client = new testing::NiceMock<FrameFetchContextMockLocalFrameClient>(); dummy_page_holder = DummyPageHolder::Create(IntSize(500, 500), nullptr, client); dummy_page_holder->GetPage().SetDeviceScaleFactorDeprecated(1.0); @@ -291,7 +291,7 @@ KURL main_resource_url; KURL different_host_url; - Persistent<::testing::NiceMock<FrameFetchContextMockLocalFrameClient>> client; + Persistent<testing::NiceMock<FrameFetchContextMockLocalFrameClient>> client; }; class FrameFetchContextModifyRequestTest : public FrameFetchContextTest { @@ -972,8 +972,8 @@ int index = 0; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << index++ << " " << test.document_url - << " => " << test.serialized_origin); + SCOPED_TRACE(testing::Message() << index++ << " " << test.document_url + << " => " << test.serialized_origin); // Set up a new document to ensure sandbox flags are cleared: dummy_page_holder = DummyPageHolder::Create(IntSize(500, 500)); dummy_page_holder->GetPage().SetDeviceScaleFactorDeprecated(1.0); @@ -1130,16 +1130,16 @@ resource_request.SetFetchCredentialsMode( network::mojom::FetchCredentialsMode::kOmit); Resource* resource = MockResource::Create(resource_request); - EXPECT_CALL(*client, - DispatchDidLoadResourceFromMemoryCache( - ::testing::AllOf( - ::testing::Property(&ResourceRequest::Url, url), - ::testing::Property( - &ResourceRequest::GetFrameType, - network::mojom::RequestContextFrameType::kNone), - ::testing::Property(&ResourceRequest::GetRequestContext, - WebURLRequest::kRequestContextImage)), - ResourceResponse())); + EXPECT_CALL( + *client, + DispatchDidLoadResourceFromMemoryCache( + testing::AllOf( + testing::Property(&ResourceRequest::Url, url), + testing::Property(&ResourceRequest::GetFrameType, + network::mojom::RequestContextFrameType::kNone), + testing::Property(&ResourceRequest::GetRequestContext, + WebURLRequest::kRequestContextImage)), + ResourceResponse())); fetch_context->DispatchDidLoadResourceFromMemoryCache( CreateUniqueIdentifier(), resource_request, resource->GetResponse()); } @@ -1359,7 +1359,7 @@ Checkpoint checkpoint; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*client, UserAgent()).WillOnce(::testing::Return(String("hi"))); + EXPECT_CALL(*client, UserAgent()).WillOnce(testing::Return(String("hi"))); EXPECT_CALL(checkpoint, Call(2)); checkpoint.Call(1); @@ -1633,7 +1633,7 @@ ClientLoFiInterventionHeader) { // Verify header not added if Lo-Fi not active. EXPECT_CALL(*client, GetPreviewsStateForFrame()) - .WillRepeatedly(::testing::Return(WebURLRequest::kPreviewsOff)); + .WillRepeatedly(testing::Return(WebURLRequest::kPreviewsOff)); ResourceRequest resource_request("http://www.example.com/style.css"); fetch_context->AddAdditionalRequestHeaders(resource_request, kFetchMainResource); @@ -1641,7 +1641,7 @@ // Verify header is added if Lo-Fi is active. EXPECT_CALL(*client, GetPreviewsStateForFrame()) - .WillRepeatedly(::testing::Return(WebURLRequest::kClientLoFiOn)); + .WillRepeatedly(testing::Return(WebURLRequest::kClientLoFiOn)); fetch_context->AddAdditionalRequestHeaders(resource_request, kFetchSubresource); EXPECT_EQ( @@ -1667,7 +1667,7 @@ NoScriptInterventionHeader) { // Verify header not added if NoScript not active. EXPECT_CALL(*client, GetPreviewsStateForFrame()) - .WillRepeatedly(::testing::Return(WebURLRequest::kPreviewsOff)); + .WillRepeatedly(testing::Return(WebURLRequest::kPreviewsOff)); ResourceRequest resource_request("http://www.example.com/style.css"); fetch_context->AddAdditionalRequestHeaders(resource_request, kFetchMainResource); @@ -1675,7 +1675,7 @@ // Verify header is added if NoScript is active. EXPECT_CALL(*client, GetPreviewsStateForFrame()) - .WillRepeatedly(::testing::Return(WebURLRequest::kNoScriptOn)); + .WillRepeatedly(testing::Return(WebURLRequest::kNoScriptOn)); fetch_context->AddAdditionalRequestHeaders(resource_request, kFetchSubresource); EXPECT_EQ(
diff --git a/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp b/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp index e7f7b7c..6fb1173 100644 --- a/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp +++ b/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp
@@ -40,7 +40,7 @@ TaskTiming(double start, double end) : start(start), end(end) {} }; -class InteractiveDetectorTest : public ::testing::Test { +class InteractiveDetectorTest : public testing::Test { public: InteractiveDetectorTest() { platform_->AdvanceClockSeconds(1);
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp index 0ffa595..77cb410 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -88,7 +88,7 @@ mutable bool is_cross_origin_ = false; }; -class LinkLoaderPreloadTestBase : public ::testing::Test { +class LinkLoaderPreloadTestBase : public testing::Test { public: struct Expectations { ResourceLoadPriority priority; @@ -179,7 +179,7 @@ class LinkLoaderPreloadTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<PreloadTestParams> {}; + public testing::WithParamInterface<PreloadTestParams> {}; TEST_P(LinkLoaderPreloadTest, Preload) { const auto& test_case = GetParam(); @@ -196,7 +196,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadTest, LinkLoaderPreloadTest, - ::testing::ValuesIn(kPreloadTestParams)); + testing::ValuesIn(kPreloadTestParams)); struct PreloadMimeTypeTestParams { const char* href; @@ -257,7 +257,7 @@ class LinkLoaderPreloadMimeTypeTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<PreloadMimeTypeTestParams> {}; + public testing::WithParamInterface<PreloadMimeTypeTestParams> {}; TEST_P(LinkLoaderPreloadMimeTypeTest, Preload) { const auto& test_case = GetParam(); @@ -274,7 +274,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadMimeTypeTest, LinkLoaderPreloadMimeTypeTest, - ::testing::ValuesIn(kPreloadMimeTypeTestParams)); + testing::ValuesIn(kPreloadMimeTypeTestParams)); struct PreloadMediaTestParams { const char* media; @@ -290,7 +290,7 @@ class LinkLoaderPreloadMediaTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<PreloadMediaTestParams> {}; + public testing::WithParamInterface<PreloadMediaTestParams> {}; TEST_P(LinkLoaderPreloadMediaTest, Preload) { const auto& test_case = GetParam(); @@ -308,7 +308,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadMediaTest, LinkLoaderPreloadMediaTest, - ::testing::ValuesIn(kPreloadMediaTestParams)); + testing::ValuesIn(kPreloadMediaTestParams)); constexpr ReferrerPolicy kPreloadReferrerPolicyTestParams[] = { kReferrerPolicyOrigin, @@ -320,7 +320,7 @@ class LinkLoaderPreloadReferrerPolicyTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<ReferrerPolicy> {}; + public testing::WithParamInterface<ReferrerPolicy> {}; TEST_P(LinkLoaderPreloadReferrerPolicyTest, Preload) { const ReferrerPolicy referrer_policy = GetParam(); @@ -336,7 +336,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadReferrerPolicyTest, LinkLoaderPreloadReferrerPolicyTest, - ::testing::ValuesIn(kPreloadReferrerPolicyTestParams)); + testing::ValuesIn(kPreloadReferrerPolicyTestParams)); struct PreloadNonceTestParams { const char* nonce; @@ -352,7 +352,7 @@ class LinkLoaderPreloadNonceTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<PreloadNonceTestParams> {}; + public testing::WithParamInterface<PreloadNonceTestParams> {}; TEST_P(LinkLoaderPreloadNonceTest, Preload) { const auto& test_case = GetParam(); @@ -375,7 +375,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadNonceTest, LinkLoaderPreloadNonceTest, - ::testing::ValuesIn(kPreloadNonceTestParams)); + testing::ValuesIn(kPreloadNonceTestParams)); struct PreloadSrcsetTestParams { const char* href; @@ -405,7 +405,7 @@ class LinkLoaderPreloadSrcsetTest : public LinkLoaderPreloadTestBase, - public ::testing::WithParamInterface<PreloadSrcsetTestParams> {}; + public testing::WithParamInterface<PreloadSrcsetTestParams> {}; TEST_P(LinkLoaderPreloadSrcsetTest, Preload) { const auto& test_case = GetParam(); @@ -425,7 +425,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadSrcsetTest, LinkLoaderPreloadSrcsetTest, - ::testing::ValuesIn(kPreloadSrcsetTestParams)); + testing::ValuesIn(kPreloadSrcsetTestParams)); struct ModulePreloadTestParams { const char* href; @@ -454,7 +454,7 @@ network::mojom::FetchCredentialsMode::kOmit}}; class LinkLoaderModulePreloadTest - : public ::testing::TestWithParam<ModulePreloadTestParams> {}; + : public testing::TestWithParam<ModulePreloadTestParams> {}; class ModulePreloadTestModulator final : public DummyModulator { public: @@ -509,7 +509,7 @@ INSTANTIATE_TEST_CASE_P(LinkLoaderModulePreloadTest, LinkLoaderModulePreloadTest, - ::testing::ValuesIn(kModulePreloadTestParams)); + testing::ValuesIn(kModulePreloadTestParams)); TEST(LinkLoaderTest, Prefetch) { struct TestCase {
diff --git a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp index 4f14f879..0fbeaa1 100644 --- a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp +++ b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
@@ -57,9 +57,9 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << "Origin: " << test.origin - << ", Target: " << test.target - << ", Expectation: " << test.expectation); + SCOPED_TRACE(testing::Message() + << "Origin: " << test.origin << ", Target: " << test.target + << ", Expectation: " << test.expectation); KURL origin_url(NullURL(), test.origin); scoped_refptr<const SecurityOrigin> security_origin( SecurityOrigin::Create(origin_url));
diff --git a/third_party/WebKit/Source/core/loader/ProgrammaticScrollTest.cpp b/third_party/WebKit/Source/core/loader/ProgrammaticScrollTest.cpp index bda7fc3..299e825 100644 --- a/third_party/WebKit/Source/core/loader/ProgrammaticScrollTest.cpp +++ b/third_party/WebKit/Source/core/loader/ProgrammaticScrollTest.cpp
@@ -25,7 +25,7 @@ namespace blink { -class ProgrammaticScrollTest : public ::testing::Test { +class ProgrammaticScrollTest : public testing::Test { public: ProgrammaticScrollTest() : base_url_("http://www.test.com/") {} @@ -106,14 +106,14 @@ EXPECT_EQ(400, web_view->MainFrameImpl()->GetScrollOffset().height); } -class ProgrammaticScrollSimTest : public ::testing::WithParamInterface<bool>, +class ProgrammaticScrollSimTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { public: ProgrammaticScrollSimTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, ProgrammaticScrollSimTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ProgrammaticScrollSimTest, testing::Bool()); TEST_P(ProgrammaticScrollSimTest, NavigateToHash) { WebView().Resize(WebSize(800, 600));
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp index c8c1193..6647966 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
@@ -46,12 +46,12 @@ namespace { -using ::testing::_; -using ::testing::InSequence; -using ::testing::InvokeWithoutArgs; -using ::testing::StrEq; -using ::testing::Truly; -using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; +using testing::_; +using testing::InSequence; +using testing::InvokeWithoutArgs; +using testing::StrEq; +using testing::Truly; +using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; constexpr char kFileName[] = "fox-null-terminated.html"; @@ -59,7 +59,7 @@ public: static std::unique_ptr<MockThreadableLoaderClient> Create() { return base::WrapUnique( - new ::testing::StrictMock<MockThreadableLoaderClient>); + new testing::StrictMock<MockThreadableLoaderClient>); } MOCK_METHOD2(DidSendData, void(unsigned long long, unsigned long long)); MOCK_METHOD3(DidReceiveResponseMock, @@ -437,7 +437,7 @@ }; class ThreadableLoaderTest - : public ::testing::TestWithParam<ThreadableLoaderToTest> { + : public testing::TestWithParam<ThreadableLoaderToTest> { public: ThreadableLoaderTest() { switch (GetParam()) { @@ -491,11 +491,11 @@ INSTANTIATE_TEST_CASE_P(Document, ThreadableLoaderTest, - ::testing::Values(kDocumentThreadableLoaderTest)); + testing::Values(kDocumentThreadableLoaderTest)); INSTANTIATE_TEST_CASE_P(Worker, ThreadableLoaderTest, - ::testing::Values(kWorkerThreadableLoaderTest)); + testing::Values(kWorkerThreadableLoaderTest)); TEST_P(ThreadableLoaderTest, StartAndStop) {}
diff --git a/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp b/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp index 1ceef1e..b21eb81 100644 --- a/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp +++ b/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp
@@ -26,7 +26,7 @@ namespace blink { -class FontResourceTest : public ::testing::Test { +class FontResourceTest : public testing::Test { void TearDown() override { Platform::Current() ->GetURLLoaderMockFactory()
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp index b1684619..d9f067a 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
@@ -507,7 +507,7 @@ static MockFinishObserver* Create() { return - new ::testing::StrictMock<MockFinishObserver>; + new testing::StrictMock<MockFinishObserver>; } MOCK_METHOD0(NotifyFinished, void()); String DebugName() const override { return "MockFinishObserver"; } @@ -620,7 +620,7 @@ } class ImageResourceReloadTest - : public ::testing::TestWithParam<bool>, + : public testing::TestWithParam<bool>, private ScopedClientPlaceholdersForServerLoFiForTest { public: ImageResourceReloadTest() @@ -952,7 +952,7 @@ INSTANTIATE_TEST_CASE_P(/* no prefix */, ImageResourceReloadTest, - ::testing::Bool()); + testing::Bool()); TEST(ImageResourceTest, SVGImage) { KURL url("http://127.0.0.1:8000/foo"); @@ -1932,7 +1932,7 @@ } // namespace -class ImageResourceCounterTest : public ::testing::Test { +class ImageResourceCounterTest : public testing::Test { public: ImageResourceCounterTest() = default; ~ImageResourceCounterTest() = default;
diff --git a/third_party/WebKit/Source/core/mojo/tests/JsToCppTest.cpp b/third_party/WebKit/Source/core/mojo/tests/JsToCppTest.cpp index fe1a073..6d303252 100644 --- a/third_party/WebKit/Source/core/mojo/tests/JsToCppTest.cpp +++ b/third_party/WebKit/Source/core/mojo/tests/JsToCppTest.cpp
@@ -371,7 +371,7 @@ bool termination_seen_; }; -class JsToCppTest : public ::testing::Test { +class JsToCppTest : public testing::Test { public: void RunTest(CppSideConnection* cpp_side) { js_to_cpp::blink::CppSidePtr cpp_side_ptr;
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp index c5c7529..d16e1b4 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp
@@ -67,7 +67,7 @@ } // namespace -class OriginTrialContextTest : public ::testing::Test, +class OriginTrialContextTest : public testing::Test, private ScopedOriginTrialsForTest { protected: OriginTrialContextTest()
diff --git a/third_party/WebKit/Source/core/page/ChromeClientImplTest.cpp b/third_party/WebKit/Source/core/page/ChromeClientImplTest.cpp index f291c12..c1a2ec0 100644 --- a/third_party/WebKit/Source/core/page/ChromeClientImplTest.cpp +++ b/third_party/WebKit/Source/core/page/ChromeClientImplTest.cpp
@@ -80,7 +80,7 @@ FrameTestHelpers::WebViewHelper web_view_helper_; }; -class CreateWindowTest : public ::testing::Test { +class CreateWindowTest : public testing::Test { protected: void SetUp() override { web_view_ = helper_.Initialize(nullptr, &web_view_client_); @@ -164,7 +164,7 @@ // TODO(crbug.com/779126): A number of popups are not supported in immersive // mode. The PagePopupSuppressionTests ensure that these unsupported popups // do not appear in immersive mode. -class PagePopupSuppressionTest : public ::testing::Test { +class PagePopupSuppressionTest : public testing::Test { public: PagePopupSuppressionTest() = default;
diff --git a/third_party/WebKit/Source/core/page/ChromeClientTest.cpp b/third_party/WebKit/Source/core/page/ChromeClientTest.cpp index de71928c..bfeb1684 100644 --- a/third_party/WebKit/Source/core/page/ChromeClientTest.cpp +++ b/third_party/WebKit/Source/core/page/ChromeClientTest.cpp
@@ -34,7 +34,7 @@ } // anonymous namespace -class ChromeClientTest : public ::testing::Test {}; +class ChromeClientTest : public testing::Test {}; TEST_F(ChromeClientTest, SetToolTipFlood) { ChromeClientToolTipLogger logger;
diff --git a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp index 2b6c7068..9e84eec3 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
@@ -16,7 +16,7 @@ #include "public/web/WebContextMenuData.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::Return; +using testing::Return; namespace blink { @@ -52,7 +52,7 @@ } // anonymous namespace -class ContextMenuControllerTest : public ::testing::Test { +class ContextMenuControllerTest : public testing::Test { public: void SetUp() { web_view_helper_.Initialize(&web_frame_client_);
diff --git a/third_party/WebKit/Source/core/page/DragControllerTest.cpp b/third_party/WebKit/Source/core/page/DragControllerTest.cpp index 3fedc81..23c0478 100644 --- a/third_party/WebKit/Source/core/page/DragControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/DragControllerTest.cpp
@@ -43,7 +43,7 @@ typedef bool TestParamRootLayerScrolling; class DragControllerTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public RenderingTest { protected: @@ -65,7 +65,7 @@ Persistent<DragMockChromeClient> chrome_client_; }; -INSTANTIATE_TEST_CASE_P(All, DragControllerTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, DragControllerTest, testing::Bool()); TEST_P(DragControllerTest, DragImageForSelectionUsesPageScaleFactor) { SetBodyInnerHTML( @@ -88,14 +88,14 @@ EXPECT_EQ(image1->Size().Height() * 2, image2->Size().Height()); } -class DragControllerSimTest : public ::testing::WithParamInterface<bool>, +class DragControllerSimTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { public: DragControllerSimTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, DragControllerSimTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, DragControllerSimTest, testing::Bool()); // Tests that dragging a URL onto a WebWidget that doesn't navigate on Drag and // Drop clears out the Autoscroll state. Regression test for
diff --git a/third_party/WebKit/Source/core/page/EffectiveNavigationPolicyTest.cpp b/third_party/WebKit/Source/core/page/EffectiveNavigationPolicyTest.cpp index 4e32e737..c85250b 100644 --- a/third_party/WebKit/Source/core/page/EffectiveNavigationPolicyTest.cpp +++ b/third_party/WebKit/Source/core/page/EffectiveNavigationPolicyTest.cpp
@@ -37,7 +37,7 @@ namespace blink { -class EffectiveNavigationPolicyTest : public ::testing::Test { +class EffectiveNavigationPolicyTest : public testing::Test { protected: NavigationPolicy GetNavigationPolicyWithMouseEvent( int modifiers,
diff --git a/third_party/WebKit/Source/core/page/Page.h b/third_party/WebKit/Source/core/page/Page.h index 7cf7a0e..ec554ce 100644 --- a/third_party/WebKit/Source/core/page/Page.h +++ b/third_party/WebKit/Source/core/page/Page.h
@@ -43,7 +43,7 @@ #include "platform/geometry/LayoutRect.h" #include "platform/geometry/Region.h" #include "platform/heap/Handle.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/wtf/Forward.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/page/PageOverlayTest.cpp b/third_party/WebKit/Source/core/page/PageOverlayTest.cpp index 3ff7454..7a21723 100644 --- a/third_party/WebKit/Source/core/page/PageOverlayTest.cpp +++ b/third_party/WebKit/Source/core/page/PageOverlayTest.cpp
@@ -24,9 +24,9 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkPaint.h" -using ::testing::_; -using ::testing::AtLeast; -using ::testing::Property; +using testing::_; +using testing::AtLeast; +using testing::Property; namespace blink { namespace { @@ -65,7 +65,7 @@ Color color_; }; -class PageOverlayTest : public ::testing::Test { +class PageOverlayTest : public testing::Test { protected: enum CompositingMode { kAcceleratedCompositing, kUnacceleratedCompositing };
diff --git a/third_party/WebKit/Source/core/page/SlotScopedTraversalTest.cpp b/third_party/WebKit/Source/core/page/SlotScopedTraversalTest.cpp index 59be450..63f2295b 100644 --- a/third_party/WebKit/Source/core/page/SlotScopedTraversalTest.cpp +++ b/third_party/WebKit/Source/core/page/SlotScopedTraversalTest.cpp
@@ -20,7 +20,7 @@ namespace blink { -class SlotScopedTraversalTest : public ::testing::Test { +class SlotScopedTraversalTest : public testing::Test { protected: Document& GetDocument() const;
diff --git a/third_party/WebKit/Source/core/page/ViewportTest.cpp b/third_party/WebKit/Source/core/page/ViewportTest.cpp index afecdfb..e26bf948 100644 --- a/third_party/WebKit/Source/core/page/ViewportTest.cpp +++ b/third_party/WebKit/Source/core/page/ViewportTest.cpp
@@ -60,7 +60,7 @@ using blink::test::RunPendingTasks; -class ViewportTest : public ::testing::Test { +class ViewportTest : public testing::Test { protected: ViewportTest() : base_url_("http://www.test.com/"), chrome_url_("chrome://") {}
diff --git a/third_party/WebKit/Source/core/page/WindowFeaturesTest.cpp b/third_party/WebKit/Source/core/page/WindowFeaturesTest.cpp index 47633aa..aaa80c5 100644 --- a/third_party/WebKit/Source/core/page/WindowFeaturesTest.cpp +++ b/third_party/WebKit/Source/core/page/WindowFeaturesTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -using WindowFeaturesTest = ::testing::Test; +using WindowFeaturesTest = testing::Test; TEST_F(WindowFeaturesTest, NoOpener) { static const struct {
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp index 8515e1c..7d69e66 100644 --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp
@@ -40,14 +40,14 @@ #include "testing/gtest/include/gtest/gtest.h" using blink::test::RunPendingTasks; -using ::testing::Mock; +using testing::Mock; namespace blink { namespace { -class RootScrollerTest : public ::testing::Test, - public ::testing::WithParamInterface<bool>, +class RootScrollerTest : public testing::Test, + public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, private ScopedImplicitRootScrollerForTest, private ScopedSetRootScrollerForTest { @@ -188,7 +188,7 @@ RuntimeEnabledFeatures::Backup features_backup_; }; -INSTANTIATE_TEST_CASE_P(All, RootScrollerTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, RootScrollerTest, testing::Bool()); // Test that no root scroller element is set if setRootScroller isn't called on // any elements. The document Node should be the default effective root @@ -1258,7 +1258,7 @@ &MainFrameView()->GetRootFrameViewport()->LayoutViewport()); } -class RootScrollerSimTest : public ::testing::WithParamInterface<bool>, +class RootScrollerSimTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, private ScopedImplicitRootScrollerForTest, public SimTest { @@ -1268,7 +1268,7 @@ ScopedImplicitRootScrollerForTest(false) {} }; -INSTANTIATE_TEST_CASE_P(All, RootScrollerSimTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, RootScrollerSimTest, testing::Bool()); // Tests that the root scroller doesn't affect visualViewport pageLeft and // pageTop. @@ -1587,7 +1587,7 @@ } }; -INSTANTIATE_TEST_CASE_P(All, RootScrollerHitTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, RootScrollerHitTest, testing::Bool()); // Test that hit testing in the area revealed at the bottom of the screen // revealed by hiding the URL bar works properly when using a root scroller
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollIntoViewTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollIntoViewTest.cpp index cc8c42f..6eedbd02 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollIntoViewTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollIntoViewTest.cpp
@@ -20,14 +20,14 @@ namespace { typedef bool TestParamRootLayerScrolling; -class ScrollIntoViewTest : public ::testing::WithParamInterface<bool>, +class ScrollIntoViewTest : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public SimTest { protected: ScrollIntoViewTest() : ScopedRootLayerScrollingForTest(GetParam()) {} }; -INSTANTIATE_TEST_CASE_P(All, ScrollIntoViewTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollIntoViewTest, testing::Bool()); TEST_P(ScrollIntoViewTest, InstantScroll) { v8::HandleScope HandleScope(v8::Isolate::GetCurrent());
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp index 4b7445f..8abb14e6 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
@@ -26,7 +26,7 @@ return ScrollState::Create(std::move(scroll_state_data)); } -class ScrollStateTest : public ::testing::Test {}; +class ScrollStateTest : public testing::Test {}; TEST_F(ScrollStateTest, ConsumeDeltaNative) { const float kDeltaX = 12.3;
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp index f456b782..474caed 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp
@@ -59,8 +59,8 @@ namespace blink { -class ScrollingCoordinatorTest : public ::testing::Test, - public ::testing::WithParamInterface<bool>, +class ScrollingCoordinatorTest : public testing::Test, + public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest { public: ScrollingCoordinatorTest() @@ -133,7 +133,7 @@ FrameTestHelpers::WebViewHelper helper_; }; -INSTANTIATE_TEST_CASE_P(All, ScrollingCoordinatorTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, ScrollingCoordinatorTest, testing::Bool()); TEST_P(ScrollingCoordinatorTest, fastScrollingByDefault) { GetWebView()->Resize(WebSize(800, 600)); @@ -1203,7 +1203,7 @@ INSTANTIATE_TEST_CASE_P(All, NonCompositedMainThreadScrollingReasonTest, - ::testing::Bool()); + testing::Bool()); TEST_P(NonCompositedMainThreadScrollingReasonTest, TransparentTest) { TestNonCompositedReasons("transparent",
diff --git a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp index 8f5bbb5..cd3d21b 100644 --- a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp
@@ -24,7 +24,7 @@ typedef bool TestParamRootLayerScrolling; class SnapCoordinatorTest - : public ::testing::TestWithParam<TestParamRootLayerScrolling>, + : public testing::TestWithParam<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest { protected: SnapCoordinatorTest() : ScopedRootLayerScrollingForTest(GetParam()) {} @@ -114,7 +114,7 @@ std::unique_ptr<DummyPageHolder> page_holder_; }; -INSTANTIATE_TEST_CASE_P(All, SnapCoordinatorTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, SnapCoordinatorTest, testing::Bool()); TEST_P(SnapCoordinatorTest, SimpleSnapElement) { Element& snap_element = *GetDocument().getElementById("snap-element");
diff --git a/third_party/WebKit/Source/core/paint/BlockPainterTest.cpp b/third_party/WebKit/Source/core/paint/BlockPainterTest.cpp index cc08006..c8d72d2f 100644 --- a/third_party/WebKit/Source/core/paint/BlockPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/BlockPainterTest.cpp
@@ -15,10 +15,9 @@ using BlockPainterTest = PaintControllerPaintTest; -INSTANTIATE_TEST_CASE_P( - All, - BlockPainterTest, - ::testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + BlockPainterTest, + testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); TEST_P(BlockPainterTest, ScrollHitTestProperties) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp b/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp index 89eb5cb..ca0d9aa 100644 --- a/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp +++ b/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp
@@ -120,7 +120,7 @@ INSTANTIATE_TEST_CASE_P(All, BoxPaintInvalidatorTest, - ::testing::Values(0, kRootLayerScrolling)); + testing::Values(0, kRootLayerScrolling)); TEST_P(BoxPaintInvalidatorTest, SlowMapToVisualRectInAncestorSpaceLayoutView) { SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/FragmentData.h b/third_party/WebKit/Source/core/paint/FragmentData.h index e4d11c7..e845084 100644 --- a/third_party/WebKit/Source/core/paint/FragmentData.h +++ b/third_party/WebKit/Source/core/paint/FragmentData.h
@@ -208,7 +208,6 @@ // Contains rare data that that is not needed on all fragments. struct RareData { - WTF_MAKE_NONCOPYABLE(RareData); USING_FAST_MALLOC(RareData); public: @@ -231,6 +230,8 @@ bool is_clip_path_cache_valid = false; Optional<IntRect> clip_path_bounding_box; scoped_refptr<const RefCountedPath> clip_path_path; + + DISALLOW_COPY_AND_ASSIGN(RareData); }; RareData& EnsureRareData();
diff --git a/third_party/WebKit/Source/core/paint/HTMLCanvasPainterTest.cpp b/third_party/WebKit/Source/core/paint/HTMLCanvasPainterTest.cpp index 07e5ee7..f364760 100644 --- a/third_party/WebKit/Source/core/paint/HTMLCanvasPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/HTMLCanvasPainterTest.cpp
@@ -77,10 +77,9 @@ FakeGLES2Interface gl_; }; -INSTANTIATE_TEST_CASE_P( - All, - HTMLCanvasPainterTestForSPv2, - ::testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + HTMLCanvasPainterTestForSPv2, + testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); TEST_P(HTMLCanvasPainterTestForSPv2, Canvas2DLayerAppearsInLayerTree) { // Insert a <canvas> and force it into accelerated mode.
diff --git a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp index 770918b..c532552 100644 --- a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp
@@ -17,22 +17,20 @@ namespace blink { -INSTANTIATE_TEST_CASE_P( - All, - PaintControllerPaintTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintControllerPaintTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); using PaintControllerPaintTestForSPv2 = PaintControllerPaintTest; -INSTANTIATE_TEST_CASE_P( - All, - PaintControllerPaintTestForSPv2, - ::testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintControllerPaintTestForSPv2, + testing::ValuesIn(kSlimmingPaintV2TestConfigurations)); using PaintControllerPaintTestForNonSPv1 = PaintControllerPaintTest; INSTANTIATE_TEST_CASE_P( All, PaintControllerPaintTestForNonSPv1, - ::testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); + testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); TEST_P(PaintControllerPaintTest, FullDocumentPaintingWithCaret) { SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp index 561de04..bd9fbd7 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
@@ -34,10 +34,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - PaintInvalidationTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintInvalidationTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); // Changing style in a way that changes overflow without layout should cause // the layout view to possibly need a paint invalidation since we may have
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp index 562981f..679c72a 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -866,7 +866,7 @@ } class PaintLayerClipperTestParameterized - : public ::testing::WithParamInterface<bool>, + : public testing::WithParamInterface<bool>, private ScopedRootLayerScrollingForTest, public PaintLayerClipperTest { public: @@ -876,7 +876,7 @@ INSTANTIATE_TEST_CASE_P(All, PaintLayerClipperTestParameterized, - ::testing::Bool()); + testing::Bool()); TEST_P(PaintLayerClipperTestParameterized, FixedLayerClipRectInDocumentSpace) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp index 6c43be3..8d4db15 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -49,10 +49,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - PaintLayerPainterTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintLayerPainterTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(PaintLayerPainterTest, CachedSubsequence) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp index 81ff9e4..a2ec66e2 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
@@ -14,7 +14,7 @@ #include "platform/testing/runtime_enabled_features_test_helpers.h" #include "testing/gmock/include/gmock/gmock.h" -using ::testing::_; +using testing::_; namespace blink { namespace { @@ -38,7 +38,7 @@ chrome_client_(new ScrollableAreaMockChromeClient) {} ~PaintLayerScrollableAreaTest() override { - ::testing::Mock::VerifyAndClearExpectations(&GetChromeClient()); + testing::Mock::VerifyAndClearExpectations(&GetChromeClient()); } ScrollableAreaMockChromeClient& GetChromeClient() const override {
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp index 78203a9..cd3540f 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
@@ -28,10 +28,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - PaintLayerTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintLayerTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(PaintLayerTest, ChildWithoutPaintLayer) { SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp index e40991f..3b54d89 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -123,10 +123,9 @@ #define CHECK_EXACT_VISUAL_RECT(expected, source_object, ancestor) \ CHECK_VISUAL_RECT(expected, source_object, ancestor, 0) -INSTANTIATE_TEST_CASE_P( - All, - PaintPropertyTreeBuilderTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PaintPropertyTreeBuilderTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) { LoadTestData("fixed-position.html");
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp index 902ba3f..de8198b9 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp
@@ -29,23 +29,23 @@ INSTANTIATE_TEST_CASE_P( All, PaintPropertyTreePrinterTest, - ::testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); + testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTree) { SetBodyInnerHTML("hello world"); String transform_tree_as_string = transformPropertyTreeAsString(*GetDocument().View()); EXPECT_THAT(transform_tree_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*" - " .*Translation \\(.*\\) .*")); + testing::MatchesRegex("root .*" + " .*Translation \\(.*\\) .*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleClipTree) { SetBodyInnerHTML("hello world"); String clip_tree_as_string = clipPropertyTreeAsString(*GetDocument().View()); EXPECT_THAT(clip_tree_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*" - " .*Clip \\(.*\\) .*")); + testing::MatchesRegex("root .*" + " .*Clip \\(.*\\) .*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTree) { @@ -53,8 +53,8 @@ String effect_tree_as_string = effectPropertyTreeAsString(*GetDocument().View()); EXPECT_THAT(effect_tree_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*" - " Effect \\(LayoutBlockFlow DIV\\) .*")); + testing::MatchesRegex("root .*" + " Effect \\(LayoutBlockFlow DIV\\) .*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTree) { @@ -62,8 +62,8 @@ String scroll_tree_as_string = scrollPropertyTreeAsString(*GetDocument().View()); EXPECT_THAT(scroll_tree_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*" - " Scroll \\(.*\\) .*")); + testing::MatchesRegex("root .*" + " Scroll \\(.*\\) .*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath) { @@ -77,10 +77,10 @@ String transform_path_as_string = transformed_object_properties->Transform()->ToTreeString(); EXPECT_THAT(transform_path_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*\"scroll\".*" - " .*\"parent\".*" - " .*\"matrix\".*" - " .*\"matrix\".*")); + testing::MatchesRegex("root .*\"scroll\".*" + " .*\"parent\".*" + " .*\"matrix\".*" + " .*\"matrix\".*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath) { @@ -94,9 +94,9 @@ String clip_path_as_string = clipped_object_properties->CssClip()->ToTreeString(); EXPECT_THAT(clip_path_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*\"rect\".*" - " .*\"rect\".*" - " .*\"rect\".*")); + testing::MatchesRegex("root .*\"rect\".*" + " .*\"rect\".*" + " .*\"rect\".*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) { @@ -108,8 +108,8 @@ String effect_path_as_string = effect_object_properties->Effect()->ToTreeString(); EXPECT_THAT(effect_path_as_string.Ascii().data(), - ::testing::MatchesRegex("root .*\"outputClip\".*" - " .*\"parent\".*\"opacity\".*")); + testing::MatchesRegex("root .*\"outputClip\".*" + " .*\"parent\".*\"opacity\".*")); } TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) { @@ -126,8 +126,8 @@ ->ScrollNode() ->ToTreeString(); EXPECT_THAT(scroll_path_as_string.Ascii().data(), - ::testing::MatchesRegex("root .* \\{\\}.*" - " .*\"parent\".*")); + testing::MatchesRegex("root .* \\{\\}.*" + " .*\"parent\".*")); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp index 909927e..aa0e93c 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -15,7 +15,7 @@ INSTANTIATE_TEST_CASE_P( All, PaintPropertyTreeUpdateTest, - ::testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); + testing::ValuesIn(kSlimmingPaintNonV1TestConfigurations)); TEST_P(PaintPropertyTreeUpdateTest, ThreadedScrollingDisabledMainThreadScrollReason) {
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp index c811e1f..2c16cb5 100644 --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
@@ -57,10 +57,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - PrePaintTreeWalkTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + PrePaintTreeWalkTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithBorderInvalidation) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/paint/TablePainterTest.cpp b/third_party/WebKit/Source/core/paint/TablePainterTest.cpp index ef42c687..10075fb 100644 --- a/third_party/WebKit/Source/core/paint/TablePainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/TablePainterTest.cpp
@@ -16,7 +16,7 @@ using TablePainterTest = PaintControllerPaintTest; INSTANTIATE_TEST_CASE_P(All, TablePainterTest, - ::testing::Values(0, kRootLayerScrolling)); + testing::Values(0, kRootLayerScrolling)); TEST_P(TablePainterTest, Background) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/paint/ViewPainterTest.cpp b/third_party/WebKit/Source/core/paint/ViewPainterTest.cpp index 5821854b..7e49d9d 100644 --- a/third_party/WebKit/Source/core/paint/ViewPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/ViewPainterTest.cpp
@@ -18,11 +18,11 @@ INSTANTIATE_TEST_CASE_P(All, ViewPainterTest, - ::testing::Values(0, - kSlimmingPaintV175, - kRootLayerScrolling, - kSlimmingPaintV175 | - kRootLayerScrolling)); + testing::Values(0, + kSlimmingPaintV175, + kRootLayerScrolling, + kSlimmingPaintV175 | + kRootLayerScrolling)); void ViewPainterTest::RunFixedBackgroundTest( bool prefer_compositing_to_lcd_text) {
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMappingTest.cpp index 53885275..1bc79325 100644 --- a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMappingTest.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMappingTest.cpp
@@ -17,7 +17,7 @@ typedef bool TestParamRootLayerScrolling; class CompositedLayerMappingTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public RenderingTest { public: @@ -62,7 +62,7 @@ void TearDown() override { RenderingTest::TearDown(); } }; -INSTANTIATE_TEST_CASE_P(All, CompositedLayerMappingTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, CompositedLayerMappingTest, testing::Bool()); TEST_P(CompositedLayerMappingTest, SubpixelAccumulationChange) { SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositingInputsUpdaterTest.cpp b/third_party/WebKit/Source/core/paint/compositing/CompositingInputsUpdaterTest.cpp index facea704..0d549fac 100644 --- a/third_party/WebKit/Source/core/paint/compositing/CompositingInputsUpdaterTest.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/CompositingInputsUpdaterTest.cpp
@@ -12,7 +12,7 @@ typedef bool TestParamRootLayerScrolling; class CompositingInputsUpdaterTest - : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, + : public testing::WithParamInterface<TestParamRootLayerScrolling>, private ScopedRootLayerScrollingForTest, public RenderingTest { public: @@ -21,7 +21,7 @@ RenderingTest(SingleChildLocalFrameClient::Create()) {} }; -INSTANTIATE_TEST_CASE_P(All, CompositingInputsUpdaterTest, ::testing::Bool()); +INSTANTIATE_TEST_CASE_P(All, CompositingInputsUpdaterTest, testing::Bool()); // Tests that transitioning a sticky away from an ancestor overflow layer that // does not have a scrollable area does not crash.
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc index 3f5d406..bee7dc4 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc
@@ -30,7 +30,7 @@ INSTANTIATE_TEST_CASE_P(All, NGTextFragmentPainterTest, - ::testing::Values(0, kRootLayerScrolling)); + testing::Values(0, kRootLayerScrolling)); TEST_P(NGTextFragmentPainterTest, TestTextStyle) { SetBodyInnerHTML(R"HTML(
diff --git a/third_party/WebKit/Source/core/policy/PolicyTest.cpp b/third_party/WebKit/Source/core/policy/PolicyTest.cpp index b68e3c2..072c7265 100644 --- a/third_party/WebKit/Source/core/policy/PolicyTest.cpp +++ b/third_party/WebKit/Source/core/policy/PolicyTest.cpp
@@ -19,9 +19,9 @@ constexpr char kOriginB[] = "https://example.net"; } // namespace -using ::testing::UnorderedElementsAre; +using testing::UnorderedElementsAre; -class PolicyTest : public ::testing::Test { +class PolicyTest : public testing::Test { public: void SetUp() override { document_ = Document::CreateForTest();
diff --git a/third_party/WebKit/Source/core/scheduler/ActiveConnectionThrottlingTest.cpp b/third_party/WebKit/Source/core/scheduler/ActiveConnectionThrottlingTest.cpp index 6a75eaa..023f13e 100644 --- a/third_party/WebKit/Source/core/scheduler/ActiveConnectionThrottlingTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/ActiveConnectionThrottlingTest.cpp
@@ -6,13 +6,13 @@ #include "core/frame/WebLocalFrameImpl.h" #include "core/testing/sim/SimRequest.h" #include "core/testing/sim/SimTest.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "platform/testing/TestingPlatformSupportWithWebRTC.h" #include "public/web/WebScriptSource.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; +using testing::_; namespace blink {
diff --git a/third_party/WebKit/Source/core/scheduler/FrameSchedulerTest.cpp b/third_party/WebKit/Source/core/scheduler/FrameSchedulerTest.cpp index 005eeb5a..399a7087 100644 --- a/third_party/WebKit/Source/core/scheduler/FrameSchedulerTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/FrameSchedulerTest.cpp
@@ -8,7 +8,7 @@ #include "platform/scheduler/public/frame_scheduler.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink {
diff --git a/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp b/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp index ae1b11e..8db690a1 100644 --- a/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp
@@ -30,7 +30,7 @@ #include "public/web/WebSettings.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; +using testing::_; namespace blink { @@ -73,10 +73,9 @@ } }; -INSTANTIATE_TEST_CASE_P( - All, - FrameThrottlingTest, - ::testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); +INSTANTIATE_TEST_CASE_P(All, + FrameThrottlingTest, + testing::ValuesIn(kAllSlimmingPaintTestConfigurations)); TEST_P(FrameThrottlingTest, ThrottleInvisibleFrames) { SimRequest main_resource("https://example.com/", "text/html");
diff --git a/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp b/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp index 34ebd77..1b9e2d7 100644 --- a/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp
@@ -12,7 +12,7 @@ #include "public/platform/scheduler/renderer/renderer_scheduler.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink {
diff --git a/third_party/WebKit/Source/core/scheduler/VirtualTimeTest.cpp b/third_party/WebKit/Source/core/scheduler/VirtualTimeTest.cpp index 773ac24..ab428a5 100644 --- a/third_party/WebKit/Source/core/scheduler/VirtualTimeTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/VirtualTimeTest.cpp
@@ -5,7 +5,7 @@ #include "build/build_config.h" #include "core/testing/sim/SimRequest.h" #include "core/testing/sim/SimTest.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" #include "public/platform/TaskType.h"
diff --git a/third_party/WebKit/Source/core/script/MockScriptElementBase.h b/third_party/WebKit/Source/core/script/MockScriptElementBase.h index 876c89c..8b5723e 100644 --- a/third_party/WebKit/Source/core/script/MockScriptElementBase.h +++ b/third_party/WebKit/Source/core/script/MockScriptElementBase.h
@@ -19,7 +19,7 @@ public: static MockScriptElementBase* Create() { - return new ::testing::StrictMock<MockScriptElementBase>(); + return new testing::StrictMock<MockScriptElementBase>(); } virtual ~MockScriptElementBase() {}
diff --git a/third_party/WebKit/Source/core/script/ModuleMapTest.cpp b/third_party/WebKit/Source/core/script/ModuleMapTest.cpp index 71111039..8058444e 100644 --- a/third_party/WebKit/Source/core/script/ModuleMapTest.cpp +++ b/third_party/WebKit/Source/core/script/ModuleMapTest.cpp
@@ -152,7 +152,7 @@ test_requests_.clear(); } -class ModuleMapTest : public ::testing::Test { +class ModuleMapTest : public testing::Test { public: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/script/ScriptModuleResolverImplTest.cpp b/third_party/WebKit/Source/core/script/ScriptModuleResolverImplTest.cpp index 420654b4..0416b4d 100644 --- a/third_party/WebKit/Source/core/script/ScriptModuleResolverImplTest.cpp +++ b/third_party/WebKit/Source/core/script/ScriptModuleResolverImplTest.cpp
@@ -98,7 +98,7 @@ } // namespace -class ScriptModuleResolverImplTest : public ::testing::Test { +class ScriptModuleResolverImplTest : public testing::Test { public: void SetUp() override;
diff --git a/third_party/WebKit/Source/core/script/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/script/ScriptRunnerTest.cpp index 55e422ae..3a89fefd 100644 --- a/third_party/WebKit/Source/core/script/ScriptRunnerTest.cpp +++ b/third_party/WebKit/Source/core/script/ScriptRunnerTest.cpp
@@ -13,12 +13,12 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::Invoke; -using ::testing::ElementsAre; -using ::testing::Return; -using ::testing::WhenSorted; -using ::testing::ElementsAreArray; -using ::testing::_; +using testing::Invoke; +using testing::ElementsAre; +using testing::Return; +using testing::WhenSorted; +using testing::ElementsAreArray; +using testing::_; namespace blink { @@ -118,7 +118,7 @@ return this; } -class ScriptRunnerTest : public ::testing::Test { +class ScriptRunnerTest : public testing::Test { public: ScriptRunnerTest() : document_(Document::CreateForTest()) {} @@ -382,7 +382,7 @@ int expected[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; - EXPECT_THAT(order_, ::testing::ElementsAreArray(expected)); + EXPECT_THAT(order_, testing::ElementsAreArray(expected)); } TEST_F(ScriptRunnerTest, ResumeAndSuspend_InOrder) {
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp index beedd206..f1ac5c5 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp
@@ -23,7 +23,7 @@ #include "third_party/skia/include/utils/SkNullCanvas.h" namespace blink { -class SVGImageTest : public ::testing::Test { +class SVGImageTest : public testing::Test { public: SVGImage& GetImage() { return *image_; }
diff --git a/third_party/WebKit/Source/core/testing/CoreUnitTestHelper.cpp b/third_party/WebKit/Source/core/testing/CoreUnitTestHelper.cpp index 29b0087..4e664b87 100644 --- a/third_party/WebKit/Source/core/testing/CoreUnitTestHelper.cpp +++ b/third_party/WebKit/Source/core/testing/CoreUnitTestHelper.cpp
@@ -54,7 +54,7 @@ GetDocument().View()->UpdateAllLifecyclePhases(); // Allow ASSERT_DEATH and EXPECT_DEATH for multiple threads. - ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + testing::FLAGS_gtest_death_test_style = "threadsafe"; } void RenderingTest::TearDown() {
diff --git a/third_party/WebKit/Source/core/testing/PageTestBase.h b/third_party/WebKit/Source/core/testing/PageTestBase.h index 586336bf..3943a700 100644 --- a/third_party/WebKit/Source/core/testing/PageTestBase.h +++ b/third_party/WebKit/Source/core/testing/PageTestBase.h
@@ -13,7 +13,7 @@ class Document; class LocalFrame; -class PageTestBase : public ::testing::Test { +class PageTestBase : public testing::Test { USING_FAST_MALLOC(PageTestBase); public:
diff --git a/third_party/WebKit/Source/core/testing/sim/SimTest.h b/third_party/WebKit/Source/core/testing/sim/SimTest.h index ad5cc82..b3c46ee 100644 --- a/third_party/WebKit/Source/core/testing/sim/SimTest.h +++ b/third_party/WebKit/Source/core/testing/sim/SimTest.h
@@ -20,7 +20,7 @@ class Document; class LocalDOMWindow; -class SimTest : public ::testing::Test { +class SimTest : public testing::Test { protected: SimTest(); ~SimTest() override;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceObserverTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceObserverTest.cpp index aac7c1f..f96a736 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceObserverTest.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceObserverTest.cpp
@@ -28,7 +28,7 @@ ExecutionContext* GetExecutionContext() const override { return nullptr; } }; -class PerformanceObserverTest : public ::testing::Test { +class PerformanceObserverTest : public testing::Test { protected: void Initialize(ScriptState* script_state) { v8::Local<v8::Function> callback =
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp index f4c8f72..db69f40 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp
@@ -8,7 +8,7 @@ namespace blink { -class PerformanceResourceTimingTest : public ::testing::Test { +class PerformanceResourceTimingTest : public testing::Test { protected: AtomicString GetNextHopProtocol(const AtomicString& alpn_negotiated_protocol, const AtomicString& connection_info) {
diff --git a/third_party/WebKit/Source/core/timing/WindowPerformanceTest.cpp b/third_party/WebKit/Source/core/timing/WindowPerformanceTest.cpp index ad4468d..5fa4bba 100644 --- a/third_party/WebKit/Source/core/timing/WindowPerformanceTest.cpp +++ b/third_party/WebKit/Source/core/timing/WindowPerformanceTest.cpp
@@ -48,7 +48,7 @@ } // namespace -class WindowPerformanceTest : public ::testing::Test { +class WindowPerformanceTest : public testing::Test { protected: void SetUp() override { page_holder_ = DummyPageHolder::Create(IntSize(800, 600));
diff --git a/third_party/WebKit/Source/core/url/URLSearchParamsTest.cpp b/third_party/WebKit/Source/core/url/URLSearchParamsTest.cpp index 54aa52c..a28bada 100644 --- a/third_party/WebKit/Source/core/url/URLSearchParamsTest.cpp +++ b/third_party/WebKit/Source/core/url/URLSearchParamsTest.cpp
@@ -8,7 +8,7 @@ namespace blink { -using URLSearchParamsTest = ::testing::Test; +using URLSearchParamsTest = testing::Test; TEST_F(URLSearchParamsTest, ToEncodedFormData) { URLSearchParams* params = URLSearchParams::Create(String());
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp index b866639..bfbb9c5 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
@@ -161,7 +161,7 @@ new MockWorkerThreadLifecycleObserver( worker_thread->GetWorkerThreadLifecycleContext()); EXPECT_CALL(*mock_worker_thread_lifecycle_observer_, - ContextDestroyed(::testing::_)) + ContextDestroyed(testing::_)) .Times(1); return std::move(worker_thread); }
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp index 94d0ebbac..f9042c0 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp
@@ -201,7 +201,7 @@ } }; -class ThreadedWorkletTest : public ::testing::Test { +class ThreadedWorkletTest : public testing::Test { public: void SetUp() override { page_ = DummyPageHolder::Create();
diff --git a/third_party/WebKit/Source/core/workers/WorkerModuleFetchCoordinatorTest.cpp b/third_party/WebKit/Source/core/workers/WorkerModuleFetchCoordinatorTest.cpp index 644575dc..439eaadd 100644 --- a/third_party/WebKit/Source/core/workers/WorkerModuleFetchCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerModuleFetchCoordinatorTest.cpp
@@ -19,7 +19,7 @@ namespace blink { -class WorkerModuleFetchCoordinatorTest : public ::testing::Test { +class WorkerModuleFetchCoordinatorTest : public testing::Test { public: WorkerModuleFetchCoordinatorTest() = default;
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp index bf2e7c33..71cfd64 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -18,8 +18,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::AtMost; +using testing::_; +using testing::AtMost; namespace blink { @@ -67,7 +67,7 @@ } // namespace -class WorkerThreadTest : public ::testing::Test { +class WorkerThreadTest : public testing::Test { public: WorkerThreadTest() = default;
diff --git a/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp index 1729cfc..2cab070 100644 --- a/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class WorkletModuleResponsesMapTest : public ::testing::Test { +class WorkletModuleResponsesMapTest : public testing::Test { public: WorkletModuleResponsesMapTest() = default;
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js index daf7d90..94b9920 100644 --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -124,7 +124,6 @@ Runtime.experiments.register('timelineEventInitiators', 'Timeline: event initiators'); Runtime.experiments.register('timelineFlowEvents', 'Timeline: flow events', true); Runtime.experiments.register('timelineInvalidationTracking', 'Timeline: invalidation tracking', true); - Runtime.experiments.register('timelineKeepHistory', 'Timeline: keep recording history'); Runtime.experiments.register('timelinePaintTimingMarkers', 'Timeline: paint timing markers', true); Runtime.experiments.register('timelineShowAllEvents', 'Timeline: show all events', true); Runtime.experiments.register('timelineShowAllProcesses', 'Timeline: show all processes', true); @@ -142,8 +141,7 @@ Runtime.experiments.enableForTest('networkSearch'); } - Runtime.experiments.setDefaultExperiments( - ['colorContrastRatio', 'stepIntoAsync', 'timelineKeepHistory', 'oopifInlineDOM']); + Runtime.experiments.setDefaultExperiments(['colorContrastRatio', 'stepIntoAsync', 'oopifInlineDOM']); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js index dbfdd24..d8fd2cf 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -53,10 +53,7 @@ this._recordReloadAction = /** @type {!UI.Action }*/ (UI.actionRegistry.action('timeline.record-reload')); - if (!Runtime.experiments.isEnabled('timelineKeepHistory')) - this._historyManager = null; - else - this._historyManager = new Timeline.TimelineHistoryManager(); + this._historyManager = new Timeline.TimelineHistoryManager(); /** @type {!Array<!TimelineModel.TimelineModelFilter>} */ this._filters = []; @@ -155,8 +152,7 @@ */ willHide() { UI.context.setFlavor(Timeline.TimelinePanel, null); - if (this._historyManager) - this._historyManager.cancelIfShowing(); + this._historyManager.cancelIfShowing(); } /** @@ -230,10 +226,8 @@ this._panelToolbar.appendToolbarItem(this._saveButton); // History - if (this._historyManager) { - this._panelToolbar.appendSeparator(); - this._panelToolbar.appendToolbarItem(this._historyManager.button()); - } + this._panelToolbar.appendSeparator(); + this._panelToolbar.appendToolbarItem(this._historyManager.button()); this._panelToolbar.appendSeparator(); // View @@ -389,8 +383,6 @@ * @return {boolean} */ _navigateHistory(direction) { - if (!this._historyManager) - return true; const model = this._historyManager.navigate(direction); if (model && model !== this._performanceModel) this._setModel(model); @@ -534,8 +526,7 @@ this._toggleRecordAction.setToggled(this._state === state.Recording); this._toggleRecordAction.setEnabled(this._state === state.Recording || this._state === state.Idle); this._recordReloadAction.setEnabled(this._state === state.Idle); - if (this._historyManager) - this._historyManager.setEnabled(this._state === state.Idle); + this._historyManager.setEnabled(this._state === state.Idle); this._clearButton.setEnabled(this._state === state.Idle); this._panelToolbar.setEnabled(this._state !== state.Loading); this._dropTarget.setEnabled(this._state === state.Idle); @@ -562,8 +553,7 @@ } _onClearButton() { - if (this._historyManager) - this._historyManager.clear(); + this._historyManager.clear(); this._clear(); } @@ -581,8 +571,6 @@ * @param {?Timeline.PerformanceModel} model */ _setModel(model) { - if (this._performanceModel && !this._historyManager) - this._performanceModel.dispose(); this._performanceModel = model; this._flameChart.setModel(model); @@ -747,8 +735,7 @@ performanceModel.setTracingModel(tracingModel); this._setModel(performanceModel); - if (this._historyManager) - this._historyManager.addRecording(performanceModel); + this._historyManager.addRecording(performanceModel); } _showRecordingStarted() { @@ -1320,13 +1307,9 @@ panel._showHistory(); return true; case 'timeline.previous-recording': - if (!Runtime.experiments.isEnabled('timelineKeepHistory')) - return false; panel._navigateHistory(1); return true; case 'timeline.next-recording': - if (!Runtime.experiments.isEnabled('timelineKeepHistory')) - return false; panel._navigateHistory(-1); return true; }
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/module.json b/third_party/WebKit/Source/devtools/front_end/timeline/module.json index 0266b35..c3450ac 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/module.json +++ b/third_party/WebKit/Source/devtools/front_end/timeline/module.json
@@ -167,7 +167,6 @@ "className": "Timeline.TimelinePanel.ActionDelegate", "category": "Performance", "title": "Show recent timeline sessions", - "experiment": "timelineKeepHistory", "contextTypes": [ "Timeline.TimelinePanel" ], @@ -195,7 +194,6 @@ "type": "action", "actionId": "timeline.previous-recording", "className": "Timeline.TimelinePanel.ActionDelegate", - "experiment": "timelineKeepHistory", "contextTypes": [ "Timeline.TimelinePanel" ], @@ -214,7 +212,6 @@ "type": "action", "actionId": "timeline.next-recording", "className": "Timeline.TimelinePanel.ActionDelegate", - "experiment": "timelineKeepHistory", "contextTypes": [ "Timeline.TimelinePanel" ],
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js b/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js index 34e4d0ee..8daf09a 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js
@@ -165,15 +165,13 @@ UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-previous-frame') .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-next-frame')), Common.UIString('Jump to previous/next frame')); - if (Runtime.experiments.isEnabled('timelineKeepHistory')) { - section.addRelatedKeys( - UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.show-history'), - Common.UIString('Pick a recording from history')); - section.addRelatedKeys( - UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.previous-recording') - .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.next-recording')), - Common.UIString('Show previous/next recording')); - } + section.addRelatedKeys( + UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.show-history'), + Common.UIString('Pick a recording from history')); + section.addRelatedKeys( + UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.previous-recording') + .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.next-recording')), + Common.UIString('Show previous/next recording')); // Memory panel section = UI.shortcutsScreen.section(Common.UIString('Memory Panel'));
diff --git a/third_party/WebKit/Source/modules/BUILD.gn b/third_party/WebKit/Source/modules/BUILD.gn index 6d002f8..ed879aeb 100644 --- a/third_party/WebKit/Source/modules/BUILD.gn +++ b/third_party/WebKit/Source/modules/BUILD.gn
@@ -236,6 +236,7 @@ "accessibility/AXObjectCacheTest.cpp", "accessibility/AXObjectTest.cpp", "accessibility/AXPositionTest.cpp", + "accessibility/AXRangeTest.cpp", "accessibility/AXSelectionTest.cpp", "accessibility/AccessibilityObjectModelTest.cpp", "accessibility/testing/AccessibilityTest.cpp",
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheTest.cpp index 5b3944a4..1136726 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheTest.cpp
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <gtest/gtest.h> - #include "core/dom/AXObjectCache.h" + #include "core/dom/Document.h" #include "core/dom/Element.h" #include "modules/accessibility/testing/AccessibilityTest.h" +#include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp index e74476a..91dda20 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "modules/accessibility/AXObject.h" + #include "modules/accessibility/testing/AccessibilityTest.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/modules/accessibility/AXPositionTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXPositionTest.cpp index e8e4f6b..400b467 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXPositionTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXPositionTest.cpp
@@ -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 "modules/accessibility/AXPosition.h" + #include "core/dom/Element.h" #include "core/dom/Node.h" #include "core/editing/Position.h" #include "core/html/HTMLElement.h" #include "modules/accessibility/AXObject.h" -#include "modules/accessibility/AXPosition.h" #include "modules/accessibility/testing/AccessibilityTest.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/modules/accessibility/AXRange.cpp b/third_party/WebKit/Source/modules/accessibility/AXRange.cpp new file mode 100644 index 0000000..c01422d --- /dev/null +++ b/third_party/WebKit/Source/modules/accessibility/AXRange.cpp
@@ -0,0 +1,83 @@ +// Copyright 2018 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 "modules/accessibility/AXRange.h" + +#include "core/dom/Document.h" +#include "modules/accessibility/AXObject.h" + +namespace blink { + +AXRange::AXRange(const AXPosition& start, const AXPosition& end) + : start_(start), end_(end) { + DCHECK(start.IsValid()); + DCHECK(end.IsValid()); + DCHECK_LE(start, end); + + const Document* document = start.ContainerObject()->GetDocument(); + DCHECK(document); + DCHECK(document->IsActive()); + DCHECK(!document->NeedsLayoutTreeUpdate()); + DCHECK_EQ(end.ContainerObject()->GetDocument(), document); +#if DCHECK_IS_ON() + dom_tree_version_ = document->DomTreeVersion(); + style_version_ = document->StyleVersion(); +#endif // DCHECK_IS_ON() +} + +AXObject* AXRange::CommonAncestorContainer() const { + if (!IsValid()) + return nullptr; + int start_index, end_index; + return const_cast<AXObject*>(AXObject::LowestCommonAncestor( + *start_.ContainerObject(), *end_.ContainerObject(), &start_index, + &end_index)); +} + +bool AXRange::IsCollapsed() const { + return IsValid() && start_ == end_; +} + +bool AXRange::IsValid() const { + if (!start_.IsValid() || !end_.IsValid()) + return false; + + // We don't support ranges that span across documents. + if (start_.ContainerObject()->GetDocument() != + end_.ContainerObject()->GetDocument()) { + return false; + } + + DCHECK(!start_.ContainerObject()->GetDocument()->NeedsLayoutTreeUpdate()); +#if DCHECK_IS_ON() + DCHECK_EQ(start_.ContainerObject()->GetDocument()->DomTreeVersion(), + dom_tree_version_); + DCHECK_EQ(start_.ContainerObject()->GetDocument()->StyleVersion(), + style_version_); +#endif // DCHECK_IS_ON() + return true; +} + +// static +AXRange AXRange::RangeOfContents(const AXObject& container) { + return AXRange(AXPosition::CreateFirstPositionInContainerObject(container), + AXPosition::CreateLastPositionInContainerObject(container)); +} + +bool operator==(const AXRange& a, const AXRange& b) { + DCHECK(a.IsValid() && b.IsValid()); + return a.Start() == b.Start() && a.End() == b.End(); +} + +bool operator!=(const AXRange& a, const AXRange& b) { + return !(a == b); +} + +std::ostream& operator<<(std::ostream& ostream, const AXRange& range) { + if (!range.IsValid()) + return ostream << "Invalid AXRange"; + return ostream << "AXRange from " << range.Start() << " to " << range.End(); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/accessibility/AXRange.h b/third_party/WebKit/Source/modules/accessibility/AXRange.h new file mode 100644 index 0000000..b4e1f32 --- /dev/null +++ b/third_party/WebKit/Source/modules/accessibility/AXRange.h
@@ -0,0 +1,64 @@ +// Copyright 2018 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 AXRange_h +#define AXRange_h + +#include <base/logging.h> +#include <stdint.h> +#include <ostream> + +#include "modules/ModulesExport.h" +#include "modules/accessibility/AXPosition.h" +#include "platform/wtf/Allocator.h" + +namespace blink { + +class AXObject; + +class MODULES_EXPORT AXRange final { + DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); + + public: + AXRange(const AXPosition& start, const AXPosition& end); + AXRange(const AXRange&) = default; + AXRange& operator=(const AXRange&) = default; + ~AXRange() = default; + + const AXPosition Start() const { return start_; } + const AXPosition End() const { return end_; } + + // Returns the lowest common ancestor of the container objects of the start + // and end positions, or nullptr if the range is invalid. + AXObject* CommonAncestorContainer() const; + + // The |AXRange| is collapsed if the start position is equal to the end + // position or if the range is invalid. + bool IsCollapsed() const; + + // The range is invalid if either the start or end position is invalid, or if + // the positions are in two separate documents. + bool IsValid() const; + + // Creates an |AXRange| encompassing the contents of the given |AXObject|. + static AXRange RangeOfContents(const AXObject&); + + private: + AXPosition start_; + AXPosition end_; + +#if DCHECK_IS_ON() + // TODO(ax-dev): Use layout tree version in place of DOM and style versions. + uint64_t dom_tree_version_; + uint64_t style_version_; +#endif +}; + +MODULES_EXPORT bool operator==(const AXRange&, const AXRange&); +MODULES_EXPORT bool operator!=(const AXRange&, const AXRange&); +MODULES_EXPORT std::ostream& operator<<(std::ostream&, const AXRange&); + +} // namespace blink + +#endif // AXRange_h
diff --git a/third_party/WebKit/Source/modules/accessibility/AXRangeTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXRangeTest.cpp new file mode 100644 index 0000000..b33358e9 --- /dev/null +++ b/third_party/WebKit/Source/modules/accessibility/AXRangeTest.cpp
@@ -0,0 +1,82 @@ +// Copyright 2018 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 "modules/accessibility/AXRange.h" + +#include "modules/accessibility/AXObject.h" +#include "modules/accessibility/AXPosition.h" +#include "modules/accessibility/testing/AccessibilityTest.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +TEST_F(AccessibilityTest, CommonAncestorContainerOfRange) { + SetBodyInnerHTML(R"HTML(<input id='input' type='text' value='value'>" + R"<p id='paragraph'>hello<br id='br'>there</p>" + R"<button id='button'>button</button>)HTML"); + + const AXObject* root = GetAXRootObject(); + ASSERT_NE(nullptr, root); + const AXObject* input = GetAXObjectByElementId("input"); + ASSERT_NE(nullptr, input); + const AXObject* paragraph = GetAXObjectByElementId("paragraph"); + ASSERT_NE(nullptr, paragraph); + const AXObject* text1 = paragraph->FirstChild(); + ASSERT_NE(nullptr, text1); + ASSERT_EQ(AccessibilityRole::kStaticTextRole, text1->RoleValue()); + const AXObject* br = GetAXObjectByElementId("br"); + ASSERT_NE(nullptr, br); + const AXObject* text2 = paragraph->LastChild(); + ASSERT_NE(nullptr, text2); + ASSERT_EQ(AccessibilityRole::kStaticTextRole, text2->RoleValue()); + const AXObject* button = GetAXObjectByElementId("button"); + ASSERT_NE(nullptr, button); + + EXPECT_EQ(root, + AXRange(AXPosition::CreateFirstPositionInContainerObject(*input), + AXPosition::CreateLastPositionInContainerObject(*button)) + .CommonAncestorContainer()); + EXPECT_EQ(root, + AXRange(AXPosition::CreateFirstPositionInContainerObject(*br), + AXPosition::CreateFirstPositionInContainerObject(*button)) + .CommonAncestorContainer()); + EXPECT_EQ(paragraph, AXRange(AXPosition::CreatePositionBeforeObject(*text1), + AXPosition::CreatePositionAfterObject(*text2)) + .CommonAncestorContainer()); +} + +TEST_F(AccessibilityTest, IsCollapsedRange) { + SetBodyInnerHTML(R"HTML(<p id='paragraph'>hello there</p>)HTML"); + + const AXObject* paragraph = GetAXObjectByElementId("paragraph"); + ASSERT_NE(nullptr, paragraph); + const AXObject* text = paragraph->FirstChild(); + ASSERT_NE(nullptr, text); + ASSERT_EQ(AccessibilityRole::kStaticTextRole, text->RoleValue()); + + const AXRange paragraph_range( + AXPosition::CreateLastPositionInContainerObject(*paragraph), + AXPosition::CreateLastPositionInContainerObject(*paragraph)); + const AXRange text_range( + AXPosition::CreateLastPositionInContainerObject(*text), + AXPosition::CreateLastPositionInContainerObject(*text)); + EXPECT_TRUE(paragraph_range.IsCollapsed()); + EXPECT_TRUE(text_range.IsCollapsed()); + EXPECT_FALSE(AXRange::RangeOfContents(*paragraph).IsCollapsed()); +} + +TEST_F(AccessibilityTest, RangeOfContents) { + SetBodyInnerHTML(R"HTML(<p id='paragraph'>hello there</p>)HTML"); + + const AXObject* paragraph = GetAXObjectByElementId("paragraph"); + ASSERT_NE(nullptr, paragraph); + + const AXRange paragraph_range = AXRange::RangeOfContents(*paragraph); + EXPECT_EQ(AXPosition::CreateFirstPositionInContainerObject(*paragraph), + paragraph_range.Start()); + EXPECT_EQ(AXPosition::CreateLastPositionInContainerObject(*paragraph), + paragraph_range.End()); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/accessibility/AXSelection.cpp b/third_party/WebKit/Source/modules/accessibility/AXSelection.cpp index e68fc5a..4a629dd 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXSelection.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXSelection.cpp
@@ -77,10 +77,13 @@ bool AXSelection::IsValid() const { if (!base_.IsValid() || !extent_.IsValid()) return false; + // We don't support selections that span across documents. if (base_.ContainerObject()->GetDocument() != - extent_.ContainerObject()->GetDocument()) + extent_.ContainerObject()->GetDocument()) { return false; + } + DCHECK(!base_.ContainerObject()->GetDocument()->NeedsLayoutTreeUpdate()); #if DCHECK_IS_ON() DCHECK_EQ(base_.ContainerObject()->GetDocument()->DomTreeVersion(),
diff --git a/third_party/WebKit/Source/modules/accessibility/AXSelectionTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXSelectionTest.cpp index 7264a18..11167430 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXSelectionTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXSelectionTest.cpp
@@ -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 "modules/accessibility/AXSelection.h" + #include "core/dom/Node.h" #include "core/editing/Position.h" #include "core/editing/SelectionTemplate.h" #include "modules/accessibility/AXObject.h" #include "modules/accessibility/AXPosition.h" -#include "modules/accessibility/AXSelection.h" #include "modules/accessibility/testing/AccessibilityTest.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/modules/accessibility/BUILD.gn b/third_party/WebKit/Source/modules/accessibility/BUILD.gn index 2c7d31f..5a12abec 100644 --- a/third_party/WebKit/Source/modules/accessibility/BUILD.gn +++ b/third_party/WebKit/Source/modules/accessibility/BUILD.gn
@@ -48,6 +48,8 @@ "AXProgressIndicator.h", "AXRadioInput.cpp", "AXRadioInput.h", + "AXRange.cpp", + "AXRange.h", "AXRelationCache.cpp", "AXRelationCache.h", "AXSVGRoot.cpp",
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManagerTest.cpp b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManagerTest.cpp index 7bce8987..31e9bde3 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManagerTest.cpp +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManagerTest.cpp
@@ -18,7 +18,7 @@ namespace blink { -class BackgroundFetchManagerTest : public ::testing::Test { +class BackgroundFetchManagerTest : public testing::Test { protected: // Creates a vector of WebServiceWorkerRequest entries for the given // |requests| based on the |scope|. Proxied in the fixture to reduce the
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DAPITest.cpp b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DAPITest.cpp index eab8f3a..45afd9c9 100644 --- a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DAPITest.cpp +++ b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DAPITest.cpp
@@ -21,7 +21,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::Mock; +using testing::Mock; namespace blink {
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DTest.cpp index 75166a8..7088298d 100644 --- a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DTest.cpp +++ b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2DTest.cpp
@@ -42,9 +42,9 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSwizzle.h" -using ::testing::_; -using ::testing::InSequence; -using ::testing::Mock; +using testing::_; +using testing::InSequence; +using testing::Mock; namespace blink { @@ -152,7 +152,7 @@ }; // TODO(Oilpan): avoid tedious part-object wrapper by supporting on-heap - // ::testing::Tests. + // testing::Tests. Persistent<WrapGradients> wrap_gradients_; protected:
diff --git a/third_party/WebKit/Source/modules/canvas/offscreencanvas/OffscreenCanvasTest.cpp b/third_party/WebKit/Source/modules/canvas/offscreencanvas/OffscreenCanvasTest.cpp index c889ab29..291fbde 100644 --- a/third_party/WebKit/Source/modules/canvas/offscreencanvas/OffscreenCanvasTest.cpp +++ b/third_party/WebKit/Source/modules/canvas/offscreencanvas/OffscreenCanvasTest.cpp
@@ -19,7 +19,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/mojom/page/page_visibility_state.mojom-blink.h" -using ::testing::Mock; +using testing::Mock; namespace blink {
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp index bceab10..1ca8d19 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp
@@ -13,7 +13,7 @@ static const int kHeight = 75; static const float kZoom = 1.0; -class PaintRenderingContext2DTest : public ::testing::Test { +class PaintRenderingContext2DTest : public testing::Test { protected: void SetUp() override;
diff --git a/third_party/WebKit/Source/modules/eventsource/EventSourceParserTest.cpp b/third_party/WebKit/Source/modules/eventsource/EventSourceParserTest.cpp index 2a0fa442..42a50ce 100644 --- a/third_party/WebKit/Source/modules/eventsource/EventSourceParserTest.cpp +++ b/third_party/WebKit/Source/modules/eventsource/EventSourceParserTest.cpp
@@ -86,7 +86,7 @@ Vector<EventOrReconnectionTimeSetting> events_; }; -class EventSourceParserTest : public ::testing::Test { +class EventSourceParserTest : public testing::Test { protected: using Type = EventOrReconnectionTimeSetting::Type; EventSourceParserTest()
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp index 58ef3bc..a58f5b4 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class DOMFileSystemBaseTest : public ::testing::Test { +class DOMFileSystemBaseTest : public testing::Test { public: DOMFileSystemBaseTest() { file_path_ = test::BlinkRootDir();
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp index 37d3c3f..3cafdad 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
@@ -60,7 +60,7 @@ namespace blink { namespace { -class IDBRequestTest : public ::testing::Test { +class IDBRequestTest : public testing::Test { protected: void SetUp() override { url_loader_mock_factory_ = platform_->GetURLLoaderMockFactory();
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp index 1c652bc2..a90fdf3 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
@@ -76,7 +76,7 @@ FakeIDBDatabaseCallbacks() = default; }; -class IDBTransactionTest : public ::testing::Test { +class IDBTransactionTest : public testing::Test { protected: void SetUp() override { url_loader_mock_factory_ = platform_->GetURLLoaderMockFactory();
diff --git a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h index 1a7b23b..e444090 100644 --- a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h +++ b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h
@@ -14,7 +14,7 @@ namespace blink { -class MockWebIDBDatabase : public ::testing::StrictMock<WebIDBDatabase> { +class MockWebIDBDatabase : public testing::StrictMock<WebIDBDatabase> { public: virtual ~MockWebIDBDatabase();
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp index 8c7103d..454dfada1 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -499,9 +499,7 @@ // seperate button panel. This is because they are displayed in two lines. if (IsModern() && MediaElement().IsHTMLVideoElement()) { media_button_panel_ = new MediaControlButtonPanelElement(*this); - if (RuntimeEnabledFeatures::DoubleTapToJumpOnVideoEnabled()) { - scrubbing_message_ = new MediaControlScrubbingMessageElement(*this); - } + scrubbing_message_ = new MediaControlScrubbingMessageElement(*this); } play_button_ = new MediaControlPlayButtonElement(*this); @@ -916,13 +914,13 @@ return panel_; } -void MediaControlsImpl::BeginScrubbing() { +void MediaControlsImpl::BeginScrubbing(bool is_touch_event) { if (!MediaElement().paused()) { is_paused_for_scrubbing_ = true; MediaElement().pause(); } - if (scrubbing_message_) { + if (scrubbing_message_ && is_touch_event) { scrubbing_message_->SetIsWanted(true); if (scrubbing_message_->DoesFit()) panel_->setAttribute("class", kScrubbingMessageCSSClass);
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h index f8f8cfb..a7da9f70 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h
@@ -134,7 +134,7 @@ void ShowOverlayCastButtonIfNeeded(); // Methods call by the scrubber. - void BeginScrubbing(); + void BeginScrubbing(bool); void EndScrubbing(); void UpdateCurrentTimeDisplay();
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp index 5d0c7b8..f7a5837 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
@@ -34,9 +34,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::AtLeast; -using ::testing::Return; +using testing::_; +using testing::AtLeast; +using testing::Return; namespace blink { @@ -191,7 +191,7 @@ } void TearDown() override { - ::testing::Mock::VerifyAndClear(&ScreenOrientationClient()); + testing::Mock::VerifyAndClear(&ScreenOrientationClient()); ScreenOrientationClient().Close(); } @@ -369,7 +369,7 @@ ScreenOrientationControllerImpl::ComputeOrientation( screen_info.rect, screen_info.orientation_angle)); - ::testing::Mock::VerifyAndClearExpectations(&ChromeClient()); + testing::Mock::VerifyAndClearExpectations(&ChromeClient()); EXPECT_CALL(ChromeClient(), GetScreenInfo()) .Times(AtLeast(1)) .WillRepeatedly(Return(screen_info)); @@ -623,8 +623,8 @@ // Repeat test with natural_orientation_is_portrait_ = false then true. for (int n_o_i_p = 0; n_o_i_p <= 1; n_o_i_p++) { natural_orientation_is_portrait_ = static_cast<bool>(n_o_i_p); - SCOPED_TRACE(::testing::Message() << "natural_orientation_is_portrait_=" - << natural_orientation_is_portrait_); + SCOPED_TRACE(testing::Message() << "natural_orientation_is_portrait_=" + << natural_orientation_is_portrait_); DeviceOrientationType natural_orientation = natural_orientation_is_portrait_ ? DeviceOrientationType::kPortrait @@ -639,7 +639,7 @@ // orientation, it only depends on whether the device is naturally portrait // or naturally landscape). Similarly for a naturally landscape device. for (int screen_angle = 0; screen_angle < 360; screen_angle += 90) { - SCOPED_TRACE(::testing::Message() << "screen_angle=" << screen_angle); + SCOPED_TRACE(testing::Message() << "screen_angle=" << screen_angle); WebScreenOrientationType screen_type = kWebScreenOrientationUndefined; switch (screen_angle) { case 0:
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp index 57b38fa..a217f8f 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp
@@ -32,8 +32,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::AtLeast; -using ::testing::Return; +using testing::AtLeast; +using testing::Return; namespace blink { @@ -229,7 +229,7 @@ WebScreenOrientationType new_screen_orientation) { WebScreenInfo screen_info; screen_info.orientation_type = new_screen_orientation; - ::testing::Mock::VerifyAndClearExpectations(&GetChromeClient()); + testing::Mock::VerifyAndClearExpectations(&GetChromeClient()); EXPECT_CALL(GetChromeClient(), GetScreenInfo()) .Times(AtLeast(1)) .WillRepeatedly(Return(screen_info));
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp index 8aa73679..1e01d36c 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
@@ -218,9 +218,10 @@ } else { // Cancel the play pause event. tap_timer_.Stop(); - tap_was_touch_event_.reset(); - if (RuntimeEnabledFeatures::DoubleTapToJumpOnVideoEnabled()) { + // If both taps were touch events, then jump. + if (tap_was_touch_event_.value() && + MediaControlsImpl::IsTouchEvent(event)) { // Jump forwards or backwards based on the position of the tap. WebSize element_size = MediaControlElementsHelper::GetSizeOrDefault(*this, WebSize(0, 0)); @@ -240,6 +241,7 @@ } } + tap_was_touch_event_.reset(); event->SetDefaultHandled(); } }
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineElement.cpp index 02bf2de..ab22edc 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineElement.cpp
@@ -118,7 +118,7 @@ if (BeginScrubbingEvent(*event)) { Platform::Current()->RecordAction( UserMetricsAction("Media.Controls.ScrubbingBegin")); - GetMediaControls().BeginScrubbing(); + GetMediaControls().BeginScrubbing(MediaControlsImpl::IsTouchEvent(event)); Element* thumb = UserAgentShadowRoot()->getElementById( ShadowElementNames::SliderThumb()); bool started_from_thumb = thumb && thumb == event->target()->ToNode();
diff --git a/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css b/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css index 51d9f40e..7242f11 100644 --- a/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css +++ b/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css
@@ -3,6 +3,22 @@ found in the LICENSE file.*/ /** + * Used in MediaDocument only. + * TODO: Move those outside of this file. + */ + +video:-webkit-full-page-media { + margin: auto; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + max-height: 100%; + max-width: 100%; +} + +/** * Panel Structure */
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevicesTest.cpp b/third_party/WebKit/Source/modules/mediastream/MediaDevicesTest.cpp index 2f84176..830ab8e 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevicesTest.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevicesTest.cpp
@@ -185,7 +185,7 @@ ScriptValue saved_arg_; }; -class MediaDevicesTest : public ::testing::Test { +class MediaDevicesTest : public testing::Test { public: using MediaDeviceInfos = PersistentHeapVector<Member<MediaDeviceInfo>>;
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp index 2734f8b..bc80702 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -63,7 +63,7 @@ KURL base_; }; -class NotificationDataTest : public ::testing::Test { +class NotificationDataTest : public testing::Test { public: void SetUp() override { execution_context_ = new CompleteUrlExecutionContext(kNotificationBaseUrl);
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp index 00d2405..be5b841 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
@@ -123,7 +123,7 @@ } class PaymentRequestDetailsTest - : public ::testing::TestWithParam<DetailsTestCase> {}; + : public testing::TestWithParam<DetailsTestCase> {}; TEST_P(PaymentRequestDetailsTest, ValidatesDetails) { V8TestingScope scope; @@ -147,738 +147,738 @@ INSTANTIATE_TEST_CASE_P( EmptyData, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataLabel, - kPaymentTestOverwriteValue, - "", - false), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataLabel, - kPaymentTestOverwriteValue, - "", - false), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataId, - kPaymentTestOverwriteValue, - "", - false), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataLabel, - kPaymentTestOverwriteValue, - "", - false), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataLabel, - kPaymentTestOverwriteValue, - "", - false), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataLabel, - kPaymentTestOverwriteValue, - "", - false))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataLabel, + kPaymentTestOverwriteValue, + "", + false), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataLabel, + kPaymentTestOverwriteValue, + "", + false), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataId, + kPaymentTestOverwriteValue, + "", + false), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataLabel, + kPaymentTestOverwriteValue, + "", + false), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataLabel, + kPaymentTestOverwriteValue, + "", + false), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataLabel, + kPaymentTestOverwriteValue, + "", + false))); INSTANTIATE_TEST_CASE_P( ValidCurrencyCodeFormat, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataCurrencyCode, - kPaymentTestOverwriteValue, - "USD"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataCurrencyCode, - kPaymentTestOverwriteValue, - "USD"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataCurrencyCode, - kPaymentTestOverwriteValue, - "USD"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataCurrencyCode, - kPaymentTestOverwriteValue, - "USD"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataCurrencyCode, - kPaymentTestOverwriteValue, - "USD"))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataCurrencyCode, + kPaymentTestOverwriteValue, + "USD"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataCurrencyCode, + kPaymentTestOverwriteValue, + "USD"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataCurrencyCode, + kPaymentTestOverwriteValue, + "USD"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataCurrencyCode, + kPaymentTestOverwriteValue, + "USD"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataCurrencyCode, + kPaymentTestOverwriteValue, + "USD"))); INSTANTIATE_TEST_CASE_P( ValidCurrencySystem, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataCurrencySystem, - kPaymentTestOverwriteValue, - "https://bitcoin.org"))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataCurrencySystem, + kPaymentTestOverwriteValue, + "https://bitcoin.org"))); INSTANTIATE_TEST_CASE_P( InvalidCurrencySystem, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataCurrencySystem, - kPaymentTestOverwriteValue, - "\\^%\\", - true, - kV8RangeError))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataCurrencySystem, + kPaymentTestOverwriteValue, + "\\^%\\", + true, + kV8RangeError))); INSTANTIATE_TEST_CASE_P( ValidValueFormat, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "0"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.99"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "0"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-0"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.99"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3.00"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "0"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-0"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.99"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3.00"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-012345678901234567890123456789"))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "0"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.99"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "0"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-0"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.99"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3.00"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "0"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-0"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.99"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3.00"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-012345678901234567890123456789"))); INSTANTIATE_TEST_CASE_P( ValidValueFormatForModifier, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "0"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.99"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "0"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-0"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.99"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3.00"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "012345678901234567890123456789"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789.0123456789"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789012345678.9"), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-012345678901234567890123456789"))); + testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "0"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.99"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "0"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-0"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.99"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3.00"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "012345678901234567890123456789"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789.0123456789"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789012345678.9"), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-012345678901234567890123456789"))); INSTANTIATE_TEST_CASE_P( InvalidValueFormat, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3.00", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "notdigits", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "ALSONOTDIGITS", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - ".99", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1.0.0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1/3", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789.0123456789", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789012345678.9", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-012345678901234567890123456789", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "notdigits", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "ALSONOTDIGITS", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - ".99", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1.0.0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1/3", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "notdigits", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "ALSONOTDIGITS", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - ".99", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1.0.0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailShippingOption, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1/3", - true, - kV8TypeError))); + testing::Values(DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3.00", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "notdigits", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "ALSONOTDIGITS", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + ".99", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1.0.0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1/3", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789.0123456789", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789012345678.9", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-012345678901234567890123456789", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "notdigits", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "ALSONOTDIGITS", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + ".99", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1.0.0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1/3", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "notdigits", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "ALSONOTDIGITS", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + ".99", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1.0.0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailShippingOption, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1/3", + true, + kV8TypeError))); INSTANTIATE_TEST_CASE_P( InvalidValueFormatForModifier, PaymentRequestDetailsTest, - ::testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-3.00", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "notdigits", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "ALSONOTDIGITS", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - ".99", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1.0.0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1/3", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789.0123456789", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-01234567890123456789012345678.9", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierTotal, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-012345678901234567890123456789", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "notdigits", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "ALSONOTDIGITS", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - ".99", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "-10.", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "10-", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1-0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1.0.0", - true, - kV8TypeError), - DetailsTestCase(kPaymentTestDetailModifierItem, - kPaymentTestDataValue, - kPaymentTestOverwriteValue, - "1/3", - true, - kV8TypeError))); + testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-3.00", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "notdigits", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "ALSONOTDIGITS", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + ".99", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1.0.0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1/3", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789.0123456789", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-01234567890123456789012345678.9", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierTotal, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-012345678901234567890123456789", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "notdigits", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "ALSONOTDIGITS", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + ".99", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "-10.", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "10-", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1-0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1.0.0", + true, + kV8TypeError), + DetailsTestCase(kPaymentTestDetailModifierItem, + kPaymentTestDataValue, + kPaymentTestOverwriteValue, + "1/3", + true, + kV8TypeError))); } // namespace } // namespace blink
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp index 8e87d497..a503dbd 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
@@ -49,8 +49,8 @@ scope.GetExceptionState()); EXPECT_FALSE(scope.GetExceptionState().HadException()); - EXPECT_CALL(*updater, OnUpdatePaymentDetails(::testing::_)); - EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(::testing::_)).Times(0); + EXPECT_CALL(*updater, OnUpdatePaymentDetails(testing::_)); + EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(testing::_)).Times(0); payment_details->Resolve("foo"); } @@ -69,8 +69,8 @@ scope.GetExceptionState()); EXPECT_FALSE(scope.GetExceptionState().HadException()); - EXPECT_CALL(*updater, OnUpdatePaymentDetails(::testing::_)).Times(0); - EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(::testing::_)); + EXPECT_CALL(*updater, OnUpdatePaymentDetails(testing::_)).Times(0); + EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(testing::_)); payment_details->Reject("oops"); }
diff --git a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp index 788781b6..4ef36e3d 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
@@ -28,8 +28,8 @@ public: MockPaymentCompleter() { - ON_CALL(*this, Complete(::testing::_, ::testing::_)) - .WillByDefault(::testing::ReturnPointee(&dummy_promise_)); + ON_CALL(*this, Complete(testing::_, testing::_)) + .WillByDefault(testing::ReturnPointee(&dummy_promise_)); } ~MockPaymentCompleter() override = default;
diff --git a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp index 90b8e954..b552f690 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
@@ -218,26 +218,26 @@ PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() { v8::MicrotasksScope::PerformCheckpoint(script_state_->GetIsolate()); for (MockFunction* mock_function : mock_functions_) { - ::testing::Mock::VerifyAndClearExpectations(mock_function); + testing::Mock::VerifyAndClearExpectations(mock_function); } } v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall( String* captor) { mock_functions_.push_back(new MockFunction(script_state_, captor)); - EXPECT_CALL(*mock_functions_.back(), Call(::testing::_)); + EXPECT_CALL(*mock_functions_.back(), Call(testing::_)); return mock_functions_.back()->Bind(); } v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall() { mock_functions_.push_back(new MockFunction(script_state_)); - EXPECT_CALL(*mock_functions_.back(), Call(::testing::_)); + EXPECT_CALL(*mock_functions_.back(), Call(testing::_)); return mock_functions_.back()->Bind(); } v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectNoCall() { mock_functions_.push_back(new MockFunction(script_state_)); - EXPECT_CALL(*mock_functions_.back(), Call(::testing::_)).Times(0); + EXPECT_CALL(*mock_functions_.back(), Call(testing::_)).Times(0); return mock_functions_.back()->Bind(); } @@ -250,16 +250,16 @@ PaymentRequestMockFunctionScope::MockFunction::MockFunction( ScriptState* script_state) : ScriptFunction(script_state) { - ON_CALL(*this, Call(::testing::_)).WillByDefault(::testing::ReturnArg<0>()); + ON_CALL(*this, Call(testing::_)).WillByDefault(testing::ReturnArg<0>()); } PaymentRequestMockFunctionScope::MockFunction::MockFunction( ScriptState* script_state, String* captor) : ScriptFunction(script_state), value_(captor) { - ON_CALL(*this, Call(::testing::_)) + ON_CALL(*this, Call(testing::_)) .WillByDefault( - ::testing::DoAll(SaveValueIn(value_), ::testing::ReturnArg<0>())); + testing::DoAll(SaveValueIn(value_), testing::ReturnArg<0>())); } v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::Bind() {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp index ab8e1aa..604b735 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
@@ -24,7 +24,7 @@ }; class PaymentsCurrencyValidatorTest - : public ::testing::TestWithParam<CurrencyCodeTestCase> {}; + : public testing::TestWithParam<CurrencyCodeTestCase> {}; const char* LongString2048() { static char long_string[2049]; @@ -59,7 +59,7 @@ INSTANTIATE_TEST_CASE_P( CurrencyCodes, PaymentsCurrencyValidatorTest, - ::testing::Values( + testing::Values( // The most common identifiers are three-letter alphabetic codes as // defined by [ISO4217] (for example, "USD" for US Dollars). // |system| is a URL that indicates the currency system that the @@ -102,8 +102,7 @@ return out; } -class PaymentsAmountValidatorTest : public ::testing::TestWithParam<TestCase> { -}; +class PaymentsAmountValidatorTest : public testing::TestWithParam<TestCase> {}; TEST_P(PaymentsAmountValidatorTest, IsValidAmountFormat) { String error_message; @@ -122,35 +121,34 @@ INSTANTIATE_TEST_CASE_P( Amounts, PaymentsAmountValidatorTest, - ::testing::Values(TestCase("0", true), - TestCase("-0", true), - TestCase("1", true), - TestCase("10", true), - TestCase("-3", true), - TestCase("10.99", true), - TestCase("-3.00", true), - TestCase("01234567890123456789.0123456789", true), - TestCase("01234567890123456789012345678.9", true), - TestCase("012345678901234567890123456789", true), - TestCase("-01234567890123456789.0123456789", true), - TestCase("-01234567890123456789012345678.9", true), - TestCase("-012345678901234567890123456789", true), - // Invalid amount formats - TestCase("", false), - TestCase("-", false), - TestCase("notdigits", false), - TestCase("ALSONOTDIGITS", false), - TestCase("10.", false), - TestCase(".99", false), - TestCase("-10.", false), - TestCase("-.99", false), - TestCase("10-", false), - TestCase("1-0", false), - TestCase("1.0.0", false), - TestCase("1/3", false))); + testing::Values(TestCase("0", true), + TestCase("-0", true), + TestCase("1", true), + TestCase("10", true), + TestCase("-3", true), + TestCase("10.99", true), + TestCase("-3.00", true), + TestCase("01234567890123456789.0123456789", true), + TestCase("01234567890123456789012345678.9", true), + TestCase("012345678901234567890123456789", true), + TestCase("-01234567890123456789.0123456789", true), + TestCase("-01234567890123456789012345678.9", true), + TestCase("-012345678901234567890123456789", true), + // Invalid amount formats + TestCase("", false), + TestCase("-", false), + TestCase("notdigits", false), + TestCase("ALSONOTDIGITS", false), + TestCase("10.", false), + TestCase(".99", false), + TestCase("-10.", false), + TestCase("-.99", false), + TestCase("10-", false), + TestCase("1-0", false), + TestCase("1.0.0", false), + TestCase("1/3", false))); -class PaymentsRegionValidatorTest : public ::testing::TestWithParam<TestCase> { -}; +class PaymentsRegionValidatorTest : public testing::TestWithParam<TestCase> {}; TEST_P(PaymentsRegionValidatorTest, IsValidCountryCodeFormat) { String error_message; @@ -168,16 +166,16 @@ INSTANTIATE_TEST_CASE_P(CountryCodes, PaymentsRegionValidatorTest, - ::testing::Values(TestCase("US", true), - // Invalid country code formats - TestCase("U1", false), - TestCase("U", false), - TestCase("us", false), - TestCase("USA", false), - TestCase("", false))); + testing::Values(TestCase("US", true), + // Invalid country code formats + TestCase("U1", false), + TestCase("U", false), + TestCase("us", false), + TestCase("USA", false), + TestCase("", false))); -class PaymentsLanguageValidatorTest - : public ::testing::TestWithParam<TestCase> {}; +class PaymentsLanguageValidatorTest : public testing::TestWithParam<TestCase> { +}; TEST_P(PaymentsLanguageValidatorTest, IsValidLanguageCodeFormat) { String error_message; @@ -195,18 +193,17 @@ INSTANTIATE_TEST_CASE_P(LanguageCodes, PaymentsLanguageValidatorTest, - ::testing::Values(TestCase("", true), - TestCase("en", true), - TestCase("eng", true), - // Invalid language code formats - TestCase("e1", false), - TestCase("en1", false), - TestCase("e", false), - TestCase("engl", false), - TestCase("EN", false))); + testing::Values(TestCase("", true), + TestCase("en", true), + TestCase("eng", true), + // Invalid language code formats + TestCase("e1", false), + TestCase("en1", false), + TestCase("e", false), + TestCase("engl", false), + TestCase("EN", false))); -class PaymentsScriptValidatorTest : public ::testing::TestWithParam<TestCase> { -}; +class PaymentsScriptValidatorTest : public testing::TestWithParam<TestCase> {}; TEST_P(PaymentsScriptValidatorTest, IsValidScriptCodeFormat) { String error_message; @@ -224,15 +221,15 @@ INSTANTIATE_TEST_CASE_P(ScriptCodes, PaymentsScriptValidatorTest, - ::testing::Values(TestCase("", true), - TestCase("Latn", true), - // Invalid script code formats - TestCase("Lat1", false), - TestCase("1lat", false), - TestCase("Latin", false), - TestCase("Lat", false), - TestCase("latn", false), - TestCase("LATN", false))); + testing::Values(TestCase("", true), + TestCase("Latn", true), + // Invalid script code formats + TestCase("Lat1", false), + TestCase("1lat", false), + TestCase("Latin", false), + TestCase("Lat", false), + TestCase("latn", false), + TestCase("LATN", false))); struct ShippingAddressTestCase { ShippingAddressTestCase(const char* country_code, @@ -252,7 +249,7 @@ }; class PaymentsShippingAddressValidatorTest - : public ::testing::TestWithParam<ShippingAddressTestCase> {}; + : public testing::TestWithParam<ShippingAddressTestCase> {}; TEST_P(PaymentsShippingAddressValidatorTest, IsValidShippingAddress) { payments::mojom::blink::PaymentAddressPtr address = @@ -275,7 +272,7 @@ INSTANTIATE_TEST_CASE_P( ShippingAddresses, PaymentsShippingAddressValidatorTest, - ::testing::Values( + testing::Values( ShippingAddressTestCase("US", "en", "Latn", true), ShippingAddressTestCase("US", "en", "", true), ShippingAddressTestCase("US", "", "", true),
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionTest.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionTest.cpp index 693da916..6480acb 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionTest.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionTest.cpp
@@ -26,7 +26,7 @@ namespace blink { -class RTCPeerConnectionTest : public ::testing::Test { +class RTCPeerConnectionTest : public testing::Test { public: RTCPeerConnection* CreatePC(V8TestingScope& scope) { RTCConfiguration config;
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp index 840554b..45e3a50 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp
@@ -4,6 +4,7 @@ #include "modules/peerconnection/RTCRtpReceiver.h" +#include "modules/peerconnection/WebRTCStatsReportCallbackResolver.h" #include "platform/bindings/Microtask.h" #include "platform/wtf/text/WTFString.h" #include "public/platform/WebMediaStream.h" @@ -37,6 +38,13 @@ return contributing_sources_; } +ScriptPromise RTCRtpReceiver::getStats(ScriptState* script_state) { + ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); + ScriptPromise promise = resolver->Promise(); + receiver_->GetStats(WebRTCStatsReportCallbackResolver::Create(resolver)); + return promise; +} + const WebRTCRtpReceiver& RTCRtpReceiver::web_receiver() const { return *receiver_; }
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h index 442d215..06b83bb 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h +++ b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.h
@@ -30,6 +30,7 @@ MediaStreamTrack* track() const; const HeapVector<Member<RTCRtpContributingSource>>& getContributingSources(); + ScriptPromise getStats(ScriptState*); const WebRTCRtpReceiver& web_receiver() const; MediaStreamVector streams() const;
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.idl b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.idl index 35d0b2d2..48e20ba 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.idl +++ b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.idl
@@ -7,6 +7,6 @@ interface RTCRtpReceiver { readonly attribute MediaStreamTrack track; sequence<RTCRtpContributingSource> getContributingSources(); - + [RuntimeEnabled=RTCPeerConnectionGetStatsSelector, CallWith=ScriptState] Promise<RTCStatsReport> getStats(); // TODO(hbos): Support every member of the spec. https://crbug.com/700916 };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityStateTest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityStateTest.cpp index 370c241..fa64fa33 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityStateTest.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityStateTest.cpp
@@ -45,7 +45,7 @@ MOCK_METHOD0(RejectAvailabilityNotSupported, void()); }; -class PresentationAvailabilityStateTest : public ::testing::Test { +class PresentationAvailabilityStateTest : public testing::Test { public: PresentationAvailabilityStateTest() : url1_(KURL("https://www.example.com/1.html")), @@ -174,7 +174,7 @@ TEST_F(PresentationAvailabilityStateTest, RequestAvailabilityOneUrlNoAvailabilityChange) { auto* mock_callback = - new ::testing::StrictMock<MockPresentationAvailabilityCallbacks>(); + new testing::StrictMock<MockPresentationAvailabilityCallbacks>(); EXPECT_CALL(mock_presentation_service_, ListenForScreenAvailability(url1_)) .Times(1);
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp index ec0c21b6..eb24669 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp
@@ -33,7 +33,7 @@ MOCK_METHOD2(handleEvent, void(ExecutionContext* executionContext, Event*)); }; -class PresentationReceiverTest : public ::testing::Test { +class PresentationReceiverTest : public testing::Test { public: PresentationReceiverTest() : connection_info_(KURL("http://example.com"), "id") {} @@ -76,7 +76,7 @@ EXPECT_EQ(expected_size, receiver->connection_list_->connections_.size()); } -using ::testing::StrictMock; +using testing::StrictMock; TEST_F(PresentationReceiverTest, NoConnectionUnresolvedConnectionList) { V8TestingScope scope; @@ -85,7 +85,7 @@ auto event_handler = new StrictMock<MockEventListenerForPresentationReceiver>(); AddConnectionavailableEventListener(event_handler, receiver); - EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); + EXPECT_CALL(*event_handler, handleEvent(testing::_, testing::_)).Times(0); receiver->connectionList(scope.GetScriptState()); @@ -101,7 +101,7 @@ auto event_handler = new StrictMock<MockEventListenerForPresentationReceiver>(); AddConnectionavailableEventListener(event_handler, receiver); - EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); + EXPECT_CALL(*event_handler, handleEvent(testing::_, testing::_)).Times(0); receiver->connectionList(scope.GetScriptState()); @@ -122,7 +122,7 @@ StrictMock<MockEventListenerForPresentationReceiver>* event_handler = new StrictMock<MockEventListenerForPresentationReceiver>(); AddConnectionavailableEventListener(event_handler, receiver); - EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(1); + EXPECT_CALL(*event_handler, handleEvent(testing::_, testing::_)).Times(1); receiver->connectionList(scope.GetScriptState()); @@ -153,7 +153,7 @@ StrictMock<MockEventListenerForPresentationReceiver>* event_handler = new StrictMock<MockEventListenerForPresentationReceiver>(); AddConnectionavailableEventListener(event_handler, receiver); - EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); + EXPECT_CALL(*event_handler, handleEvent(testing::_, testing::_)).Times(0); // Receive first connection. receiver->OnReceiverConnectionAvailable( @@ -180,13 +180,13 @@ TEST_F(PresentationReceiverTest, CreateReceiver) { MockWebPresentationClient client; - EXPECT_CALL(client, SetReceiver(::testing::NotNull())); + EXPECT_CALL(client, SetReceiver(testing::NotNull())); V8TestingScope scope; new PresentationReceiver(&scope.GetFrame(), &client); - EXPECT_TRUE(::testing::Mock::VerifyAndClearExpectations(&client)); + EXPECT_TRUE(testing::Mock::VerifyAndClearExpectations(&client)); - EXPECT_CALL(client, SetReceiver(::testing::IsNull())); + EXPECT_CALL(client, SetReceiver(testing::IsNull())); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp index fd452279..6735cc44 100644 --- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp +++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp
@@ -26,9 +26,8 @@ class MockFunction : public ScriptFunction { public: - static ::testing::StrictMock<MockFunction>* Create( - ScriptState* script_state) { - return new ::testing::StrictMock<MockFunction>(script_state); + static testing::StrictMock<MockFunction>* Create(ScriptState* script_state) { + return new testing::StrictMock<MockFunction>(script_state); } v8::Local<v8::Function> Bind() { return BindToV8Function(); } @@ -63,7 +62,7 @@ void(PresentationAvailabilityObserver*)); }; -class RemotePlaybackTest : public ::testing::Test, +class RemotePlaybackTest : public testing::Test, private ScopedRemotePlaybackBackendForTest { public: RemotePlaybackTest() : ScopedRemotePlaybackBackendForTest(true) {} @@ -99,8 +98,8 @@ auto resolve = MockFunction::Create(scope.GetScriptState()); auto reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(0); - EXPECT_CALL(*reject, Call(::testing::_)).Times(1); + EXPECT_CALL(*resolve, Call(testing::_)).Times(0); + EXPECT_CALL(*reject, Call(testing::_)).Times(1); std::unique_ptr<UserGestureIndicator> indicator = Frame::NotifyUserActivation( &page_holder->GetFrame(), UserGestureToken::kNewGesture); @@ -113,8 +112,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); } TEST_F(RemotePlaybackTest, PromptConnectedRejectsWhenCancelled) { @@ -130,8 +129,8 @@ auto resolve = MockFunction::Create(scope.GetScriptState()); auto reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(0); - EXPECT_CALL(*reject, Call(::testing::_)).Times(1); + EXPECT_CALL(*resolve, Call(testing::_)).Times(0); + EXPECT_CALL(*reject, Call(testing::_)).Times(1); SetState(remote_playback, WebRemotePlaybackState::kConnected); @@ -146,8 +145,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); } TEST_F(RemotePlaybackTest, PromptConnectedResolvesWhenDisconnected) { @@ -163,8 +162,8 @@ auto resolve = MockFunction::Create(scope.GetScriptState()); auto reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(1); - EXPECT_CALL(*reject, Call(::testing::_)).Times(0); + EXPECT_CALL(*resolve, Call(testing::_)).Times(1); + EXPECT_CALL(*reject, Call(testing::_)).Times(0); SetState(remote_playback, WebRemotePlaybackState::kConnected); @@ -180,8 +179,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); } TEST_F(RemotePlaybackTest, StateChangeEvents) { @@ -195,11 +194,11 @@ HTMLMediaElementRemotePlayback::remote(*element); auto connecting_handler = - new ::testing::StrictMock<MockEventListenerForRemotePlayback>(); + new testing::StrictMock<MockEventListenerForRemotePlayback>(); auto connect_handler = - new ::testing::StrictMock<MockEventListenerForRemotePlayback>(); + new testing::StrictMock<MockEventListenerForRemotePlayback>(); auto disconnect_handler = - new ::testing::StrictMock<MockEventListenerForRemotePlayback>(); + new testing::StrictMock<MockEventListenerForRemotePlayback>(); remote_playback->addEventListener(EventTypeNames::connecting, connecting_handler); @@ -207,11 +206,10 @@ remote_playback->addEventListener(EventTypeNames::disconnect, disconnect_handler); - EXPECT_CALL(*connecting_handler, handleEvent(::testing::_, ::testing::_)) + EXPECT_CALL(*connecting_handler, handleEvent(testing::_, testing::_)) .Times(1); - EXPECT_CALL(*connect_handler, handleEvent(::testing::_, ::testing::_)) - .Times(1); - EXPECT_CALL(*disconnect_handler, handleEvent(::testing::_, ::testing::_)) + EXPECT_CALL(*connect_handler, handleEvent(testing::_, testing::_)).Times(1); + EXPECT_CALL(*disconnect_handler, handleEvent(testing::_, testing::_)) .Times(1); SetState(remote_playback, WebRemotePlaybackState::kConnecting); @@ -223,9 +221,9 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(connecting_handler); - ::testing::Mock::VerifyAndClear(connect_handler); - ::testing::Mock::VerifyAndClear(disconnect_handler); + testing::Mock::VerifyAndClear(connecting_handler); + testing::Mock::VerifyAndClear(connect_handler); + testing::Mock::VerifyAndClear(disconnect_handler); } TEST_F(RemotePlaybackTest, @@ -242,8 +240,8 @@ MockFunction* resolve = MockFunction::Create(scope.GetScriptState()); MockFunction* reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(0); - EXPECT_CALL(*reject, Call(::testing::_)).Times(1); + EXPECT_CALL(*resolve, Call(testing::_)).Times(0); + EXPECT_CALL(*reject, Call(testing::_)).Times(1); std::unique_ptr<UserGestureIndicator> indicator = Frame::NotifyUserActivation( &page_holder->GetFrame(), UserGestureToken::kNewGesture); @@ -257,8 +255,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); } TEST_F(RemotePlaybackTest, DisableRemotePlaybackCancelsAvailabilityCallbacks) { @@ -278,13 +276,13 @@ // The initial call upon registering will not happen as it's posted on the // message loop. - EXPECT_CALL(*callback_function, Call(::testing::_)).Times(0); + EXPECT_CALL(*callback_function, Call(testing::_)).Times(0); MockFunction* resolve = MockFunction::Create(scope.GetScriptState()); MockFunction* reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(1); - EXPECT_CALL(*reject, Call(::testing::_)).Times(0); + EXPECT_CALL(*resolve, Call(testing::_)).Times(1); + EXPECT_CALL(*reject, Call(testing::_)).Times(0); remote_playback ->watchAvailability(scope.GetScriptState(), availability_callback) @@ -298,9 +296,9 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); - ::testing::Mock::VerifyAndClear(callback_function); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(callback_function); } TEST_F(RemotePlaybackTest, PromptThrowsWhenBackendDisabled) { @@ -317,8 +315,8 @@ auto resolve = MockFunction::Create(scope.GetScriptState()); auto reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(0); - EXPECT_CALL(*reject, Call(::testing::_)).Times(1); + EXPECT_CALL(*resolve, Call(testing::_)).Times(0); + EXPECT_CALL(*reject, Call(testing::_)).Times(1); std::unique_ptr<UserGestureIndicator> indicator = Frame::NotifyUserActivation( &page_holder->GetFrame(), UserGestureToken::kNewGesture); @@ -330,8 +328,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); } TEST_F(RemotePlaybackTest, WatchAvailabilityWorksWhenBackendDisabled) { @@ -352,13 +350,13 @@ // The initial call upon registering will not happen as it's posted on the // message loop. - EXPECT_CALL(*callback_function, Call(::testing::_)).Times(0); + EXPECT_CALL(*callback_function, Call(testing::_)).Times(0); MockFunction* resolve = MockFunction::Create(scope.GetScriptState()); MockFunction* reject = MockFunction::Create(scope.GetScriptState()); - EXPECT_CALL(*resolve, Call(::testing::_)).Times(1); - EXPECT_CALL(*reject, Call(::testing::_)).Times(0); + EXPECT_CALL(*resolve, Call(testing::_)).Times(1); + EXPECT_CALL(*reject, Call(testing::_)).Times(0); remote_playback ->watchAvailability(scope.GetScriptState(), availability_callback) @@ -369,9 +367,9 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(resolve); - ::testing::Mock::VerifyAndClear(reject); - ::testing::Mock::VerifyAndClear(callback_function); + testing::Mock::VerifyAndClear(resolve); + testing::Mock::VerifyAndClear(reject); + testing::Mock::VerifyAndClear(callback_function); } TEST_F(RemotePlaybackTest, IsListening) { @@ -392,10 +390,10 @@ frame, static_cast<PresentationController*>(mock_controller)); EXPECT_CALL(*mock_controller, - AddAvailabilityObserver(::testing::Eq(remote_playback))) + AddAvailabilityObserver(testing::Eq(remote_playback))) .Times(2); EXPECT_CALL(*mock_controller, - RemoveAvailabilityObserver(::testing::Eq(remote_playback))) + RemoveAvailabilityObserver(testing::Eq(remote_playback))) .Times(2); MockFunction* callback_function = @@ -405,7 +403,7 @@ // The initial call upon registering will not happen as it's posted on the // message loop. - EXPECT_CALL(*callback_function, Call(::testing::_)).Times(2); + EXPECT_CALL(*callback_function, Call(testing::_)).Times(2); remote_playback->watchAvailability(scope.GetScriptState(), availability_callback); @@ -441,8 +439,8 @@ // Verify mock expectations explicitly as the mock objects are garbage // collected. - ::testing::Mock::VerifyAndClear(callback_function); - ::testing::Mock::VerifyAndClear(mock_controller); + testing::Mock::VerifyAndClear(callback_function); + testing::Mock::VerifyAndClear(mock_controller); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp index a56ec4c..940964d5 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp
@@ -109,7 +109,7 @@ std::unique_ptr<RawScriptData>(const WebURL& script_url)); }; -class WebEmbeddedWorkerImplTest : public ::testing::Test { +class WebEmbeddedWorkerImplTest : public testing::Test { protected: void SetUp() override { auto client = std::make_unique<MockServiceWorkerContextClient>(); @@ -154,11 +154,11 @@ TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart) { EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); } TEST_F(WebEmbeddedWorkerImplTest, TerminateWhileWaitingForDebugger) { @@ -166,33 +166,33 @@ start_data_.wait_for_debugger_mode = WebEmbeddedWorkerStartData::kWaitForDebugger; worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); } TEST_F(WebEmbeddedWorkerImplTest, TerminateWhileLoadingScript) { EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate before loading the script. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); } TEST_F(WebEmbeddedWorkerImplTest, TerminateWhilePausedAfterDownload) { @@ -200,31 +200,31 @@ start_data_.pause_after_download_mode = WebEmbeddedWorkerStartData::kPauseAfterDownload; worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()).Times(0); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Terminate before resuming after download. EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()).Times(0); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); } TEST_F(WebEmbeddedWorkerImplTest, ScriptNotFound) { @@ -240,26 +240,26 @@ EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(0); EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()).Times(0); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); } // The running worker is detected as a memory leak. crbug.com/586897 and @@ -272,32 +272,32 @@ TEST_F(WebEmbeddedWorkerImplTest, MAYBE_DontPauseAfterDownload) { EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); // This is called on the worker thread. EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); mock_client_->WaitUntilScriptEvaluated(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate the running worker thread. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(0); @@ -317,37 +317,37 @@ start_data_.pause_after_download_mode = WebEmbeddedWorkerStartData::kPauseAfterDownload; worker_->StartWorkerContext(start_data_); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()).Times(0); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_); // Resume after download. EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()) - .WillOnce(::testing::Return(nullptr)); + .WillOnce(testing::Return(nullptr)); // This is called on the worker thread. EXPECT_CALL(*mock_installed_scripts_manager_, IsScriptInstalled(start_data_.script_url)) - .Times(::testing::AtLeast(1)) - .WillRepeatedly(::testing::Return(false)); + .Times(testing::AtLeast(1)) + .WillRepeatedly(testing::Return(false)); worker_->ResumeAfterDownload(); mock_client_->WaitUntilScriptEvaluated(); - ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate the running worker thread. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(0);
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp index 3956196..1c4039f 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp
@@ -52,7 +52,7 @@ bool wake_lock_status_ = false; }; -class ScreenWakeLockTest : public ::testing::Test { +class ScreenWakeLockTest : public testing::Test { protected: void SetUp() override { service_manager::InterfaceProvider::TestApi test_api(
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContextTest.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContextTest.cpp index bcc8b05..6e9d80a 100644 --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContextTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContextTest.cpp
@@ -102,7 +102,7 @@ TEST_P(test_case_name, DISABLED_##test_name) class BaseAudioContextAutoplayTest - : public ::testing::TestWithParam<AutoplayPolicy::Type> { + : public testing::TestWithParam<AutoplayPolicy::Type> { protected: using AutoplayStatus = BaseAudioContext::AutoplayStatus; @@ -743,9 +743,9 @@ INSTANTIATE_TEST_CASE_P( BaseAudioContextAutoplayTest, BaseAudioContextAutoplayTest, - ::testing::Values(AutoplayPolicy::Type::kNoUserGestureRequired, - AutoplayPolicy::Type::kUserGestureRequired, - AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin, - AutoplayPolicy::Type::kDocumentUserActivationRequired)); + testing::Values(AutoplayPolicy::Type::kNoUserGestureRequired, + AutoplayPolicy::Type::kUserGestureRequired, + AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin, + AutoplayPolicy::Type::kDocumentUserActivationRequired)); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp index 0833022..f646d646 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
@@ -26,23 +26,23 @@ #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::InSequence; -using ::testing::Ref; -using ::testing::Return; +using testing::_; +using testing::AnyNumber; +using testing::InSequence; +using testing::Ref; +using testing::Return; namespace blink { namespace { -typedef ::testing::StrictMock<::testing::MockFunction<void(int)>> +typedef testing::StrictMock<testing::MockFunction<void(int)>> Checkpoint; // NOLINT class MockWebSocketChannel : public WebSocketChannel { public: static MockWebSocketChannel* Create() { - return new ::testing::StrictMock<MockWebSocketChannel>(); + return new testing::StrictMock<MockWebSocketChannel>(); } ~MockWebSocketChannel() override = default; @@ -117,7 +117,7 @@ // These statements are needed to clear WebSocket::channel_ to // avoid ASSERTION failure on ~DOMWebSocket. DCHECK(Socket().Channel()); - ::testing::Mock::VerifyAndClear(Socket().Channel()); + testing::Mock::VerifyAndClear(Socket().Channel()); EXPECT_CALL(Channel(), Disconnect()).Times(AnyNumber()); Socket().DidClose(WebSocketChannelClient::kClosingHandshakeIncomplete, 1006, @@ -822,7 +822,7 @@ // FIXME: We should add tests for suspend / resume. class DOMWebSocketValidClosingTest - : public ::testing::TestWithParam<unsigned short> {}; + : public testing::TestWithParam<unsigned short> {}; TEST_P(DOMWebSocketValidClosingTest, test) { V8TestingScope scope; @@ -848,10 +848,10 @@ INSTANTIATE_TEST_CASE_P(DOMWebSocketValidClosing, DOMWebSocketValidClosingTest, - ::testing::Values(1000, 3000, 3001, 4998, 4999)); + testing::Values(1000, 3000, 3001, 4998, 4999)); class DOMWebSocketInvalidClosingCodeTest - : public ::testing::TestWithParam<unsigned short> {}; + : public testing::TestWithParam<unsigned short> {}; TEST_P(DOMWebSocketInvalidClosingCodeTest, test) { V8TestingScope scope; @@ -882,7 +882,7 @@ INSTANTIATE_TEST_CASE_P( DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosingCodeTest, - ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); + testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); } // namespace
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp index 2cbc35a..ee93f51 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -27,17 +27,17 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::InSequence; -using ::testing::PrintToString; -using ::testing::AnyNumber; -using ::testing::SaveArg; +using testing::_; +using testing::InSequence; +using testing::PrintToString; +using testing::AnyNumber; +using testing::SaveArg; namespace blink { namespace { -typedef ::testing::StrictMock<::testing::MockFunction<void(int)>> Checkpoint; +typedef testing::StrictMock<testing::MockFunction<void(int)>> Checkpoint; class MockWebSocketChannelClient : public GarbageCollectedFinalized<MockWebSocketChannelClient>, @@ -46,7 +46,7 @@ public: static MockWebSocketChannelClient* Create() { - return new ::testing::StrictMock<MockWebSocketChannelClient>(); + return new testing::StrictMock<MockWebSocketChannelClient>(); } MockWebSocketChannelClient() = default; @@ -75,7 +75,7 @@ class MockWebSocketHandle : public WebSocketHandle { public: static MockWebSocketHandle* Create() { - return new ::testing::StrictMock<MockWebSocketHandle>(); + return new testing::StrictMock<MockWebSocketHandle>(); } MockWebSocketHandle() = default; @@ -103,7 +103,7 @@ class MockWebSocketHandshakeThrottle : public WebSocketHandshakeThrottle { public: static MockWebSocketHandshakeThrottle* Create() { - return new ::testing::StrictMock<MockWebSocketHandshakeThrottle>(); + return new testing::StrictMock<MockWebSocketHandshakeThrottle>(); } MockWebSocketHandshakeThrottle() = default; ~MockWebSocketHandshakeThrottle() override { Destructor(); } @@ -170,7 +170,7 @@ } EXPECT_TRUE(Channel()->Connect(KURL("ws://localhost/"), "x")); HandleClient()->DidConnect(Handle(), String("a"), String("b")); - ::testing::Mock::VerifyAndClearExpectations(this); + testing::Mock::VerifyAndClearExpectations(this); } Persistent<MockWebSocketChannelClient> channel_client_;
diff --git a/third_party/WebKit/Source/platform/DecimalTest.cpp b/third_party/WebKit/Source/platform/DecimalTest.cpp index 2ce36fd..1c69f648 100644 --- a/third_party/WebKit/Source/platform/DecimalTest.cpp +++ b/third_party/WebKit/Source/platform/DecimalTest.cpp
@@ -56,7 +56,7 @@ } }; -class DecimalTest : public ::testing::Test { +class DecimalTest : public testing::Test { protected: using Sign = Decimal::Sign; static const Sign kPositive = Decimal::kPositive;
diff --git a/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp b/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp index 243f363..eccab378 100644 --- a/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp +++ b/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp
@@ -32,7 +32,7 @@ }; // Anonymous namespace } // namespace -class LongTaskDetectorTest : public ::testing::Test { +class LongTaskDetectorTest : public testing::Test { public: // Public because it's executed on a task queue. void DummyTaskWithDuration(double duration_seconds) {
diff --git a/third_party/WebKit/Source/platform/PODArenaTest.cpp b/third_party/WebKit/Source/platform/PODArenaTest.cpp index b5c40c4..139211e 100644 --- a/third_party/WebKit/Source/platform/PODArenaTest.cpp +++ b/third_party/WebKit/Source/platform/PODArenaTest.cpp
@@ -51,7 +51,7 @@ } // anonymous namespace -class PODArenaTest : public ::testing::Test {}; +class PODArenaTest : public testing::Test {}; // Make sure the arena can successfully allocate from more than one // region.
diff --git a/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp b/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp index 7643ee1..d7deb210 100644 --- a/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp +++ b/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp
@@ -54,7 +54,7 @@ } // anonymous namespace -class PODFreeListArenaTest : public ::testing::Test { +class PODFreeListArenaTest : public testing::Test { protected: int GetFreeListSize(scoped_refptr<PODFreeListArena<TestClass1>> arena) const { return arena->GetFreeListSizeForTesting();
diff --git a/third_party/WebKit/Source/platform/TimerPerfTest.cpp b/third_party/WebKit/Source/platform/TimerPerfTest.cpp index 0c96ea2f..37f561c 100644 --- a/third_party/WebKit/Source/platform/TimerPerfTest.cpp +++ b/third_party/WebKit/Source/platform/TimerPerfTest.cpp
@@ -15,7 +15,7 @@ namespace blink { -class TimerPerfTest : public ::testing::Test { +class TimerPerfTest : public testing::Test { public: void NopTask(TimerBase*) {}
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 2984c3f..50ca409 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -20,12 +20,12 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink { namespace { -class TimerTest : public ::testing::Test { +class TimerTest : public testing::Test { public: void SetUp() override { run_times_.clear();
diff --git a/third_party/WebKit/Source/platform/WebIconSizesParserTest.cpp b/third_party/WebKit/Source/platform/WebIconSizesParserTest.cpp index 74d2535b..e2eef2c8 100644 --- a/third_party/WebKit/Source/platform/WebIconSizesParserTest.cpp +++ b/third_party/WebKit/Source/platform/WebIconSizesParserTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class WebIconSizesParserTest : public ::testing::Test {}; +class WebIconSizesParserTest : public testing::Test {}; TEST(WebIconSizesParserTest, parseSizes) { WebString sizes_attribute = "32x33";
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp index 1dce0ab..e6dba2a 100644 --- a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp +++ b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp
@@ -50,7 +50,7 @@ namespace { -class TimingFunctionTest : public ::testing::Test, +class TimingFunctionTest : public testing::Test, private ScopedFramesTimingFunctionForTest { public: TimingFunctionTest() : ScopedFramesTimingFunctionForTest(true) {}
diff --git a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp index 0098fb9..7f5e2d34 100644 --- a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp +++ b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
@@ -149,7 +149,7 @@ }; class PushPullFIFOSmokeTest - : public ::testing::TestWithParam<FIFOSmokeTestParam> {}; + : public testing::TestWithParam<FIFOSmokeTestParam> {}; TEST_P(PushPullFIFOSmokeTest, SmokeTests) { const FIFOSmokeTestParam param = GetParam(); @@ -218,7 +218,7 @@ INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest, PushPullFIFOSmokeTest, - ::testing::ValuesIn(smoke_test_params)); + testing::ValuesIn(smoke_test_params)); } // namespace
diff --git a/third_party/WebKit/Source/platform/audio/PushPullFIFOTest.cpp b/third_party/WebKit/Source/platform/audio/PushPullFIFOTest.cpp index a382373..8c20c9b5 100644 --- a/third_party/WebKit/Source/platform/audio/PushPullFIFOTest.cpp +++ b/third_party/WebKit/Source/platform/audio/PushPullFIFOTest.cpp
@@ -23,7 +23,7 @@ TEST(PushPullFIFOBasicTest, BasicTests) { // This suppresses the multi-thread warning for GTest. Potently it increases // the test execution time, but this specific test is very short and simple. - ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + testing::FLAGS_gtest_death_test_style = "threadsafe"; // FIFO length exceeding the maximum length allowed will cause crash. // i.e.) fifo_length_ <= kMaxFIFOLength @@ -131,8 +131,7 @@ return out; } -class PushPullFIFOFeatureTest : public ::testing::TestWithParam<FIFOTestParam> { -}; +class PushPullFIFOFeatureTest : public testing::TestWithParam<FIFOTestParam> {}; TEST_P(PushPullFIFOFeatureTest, FeatureTests) { const FIFOTestSetup setup = GetParam().setup; @@ -361,7 +360,7 @@ INSTANTIATE_TEST_CASE_P(PushPullFIFOFeatureTest, PushPullFIFOFeatureTest, - ::testing::ValuesIn(g_feature_test_params)); + testing::ValuesIn(g_feature_test_params)); } // namespace
diff --git a/third_party/WebKit/Source/platform/audio/VectorMathTest.cpp b/third_party/WebKit/Source/platform/audio/VectorMathTest.cpp index 59bf010..6d314fb3 100644 --- a/third_party/WebKit/Source/platform/audio/VectorMathTest.cpp +++ b/third_party/WebKit/Source/platform/audio/VectorMathTest.cpp
@@ -209,7 +209,7 @@ primary_vector.size()); } -class VectorMathTest : public ::testing::Test { +class VectorMathTest : public testing::Test { protected: enum { kDestinationCount = 4u, @@ -346,7 +346,7 @@ std::accumulate(source.begin(), source.end(), 0.0f, maxmg); float max; Vmaxmgv(source.p(), source.stride(), &max, source.size()); - EXPECT_EQ(expected_max, max) << ::testing::PrintToString(source); + EXPECT_EQ(expected_max, max) << testing::PrintToString(source); } } }
diff --git a/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp b/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp index 58ad9da..f8402e8 100644 --- a/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp +++ b/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp
@@ -20,7 +20,7 @@ } // namespace -class RuntimeCallStatsTest : public ::testing::Test { +class RuntimeCallStatsTest : public testing::Test { public: void SetUp() override { // Add one millisecond because RuntimeCallTimer uses |start_ticks_| =
diff --git a/third_party/WebKit/Source/platform/blob/BlobBytesProviderTest.cpp b/third_party/WebKit/Source/platform/blob/BlobBytesProviderTest.cpp index e47e088..0ab2fc3 100644 --- a/third_party/WebKit/Source/platform/blob/BlobBytesProviderTest.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobBytesProviderTest.cpp
@@ -17,7 +17,7 @@ namespace blink { -class BlobBytesProviderTest : public ::testing::Test { +class BlobBytesProviderTest : public testing::Test { public: void SetUp() override { test_bytes1_.resize(128); @@ -117,7 +117,7 @@ } class RequestAsFile : public BlobBytesProviderTest, - public ::testing::WithParamInterface<FileTestData> { + public testing::WithParamInterface<FileTestData> { public: void SetUp() override { BlobBytesProviderTest::SetUp(); @@ -249,7 +249,7 @@ INSTANTIATE_TEST_CASE_P(BlobBytesProviderTest, RequestAsFile, - ::testing::ValuesIn(file_tests)); + testing::ValuesIn(file_tests)); TEST_F(BlobBytesProviderTest, RequestAsFile_MultipleChunks) { auto provider = CreateProvider();
diff --git a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp index 777ba147..f35c850 100644 --- a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
@@ -82,7 +82,7 @@ } // namespace -class BlobDataHandleTest : public ::testing::Test { +class BlobDataHandleTest : public testing::Test { public: BlobDataHandleTest() : blob_registry_binding_(&mock_blob_registry_) { blob_registry_binding_.Bind(MakeRequest(&blob_registry_ptr_));
diff --git a/third_party/WebKit/Source/platform/exported/WebCORSTest.cpp b/third_party/WebKit/Source/platform/exported/WebCORSTest.cpp index 24293c5..246ffcc 100644 --- a/third_party/WebKit/Source/platform/exported/WebCORSTest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCORSTest.cpp
@@ -13,7 +13,7 @@ namespace { -class CORSExposedHeadersTest : public ::testing::Test { +class CORSExposedHeadersTest : public testing::Test { public: using CredentialsMode = network::mojom::FetchCredentialsMode;
diff --git a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp index 4e32e532..0a4324a2 100644 --- a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
@@ -490,10 +490,6 @@ RuntimeEnabledFeatures::SetPWAFullCodeCacheEnabled(enable); } -void WebRuntimeFeatures::EnableDoubleTapToJumpOnVideo(bool enable) { - RuntimeEnabledFeatures::SetDoubleTapToJumpOnVideoEnabled(enable); -} - void WebRuntimeFeatures::EnableCodeCacheAfterExecute(bool enable) { RuntimeEnabledFeatures::SetCodeCacheAfterExecuteEnabled(enable); }
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp index 1b39adf3..c451b28 100644 --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
@@ -56,7 +56,7 @@ } // namespace -class FeaturePolicyTest : public ::testing::Test { +class FeaturePolicyTest : public testing::Test { protected: FeaturePolicyTest() = default;
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp index a5c5269..ffcc40af 100644 --- a/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp
@@ -24,7 +24,7 @@ : limit(the_limit), render_orientation(the_render_orientation) {} }; -class OrientationIteratorTest : public ::testing::Test { +class OrientationIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<OrientationTestRun>& runs) { String text(g_empty_string16_bit);
diff --git a/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp index 3368ef0..f8c08246 100644 --- a/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp
@@ -284,7 +284,7 @@ kGreek3 + kHan2 + kLatin, }; -class ScriptRunIteratorTest : public ::testing::Test { +class ScriptRunIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<ScriptTestRun>& runs) { String text(g_empty_string16_bit); @@ -618,7 +618,7 @@ CHECK_SCRIPT_RUNS({{"100-ാം", USCRIPT_MALAYALAM}}); } -class ScriptRunIteratorICUDataTest : public ::testing::Test { +class ScriptRunIteratorICUDataTest : public testing::Test { public: ScriptRunIteratorICUDataTest() : max_extensions_(0), max_extensions_codepoint_(0xffff) {
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp index 5f51a87..3abb185 100644 --- a/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp
@@ -24,7 +24,7 @@ : limit(the_limit), small_caps_behavior(the_small_caps_behavior) {} }; -class SmallCapsIteratorTest : public ::testing::Test { +class SmallCapsIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<SmallCapsTestRun>& runs) { String text(g_empty_string16_bit);
diff --git a/third_party/WebKit/Source/platform/fonts/SymbolsIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/SymbolsIteratorTest.cpp index 332908a..f99eace8 100644 --- a/third_party/WebKit/Source/platform/fonts/SymbolsIteratorTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/SymbolsIteratorTest.cpp
@@ -23,7 +23,7 @@ : limit(the_limit), font_fallback_priority(the_font_fallback_priority) {} }; -class SymbolsIteratorTest : public ::testing::Test { +class SymbolsIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<FallbackTestRun>& runs) { String text(g_empty_string16_bit);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp index 2e28a41..c73900ce 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class CachingWordShaperTest : public ::testing::Test { +class CachingWordShaperTest : public testing::Test { protected: void SetUp() override { font_description.SetComputedSize(12.0);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp index 2fea05e..c0355cc 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
@@ -23,7 +23,7 @@ namespace blink { -class HarfBuzzShaperTest : public ::testing::Test { +class HarfBuzzShaperTest : public testing::Test { protected: void SetUp() override { font_description.SetComputedSize(12.0); @@ -94,7 +94,7 @@ }; class ShapeParameterTest : public HarfBuzzShaperTest, - public ::testing::WithParamInterface<TextDirection> { + public testing::WithParamInterface<TextDirection> { protected: scoped_refptr<ShapeResult> ShapeWithParameter(HarfBuzzShaper* shaper) { TextDirection direction = GetParam(); @@ -104,8 +104,8 @@ INSTANTIATE_TEST_CASE_P(HarfBuzzShaperTest, ShapeParameterTest, - ::testing::Values(TextDirection::kLtr, - TextDirection::kRtl)); + testing::Values(TextDirection::kLtr, + TextDirection::kRtl)); static inline ShapeResultTestInfo* TestInfo(scoped_refptr<ShapeResult>& result) { return static_cast<ShapeResultTestInfo*>(result.get()); @@ -586,11 +586,11 @@ // A Value-Parameterized Test class to test OffsetForPosition() with // |include_partial_glyphs| parameter. class IncludePartialGlyphs : public HarfBuzzShaperTest, - public ::testing::WithParamInterface<bool> {}; + public testing::WithParamInterface<bool> {}; INSTANTIATE_TEST_CASE_P(OffsetForPositionTest, IncludePartialGlyphs, - ::testing::Bool()); + testing::Bool()); TEST_P(IncludePartialGlyphs, OffsetForPositionMatchesPositionForOffsetLatin) { String string = To16Bit("Hello World!", 12); @@ -698,11 +698,11 @@ class ShapeResultCopyRangeTest : public HarfBuzzShaperTest, - public ::testing::WithParamInterface<ShapeResultCopyRangeTestData> {}; + public testing::WithParamInterface<ShapeResultCopyRangeTestData> {}; INSTANTIATE_TEST_CASE_P(HarfBuzzShaperTest, ShapeResultCopyRangeTest, - ::testing::ValuesIn(shape_result_copy_range_test_data)); + testing::ValuesIn(shape_result_copy_range_test_data)); // Split a ShapeResult and combine them should match to the original result. TEST_P(ShapeResultCopyRangeTest, Split) {
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp index 7fbfe6de..d8646492 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp
@@ -40,7 +40,7 @@ font_fallback_priority(the_font_fallback_priority) {} }; -class RunSegmenterTest : public ::testing::Test { +class RunSegmenterTest : public testing::Test { protected: void CheckRuns(const Vector<SegmenterTestRun>& runs, FontOrientation orientation) {
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizerTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizerTest.cpp index 02c29b48..704767c 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizerTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizerTest.cpp
@@ -31,7 +31,7 @@ return SimpleFontData::Create(platform_data, nullptr); } -class ShapeResultBloberizerTest : public ::testing::Test { +class ShapeResultBloberizerTest : public testing::Test { protected: void SetUp() override { font_description.SetComputedSize(12.0);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapingLineBreakerTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapingLineBreakerTest.cpp index 0e95e80..dd093c2 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapingLineBreakerTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapingLineBreakerTest.cpp
@@ -33,7 +33,7 @@ } // namespace -class ShapingLineBreakerTest : public ::testing::Test { +class ShapingLineBreakerTest : public testing::Test { protected: void SetUp() override { font_description.SetComputedSize(12.0); @@ -298,16 +298,16 @@ class BreakOpportunityTest : public ShapingLineBreakerTest, - public ::testing::WithParamInterface<BreakOpportunityTestData> {}; + public testing::WithParamInterface<BreakOpportunityTestData> {}; INSTANTIATE_TEST_CASE_P( ShapingLineBreakerTest, BreakOpportunityTest, - ::testing::Values(BreakOpportunityTestData{u"x y z", {1, 3, 5}}, - BreakOpportunityTestData{u"y\xADz", {2, 3}, {3}}, - BreakOpportunityTestData{u"\xADz", {1, 2}, {2}}, - BreakOpportunityTestData{u"y\xAD", {2}, {2}}, - BreakOpportunityTestData{u"\xAD\xADz", {2, 3}, {3}})); + testing::Values(BreakOpportunityTestData{u"x y z", {1, 3, 5}}, + BreakOpportunityTestData{u"y\xADz", {2, 3}, {3}}, + BreakOpportunityTestData{u"\xADz", {1, 2}, {2}}, + BreakOpportunityTestData{u"y\xAD", {2}, {2}}, + BreakOpportunityTestData{u"\xAD\xADz", {2, 3}, {3}})); TEST_P(BreakOpportunityTest, Next) { const BreakOpportunityTestData& data = GetParam(); @@ -315,12 +315,12 @@ LazyLineBreakIterator break_iterator(string); ShapingLineBreaker breaker(nullptr, &font, nullptr, &break_iterator); EXPECT_THAT(BreakPositionsByNext(breaker, string), - ::testing::ElementsAreArray(data.break_positions)); + testing::ElementsAreArray(data.break_positions)); if (!data.break_positions_with_soft_hyphen_disabled.IsEmpty()) { breaker.DisableSoftHyphen(); EXPECT_THAT(BreakPositionsByNext(breaker, string), - ::testing::ElementsAreArray( + testing::ElementsAreArray( data.break_positions_with_soft_hyphen_disabled)); } } @@ -331,12 +331,12 @@ LazyLineBreakIterator break_iterator(string); ShapingLineBreaker breaker(nullptr, &font, nullptr, &break_iterator); EXPECT_THAT(BreakPositionsByPrevious(breaker, string), - ::testing::ElementsAreArray(data.break_positions)); + testing::ElementsAreArray(data.break_positions)); if (!data.break_positions_with_soft_hyphen_disabled.IsEmpty()) { breaker.DisableSoftHyphen(); EXPECT_THAT(BreakPositionsByPrevious(breaker, string), - ::testing::ElementsAreArray( + testing::ElementsAreArray( data.break_positions_with_soft_hyphen_disabled)); } }
diff --git a/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.cpp b/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.cpp index 3b1ed38..271e3f62 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.cpp
@@ -47,34 +47,34 @@ return true; } -::testing::AssertionResult AssertAlmostEqual(const char* expr, - const char* n_expr, - const FloatBox& m, - const FloatBox& n) { +testing::AssertionResult AssertAlmostEqual(const char* expr, + const char* n_expr, + const FloatBox& m, + const FloatBox& n) { if (!ApproximatelyEqual(m, n)) { - return ::testing::AssertionFailure() + return testing::AssertionFailure() << " Value of:" << n_expr << std::endl - << " Actual:" << ::testing::PrintToString(n) << std::endl + << " Actual:" << testing::PrintToString(n) << std::endl << "Expected Approx:" << expr << std::endl - << " Which is:" << ::testing::PrintToString(m); + << " Which is:" << testing::PrintToString(m); } - return ::testing::AssertionSuccess(); + return testing::AssertionSuccess(); } -::testing::AssertionResult AssertContains(const char* expr, - const char* n_expr, - const FloatBox& m, - const FloatBox& n) { +testing::AssertionResult AssertContains(const char* expr, + const char* n_expr, + const FloatBox& m, + const FloatBox& n) { FloatBox new_m = m; new_m.ExpandTo(n); if (!ApproximatelyEqual(m, new_m)) { - return ::testing::AssertionFailure() + return testing::AssertionFailure() << " Value of:" << n_expr << std::endl - << " Actual:" << ::testing::PrintToString(n) << std::endl + << " Actual:" << testing::PrintToString(n) << std::endl << "Not Contained in:" << expr << std::endl - << " Which is:" << ::testing::PrintToString(m); + << " Which is:" << testing::PrintToString(m); } - return ::testing::AssertionSuccess(); + return testing::AssertionSuccess(); } } // namespace FloatBoxTest
diff --git a/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.h b/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.h index 5ed9068..7c7e459 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.h +++ b/third_party/WebKit/Source/platform/geometry/FloatBoxTestHelpers.h
@@ -33,14 +33,14 @@ namespace FloatBoxTest { bool ApproximatelyEqual(const float&, const float&); bool ApproximatelyEqual(const FloatBox&, const FloatBox&); -::testing::AssertionResult AssertAlmostEqual(const char*, - const char*, - const FloatBox&, - const FloatBox&); -::testing::AssertionResult AssertContains(const char*, - const char*, - const FloatBox&, - const FloatBox&); +testing::AssertionResult AssertAlmostEqual(const char*, + const char*, + const FloatBox&, + const FloatBox&); +testing::AssertionResult AssertContains(const char*, + const char*, + const FloatBox&, + const FloatBox&); } // namespace FloatBoxTest } // namespace blink
diff --git a/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.cpp b/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.cpp index 49e49b4..79b825c 100644 --- a/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.cpp
@@ -23,21 +23,20 @@ return ((abs_err / (abs_a + abs_b)) < test_epsilon); } -::testing::AssertionResult AssertAlmostEqual(const char* actual_expr, - const char* expected_expr, - float actual, - float expected, - float test_epsilon) { +testing::AssertionResult AssertAlmostEqual(const char* actual_expr, + const char* expected_expr, + float actual, + float expected, + float test_epsilon) { if (!ApproximatelyEqual(actual, expected, test_epsilon)) { - return ::testing::AssertionFailure() + return testing::AssertionFailure() << " Value of:" << actual_expr << std::endl - << " Actual:" << ::testing::PrintToString(actual) - << std::endl + << " Actual:" << testing::PrintToString(actual) << std::endl << "Expected Approx:" << expected_expr << std::endl - << " Which is:" << ::testing::PrintToString(expected); + << " Which is:" << testing::PrintToString(expected); } - return ::testing::AssertionSuccess(); + return testing::AssertionSuccess(); } } // namespace GeometryTest
diff --git a/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.h b/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.h index 06c6c5a..ff82e567 100644 --- a/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.h +++ b/third_party/WebKit/Source/platform/geometry/GeometryTestHelpers.h
@@ -11,11 +11,11 @@ namespace GeometryTest { bool ApproximatelyEqual(float, float, float test_epsilon); -::testing::AssertionResult AssertAlmostEqual(const char* actual_expr, - const char* expected_expr, - float actual, - float expected, - float test_epsilon = 1e-6); +testing::AssertionResult AssertAlmostEqual(const char* actual_expr, + const char* expected_expr, + float actual, + float expected, + float test_epsilon = 1e-6); } // namespace GeometryTest } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImageTest.cpp index 66d5e0c..8ea52562 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImageTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImageTest.cpp
@@ -110,8 +110,8 @@ MockGLES2InterfaceWithSyncTokenSupport destination_gl; - ::testing::Mock::VerifyAndClearExpectations(&gl_); - ::testing::Mock::VerifyAndClearExpectations(&destination_gl); + testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&destination_gl); InSequence s; // Indicate to gmock that order of EXPECT_CALLs is important @@ -138,8 +138,8 @@ false /*unpack_flip_y*/, dest_point, source_sub_rectangle); - ::testing::Mock::VerifyAndClearExpectations(&gl_); - ::testing::Mock::VerifyAndClearExpectations(&destination_gl); + testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&destination_gl); // Note the following expectation is commented-out because the // MailboxTextureHolder destructor skips it when the texture ID is 0.
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp index 6893bdd..e40dfbf 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -50,7 +50,7 @@ namespace blink { -class BitmapImageTest : public ::testing::Test { +class BitmapImageTest : public testing::Test { public: class FakeImageObserver : public GarbageCollectedFinalized<FakeImageObserver>, public ImageObserver { @@ -632,7 +632,7 @@ template <typename HistogramEnumType> class BitmapHistogramTest : public BitmapImageTest, - public ::testing::WithParamInterface< + public testing::WithParamInterface< HistogramTestParams<HistogramEnumType>> { protected: void RunTest(const char* histogram_name) { @@ -669,7 +669,7 @@ INSTANTIATE_TEST_CASE_P( DecodedImageTypeHistogramTest, DecodedImageTypeHistogramTest, - ::testing::ValuesIn(kDecodedImageTypeHistogramTestparams)); + testing::ValuesIn(kDecodedImageTypeHistogramTestparams)); using DecodedImageOrientationHistogramTest = BitmapHistogramTest<ImageOrientationEnum>; @@ -700,6 +700,6 @@ INSTANTIATE_TEST_CASE_P( DecodedImageOrientationHistogramTest, DecodedImageOrientationHistogramTest, - ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); + testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 5e3ee08..2a3f365 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -62,14 +62,14 @@ #include <memory> -using ::testing::AnyNumber; -using ::testing::AtLeast; -using ::testing::InSequence; -using ::testing::Pointee; -using ::testing::Return; -using ::testing::SetArgPointee; -using ::testing::Test; -using ::testing::_; +using testing::AnyNumber; +using testing::AtLeast; +using testing::InSequence; +using testing::Pointee; +using testing::Return; +using testing::SetArgPointee; +using testing::Test; +using testing::_; namespace blink { @@ -503,7 +503,7 @@ bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -515,7 +515,7 @@ bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_TRUE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -551,7 +551,7 @@ bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -563,7 +563,7 @@ bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_TRUE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -602,8 +602,8 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_host); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -615,8 +615,8 @@ EXPECT_CALL(mock_host, RestoreCanvasMatrixClipStack(_)) .Times(AtLeast(1)); // Because deferred rendering is disabled bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_host); EXPECT_TRUE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -647,7 +647,7 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -658,14 +658,14 @@ Canvas2DLayerBridge:: kHibernationEndedWithSwitchToBackgroundRendering)); DrawSomething(bridge); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); // Unhide bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_TRUE( bridge->IsAccelerated()); // Becoming visible causes switch back to GPU EXPECT_FALSE(bridge->IsHibernating()); @@ -705,8 +705,8 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -719,8 +719,8 @@ EXPECT_CALL(mock_canvas_resource_host, RestoreCanvasMatrixClipStack(_)) .Times(AtLeast(1)); DrawSomething(bridge); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -729,8 +729,8 @@ EXPECT_CALL(mock_canvas_resource_host, RestoreCanvasMatrixClipStack(_)) .Times(AtLeast(1)); bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_TRUE( bridge->IsAccelerated()); // Becoming visible causes switch back to GPU EXPECT_FALSE(bridge->IsHibernating()); @@ -768,8 +768,8 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -782,8 +782,8 @@ EXPECT_CALL(mock_canvas_resource_host, RestoreCanvasMatrixClipStack(_)) .Times(AtLeast(1)); bridge->DisableDeferral(kDisableDeferralReasonUnknown); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -792,8 +792,8 @@ EXPECT_CALL(mock_canvas_resource_host, RestoreCanvasMatrixClipStack(_)) .Times(AtLeast(1)); bridge->SetIsHidden(false); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); EXPECT_TRUE( bridge->IsAccelerated()); // Becoming visible causes switch back to GPU EXPECT_FALSE(bridge->IsHibernating()); @@ -802,7 +802,7 @@ EXPECT_CALL(mock_canvas_resource_host, RestoreCanvasMatrixClipStack(_)) .Times(AnyNumber()); bridge.Clear(); - ::testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); + testing::Mock::VerifyAndClearExpectations(&mock_canvas_resource_host); } #if CANVAS2D_HIBERNATION_ENABLED @@ -830,7 +830,7 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -840,7 +840,7 @@ ReportHibernationEvent( Canvas2DLayerBridge::kHibernationEndedWithTeardown)); bridge.Clear(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); } #if CANVAS2D_HIBERNATION_ENABLED @@ -868,7 +868,7 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_TRUE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -956,7 +956,7 @@ bridge->BeginDestruction(); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); } #if CANVAS2D_HIBERNATION_ENABLED @@ -990,7 +990,7 @@ bridge->SetIsHidden(true); bridge->SetIsHidden(false); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_TRUE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -1027,7 +1027,7 @@ bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsHibernating()); } @@ -1056,7 +1056,7 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); // Test PrepareTransferableResource() while hibernating viz::TransferableResource resource; @@ -1071,7 +1071,7 @@ ReportHibernationEvent( Canvas2DLayerBridge::kHibernationEndedWithTeardown)); bridge.Clear(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); } #if CANVAS2D_HIBERNATION_ENABLED && CANVAS2D_BACKGROUND_RENDER_SWITCH_TO_CPU @@ -1100,7 +1100,7 @@ EXPECT_CALL(*mock_logger_ptr, DidStartHibernating()).Times(1); bridge->SetIsHidden(true); platform->RunUntilIdle(); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); // Rendering in the background -> temp switch to SW EXPECT_CALL(*mock_logger_ptr, @@ -1108,7 +1108,7 @@ Canvas2DLayerBridge:: kHibernationEndedWithSwitchToBackgroundRendering)); DrawSomething(bridge); - ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); + testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); EXPECT_FALSE(bridge->IsAccelerated()); EXPECT_FALSE(bridge->IsHibernating()); EXPECT_TRUE(bridge->IsValid()); @@ -1142,21 +1142,21 @@ IntSize(300, 150), 0, Canvas2DLayerBridge::kForceAccelerationForTesting, CanvasColorParams())); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id1)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id1)); DrawSomething(bridge); bridge->PrepareTransferableResource(&resource1, &release_callback1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id2)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id2)); DrawSomething(bridge); bridge->PrepareTransferableResource(&resource2, &release_callback2); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Check that release resources does not result in destruction due // to recycling. @@ -1166,14 +1166,14 @@ release_callback1->Run(gpu::SyncToken(), lost_resource); release_callback1 = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, DestroyImageCHROMIUM(_)).Times(0); EXPECT_CALL(gl_, DeleteTextures(_, _)).Times(0); release_callback2->Run(gpu::SyncToken(), lost_resource); release_callback2 = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Destroying the bridge results in destruction of cached resources. EXPECT_CALL(gl_, DestroyImageCHROMIUM(image_id1)).Times(1); @@ -1182,7 +1182,7 @@ EXPECT_CALL(gl_, DeleteTextures(1, Pointee(texture_id2))).Times(1); bridge.Clear(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } TEST_F(Canvas2DLayerBridgeTest, NoGpuMemoryBufferRecyclingWhenPageHidden) { @@ -1206,21 +1206,21 @@ IntSize(300, 150), 0, Canvas2DLayerBridge::kForceAccelerationForTesting, CanvasColorParams())); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id1)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id1)); DrawSomething(bridge); bridge->PrepareTransferableResource(&resource1, &release_callback1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id2)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id2)); DrawSomething(bridge); bridge->PrepareTransferableResource(&resource2, &release_callback2); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Release first frame to cache EXPECT_CALL(gl_, DestroyImageCHROMIUM(_)).Times(0); @@ -1229,14 +1229,14 @@ release_callback1->Run(gpu::SyncToken(), lost_resource); release_callback1 = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Switching to Hidden frees cached resources immediately EXPECT_CALL(gl_, DestroyImageCHROMIUM(image_id1)).Times(1); EXPECT_CALL(gl_, DeleteTextures(1, Pointee(texture_id1))).Times(1); bridge->SetIsHidden(true); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Release second frame and verify that its resource is destroyed immediately // due to the layer bridge being hidden @@ -1245,7 +1245,7 @@ release_callback2->Run(gpu::SyncToken(), lost_resource); release_callback2 = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } TEST_F(Canvas2DLayerBridgeTest, ReleaseGpuMemoryBufferAfterBridgeDestroyed) { @@ -1265,21 +1265,21 @@ IntSize(300, 150), 0, Canvas2DLayerBridge::kForceAccelerationForTesting, CanvasColorParams())); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id)); DrawSomething(bridge); bridge->PrepareTransferableResource(&resource, &release_callback); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Tearing down the bridge does not destroy unreleased resources. EXPECT_CALL(gl_, DestroyImageCHROMIUM(_)).Times(0); EXPECT_CALL(gl_, DeleteTextures(_, _)).Times(0); bridge.Clear(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, DestroyImageCHROMIUM(image_id)).Times(1); EXPECT_CALL(gl_, DeleteTextures(1, Pointee(texture_id))).Times(1); @@ -1287,7 +1287,7 @@ release_callback->Run(gpu::SyncToken(), lost_resource); release_callback = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } TEST_F(Canvas2DLayerBridgeTest, EnsureCCImageCacheUse) {
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp index 061afca..7a03bdb 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp
@@ -16,11 +16,11 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkSurface.h" -using ::testing::_; -using ::testing::Pointee; -using ::testing::Return; -using ::testing::SetArrayArgument; -using ::testing::Test; +using testing::_; +using testing::Pointee; +using testing::Return; +using testing::SetArrayArgument; +using testing::Test; namespace blink { @@ -85,7 +85,7 @@ sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(GetGrContext(), SkBudgeted::kYes, image_info); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_TRUE(!!context_provider_wrapper_); scoped_refptr<CanvasResource> resource = CanvasResource_Bitmap::Create( @@ -93,7 +93,7 @@ context_provider_wrapper_), nullptr, kLow_SkFilterQuality); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); gpu::Mailbox test_mailbox; test_mailbox.name[0] = 1; @@ -102,7 +102,7 @@ test_mailbox.name, test_mailbox.name + GL_MAILBOX_SIZE_CHROMIUM)); resource->GetOrCreateGpuMailbox(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // No expected call to DeleteTextures becaus skia recycles // No expected call to ProduceTextureDirectCHROMIUM(0, *) because @@ -111,7 +111,7 @@ EXPECT_CALL(gl_, ProduceTextureDirectCHROMIUM(0, _)).Times(0); resource = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Purging skia's resource cache will finally delete the GrTexture, resulting // in the mailbox being orphaned via ProduceTextureDirectCHROMIUM. @@ -120,7 +120,7 @@ .Times(0); GetGrContext()->performDeferredCleanup(std::chrono::milliseconds(0)); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } TEST_F(CanvasResourceTest, GpuMemoryBufferSyncTokenRefresh) { @@ -137,7 +137,7 @@ EXPECT_TRUE(bool(resource)); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); gpu::Mailbox test_mailbox; test_mailbox.name[0] = 1; @@ -146,7 +146,7 @@ test_mailbox.name, test_mailbox.name + GL_MAILBOX_SIZE_CHROMIUM)); resource->GetOrCreateGpuMailbox(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); const gpu::SyncToken reference_token1 = GenTestSyncToken(1); EXPECT_CALL(gl_, GenUnverifiedSyncTokenCHROMIUM(_)) @@ -156,7 +156,7 @@ gpu::SyncToken actual_token = resource->GetSyncToken(); EXPECT_EQ(actual_token, reference_token1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Grabbing the mailbox again without making any changes must not result in // a sync token refresh @@ -166,7 +166,7 @@ actual_token = resource->GetSyncToken(); EXPECT_EQ(actual_token, reference_token1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Grabbing the mailbox again after a content change must result in // a sync token refresh, but the mailbox gets re-used. @@ -182,7 +182,7 @@ actual_token = resource->GetSyncToken(); EXPECT_EQ(actual_token, reference_token2); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorElementIdTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorElementIdTest.cpp index 9049fd2..cbb635d 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorElementIdTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorElementIdTest.cpp
@@ -8,7 +8,7 @@ namespace blink { -class CompositorElementIdTest : public ::testing::Test {}; +class CompositorElementIdTest : public testing::Test {}; uint64_t IdFromCompositorElementId(CompositorElementId element_id) { return element_id.ToInternalValue() >> kCompositorNamespaceBitCount;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp index c5ddbd3..d51c1da 100644 --- a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
@@ -80,9 +80,9 @@ auto& destructible = list.AllocateAndConstruct<MockDestructible>(); EXPECT_EQ(&destructible, &list.First()); - ::testing::MockFunction<void()> separator; + testing::MockFunction<void()> separator; { - ::testing::InSequence s; + testing::InSequence s; EXPECT_CALL(destructible, Destruct()); EXPECT_CALL(separator, Call()); EXPECT_CALL(destructible, Destruct()).Times(0); @@ -97,9 +97,9 @@ auto& destructible = list.AllocateAndConstruct<MockDestructible>(); EXPECT_EQ(&destructible, &list.First()); - ::testing::MockFunction<void()> separator; + testing::MockFunction<void()> separator; { - ::testing::InSequence s; + testing::InSequence s; EXPECT_CALL(destructible, Destruct()); EXPECT_CALL(separator, Call()); EXPECT_CALL(destructible, Destruct()).Times(0); @@ -114,13 +114,13 @@ // free to use more space if the allocator provides it. ContiguousContainer<MockDestructible> list(sizeof(MockDestructible), 1 * sizeof(MockDestructible)); - ::testing::MockFunction<void()> separator; + testing::MockFunction<void()> separator; // We should be okay to allocate and remove a single one, like before. list.AllocateAndConstruct<MockDestructible>(); EXPECT_EQ(1u, list.size()); { - ::testing::InSequence s; + testing::InSequence s; EXPECT_CALL(list[0], Destruct()); EXPECT_CALL(separator, Call()); EXPECT_CALL(list[0], Destruct()).Times(0); @@ -129,7 +129,7 @@ separator.Call(); EXPECT_EQ(0u, list.size()); - ::testing::Mock::VerifyAndClearExpectations(&separator); + testing::Mock::VerifyAndClearExpectations(&separator); // We should also be okay to allocate and remove multiple. list.AllocateAndConstruct<MockDestructible>(); @@ -141,7 +141,7 @@ EXPECT_EQ(6u, list.size()); { // The last three should be destroyed by removeLast. - ::testing::InSequence s; + testing::InSequence s; EXPECT_CALL(list[5], Destruct()); EXPECT_CALL(separator, Call()); EXPECT_CALL(list[5], Destruct()).Times(0);
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGeneratorTest.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGeneratorTest.cpp index c8d88823..b987ec0 100644 --- a/third_party/WebKit/Source/platform/graphics/DecodingImageGeneratorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGeneratorTest.cpp
@@ -24,7 +24,7 @@ } // namespace -class DecodingImageGeneratorTest : public ::testing::Test {}; +class DecodingImageGeneratorTest : public testing::Test {}; TEST_F(DecodingImageGeneratorTest, Create) { scoped_refptr<SharedBuffer> reference_data =
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp index 205c575c..196751a 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -78,7 +78,7 @@ } // namespace -class DeferredImageDecoderTest : public ::testing::Test, +class DeferredImageDecoderTest : public testing::Test, public MockImageDecoderClient { public: void SetUp() override {
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp index dc2cd938..efa8c1e 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
@@ -141,7 +141,7 @@ EXPECT_OPAQUE_PIXELS_IN_RECT(bitmap, IntRect(20, 10, 30, 40)); } -class GraphicsContextHighConstrastTest : public ::testing::Test { +class GraphicsContextHighConstrastTest : public testing::Test { protected: void SetUp() override { bitmap_.allocN32Pixels(4, 1);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index 67a8abd8..179292ec 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -58,8 +58,7 @@ namespace blink { -class GraphicsLayerTest : public ::testing::Test, - public PaintTestConfigurations { +class GraphicsLayerTest : public testing::Test, public PaintTestConfigurations { public: GraphicsLayerTest() { clip_layer_ = std::make_unique<FakeGraphicsLayer>(client_); @@ -131,7 +130,7 @@ INSTANTIATE_TEST_CASE_P(All, GraphicsLayerTest, - ::testing::Values(0, kSlimmingPaintV175)); + testing::Values(0, kSlimmingPaintV175)); class AnimationForTesting : public CompositorAnimationClient { public:
diff --git a/third_party/WebKit/Source/platform/graphics/HighContrastImageClassifierTest.cpp b/third_party/WebKit/Source/platform/graphics/HighContrastImageClassifierTest.cpp index b2e34916..936e4e33 100644 --- a/third_party/WebKit/Source/platform/graphics/HighContrastImageClassifierTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/HighContrastImageClassifierTest.cpp
@@ -17,7 +17,7 @@ namespace blink { -class HighContrastImageClassifierTest : public ::testing::Test { +class HighContrastImageClassifierTest : public testing::Test { public: // Loads the image from |file_name|, computes features vector into |features|, // and returns the classification result.
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp index 679d20b5..ca2ec5ef 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
@@ -32,7 +32,7 @@ namespace blink { -class ImageDecodingStoreTest : public ::testing::Test, +class ImageDecodingStoreTest : public testing::Test, public MockImageDecoderClient { public: void SetUp() override {
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp index d927fcf..1a51e2a 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
@@ -54,7 +54,7 @@ } // namespace -class ImageFrameGeneratorTest : public ::testing::Test, +class ImageFrameGeneratorTest : public testing::Test, public MockImageDecoderClient { public: void SetUp() override {
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImplTest.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImplTest.cpp index 3671dd8..55a874f9 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImplTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImplTest.cpp
@@ -10,8 +10,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkSurface.h" -using ::testing::_; -using ::testing::Mock; +using testing::_; +using testing::Mock; namespace blink { @@ -25,7 +25,7 @@ void(scoped_refptr<StaticBitmapImage>, unsigned resource_id)); }; -class OffscreenCanvasFrameDispatcherImplTest : public ::testing::Test { +class OffscreenCanvasFrameDispatcherImplTest : public testing::Test { public: void DispatchOneFrame(); OffscreenCanvasResourceProvider* GetResourceProvider() {
diff --git a/third_party/WebKit/Source/platform/graphics/PlaceholderImageTest.cpp b/third_party/WebKit/Source/platform/graphics/PlaceholderImageTest.cpp index e5c0e54..eef2efb1 100644 --- a/third_party/WebKit/Source/platform/graphics/PlaceholderImageTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/PlaceholderImageTest.cpp
@@ -43,7 +43,7 @@ TestingUnitsPlatform::~TestingUnitsPlatform() = default; -class PlaceholderImageTest : public ::testing::Test { +class PlaceholderImageTest : public testing::Test { private: ScopedTestingPlatformSupport<TestingUnitsPlatform> platform_; };
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImageTest.cpp index 9cab2689..2c5fe26 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImageTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImageTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class StaticBitmapImageTest : public ::testing::Test {}; +class StaticBitmapImageTest : public testing::Test {}; // This test verifies if requesting a large ImageData that cannot be handled by // V8 is denied by StaticBitmapImage. This prevents V8 from crashing the
diff --git a/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitterTest.cpp b/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitterTest.cpp index 53b0a6f..b0adb42 100644 --- a/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitterTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitterTest.cpp
@@ -121,7 +121,7 @@ }; } // namespace -class VideoFrameSubmitterTest : public ::testing::Test { +class VideoFrameSubmitterTest : public testing::Test { public: VideoFrameSubmitterTest() : now_src_(new base::SimpleTestTickClock()),
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/ChunkToLayerMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/ChunkToLayerMapperTest.cpp index 6cb686a9..f9fa77a 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/ChunkToLayerMapperTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/ChunkToLayerMapperTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class ChunkToLayerMapperTest : public ::testing::Test { +class ChunkToLayerMapperTest : public testing::Test { protected: static PaintChunk Chunk(const PropertyTreeState& state) { DEFINE_STATIC_LOCAL(FakeDisplayItemClient, fake_client, ());
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/CompositedLayerRasterInvalidatorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/CompositedLayerRasterInvalidatorTest.cpp index 8927dca..6d87553 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/CompositedLayerRasterInvalidatorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/CompositedLayerRasterInvalidatorTest.cpp
@@ -14,7 +14,7 @@ static const IntRect kDefaultLayerBounds(-9999, -7777, 18888, 16666); class CompositedLayerRasterInvalidatorTest - : public ::testing::Test, + : public testing::Test, private ScopedSlimmingPaintV2ForTest { protected: CompositedLayerRasterInvalidatorTest() : ScopedSlimmingPaintV2ForTest(true) {}
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp index 6152a08..ac1c863d 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
@@ -33,7 +33,7 @@ namespace blink { using ::blink::test::CreateOpacityOnlyEffect; -using ::testing::Pointee; +using testing::Pointee; PaintChunk::Id DefaultId() { DEFINE_STATIC_LOCAL(FakeDisplayItemClient, fake_client, ()); @@ -84,7 +84,7 @@ unsigned did_scroll_count; }; -class PaintArtifactCompositorTest : public ::testing::Test, +class PaintArtifactCompositorTest : public testing::Test, private ScopedSlimmingPaintV2ForTest { protected: PaintArtifactCompositorTest()
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayerTest.cpp index 8fdee56..5d869ad 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayerTest.cpp
@@ -39,7 +39,7 @@ using test::CreateOpacityOnlyEffect; -class PaintChunksToCcLayerTest : public ::testing::Test, +class PaintChunksToCcLayerTest : public testing::Test, private ScopedSlimmingPaintV2ForTest { protected: PaintChunksToCcLayerTest() : ScopedSlimmingPaintV2ForTest(true) {} @@ -47,18 +47,17 @@ // Matches PaintOpTypes in a PaintRecord. class PaintRecordMatcher - : public ::testing::MatcherInterface<const cc::PaintOpBuffer&> { + : public testing::MatcherInterface<const cc::PaintOpBuffer&> { public: - static ::testing::Matcher<const cc::PaintOpBuffer&> Make( + static testing::Matcher<const cc::PaintOpBuffer&> Make( std::initializer_list<cc::PaintOpType> args) { - return ::testing::MakeMatcher(new PaintRecordMatcher(args)); + return testing::MakeMatcher(new PaintRecordMatcher(args)); } PaintRecordMatcher(std::initializer_list<cc::PaintOpType> args) : expected_ops_(args) {} - bool MatchAndExplain( - const cc::PaintOpBuffer& buffer, - ::testing::MatchResultListener* listener) const override { + bool MatchAndExplain(const cc::PaintOpBuffer& buffer, + testing::MatchResultListener* listener) const override { size_t index = 0; for (cc::PaintOpBuffer::Iterator it(&buffer); it; ++it, ++index) { auto op = (*it)->GetType();
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FECompositeTest.cpp b/third_party/WebKit/Source/platform/graphics/filters/FECompositeTest.cpp index dcea59d..4988f86 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/FECompositeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/FECompositeTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class FECompositeTest : public ::testing::Test { +class FECompositeTest : public testing::Test { protected: FEComposite* CreateComposite(CompositeOperationType type, float k1 = 0,
diff --git a/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp b/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp index 70dcc87..c657bf3c83 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp
@@ -30,7 +30,7 @@ #include "platform/graphics/filters/SourceGraphic.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::Test; +using testing::Test; namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index 9179db1..2a79f32 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -46,8 +46,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" -using ::testing::Test; -using ::testing::_; +using testing::Test; +using testing::_; namespace blink { @@ -412,7 +412,7 @@ DrawingBuffer::kPreserve, kDisableMultisampling); CHECK(drawing_buffer_); SetAndSaveRestoreState(true); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); } void TearDown() override { @@ -440,7 +440,7 @@ EXPECT_EQ(initial_size, gl_->MostRecentlyProducedSize()); EXPECT_TRUE(resource.is_overlay_candidate); EXPECT_EQ(initial_size, resource.size); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); VerifyStateWasRestored(); GLuint image_id2 = gl_->NextImageIdToBeCreated(); @@ -454,7 +454,7 @@ VerifyStateWasRestored(); release_callback->Run(gpu::SyncToken(), false /* lostResource */); VerifyStateWasRestored(); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); GLuint image_id3 = gl_->NextImageIdToBeCreated(); EXPECT_CALL(*gl_, BindTexImage2DMock(image_id3)).Times(1); @@ -465,7 +465,7 @@ EXPECT_EQ(alternate_size, gl_->MostRecentlyProducedSize()); EXPECT_TRUE(resource.is_overlay_candidate); EXPECT_EQ(alternate_size, resource.size); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); GLuint image_id4 = gl_->NextImageIdToBeCreated(); EXPECT_CALL(*gl_, BindTexImage2DMock(image_id4)).Times(1); @@ -478,7 +478,7 @@ VerifyStateWasRestored(); release_callback->Run(gpu::SyncToken(), false /* lostResource */); VerifyStateWasRestored(); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); GLuint image_id5 = gl_->NextImageIdToBeCreated(); EXPECT_CALL(*gl_, BindTexImage2DMock(image_id5)).Times(1); @@ -489,7 +489,7 @@ EXPECT_EQ(initial_size, gl_->MostRecentlyProducedSize()); EXPECT_TRUE(resource.is_overlay_candidate); EXPECT_EQ(initial_size, resource.size); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); // Prepare one final resource and verify that it's the correct size. release_callback->Run(gpu::SyncToken(), false /* lostResource */); @@ -506,7 +506,7 @@ EXPECT_CALL(*gl_, DestroyImageMock(image_id4)).Times(1); EXPECT_CALL(*gl_, ReleaseTexImage2DMock(image_id4)).Times(1); drawing_buffer_->BeginDestruction(); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); } TEST_F(DrawingBufferImageChromiumTest, AllocationFailure) { @@ -526,7 +526,7 @@ EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(&resource1, &release_callback1)); EXPECT_TRUE(resource1.is_overlay_candidate); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); VerifyStateWasRestored(); // Force image CHROMIUM creation failure. Request another resource. It should @@ -546,7 +546,7 @@ EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(&resource3, &release_callback3)); EXPECT_TRUE(resource3.is_overlay_candidate); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); VerifyStateWasRestored(); release_callback1->Run(gpu::SyncToken(), false /* lostResource */); @@ -556,7 +556,7 @@ EXPECT_CALL(*gl_, DestroyImageMock(_)).Times(3); EXPECT_CALL(*gl_, ReleaseTexImage2DMock(_)).Times(3); drawing_buffer_->BeginDestruction(); - ::testing::Mock::VerifyAndClearExpectations(gl_); + testing::Mock::VerifyAndClearExpectations(gl_); } class DepthStencilTrackingGLES2Interface
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp index cecdeb78..05961f72 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
@@ -16,7 +16,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/khronos/GLES2/gl2ext.h" -using ::testing::Test; +using testing::Test; namespace blink { @@ -187,7 +187,7 @@ SharedGpuContext::ContextProviderWrapper()); EXPECT_TRUE(resource_provider && resource_provider->IsValid()); scoped_refptr<StaticBitmapImage> image = resource_provider->Snapshot(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); FakeMailboxGenerator mailboxGenerator; gpu::Mailbox mailbox; @@ -195,15 +195,15 @@ EXPECT_CALL(gl_, GenMailboxCHROMIUM(mailbox.name)) .Times(1) - .WillOnce(::testing::Invoke(&mailboxGenerator, - &FakeMailboxGenerator::GenMailbox)); + .WillOnce(testing::Invoke(&mailboxGenerator, + &FakeMailboxGenerator::GenMailbox)); SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenMailboxCHROMIUM(mailbox.name)) .Times(0); // GenMailboxCHROMIUM must not be called! @@ -213,7 +213,7 @@ mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } TEST_F(MailboxSharedGpuContextTest, MailboxCacheSurvivesSkiaRecycling) { @@ -224,7 +224,7 @@ SharedGpuContext::ContextProviderWrapper()); EXPECT_TRUE(resource_provider && resource_provider->IsValid()); scoped_refptr<StaticBitmapImage> image = resource_provider->Snapshot(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); FakeMailboxGenerator mailboxGenerator; gpu::Mailbox mailbox; @@ -232,20 +232,20 @@ EXPECT_CALL(gl_, GenMailboxCHROMIUM(mailbox.name)) .Times(1) - .WillOnce(::testing::Invoke(&mailboxGenerator, - &FakeMailboxGenerator::GenMailbox)); + .WillOnce(testing::Invoke(&mailboxGenerator, + &FakeMailboxGenerator::GenMailbox)); SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Destroy image and surface to return texture to recleable resource pool image = nullptr; resource_provider = nullptr; - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); // Re-creating surface should recycle the old GrTexture inside skia resource_provider = CanvasResourceProvider::Create( @@ -254,7 +254,7 @@ EXPECT_TRUE(resource_provider && resource_provider->IsValid()); image = resource_provider->Snapshot(); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_CALL(gl_, GenMailboxCHROMIUM(mailbox.name)) .Times(0); // GenMailboxCHROMIUM must not be called! @@ -264,7 +264,7 @@ mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); - ::testing::Mock::VerifyAndClearExpectations(&gl_); + testing::Mock::VerifyAndClearExpectations(&gl_); } } // unnamed namespace
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversionTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversionTest.cpp index 4a8fb4a0..128ae15 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversionTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversionTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class WebGLImageConversionTest : public ::testing::Test { +class WebGLImageConversionTest : public testing::Test { protected: void UnpackPixels(const uint16_t* source_data, WebGLImageConversion::DataFormat source_data_format,
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CullRectTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/CullRectTest.cpp index 0703c9e..b3ee045 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CullRectTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/CullRectTest.cpp
@@ -11,7 +11,7 @@ namespace blink { -class CullRectTest : public ::testing::Test { +class CullRectTest : public testing::Test { protected: IntRect Rect(const CullRect& cull_rect) { return cull_rect.rect_; } };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItemTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItemTest.cpp index ae7019b..ecc7746c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItemTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItemTest.cpp
@@ -15,9 +15,9 @@ namespace blink { namespace { -using ::testing::_; +using testing::_; -class DrawingDisplayItemTest : public ::testing::Test { +class DrawingDisplayItemTest : public testing::Test { protected: FakeDisplayItemClient client_; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FloatClipRectTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/FloatClipRectTest.cpp index 234a73c..8aa499a4 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FloatClipRectTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/FloatClipRectTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -class FloatClipRectTest : public ::testing::Test { +class FloatClipRectTest : public testing::Test { public: };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp index c6d80417..5922827a 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -17,7 +17,7 @@ namespace blink { -class GeometryMapperTest : public ::testing::Test, +class GeometryMapperTest : public testing::Test, public PaintTestConfigurations { public: const FloatClipRect* GetCachedClip( @@ -53,7 +53,7 @@ INSTANTIATE_TEST_CASE_P(All, GeometryMapperTest, - ::testing::ValuesIn(kSlimmingPaintVersions)); + testing::ValuesIn(kSlimmingPaintVersions)); #define EXPECT_FLOAT_RECT_NEAR(expected, actual) \ do { \
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp index fc9e47b7..9579d148 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
@@ -11,12 +11,12 @@ using ::blink::test::CreateOpacityOnlyEffect; using ::blink::test::DefaultPaintChunkProperties; -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink { namespace { -class PaintChunkerTest : public ::testing::Test, +class PaintChunkerTest : public testing::Test, private ScopedSlimmingPaintV175ForTest { public: PaintChunkerTest() : ScopedSlimmingPaintV175ForTest(true) {}
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index b15971a..1b4bc8e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -20,7 +20,7 @@ #include "testing/gmock/include/gmock/gmock.h" using blink::test::CreateOpacityOnlyEffect; -using ::testing::UnorderedElementsAre; +using testing::UnorderedElementsAre; namespace blink { @@ -33,12 +33,12 @@ INSTANTIATE_TEST_CASE_P( All, PaintControllerTest, - ::testing::Values(0, - kSlimmingPaintV175, - kSlimmingPaintV2, - kUnderInvalidationChecking, - kSlimmingPaintV175 | kUnderInvalidationChecking, - kSlimmingPaintV2 | kUnderInvalidationChecking)); + testing::Values(0, + kSlimmingPaintV175, + kSlimmingPaintV2, + kUnderInvalidationChecking, + kSlimmingPaintV175 | kUnderInvalidationChecking, + kSlimmingPaintV2 | kUnderInvalidationChecking)); TEST_P(PaintControllerTest, NestedRecorders) { GraphicsContext context(GetPaintController()); @@ -2034,7 +2034,7 @@ protected: void SetUp() override { - ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + testing::FLAGS_gtest_death_test_style = "threadsafe"; } void TestChangeDrawing() {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.h b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.h index 7a77e56..0a286957 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.h
@@ -16,7 +16,7 @@ class GraphicsContext; -class PaintControllerTestBase : public ::testing::Test { +class PaintControllerTestBase : public testing::Test { public: PaintControllerTestBase() : root_paint_property_client_("root"),
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNodeTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNodeTest.cpp index 541d6df..38927aa 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNodeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintPropertyNodeTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class PaintPropertyNodeTest : public ::testing::Test { +class PaintPropertyNodeTest : public testing::Test { protected: void SetUp() override { root = ClipPaintPropertyNode::Root();
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp index a128883b..afe9a2df 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp
@@ -8,7 +8,7 @@ namespace blink { -class PropertyTreeStateTest : public ::testing::Test {}; +class PropertyTreeStateTest : public testing::Test {}; TEST_F(PropertyTreeStateTest, CompositorElementIdNoElementIdOnAnyNode) { PropertyTreeState state(TransformPaintPropertyNode::Root(),
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp index c867ca08..fd0f290 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
@@ -238,7 +238,7 @@ decoder->ClearCacheExceptFrame(kNotFound); for (size_t i = 0; i < kNumFrames; ++i) { - SCOPED_TRACE(::testing::Message() << i); + SCOPED_TRACE(testing::Message() << i); EXPECT_EQ(ImageFrame::kFrameEmpty, frame_buffers[i].GetStatus()); } } @@ -255,7 +255,7 @@ decoder->ResetRequiredPreviousFrames(); decoder->ClearCacheExceptFrame(5); for (size_t i = 0; i < kNumFrames; ++i) { - SCOPED_TRACE(::testing::Message() << i); + SCOPED_TRACE(testing::Message() << i); if (i == 5) EXPECT_EQ(ImageFrame::kFrameComplete, frame_buffers[i].GetStatus()); else
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp index 07f808d1..506438d 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
@@ -156,7 +156,7 @@ decoder->SetData(full_data, true); for (size_t i = 0; i < skipping_step; ++i) { for (size_t j = i; j < frame_count; j += skipping_step) { - SCOPED_TRACE(::testing::Message() << "Random i:" << i << " j:" << j); + SCOPED_TRACE(testing::Message() << "Random i:" << i << " j:" << j); ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(j); EXPECT_EQ(baseline_hashes[j], HashBitmap(frame->Bitmap())); } @@ -166,7 +166,7 @@ decoder = create_decoder(); decoder->SetData(full_data, true); for (size_t i = frame_count; i; --i) { - SCOPED_TRACE(::testing::Message() << "Reverse i:" << i); + SCOPED_TRACE(testing::Message() << "Reverse i:" << i); ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(i - 1); EXPECT_EQ(baseline_hashes[i - 1], HashBitmap(frame->Bitmap())); } @@ -187,7 +187,7 @@ decoder->ClearCacheExceptFrame(clear_except_frame); for (size_t i = 0; i < skipping_step; ++i) { for (size_t j = 0; j < frame_count; j += skipping_step) { - SCOPED_TRACE(::testing::Message() << "Random i:" << i << " j:" << j); + SCOPED_TRACE(testing::Message() << "Random i:" << i << " j:" << j); ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(j); EXPECT_EQ(baseline_hashes[j], HashBitmap(frame->Bitmap())); }
diff --git a/third_party/WebKit/Source/platform/loader/LinkHeaderTest.cpp b/third_party/WebKit/Source/platform/loader/LinkHeaderTest.cpp index fade747..b6582758 100644 --- a/third_party/WebKit/Source/platform/loader/LinkHeaderTest.cpp +++ b/third_party/WebKit/Source/platform/loader/LinkHeaderTest.cpp
@@ -153,10 +153,10 @@ }; void PrintTo(const SingleTestCase& test, std::ostream* os) { - *os << ::testing::PrintToString(test.header_value); + *os << testing::PrintToString(test.header_value); } -class SingleLinkHeaderTest : public ::testing::TestWithParam<SingleTestCase> {}; +class SingleLinkHeaderTest : public testing::TestWithParam<SingleTestCase> {}; // Test the cases with a single header TEST_P(SingleLinkHeaderTest, Single) { @@ -175,7 +175,7 @@ INSTANTIATE_TEST_CASE_P(LinkHeaderTest, SingleLinkHeaderTest, - ::testing::ValuesIn(g_single_test_cases)); + testing::ValuesIn(g_single_test_cases)); struct DoubleTestCase { const char* header_value; @@ -198,10 +198,10 @@ }; void PrintTo(const DoubleTestCase& test, std::ostream* os) { - *os << ::testing::PrintToString(test.header_value); + *os << testing::PrintToString(test.header_value); } -class DoubleLinkHeaderTest : public ::testing::TestWithParam<DoubleTestCase> {}; +class DoubleLinkHeaderTest : public testing::TestWithParam<DoubleTestCase> {}; TEST_P(DoubleLinkHeaderTest, Double) { const DoubleTestCase test_case = GetParam(); @@ -219,7 +219,7 @@ INSTANTIATE_TEST_CASE_P(LinkHeaderTest, DoubleLinkHeaderTest, - ::testing::ValuesIn(g_double_test_cases)); + testing::ValuesIn(g_double_test_cases)); struct CrossOriginTestCase { const char* header_value; @@ -259,11 +259,11 @@ }; void PrintTo(const CrossOriginTestCase& test, std::ostream* os) { - *os << ::testing::PrintToString(test.header_value); + *os << testing::PrintToString(test.header_value); } class CrossOriginLinkHeaderTest - : public ::testing::TestWithParam<CrossOriginTestCase> {}; + : public testing::TestWithParam<CrossOriginTestCase> {}; TEST_P(CrossOriginLinkHeaderTest, CrossOrigin) { const CrossOriginTestCase test_case = GetParam(); @@ -281,7 +281,7 @@ INSTANTIATE_TEST_CASE_P(LinkHeaderTest, CrossOriginLinkHeaderTest, - ::testing::ValuesIn(g_cross_origin_test_cases)); + testing::ValuesIn(g_cross_origin_test_cases)); } // namespace } // namespace blink
diff --git a/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp b/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp index f87ae5d..fd3c4790 100644 --- a/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp +++ b/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp
@@ -80,7 +80,7 @@ static const char kUnsupportedHashFunctionIntegrity[] = "sha1-JfLW308qMPKfb4DaHpUBEESwuPc="; -class SubresourceIntegrityTest : public ::testing::Test { +class SubresourceIntegrityTest : public testing::Test { public: SubresourceIntegrityTest() : sec_url("https://example.test:443"), @@ -603,20 +603,20 @@ EXPECT_CALL(mock_crypto_scope.MockCrypto(), CreateDigestorProxy(kWebCryptoAlgorithmIdSha256)) - .WillRepeatedly(::testing::InvokeWithoutArgs( + .WillRepeatedly(testing::InvokeWithoutArgs( &factory_sha256, &MockWebCryptoDigestorFactory::Create)); EXPECT_CALL(mock_crypto_scope.MockCrypto(), CreateDigestorProxy(kWebCryptoAlgorithmIdSha384)) - .WillRepeatedly(::testing::InvokeWithoutArgs( + .WillRepeatedly(testing::InvokeWithoutArgs( &factory_sha384, &MockWebCryptoDigestorFactory::Create)); EXPECT_CALL(mock_crypto_scope.MockCrypto(), CreateDigestorProxy(kWebCryptoAlgorithmIdSha512)) - .WillRepeatedly(::testing::InvokeWithoutArgs( + .WillRepeatedly(testing::InvokeWithoutArgs( &factory_sha512, &MockWebCryptoDigestorFactory::Create)); for (const auto& test : cases) { SCOPED_TRACE( - ::testing::Message() + testing::Message() << "Origin: " << test.origin.BaseAsString() << ", target: " << test.target.BaseAsString() << ", CORS access-control-allow-origin header: "
diff --git a/third_party/WebKit/Source/platform/loader/cors/CORS.cpp b/third_party/WebKit/Source/platform/loader/cors/CORS.cpp index 97f4cd16..089a4d0 100644 --- a/third_party/WebKit/Source/platform/loader/cors/CORS.cpp +++ b/third_party/WebKit/Source/platform/loader/cors/CORS.cpp
@@ -74,12 +74,15 @@ const HTTPHeaderMap& response_header, network::mojom::FetchCredentialsMode credentials_mode, const SecurityOrigin& origin) { + std::unique_ptr<SecurityOrigin::PrivilegeData> privilege = + origin.CreatePrivilegeData(); return network::cors::CheckAccess( response_url, response_status_code, GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Origin), GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Credentials), - credentials_mode, origin.ToUrlOrigin()); + credentials_mode, origin.ToUrlOrigin(), + !privilege->block_local_access_from_local_origin_); } WTF::Optional<network::mojom::CORSError> CheckRedirectLocation(
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferencesTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferencesTest.cpp index 7086451..ec0f18f 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferencesTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferencesTest.cpp
@@ -13,7 +13,7 @@ namespace blink { -class ClientHintsPreferencesTest : public ::testing::Test {}; +class ClientHintsPreferencesTest : public testing::Test {}; TEST_F(ClientHintsPreferencesTest, BasicSecure) { struct TestCase {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp index 3fe3c667..7b6860a 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
@@ -55,7 +55,7 @@ } // namespace -class MemoryCacheCorrectnessTest : public ::testing::Test { +class MemoryCacheCorrectnessTest : public testing::Test { protected: MockResource* ResourceFromResourceResponse(ResourceResponse response) { if (response.Url().IsNull()) @@ -101,7 +101,7 @@ void AdvanceClock(double seconds) { platform_->AdvanceClockSeconds(seconds); } private: - // Overrides ::testing::Test. + // Overrides testing::Test. void SetUp() override { // Save the global memory cache to restore it upon teardown. global_memory_cache_ = ReplaceMemoryCacheForTesting(MemoryCache::Create());
diff --git a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp index b65e92ac2..be951ddb 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp
@@ -78,7 +78,7 @@ void DestroyDecodedDataIfPossible() override { SetDecodedSize(0); } }; -class MemoryCacheTest : public ::testing::Test { +class MemoryCacheTest : public testing::Test { public: class FakeResource final : public Resource { public:
diff --git a/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp index da86fb9..8394bdda 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp
@@ -48,7 +48,7 @@ namespace blink { -class RawResourceTest : public ::testing::Test { +class RawResourceTest : public testing::Test { public: RawResourceTest() = default; ~RawResourceTest() override = default;
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp index b4d30231..6eea24f9 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
@@ -88,7 +88,7 @@ } // namespace -class ResourceFetcherTest : public ::testing::Test { +class ResourceFetcherTest : public testing::Test { public: ResourceFetcherTest() = default; ~ResourceFetcherTest() override { GetMemoryCache()->EvictResources(); }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp index 741bc32..003c328 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp
@@ -33,7 +33,7 @@ bool was_run_ = false; }; -class ResourceLoadSchedulerTest : public ::testing::Test { +class ResourceLoadSchedulerTest : public testing::Test { public: using ThrottleOption = ResourceLoadScheduler::ThrottleOption; void SetUp() override { @@ -61,7 +61,7 @@ Persistent<ResourceLoadScheduler> scheduler_; }; -class RendererSideResourceSchedulerTest : public ::testing::Test { +class RendererSideResourceSchedulerTest : public testing::Test { public: using ThrottleOption = ResourceLoadScheduler::ThrottleOption; class TestingPlatformSupport : public ::blink::TestingPlatformSupport {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp index 31a35f9..a6f0acb 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp
@@ -15,7 +15,7 @@ namespace blink { -class ResourceLoaderTest : public ::testing::Test { +class ResourceLoaderTest : public testing::Test { DISALLOW_COPY_AND_ASSIGN(ResourceLoaderTest); public: @@ -92,19 +92,20 @@ ResourceLoadScheduler* scheduler = ResourceLoadScheduler::Create(); for (const auto& test : cases) { - SCOPED_TRACE( - ::testing::Message() - << "Origin: " << test.origin.GetString() - << ", target: " << test.target.GetString() - << ", CORS access-control-allow-origin header: " - << (test.allow_origin_url ? test.allow_origin_url->GetString() : "-") - << ", service worker: " - << (test.service_worker == kNoSW - ? "no" - : (test.service_worker == kSWClear ? "clear response" - : "opaque response")) - << ", expected CORSStatus == " - << static_cast<unsigned>(test.expectation)); + SCOPED_TRACE(testing::Message() + << "Origin: " << test.origin.GetString() + << ", target: " << test.target.GetString() + << ", CORS access-control-allow-origin header: " + << (test.allow_origin_url ? test.allow_origin_url->GetString() + : "-") + << ", service worker: " + << (test.service_worker == kNoSW + ? "no" + : (test.service_worker == kSWClear + ? "clear response" + : "opaque response")) + << ", expected CORSStatus == " + << static_cast<unsigned>(test.expectation)); context_->SetSecurityOrigin(SecurityOrigin::Create(test.origin)); ResourceFetcher* fetcher = ResourceFetcher::Create(context_);
diff --git a/third_party/WebKit/Source/platform/mhtml/MHTMLParserTest.cpp b/third_party/WebKit/Source/platform/mhtml/MHTMLParserTest.cpp index 270139b..dbef880e 100644 --- a/third_party/WebKit/Source/platform/mhtml/MHTMLParserTest.cpp +++ b/third_party/WebKit/Source/platform/mhtml/MHTMLParserTest.cpp
@@ -21,7 +21,7 @@ } // namespace -class MHTMLParserTest : public ::testing::Test { +class MHTMLParserTest : public testing::Test { public: MHTMLParserTest() = default;
diff --git a/third_party/WebKit/Source/platform/mojo/GeometryStructTraitsTest.cpp b/third_party/WebKit/Source/platform/mojo/GeometryStructTraitsTest.cpp index 78c083d..fb7c7241 100644 --- a/third_party/WebKit/Source/platform/mojo/GeometryStructTraitsTest.cpp +++ b/third_party/WebKit/Source/platform/mojo/GeometryStructTraitsTest.cpp
@@ -14,7 +14,7 @@ namespace { class GeometryStructTraitsTest - : public ::testing::Test, + : public testing::Test, public gfx::mojom::blink::GeometryTraitsTestService { public: GeometryStructTraitsTest() {}
diff --git a/third_party/WebKit/Source/platform/mojo/InterfaceInvalidatorTest.cpp b/third_party/WebKit/Source/platform/mojo/InterfaceInvalidatorTest.cpp index 655ac0ef..e883361 100644 --- a/third_party/WebKit/Source/platform/mojo/InterfaceInvalidatorTest.cpp +++ b/third_party/WebKit/Source/platform/mojo/InterfaceInvalidatorTest.cpp
@@ -90,7 +90,7 @@ DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); }; -class InterfaceInvalidatorTest : public ::testing::Test { +class InterfaceInvalidatorTest : public testing::Test { public: InterfaceInvalidatorTest() {} ~InterfaceInvalidatorTest() override {}
diff --git a/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp b/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp index 6ba4086..87d6c1e 100644 --- a/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp +++ b/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp
@@ -10,7 +10,7 @@ namespace { -class EncodedFormDataTest : public ::testing::Test { +class EncodedFormDataTest : public testing::Test { public: void CheckDeepCopied(const String& a, const String& b) { EXPECT_EQ(a, b);
diff --git a/third_party/WebKit/Source/platform/network/NetworkStateNotifierTest.cpp b/third_party/WebKit/Source/platform/network/NetworkStateNotifierTest.cpp index cca39f3..6a97bc1 100644 --- a/third_party/WebKit/Source/platform/network/NetworkStateNotifierTest.cpp +++ b/third_party/WebKit/Source/platform/network/NetworkStateNotifierTest.cpp
@@ -160,7 +160,7 @@ added_handle_; }; -class NetworkStateNotifierTest : public ::testing::Test { +class NetworkStateNotifierTest : public testing::Test { public: NetworkStateNotifierTest() : task_runner_(base::MakeRefCounted<FakeTaskRunner>()),
diff --git a/third_party/WebKit/Source/platform/runtime_enabled_features.json5 b/third_party/WebKit/Source/platform/runtime_enabled_features.json5 index bede6ee1..7a977ae 100644 --- a/third_party/WebKit/Source/platform/runtime_enabled_features.json5 +++ b/third_party/WebKit/Source/platform/runtime_enabled_features.json5
@@ -395,10 +395,6 @@ name: "DocumentWrite", }, { - name: "DoubleTapToJumpOnVideo", - settable_from_internals: true - }, - { name: "EmbedderCSPEnforcement", status: "stable", },
diff --git a/third_party/WebKit/Source/platform/scheduler/BUILD.gn b/third_party/WebKit/Source/platform/scheduler/BUILD.gn index 5cfef95..62ff057c 100644 --- a/third_party/WebKit/Source/platform/scheduler/BUILD.gn +++ b/third_party/WebKit/Source/platform/scheduler/BUILD.gn
@@ -98,7 +98,10 @@ "main_thread/frame_origin_type.h", "main_thread/frame_scheduler_impl.cc", "main_thread/frame_scheduler_impl.h", + "main_thread/page_scheduler_impl.cc", + "main_thread/page_scheduler_impl.h", "public/frame_scheduler.h", + "public/page_scheduler.h", "renderer/auto_advancing_virtual_time_domain.cc", "renderer/auto_advancing_virtual_time_domain.h", "renderer/deadline_task_runner.cc", @@ -111,9 +114,6 @@ "renderer/main_thread_scheduler_helper.h", "renderer/main_thread_task_queue.cc", "renderer/main_thread_task_queue.h", - "renderer/page_scheduler.h", - "renderer/page_scheduler_impl.cc", - "renderer/page_scheduler_impl.h", "renderer/queueing_time_estimator.cc", "renderer/queueing_time_estimator.h", "renderer/render_widget_scheduling_state.cc", @@ -206,10 +206,10 @@ "common/throttling/budget_pool_unittest.cc", "common/throttling/task_queue_throttler_unittest.cc", "main_thread/frame_scheduler_impl_unittest.cc", + "main_thread/page_scheduler_impl_unittest.cc", "renderer/auto_advancing_virtual_time_domain_unittest.cc", "renderer/deadline_task_runner_unittest.cc", "renderer/idle_time_estimator_unittest.cc", - "renderer/page_scheduler_impl_unittest.cc", "renderer/queueing_time_estimator_unittest.cc", "renderer/render_widget_signals_unittest.cc", "renderer/renderer_metrics_helper_unittest.cc",
diff --git a/third_party/WebKit/Source/platform/scheduler/base/intrusive_heap_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/intrusive_heap_unittest.cc index 1240940..ce68a43 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/intrusive_heap_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/intrusive_heap_unittest.cc
@@ -29,7 +29,7 @@ } // namespace -class IntrusiveHeapTest : public ::testing::Test { +class IntrusiveHeapTest : public testing::Test { protected: static bool CompareNodes(const TestElement& a, const TestElement& b) { return IntrusiveHeap<TestElement>::CompareNodes(a, b); @@ -278,8 +278,7 @@ heap.Pop(); } - EXPECT_THAT(results, - ::testing::ElementsAre(0, 2, 4, 6, 8, 12, 14, 16, 17, 18)); + EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 12, 14, 16, 17, 18)); } TEST_F(IntrusiveHeapTest, ChangeKeyUpButDoesntMove) { @@ -298,8 +297,7 @@ heap.Pop(); } - EXPECT_THAT(results, - ::testing::ElementsAre(0, 2, 4, 6, 8, 11, 12, 14, 16, 18)); + EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 11, 12, 14, 16, 18)); } TEST_F(IntrusiveHeapTest, ChangeKeyDown) { @@ -318,8 +316,7 @@ heap.Pop(); } - EXPECT_THAT(results, - ::testing::ElementsAre(0, 1, 2, 4, 6, 8, 12, 14, 16, 18)); + EXPECT_THAT(results, testing::ElementsAre(0, 1, 2, 4, 6, 8, 12, 14, 16, 18)); } TEST_F(IntrusiveHeapTest, ChangeKeyDownButDoesntMove) { @@ -338,8 +335,7 @@ heap.Pop(); } - EXPECT_THAT(results, - ::testing::ElementsAre(0, 2, 4, 6, 8, 9, 12, 14, 16, 18)); + EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 9, 12, 14, 16, 18)); } TEST_F(IntrusiveHeapTest, ChangeKeyCheckAllFinalPositions) {
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_impl_unittest.cc index a454d76b..532b0e5 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_impl_unittest.cc
@@ -34,19 +34,19 @@ #include "testing/gmock/include/gmock/gmock.h" #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h" -using ::testing::AnyNumber; -using ::testing::Contains; -using ::testing::ElementsAre; -using ::testing::ElementsAreArray; -using ::testing::Mock; -using ::testing::Not; -using ::testing::_; +using testing::AnyNumber; +using testing::Contains; +using testing::ElementsAre; +using testing::ElementsAreArray; +using testing::Mock; +using testing::Not; +using testing::_; using blink::scheduler::internal::EnqueueOrder; namespace blink { namespace scheduler { -class TaskQueueManagerTest : public ::testing::Test { +class TaskQueueManagerTest : public testing::Test { public: TaskQueueManagerTest() = default; void DeleteTaskQueueManager() { manager_.reset(); } @@ -1903,7 +1903,7 @@ .Times(1); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), delay1s); runners_[1]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), delay10s); - ::testing::Mock::VerifyAndClearExpectations(&observer); + testing::Mock::VerifyAndClearExpectations(&observer); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter0 = runners_[0]->CreateQueueEnabledVoter();
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc index 4986813..560a7e4 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc
@@ -61,7 +61,7 @@ DISALLOW_COPY_AND_ASSIGN(PerfTestTimeDomain); }; -class TaskQueueManagerPerfTest : public ::testing::Test { +class TaskQueueManagerPerfTest : public testing::Test { public: TaskQueueManagerPerfTest() : num_queues_(0),
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc index ac997c7..f10780b 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc
@@ -19,7 +19,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; +using testing::_; namespace blink { namespace scheduler { @@ -45,7 +45,7 @@ using TaskQueueSelector::prioritizing_selector_for_test; }; -class TaskQueueSelectorTest : public ::testing::Test { +class TaskQueueSelectorTest : public testing::Test { public: TaskQueueSelectorTest() : test_closure_( @@ -144,21 +144,21 @@ TEST_F(TaskQueueSelectorTest, TestDefaultPriority) { size_t queue_order[] = {4, 3, 2, 1, 0}; PushTasks(queue_order, 5); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(4, 3, 2, 1, 0)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(4, 3, 2, 1, 0)); } TEST_F(TaskQueueSelectorTest, TestHighPriority) { size_t queue_order[] = {0, 1, 2, 3, 4}; PushTasks(queue_order, 5); selector_.SetQueuePriority(task_queues_[2].get(), TaskQueue::kHighPriority); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(2, 0, 1, 3, 4)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(2, 0, 1, 3, 4)); } TEST_F(TaskQueueSelectorTest, TestLowPriority) { size_t queue_order[] = {0, 1, 2, 3, 4}; PushTasks(queue_order, 5); selector_.SetQueuePriority(task_queues_[2].get(), TaskQueue::kLowPriority); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(0, 1, 3, 4, 2)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(0, 1, 3, 4, 2)); } TEST_F(TaskQueueSelectorTest, TestBestEffortPriority) { @@ -168,7 +168,7 @@ TaskQueue::kBestEffortPriority); selector_.SetQueuePriority(task_queues_[2].get(), TaskQueue::kLowPriority); selector_.SetQueuePriority(task_queues_[3].get(), TaskQueue::kHighPriority); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(3, 1, 4, 2, 0)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(3, 1, 4, 2, 0)); } TEST_F(TaskQueueSelectorTest, TestControlPriority) { @@ -179,7 +179,7 @@ EXPECT_EQ(TaskQueue::kControlPriority, task_queues_[4]->GetQueuePriority()); selector_.SetQueuePriority(task_queues_[2].get(), TaskQueue::kHighPriority); EXPECT_EQ(TaskQueue::kHighPriority, task_queues_[2]->GetQueuePriority()); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(4, 2, 0, 1, 3)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(4, 2, 0, 1, 3)); } TEST_F(TaskQueueSelectorTest, TestObserverWithEnabledQueue) { @@ -214,17 +214,17 @@ // Disabling a queue should not affect its priority. EXPECT_EQ(TaskQueue::kNormalPriority, task_queues_[2]->GetQueuePriority()); EXPECT_EQ(TaskQueue::kNormalPriority, task_queues_[4]->GetQueuePriority()); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(0, 1, 3)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(0, 1, 3)); EXPECT_CALL(mock_observer, OnTaskQueueEnabled(_)).Times(2); task_queues_[2]->SetQueueEnabledForTest(true); selector_.EnableQueue(task_queues_[2].get()); selector_.SetQueuePriority(task_queues_[2].get(), TaskQueue::kBestEffortPriority); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(2)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(2)); task_queues_[4]->SetQueueEnabledForTest(true); selector_.EnableQueue(task_queues_[4].get()); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(4)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(4)); } TEST_F(TaskQueueSelectorTest, TestDisableChangePriorityThenEnable) { @@ -242,7 +242,7 @@ task_queues_[2]->SetQueueEnabledForTest(true); EXPECT_EQ(TaskQueue::kHighPriority, task_queues_[2]->GetQueuePriority()); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(2, 0, 1, 3, 4)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(2, 0, 1, 3, 4)); } TEST_F(TaskQueueSelectorTest, TestEmptyQueues) { @@ -267,7 +267,7 @@ size_t enqueue_order[] = {10, 1, 2, 9, 4}; size_t queue_order[] = {0, 1, 2, 3, 4}; PushTasksWithEnqueueOrder(queue_order, enqueue_order, 5); - EXPECT_THAT(PopTasks(), ::testing::ElementsAre(1, 2, 4, 3, 0)); + EXPECT_THAT(PopTasks(), testing::ElementsAre(1, 2, 4, 3, 0)); } TEST_F(TaskQueueSelectorTest, TestControlStarvesOthers) { @@ -485,7 +485,7 @@ WorkQueue* chosen_work_queue; EXPECT_FALSE(selector.SelectWorkQueueToService(&chosen_work_queue)); - ::testing::Mock::VerifyAndClearExpectations(&mock_observer); + testing::Mock::VerifyAndClearExpectations(&mock_observer); EXPECT_CALL(mock_observer, OnTaskQueueEnabled(_)).Times(2); @@ -520,8 +520,7 @@ class ChooseOldestWithPriorityTest : public TaskQueueSelectorTest, - public ::testing::WithParamInterface<ChooseOldestWithPriorityTestParam> { -}; + public testing::WithParamInterface<ChooseOldestWithPriorityTestParam> {}; TEST_P(ChooseOldestWithPriorityTest, RoundRobinTest) { task_queues_[0]->immediate_work_queue()->Push(TaskQueueImpl::Task( @@ -548,10 +547,9 @@ GetParam().expected_did_starve_immediate_queue); } -INSTANTIATE_TEST_CASE_P( - ChooseOldestWithPriorityTest, - ChooseOldestWithPriorityTest, - ::testing::ValuesIn(kChooseOldestWithPriorityTestCases)); +INSTANTIATE_TEST_CASE_P(ChooseOldestWithPriorityTest, + ChooseOldestWithPriorityTest, + testing::ValuesIn(kChooseOldestWithPriorityTestCases)); } // namespace task_queue_selector_unittest } // namespace internal
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc index a193baf..b2626aa 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc
@@ -14,9 +14,9 @@ #include "platform/scheduler/base/work_queue.h" #include "testing/gmock/include/gmock/gmock.h" -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::Mock; +using testing::_; +using testing::AnyNumber; +using testing::Mock; namespace blink { namespace scheduler { @@ -72,7 +72,7 @@ DISALLOW_COPY_AND_ASSIGN(MockTimeDomain); }; -class TimeDomainTest : public ::testing::Test { +class TimeDomainTest : public testing::Test { public: void SetUp() final { time_domain_ = base::WrapUnique(CreateMockTimeDomain()); @@ -212,7 +212,7 @@ EXPECT_TRUE(time_domain_->NextScheduledTaskQueue(&next_task_queue)); EXPECT_EQ(task_queue_.get(), next_task_queue); - ::testing::Mock::VerifyAndClearExpectations(time_domain_.get()); + testing::Mock::VerifyAndClearExpectations(time_domain_.get()); EXPECT_CALL(*time_domain_.get(), CancelWakeUpAt(wake_up1)).Times(1); EXPECT_CALL(*time_domain_.get(), RequestWakeUpAt(_, wake_up2)).Times(1); @@ -222,7 +222,7 @@ EXPECT_TRUE(time_domain_->NextScheduledTaskQueue(&next_task_queue)); EXPECT_EQ(task_queue2_.get(), next_task_queue); - ::testing::Mock::VerifyAndClearExpectations(time_domain_.get()); + testing::Mock::VerifyAndClearExpectations(time_domain_.get()); EXPECT_CALL(*time_domain_.get(), CancelWakeUpAt(wake_up2)).Times(1);
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc index b3be1e2..213b3ce 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc
@@ -16,7 +16,7 @@ namespace internal { -class WorkQueueSetsTest : public ::testing::Test { +class WorkQueueSetsTest : public testing::Test { public: void SetUp() override { work_queue_sets_.reset(new WorkQueueSets(kNumSets, "test"));
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc index 59630c3..8bb6bb8 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc
@@ -28,7 +28,7 @@ }; } // namespace -class WorkQueueTest : public ::testing::Test { +class WorkQueueTest : public testing::Test { public: void SetUp() override { time_domain_.reset(new RealTimeDomain());
diff --git a/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc index 52c46af..bad7d74f 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc
@@ -27,7 +27,7 @@ base::WeakPtrFactory<TestClass> weak_factory_; }; -class IdleCanceledDelayedTaskSweeperTest : public ::testing::Test, +class IdleCanceledDelayedTaskSweeperTest : public testing::Test, public IdleHelper::Delegate { public: IdleCanceledDelayedTaskSweeperTest()
diff --git a/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc index 894982f7..d05e15d11a 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc
@@ -23,12 +23,12 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::AtLeast; -using ::testing::Exactly; -using ::testing::Invoke; -using ::testing::Return; +using testing::_; +using testing::AnyNumber; +using testing::AtLeast; +using testing::Exactly; +using testing::Invoke; +using testing::Return; namespace blink { namespace scheduler { @@ -188,7 +188,7 @@ MOCK_METHOD1(OnPendingTasksChanged, void(bool has_tasks)); }; -class BaseIdleHelperTest : public ::testing::Test { +class BaseIdleHelperTest : public testing::Test { public: BaseIdleHelperTest( base::MessageLoop* message_loop, @@ -434,8 +434,7 @@ EXPECT_CALL(*idle_helper_, OnIdlePeriodEnded()).Times(0); } - void ExpectIdlePeriodStartsAndEnds( - const ::testing::Cardinality& cardinality) { + void ExpectIdlePeriodStartsAndEnds(const testing::Cardinality& cardinality) { EXPECT_CALL(*idle_helper_, OnIdlePeriodStarted()).Times(cardinality); EXPECT_CALL(*idle_helper_, OnIdlePeriodEnded()).Times(cardinality); } @@ -535,9 +534,9 @@ clock_.NowTicks() + base::TimeDelta::FromMilliseconds(10)); RunUntilIdle(); // Note we expect task 3 to run last because it's non-nestable. - EXPECT_THAT(order, ::testing::ElementsAre(std::string("1"), std::string("2"), - std::string("4"), std::string("5"), - std::string("3"))); + EXPECT_THAT(order, testing::ElementsAre(std::string("1"), std::string("2"), + std::string("4"), std::string("5"), + std::string("3"))); } TEST_F(IdleHelperTestWithIdlePeriodObserver, TestLongIdlePeriod) { @@ -628,11 +627,11 @@ idle_helper_->EnableLongIdlePeriod(); RunUntilIdle(); EXPECT_EQ(3, run_count); - EXPECT_THAT(actual_deadlines, - ::testing::ElementsAre( - clock_before + maximum_idle_period_duration(), - clock_before + 2 * maximum_idle_period_duration(), - clock_before + 3 * maximum_idle_period_duration())); + EXPECT_THAT( + actual_deadlines, + testing::ElementsAre(clock_before + maximum_idle_period_duration(), + clock_before + 2 * maximum_idle_period_duration(), + clock_before + 3 * maximum_idle_period_duration())); g_max_idle_task_reposts = 5; idle_task_runner_->PostIdleTask( @@ -711,10 +710,10 @@ idle_helper_->EnableLongIdlePeriod(); RunUntilIdle(); EXPECT_EQ(2, run_count); - EXPECT_THAT(actual_deadlines, - ::testing::ElementsAre( - clock_before + maximum_idle_period_duration(), - clock_before + 2 * maximum_idle_period_duration())); + EXPECT_THAT( + actual_deadlines, + testing::ElementsAre(clock_before + maximum_idle_period_duration(), + clock_before + 2 * maximum_idle_period_duration())); } TEST_F(IdleHelperTest, TestLongIdlePeriodRestartWaitsIfNotMaxDeadline) { @@ -781,10 +780,10 @@ idle_task_runtime, &actual_deadlines)); RunUntilIdle(); EXPECT_EQ(2, run_count); - EXPECT_THAT(actual_deadlines, - ::testing::ElementsAre( - clock_before + maximum_idle_period_duration(), - clock_before + 2 * maximum_idle_period_duration())); + EXPECT_THAT( + actual_deadlines, + testing::ElementsAre(clock_before + maximum_idle_period_duration(), + clock_before + 2 * maximum_idle_period_duration())); // Once all task have been run we should go back to the paused state. CheckIdlePeriodStateIs("in_long_idle_period_paused"); @@ -1133,7 +1132,7 @@ base::TimeTicks deadline_in_task; { - ::testing::InSequence dummy; + testing::InSequence dummy; // This will be called once. I.e when the one and only task is posted. EXPECT_CALL(*idle_helper_, OnPendingTasksChanged(true)).Times(1); // This will be called once. I.e when the one and only task completes. @@ -1163,7 +1162,7 @@ base::TimeTicks deadline_in_task; { - ::testing::InSequence dummy; + testing::InSequence dummy; // This will be called 3 times. I.e when T1 and T2 are posted and when T1 // completes. EXPECT_CALL(*idle_helper_, OnPendingTasksChanged(true)).Times(3);
diff --git a/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc index 17270eb5..769b3030 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc
@@ -18,10 +18,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::Invoke; -using ::testing::Return; +using testing::_; +using testing::AnyNumber; +using testing::Invoke; +using testing::Return; namespace blink { namespace scheduler { @@ -48,7 +48,7 @@ }; // namespace -class SchedulerHelperTest : public ::testing::Test { +class SchedulerHelperTest : public testing::Test { public: SchedulerHelperTest() : mock_task_runner_(new cc::OrderedSimpleTaskRunner(&clock_, false)) { @@ -106,8 +106,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("D3"), std::string("D4"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("D3"), std::string("D4"))); } TEST_F(SchedulerHelperTest, TestRentrantTask) { @@ -119,7 +119,7 @@ &run_order, &count, 5)); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(0, 1, 2, 3, 4)); + EXPECT_THAT(run_order, testing::ElementsAre(0, 1, 2, 3, 4)); } TEST_F(SchedulerHelperTest, IsShutdown) {
diff --git a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h index aba5121..78b6c39 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h
@@ -9,7 +9,7 @@ #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/time/time.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "public/platform/WebThread.h" #include "public/platform/scheduler/renderer/renderer_scheduler.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc index aa57ead..caa37e0 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc
@@ -10,7 +10,7 @@ #include "base/single_thread_task_runner.h" #include "platform/scheduler/child/task_runner_impl.h" #include "platform/scheduler/child/worker_scheduler.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" namespace blink { namespace scheduler {
diff --git a/third_party/WebKit/Source/platform/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc index 3719f15..94bf5ce 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc
@@ -14,10 +14,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::_; -using ::testing::AnyOf; -using ::testing::ElementsAre; -using ::testing::Invoke; +using testing::_; +using testing::AnyOf; +using testing::ElementsAre; +using testing::Invoke; namespace blink { namespace scheduler { @@ -67,7 +67,7 @@ web_scheduler_impl->Shutdown(); } -class WebThreadImplForWorkerSchedulerTest : public ::testing::Test { +class WebThreadImplForWorkerSchedulerTest : public testing::Test { public: WebThreadImplForWorkerSchedulerTest() = default; @@ -177,8 +177,7 @@ // Sometimes we get an internal scheduler task running before or after // TestTask as well. This is not a bug, and we need to make sure the test // doesn't fail when that happens. - EXPECT_THAT(calls, - ::testing::HasSubstr("willProcessTask run didProcessTask")); + EXPECT_THAT(calls, testing::HasSubstr("willProcessTask run didProcessTask")); } TEST_F(WebThreadImplForWorkerSchedulerTest, TestShutdown) {
diff --git a/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler_unittest.cc index c771564..74c182453 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler_unittest.cc
@@ -15,7 +15,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAreArray; +using testing::ElementsAreArray; namespace blink { namespace scheduler { @@ -27,7 +27,7 @@ vector->push_back(value); } -class WorkerGlobalScopeSchedulerTest : public ::testing::Test { +class WorkerGlobalScopeSchedulerTest : public testing::Test { public: WorkerGlobalScopeSchedulerTest() : mock_task_runner_(new base::TestSimpleTaskRunner()), @@ -76,7 +76,7 @@ RunUntilIdle(); PostTestTask(&run_order, "T3"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre("T1", "T2", "T3")); + EXPECT_THAT(run_order, testing::ElementsAre("T1", "T2", "T3")); // Tasks should not run after the scheduler is disposed of. global_scope_scheduler_->Dispose();
diff --git a/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl_unittest.cc index 750551d00..9c4d955 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl_unittest.cc
@@ -15,7 +15,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAreArray; +using testing::ElementsAreArray; namespace blink { namespace scheduler { @@ -89,7 +89,7 @@ std::vector<std::string>* timeline_; // NOT OWNED }; -class WorkerSchedulerImplTest : public ::testing::Test { +class WorkerSchedulerImplTest : public testing::Test { public: WorkerSchedulerImplTest() : mock_task_runner_(new cc::OrderedSimpleTaskRunner(&clock_, true)), @@ -188,8 +188,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("D3"), std::string("D4"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("D3"), std::string("D4"))); } TEST_F(WorkerSchedulerImplTest, TestPostIdleTask) { @@ -199,7 +199,7 @@ PostTestTasks(&run_order, "I1"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("I1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("I1"))); } TEST_F(WorkerSchedulerImplTest, TestPostDefaultAndIdleTasks) { @@ -210,8 +210,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D2"), std::string("D3"), - std::string("D4"), std::string("I1"))); + testing::ElementsAre(std::string("D2"), std::string("D3"), + std::string("D4"), std::string("I1"))); } TEST_F(WorkerSchedulerImplTest, TestPostDefaultDelayedAndIdleTasks) { @@ -226,9 +226,9 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D2"), std::string("D3"), - std::string("D4"), std::string("I1"), - std::string("DELAYED"))); + testing::ElementsAre(std::string("D2"), std::string("D3"), + std::string("D4"), std::string("I1"), + std::string("DELAYED"))); } TEST_F(WorkerSchedulerImplTest, TestIdleTaskWhenIsNotQuiescent) { @@ -327,8 +327,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D3"), std::string("I1"), - std::string("I2"))); + testing::ElementsAre(std::string("D3"), std::string("I1"), + std::string("I2"))); } void PostIdleTask(std::vector<std::string>* timeline,
diff --git a/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_proxy_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_proxy_unittest.cc index 24d4f2d..37fa2bc4 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_proxy_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_proxy_unittest.cc
@@ -9,7 +9,7 @@ #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" #include "platform/scheduler/child/worker_scheduler_impl.h" #include "platform/scheduler/main_thread/frame_scheduler_impl.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" #include "platform/scheduler/test/task_queue_manager_for_test.h" #include "testing/gmock/include/gmock/gmock.h" @@ -80,7 +80,7 @@ } // namespace -class WorkerSchedulerProxyTest : public ::testing::Test { +class WorkerSchedulerProxyTest : public testing::Test { public: WorkerSchedulerProxyTest() : mock_main_thread_task_runner_(
diff --git a/third_party/WebKit/Source/platform/scheduler/common/throttling/budget_pool_unittest.cc b/third_party/WebKit/Source/platform/scheduler/common/throttling/budget_pool_unittest.cc index 51dd56c5..3e1ee6f0 100644 --- a/third_party/WebKit/Source/platform/scheduler/common/throttling/budget_pool_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/common/throttling/budget_pool_unittest.cc
@@ -24,7 +24,7 @@ namespace blink { namespace scheduler { -class BudgetPoolTest : public ::testing::Test { +class BudgetPoolTest : public testing::Test { public: BudgetPoolTest() = default; ~BudgetPoolTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc b/third_party/WebKit/Source/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc index 07d1b535..62b18674 100644 --- a/third_party/WebKit/Source/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc
@@ -24,7 +24,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink { namespace scheduler { @@ -70,7 +70,7 @@ base::TimeDelta advancing_interval_; }; -class TaskQueueThrottlerTest : public ::testing::Test { +class TaskQueueThrottlerTest : public testing::Test { public: TaskQueueThrottlerTest() = default; ~TaskQueueThrottlerTest() override = default; @@ -142,7 +142,7 @@ class TaskQueueThrottlerWithAutoAdvancingTimeTest : public TaskQueueThrottlerTest, - public ::testing::WithParamInterface<bool> { + public testing::WithParamInterface<bool> { public: TaskQueueThrottlerWithAutoAdvancingTimeTest() : auto_advance_time_interval_(GetParam() @@ -163,7 +163,7 @@ INSTANTIATE_TEST_CASE_P(All, TaskQueueThrottlerWithAutoAdvancingTimeTest, - ::testing::Bool()); + testing::Bool()); TEST_F(TaskQueueThrottlerTest, ThrottledTasksReportRealTime) { EXPECT_EQ(timer_queue_->GetTimeDomain()->Now(),
diff --git a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.cc index 2e95b71..b20b37c 100644 --- a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.cc
@@ -15,8 +15,8 @@ #include "platform/scheduler/child/task_runner_impl.h" #include "platform/scheduler/child/worker_scheduler_proxy.h" #include "platform/scheduler/common/throttling/budget_pool.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" #include "platform/scheduler/util/tracing_helper.h" #include "public/platform/BlameContext.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.h index fe677b7..1fc5c99 100644 --- a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl.h
@@ -173,6 +173,8 @@ StateTracer<kTracingCategoryNameInfo> url_tracer_; // |task_queue_throttled_| is false if |throttleable_task_queue_| is absent. TraceableState<bool, kTracingCategoryNameInfo> task_queue_throttled_; + // TODO(kraynov): https://crbug.com/827113 + // Trace active connection count. int active_connection_count_; TraceableState<bool, kTracingCategoryNameInfo> has_active_connection_;
diff --git a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc index 8c741d4..a18767d 100644 --- a/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc
@@ -12,7 +12,7 @@ #include "components/viz/test/ordered_simple_task_runner.h" #include "platform/WebTaskRunner.h" #include "platform/runtime_enabled_features.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" #include "platform/scheduler/test/task_queue_manager_for_test.h" #include "platform/testing/runtime_enabled_features_test_helpers.h" @@ -23,7 +23,7 @@ // To avoid symbol collisions in jumbo builds. namespace frame_scheduler_impl_unittest { -class FrameSchedulerImplTest : public ::testing::Test { +class FrameSchedulerImplTest : public testing::Test { public: FrameSchedulerImplTest() = default; ~FrameSchedulerImplTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl.cc similarity index 99% rename from third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.cc rename to third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl.cc index c1dc54d..8edacf5f 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_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 "platform/scheduler/renderer/page_scheduler_impl.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "base/logging.h" #include "base/metrics/field_trial_params.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl.h similarity index 93% rename from third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.h rename to third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl.h index 671cb85..fce29f4 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_IMPL_H_ -#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_IMPL_H_ +#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_MAIN_THREAD_PAGE_SCHEDULER_IMPL_H_ +#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_MAIN_THREAD_PAGE_SCHEDULER_IMPL_H_ #include <memory> #include <set> @@ -17,7 +17,7 @@ #include "platform/scheduler/child/page_visibility_state.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/scheduler/common/throttling/task_queue_throttler.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" #include "platform/scheduler/util/tracing_helper.h" namespace base { @@ -126,4 +126,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_IMPL_H_ +#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_MAIN_THREAD_PAGE_SCHEDULER_IMPL_H_
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl_unittest.cc similarity index 99% rename from third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl_unittest.cc rename to third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_impl_unittest.cc index b1e0fa2..7cd09ee 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/main_thread/page_scheduler_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 "platform/scheduler/renderer/page_scheduler_impl.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include <memory> @@ -22,7 +22,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; using VirtualTimePolicy = blink::PageScheduler::VirtualTimePolicy; namespace blink { @@ -30,7 +30,7 @@ // To avoid symbol collisions in jumbo builds. namespace page_scheduler_impl_unittest { -class PageSchedulerImplTest : public ::testing::Test { +class PageSchedulerImplTest : public testing::Test { public: PageSchedulerImplTest() = default; ~PageSchedulerImplTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler.h b/third_party/WebKit/Source/platform/scheduler/public/page_scheduler.h similarity index 95% rename from third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler.h rename to third_party/WebKit/Source/platform/scheduler/public/page_scheduler.h index 19fef25..bcd5aaf 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/page_scheduler.h +++ b/third_party/WebKit/Source/platform/scheduler/public/page_scheduler.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_H_ -#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_H_ +#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_PUBLIC_PAGE_SCHEDULER_H_ +#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_PUBLIC_PAGE_SCHEDULER_H_ #include <memory> #include "platform/PlatformExport.h" @@ -136,4 +136,4 @@ } // namespace blink -#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_PAGE_SCHEDULER_H_ +#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_PUBLIC_PAGE_SCHEDULER_H_
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 46fd471..e671cb9 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
@@ -20,7 +20,7 @@ // Namespace to avoid symbol collisions in jumbo builds. namespace auto_advancing_virtual_time_domain_unittest { -class AutoAdvancingVirtualTimeDomainTest : public ::testing::Test { +class AutoAdvancingVirtualTimeDomainTest : public testing::Test { public: AutoAdvancingVirtualTimeDomainTest() = default; ~AutoAdvancingVirtualTimeDomainTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/deadline_task_runner_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/deadline_task_runner_unittest.cc index 0fcaa7a..bcd56c3 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/deadline_task_runner_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/deadline_task_runner_unittest.cc
@@ -14,7 +14,7 @@ namespace blink { namespace scheduler { -class DeadlineTaskRunnerTest : public ::testing::Test { +class DeadlineTaskRunnerTest : public testing::Test { public: DeadlineTaskRunnerTest() = default; ~DeadlineTaskRunnerTest() override = default; @@ -46,7 +46,7 @@ deadline_task_runner_->SetDeadline(FROM_HERE, delay, clock_->NowTicks()); RunUntilIdle(); - EXPECT_THAT(run_times_, ::testing::ElementsAre(start_time + delay)); + EXPECT_THAT(run_times_, testing::ElementsAre(start_time + delay)); }; TEST_F(DeadlineTaskRunnerTest, RunTwice) { @@ -60,7 +60,7 @@ deadline_task_runner_->SetDeadline(FROM_HERE, delay2, clock_->NowTicks()); RunUntilIdle(); - EXPECT_THAT(run_times_, ::testing::ElementsAre(deadline1, deadline2)); + EXPECT_THAT(run_times_, testing::ElementsAre(deadline1, deadline2)); }; TEST_F(DeadlineTaskRunnerTest, EarlierDeadlinesTakePrecidence) { @@ -74,7 +74,7 @@ RunUntilIdle(); - EXPECT_THAT(run_times_, ::testing::ElementsAre(start_time + delay1)); + EXPECT_THAT(run_times_, testing::ElementsAre(start_time + delay1)); }; TEST_F(DeadlineTaskRunnerTest, LaterDeadlinesIgnored) { @@ -86,7 +86,7 @@ RunUntilIdle(); - EXPECT_THAT(run_times_, ::testing::ElementsAre(start_time + delay100)); + EXPECT_THAT(run_times_, testing::ElementsAre(start_time + delay100)); }; TEST_F(DeadlineTaskRunnerTest, DeleteDeadlineTaskRunnerAfterPosting) {
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/frame_status.cc b/third_party/WebKit/Source/platform/scheduler/renderer/frame_status.cc index 01503dd..c286d0e 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/frame_status.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/frame_status.cc
@@ -5,7 +5,7 @@ #include "platform/scheduler/renderer/frame_status.h" #include "platform/scheduler/public/frame_scheduler.h" -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" namespace blink { namespace scheduler {
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 1b8e07f..3993017 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
@@ -32,7 +32,7 @@ estimation_percentile) {} }; -class IdleTimeEstimatorTest : public ::testing::Test { +class IdleTimeEstimatorTest : public testing::Test { public: IdleTimeEstimatorTest() : frame_length_(base::TimeDelta::FromMilliseconds(16)) {}
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/queueing_time_estimator_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/queueing_time_estimator_unittest.cc index 2bfaa66..af0b647 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/queueing_time_estimator_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/queueing_time_estimator_unittest.cc
@@ -94,7 +94,7 @@ } // namespace -class QueueingTimeEstimatorTest : public ::testing::Test { +class QueueingTimeEstimatorTest : public testing::Test { protected: static std::vector<BucketExpectation> GetFineGrained( const std::vector<BucketExpectation>& expected) { @@ -158,7 +158,7 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(300))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(300))); std::vector<BucketExpectation> expected = {{300, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 1, expected); std::vector<BucketExpectation> fine_grained = GetFineGrained(expected); @@ -193,11 +193,11 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(7600), - base::TimeDelta::FromMilliseconds(15500), - base::TimeDelta::FromMilliseconds(10500), - base::TimeDelta::FromMilliseconds(5500), - base::TimeDelta::FromMilliseconds(900))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(7600), + base::TimeDelta::FromMilliseconds(15500), + base::TimeDelta::FromMilliseconds(10500), + base::TimeDelta::FromMilliseconds(5500), + base::TimeDelta::FromMilliseconds(900))); std::vector<BucketExpectation> expected = { {900, 1}, {5500, 1}, {7600, 1}, {10500, 2}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 5, expected); @@ -369,8 +369,8 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(100))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(100))); std::vector<BucketExpectation> expected = {{0, 1}, {100, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); std::vector<BucketExpectation> fine_grained = GetFineGrained(expected); @@ -420,8 +420,8 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(100))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(100))); std::vector<BucketExpectation> expected = {{100, 2}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); std::vector<BucketExpectation> fine_grained = GetFineGrained(expected); @@ -469,8 +469,8 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(100))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(100))); std::vector<BucketExpectation> expected = {{100, 2}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); std::vector<BucketExpectation> fine_grained = GetFineGrained(expected); @@ -518,7 +518,7 @@ base::TimeDelta::FromMilliseconds(0), base::TimeDelta::FromMilliseconds(0)}; EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAreArray(expected_durations)); + testing::ElementsAreArray(expected_durations)); // UMA reported only on disjoint windows. std::vector<BucketExpectation> expected = {{0, 1}, {2500, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); @@ -569,7 +569,7 @@ base::TimeDelta::FromMilliseconds(0), base::TimeDelta::FromMilliseconds(0)}; EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAreArray(expected_durations)); + testing::ElementsAreArray(expected_durations)); std::vector<BucketExpectation> expected = {{0, 1}, {725, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); std::vector<BucketExpectation> fine_grained = GetFineGrained(expected); @@ -629,7 +629,7 @@ base::TimeDelta::FromMilliseconds(0)}; EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAreArray(expected_durations)); + testing::ElementsAreArray(expected_durations)); std::vector<BucketExpectation> expected = {{325, 1}, {400, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 2, expected); // The two values get grouped under the same bucket in the microsecond @@ -683,10 +683,10 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(1000), - base::TimeDelta::FromMilliseconds(125), - base::TimeDelta::FromMilliseconds(20))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(1000), + base::TimeDelta::FromMilliseconds(125), + base::TimeDelta::FromMilliseconds(20))); std::vector<BucketExpectation> expected = { {0, 1}, {20, 1}, {125, 1}, {1000, 1}}; TestHistogram("RendererScheduler.ExpectedTaskQueueingDuration", 4, expected); @@ -767,14 +767,14 @@ estimator.OnTopLevelTaskCompleted(time); EXPECT_THAT(client.expected_queueing_times(), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(25), - base::TimeDelta::FromMilliseconds(121), - base::TimeDelta::FromMilliseconds(121), - base::TimeDelta::FromMilliseconds(150), - base::TimeDelta::FromMilliseconds(330), - base::TimeDelta::FromMilliseconds(321), - base::TimeDelta::FromMilliseconds(561), - base::TimeDelta::FromMilliseconds(801))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(25), + base::TimeDelta::FromMilliseconds(121), + base::TimeDelta::FromMilliseconds(121), + base::TimeDelta::FromMilliseconds(150), + base::TimeDelta::FromMilliseconds(330), + base::TimeDelta::FromMilliseconds(321), + base::TimeDelta::FromMilliseconds(561), + base::TimeDelta::FromMilliseconds(801))); } // Split ExpectedQueueingTime only reports once per disjoint window. The @@ -870,69 +870,69 @@ // End of window 4. Now check the vectors per task queue type. EXPECT_THAT(client.QueueTypeValues(QueueType::kDefault), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(900), - base::TimeDelta::FromMilliseconds(800), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(900), + base::TimeDelta::FromMilliseconds(800), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(36))); // The 800 and 900 values get grouped into a single bucket. std::vector<BucketExpectation> expected = {{36, 1}, {100, 1}, {800, 2}}; TestHistogram("RendererScheduler.ExpectedQueueingTimeByTaskQueue2.Default", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kFrameLoading), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(36))); expected = {{0, 2}, {36, 1}, {100, 1}}; TestHistogram( "RendererScheduler.ExpectedQueueingTimeByTaskQueue2.FrameLoading", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kFrameThrottleable), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(36))); expected = {{0, 2}, {36, 1}, {100, 1}}; TestHistogram( "RendererScheduler.ExpectedQueueingTimeByTaskQueue2.FrameThrottleable", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kFramePausable), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(36))); expected = {{0, 3}, {36, 1}}; TestHistogram( "RendererScheduler.ExpectedQueueingTimeByTaskQueue2.FramePausable", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kUnthrottled), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(36))); expected = {{0, 2}, {36, 1}, {100, 1}}; TestHistogram( "RendererScheduler.ExpectedQueueingTimeByTaskQueue2.Unthrottled", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kCompositor), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(36))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(36))); expected = {{0, 3}, {36, 1}}; TestHistogram("RendererScheduler.ExpectedQueueingTimeByTaskQueue2.Compositor", 4, GetFineGrained(expected)); EXPECT_THAT(client.QueueTypeValues(QueueType::kOther), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(22))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(22))); expected = {{0, 3}, {22, 1}}; TestHistogram("RendererScheduler.ExpectedQueueingTimeByTaskQueue2.Other", 4, GetFineGrained(expected)); @@ -943,7 +943,7 @@ base::TimeDelta::FromMilliseconds(400), base::TimeDelta::FromMilliseconds(238)}; EXPECT_THAT(client.FrameStatusValues(FrameStatus::kNone), - ::testing::ElementsAreArray(expected_sums)); + testing::ElementsAreArray(expected_sums)); expected = {{238, 1}, {400, 1}, {800, 1}, {900, 1}}; // The 800 and 900 values end up grouped up in the fine-grained version. std::vector<BucketExpectation> fine_grained = { @@ -1125,11 +1125,11 @@ // End of window 5. Now check the vectors per frame type. EXPECT_THAT(client.FrameStatusValues(FrameStatus::kMainFrameBackground), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(900), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(800), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(16))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(900), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(800), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(16))); std::vector<BucketExpectation> expected = { {0, 1}, {16, 1}, {100, 1}, {800, 2}}; TestHistogram( @@ -1138,11 +1138,11 @@ 5, GetFineGrained(expected)); EXPECT_THAT(client.FrameStatusValues(FrameStatus::kMainFrameVisible), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(800), - base::TimeDelta::FromMilliseconds(900), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(16))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(800), + base::TimeDelta::FromMilliseconds(900), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(16))); expected = {{0, 2}, {16, 1}, {800, 2}}; TestHistogram( "RendererScheduler.ExpectedQueueingTimeByFrameStatus2.MainFrameVisible", @@ -1164,11 +1164,11 @@ }; for (const auto& frame_expectation : three_expected) { EXPECT_THAT(client.FrameStatusValues(frame_expectation.frame_status), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(100), - base::TimeDelta::FromMilliseconds(16))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(100), + base::TimeDelta::FromMilliseconds(16))); expected = {{0, 3}, {16, 1}, {100, 1}}; TestHistogram(frame_expectation.name, 5, GetFineGrained(expected)); } @@ -1188,21 +1188,21 @@ "CrossOriginBackground"}}; for (const auto& frame_expectation : more_expected) { EXPECT_THAT(client.FrameStatusValues(frame_expectation.frame_status), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(16))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(16))); expected = {{0, 4}, {16, 1}}; TestHistogram(frame_expectation.name, 5, GetFineGrained(expected)); } EXPECT_THAT(client.FrameStatusValues(FrameStatus::kNone), - ::testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(0), - base::TimeDelta::FromMilliseconds(82))); + testing::ElementsAre(base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(0), + base::TimeDelta::FromMilliseconds(82))); expected = {{0, 4}, {82, 1}}; TestHistogram("RendererScheduler.ExpectedQueueingTimeByFrameStatus2.Other", 5, GetFineGrained(expected)); @@ -1214,7 +1214,7 @@ base::TimeDelta::FromMilliseconds(400), base::TimeDelta::FromMilliseconds(226)}; EXPECT_THAT(client.QueueTypeValues(QueueType::kOther), - ::testing::ElementsAreArray(expected_sums)); + testing::ElementsAreArray(expected_sums)); expected = {{226, 1}, {400, 1}, {800, 1}, {900, 1}, {1700, 1}}; std::vector<BucketExpectation> fine_grained = { {226 * 1000, 1}, {400 * 1000, 1}, {800 * 1000, 2}, {1700 * 1000, 1}};
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/render_widget_signals_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/render_widget_signals_unittest.cc index db04860..f1f6915 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/render_widget_signals_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/render_widget_signals_unittest.cc
@@ -9,9 +9,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::AnyNumber; -using ::testing::Mock; -using ::testing::_; +using testing::AnyNumber; +using testing::Mock; +using testing::_; namespace blink { namespace scheduler { @@ -31,7 +31,7 @@ DISALLOW_COPY_AND_ASSIGN(MockObserver); }; -class RenderWidgetSignalsTest : public ::testing::Test { +class RenderWidgetSignalsTest : public testing::Test { public: RenderWidgetSignalsTest() = default; ~RenderWidgetSignalsTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc index c352b8d..7233ec341 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc
@@ -39,7 +39,7 @@ using testing::ElementsAre; using testing::UnorderedElementsAre; -class RendererMetricsHelperTest : public ::testing::Test { +class RendererMetricsHelperTest : public testing::Test { public: RendererMetricsHelperTest() = default; ~RendererMetricsHelperTest() = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index 50f946c..da470e2 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -29,8 +29,8 @@ #include "platform/scheduler/child/features.h" #include "platform/scheduler/child/process_state.h" #include "platform/scheduler/common/throttling/task_queue_throttler.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" #include "platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" #include "public/platform/Platform.h" #include "public/platform/scheduler/renderer_process_type.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h index 4c1ea65a..a010e500 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h
@@ -21,12 +21,12 @@ #include "platform/scheduler/child/idle_canceled_delayed_task_sweeper.h" #include "platform/scheduler/child/idle_helper.h" #include "platform/scheduler/child/pollable_thread_safe_flag.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" #include "platform/scheduler/renderer/deadline_task_runner.h" #include "platform/scheduler/renderer/idle_time_estimator.h" #include "platform/scheduler/renderer/main_thread_scheduler_helper.h" #include "platform/scheduler/renderer/main_thread_task_queue.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" #include "platform/scheduler/renderer/queueing_time_estimator.h" #include "platform/scheduler/renderer/render_widget_signals.h" #include "platform/scheduler/renderer/renderer_metrics_helper.h"
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 8f8364c..243a9f64 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
@@ -34,7 +34,7 @@ // To avoid symbol collisions in jumbo builds. namespace renderer_scheduler_impl_unittest { -using ::testing::Mock; +using testing::Mock; class FakeInputEvent : public blink::WebInputEvent { public: @@ -265,7 +265,7 @@ return os << RendererSchedulerImpl::UseCaseToString(use_case); } -class RendererSchedulerImplTest : public ::testing::Test { +class RendererSchedulerImplTest : public testing::Test { public: RendererSchedulerImplTest() : fake_task_(TaskQueue::PostedTask(base::BindOnce([] {}), FROM_HERE), @@ -762,17 +762,17 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("D3"), std::string("D4"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("D3"), std::string("D4"))); } TEST_F(RendererSchedulerImplTest, TestPostDefaultAndCompositor) { std::vector<std::string> run_order; PostTestTasks(&run_order, "D1 C1 P1"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::Contains("D1")); - EXPECT_THAT(run_order, ::testing::Contains("C1")); - EXPECT_THAT(run_order, ::testing::Contains("P1")); + EXPECT_THAT(run_order, testing::Contains("D1")); + EXPECT_THAT(run_order, testing::Contains("C1")); + EXPECT_THAT(run_order, testing::Contains("P1")); } TEST_F(RendererSchedulerImplTest, TestRentrantTask) { @@ -784,7 +784,7 @@ &run_order, &count, 5)); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(0, 1, 2, 3, 4)); + EXPECT_THAT(run_order, testing::ElementsAre(0, 1, 2, 3, 4)); } TEST_F(RendererSchedulerImplTest, TestPostIdleTask) { @@ -914,10 +914,10 @@ RunUntilIdle(); // High-priority input is enabled and input tasks are processed first. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("P1"), std::string("P2"), - std::string("L1"), std::string("D1"), - std::string("C1"), std::string("D2"), - std::string("C2"), std::string("I1"))); + testing::ElementsAre(std::string("P1"), std::string("P2"), + std::string("L1"), std::string("D1"), + std::string("C1"), std::string("D2"), + std::string("C2"), std::string("I1"))); EXPECT_EQ(UseCase::kNone, CurrentUseCase()); } @@ -931,10 +931,10 @@ RunUntilIdle(); // Even with slow compositor input tasks are handled first. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("P1"), std::string("L1"), - std::string("D1"), std::string("C1"), - std::string("D2"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("P1"), std::string("L1"), + std::string("D1"), std::string("C1"), + std::string("D2"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kNone, CurrentUseCase()); } @@ -948,9 +948,9 @@ SimulateCompositorGestureStart(TouchEventPolicy::kSendTouchStart); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"), - std::string("D2"), std::string("C1"), - std::string("C2"), std::string("I1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"), + std::string("D2"), std::string("C1"), + std::string("C2"), std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -964,9 +964,9 @@ SimulateMainThreadGestureWithoutScrollUpdates(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("L1"), std::string("D1"), - std::string("D2"), std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("L1"), std::string("D1"), + std::string("D2"), std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); } @@ -980,9 +980,9 @@ SimulateMainThreadGestureWithoutPreventDefault(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"), - std::string("D2"), std::string("C1"), - std::string("C2"), std::string("I1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"), + std::string("D2"), std::string("C1"), + std::string("C2"), std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1013,9 +1013,9 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("L1"), std::string("D1"), - std::string("D2"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("L1"), std::string("D1"), + std::string("D2"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1028,9 +1028,9 @@ SimulateCompositorGestureStart(TouchEventPolicy::kDontSendTouchStart); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"), - std::string("D2"), std::string("C1"), - std::string("C2"), std::string("I1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"), + std::string("D2"), std::string("C1"), + std::string("C2"), std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1045,9 +1045,9 @@ blink::WebInputEvent::kGestureScrollBegin); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("L1"), std::string("D1"), - std::string("D2"), std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("L1"), std::string("D1"), + std::string("D2"), std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); scheduler_->DidHandleInputEventOnMainThread( FakeInputEvent(blink::WebInputEvent::kGestureFlingStart), @@ -1064,9 +1064,9 @@ blink::WebInputEvent::kGestureScrollBegin); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("L1"), std::string("D1"), - std::string("D2"), std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("L1"), std::string("D1"), + std::string("D2"), std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); scheduler_->DidHandleInputEventOnMainThread( FakeInputEvent(blink::WebInputEvent::kGestureFlingStart), @@ -1090,9 +1090,9 @@ // Because the main thread is performing custom input handling, we let all // tasks run. However compositing tasks are still given priority. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("L1"), std::string("D1"), - std::string("D2"), std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("L1"), std::string("D1"), + std::string("D2"), std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); } @@ -1114,9 +1114,9 @@ // Because we are still waiting for the touchstart to be processed, // non-essential tasks like loading tasks are blocked. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); EXPECT_EQ(UseCase::kTouchstart, CurrentUseCase()); } @@ -1133,9 +1133,9 @@ EnableIdleTasks(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("C1"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("C1"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1156,7 +1156,7 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("T1"))); + testing::ElementsAre(std::string("C1"), std::string("T1"))); } TEST_F(RendererSchedulerImplTest, @@ -1175,7 +1175,7 @@ EXPECT_FALSE(TouchStartExpectedSoon()); EXPECT_EQ(UseCase::kMainThreadGesture, CurrentUseCase()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("C1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("C1"))); } TEST_F(RendererSchedulerImplTest, @@ -1195,7 +1195,7 @@ EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("T1"))); + testing::ElementsAre(std::string("C1"), std::string("T1"))); } TEST_F(RendererSchedulerImplTest, @@ -1215,7 +1215,7 @@ EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("T1"))); + testing::ElementsAre(std::string("C1"), std::string("T1"))); } TEST_F(RendererSchedulerImplTest, TestTouchstartPolicy_Compositor) { @@ -1230,8 +1230,8 @@ EnableIdleTasks(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"))); // Animation or meta events like TapDown/FlingCancel shouldn't affect the // priority. @@ -1244,7 +1244,7 @@ FakeInputEvent(blink::WebInputEvent::kGestureTapDown), RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); // Action events like ScrollBegin will kick us back into compositor priority, // allowing service of the timer, loading and idle queues. @@ -1255,8 +1255,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("T1"), - std::string("T2"))); + testing::ElementsAre(std::string("L1"), std::string("T1"), + std::string("T2"))); } TEST_F(RendererSchedulerImplTest, TestTouchstartPolicy_MainThread) { @@ -1274,8 +1274,8 @@ EnableIdleTasks(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"))); // Meta events like TapDown/FlingCancel shouldn't affect the priority. run_order.clear(); @@ -1292,7 +1292,7 @@ FakeInputEvent(blink::WebInputEvent::kGestureTapDown), WebInputEventResult::kHandledSystem); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); // Action events like ScrollBegin will kick us back into compositor priority, // allowing service of the timer, loading and idle queues. @@ -1306,8 +1306,8 @@ RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("T1"), - std::string("T2"))); + testing::ElementsAre(std::string("L1"), std::string("T1"), + std::string("T2"))); } // TODO(alexclarke): Reenable once we've reinstaed the Loading @@ -1325,7 +1325,7 @@ std::string("D1"), std::string("L1"), std::string("D2"), std::string("L2"), std::string("C1"), std::string("T1"), std::string("C2"), std::string("T2"), std::string("I1")}; - EXPECT_THAT(run_order, ::testing::ElementsAreArray(loading_policy_expected)); + EXPECT_THAT(run_order, testing::ElementsAreArray(loading_policy_expected)); EXPECT_EQ(UseCase::kLoading, CurrentUseCase()); // Advance 15s and try again, the loading policy should have ended and the @@ -1341,7 +1341,7 @@ std::string("D1"), std::string("C1"), std::string("T1"), std::string("L1"), std::string("D2"), std::string("C2"), std::string("T2"), std::string("L2"), std::string("I1")}; - EXPECT_THAT(run_order, ::testing::ElementsAreArray(default_order_expected)); + EXPECT_THAT(run_order, testing::ElementsAreArray(default_order_expected)); EXPECT_EQ(UseCase::kNone, CurrentUseCase()); } @@ -1360,9 +1360,9 @@ // Note compositor tasks are not prioritized. EXPECT_EQ(UseCase::kNone, CurrentUseCase()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("D2"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("D2"), std::string("C2"), + std::string("I1"))); } TEST_F(RendererSchedulerImplTest, @@ -1380,9 +1380,9 @@ // Note compositor tasks are not prioritized. EXPECT_EQ(UseCase::kNone, CurrentUseCase()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("D2"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("D2"), std::string("C2"), + std::string("I1"))); } TEST_F(RendererSchedulerImplTest, @@ -1401,9 +1401,9 @@ // Note compositor tasks deprioritized. EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("C1"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("C1"), std::string("C2"), + std::string("I1"))); } TEST_F(RendererSchedulerImplTest, @@ -1419,9 +1419,9 @@ RunUntilIdle(); // Note compositor tasks are prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); scheduler_->DidHandleInputEventOnMainThread( FakeInputEvent(blink::WebInputEvent::kMouseMove, blink::WebInputEvent::kLeftButtonDown), @@ -1457,9 +1457,9 @@ // Note compositor tasks are prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); } TEST_F(RendererSchedulerImplTest, EventForwardedToMainThread_MouseClick) { @@ -1484,9 +1484,9 @@ // Note compositor tasks are prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); } TEST_F(RendererSchedulerImplTest, EventConsumedOnCompositorThread_MouseWheel) { @@ -1500,9 +1500,9 @@ RunUntilIdle(); // Note compositor tasks are not prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("C1"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("C1"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1518,9 +1518,9 @@ RunUntilIdle(); // Note compositor tasks are prioritized (since they are fast). EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase()); } @@ -1544,9 +1544,9 @@ RunUntilIdle(); // Note compositor tasks are prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"), - std::string("I1"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"), + std::string("I1"))); EXPECT_EQ(UseCase::kMainThreadGesture, CurrentUseCase()); } @@ -1572,9 +1572,9 @@ RunUntilIdle(); // Note compositor tasks are not prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("D2"), - std::string("C1"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("D2"), + std::string("C1"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kCompositorGesture, CurrentUseCase()); } @@ -1592,9 +1592,9 @@ RunUntilIdle(); // Note compositor tasks are not prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("D2"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("D2"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kNone, CurrentUseCase()); } @@ -1612,9 +1612,9 @@ RunUntilIdle(); // Note compositor tasks are not prioritized. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("D2"), std::string("C2"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("D2"), std::string("C2"), + std::string("I1"))); EXPECT_EQ(UseCase::kNone, CurrentUseCase()); // Note compositor tasks are not prioritized. scheduler_->DidHandleInputEventOnMainThread( @@ -1643,8 +1643,8 @@ // Ensure that the default D1 task gets to run at some point before the final // C2 compositor task. EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("D1"), - std::string("C2"))); + testing::ElementsAre(std::string("C1"), std::string("D1"), + std::string("C2"))); } TEST_F(RendererSchedulerImplTest, @@ -1677,8 +1677,8 @@ RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"))); run_order.clear(); clock_.Advance(base::TimeDelta::FromMilliseconds(1000)); @@ -1690,8 +1690,8 @@ // Touchstart policy mode should have ended now that the clock has advanced. RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"), - std::string("D2"))); + testing::ElementsAre(std::string("L1"), std::string("D1"), + std::string("D2"))); } TEST_F(RendererSchedulerImplTest, @@ -1705,8 +1705,8 @@ RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("C2"), - std::string("D1"), std::string("D2"))); + testing::ElementsAre(std::string("C1"), std::string("C2"), + std::string("D1"), std::string("D2"))); // Receiving the first touchmove will not affect scheduler priority. run_order.clear(); @@ -1714,7 +1714,7 @@ FakeInputEvent(blink::WebInputEvent::kTouchMove), RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); // Receiving the second touchmove will kick us back into compositor priority. run_order.clear(); @@ -1722,7 +1722,7 @@ FakeInputEvent(blink::WebInputEvent::kTouchMove), RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("L1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("L1"))); } TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) { @@ -2090,7 +2090,7 @@ RunUntilIdle(); EXPECT_THAT( mock_scheduler_->use_cases_, - ::testing::ElementsAre( + testing::ElementsAre( std::string("none"), std::string("compositor_gesture"), std::string("compositor_gesture touchstart expected"), std::string("none touchstart expected"), std::string("none"))); @@ -2155,9 +2155,9 @@ EnableIdleTasks(); RunUntilIdle(); // Note we expect task 3 to run last because it's non-nestable. - EXPECT_THAT(order, ::testing::ElementsAre(std::string("1"), std::string("2"), - std::string("4"), std::string("5"), - std::string("3"))); + EXPECT_THAT(order, testing::ElementsAre(std::string("1"), std::string("2"), + std::string("4"), std::string("5"), + std::string("3"))); } TEST_F(RendererSchedulerImplTest, TestBeginMainFrameNotExpectedUntil) { @@ -2260,11 +2260,11 @@ scheduler_->BeginFrameNotExpectedSoon(); RunUntilIdle(); EXPECT_EQ(3, run_count); - EXPECT_THAT(actual_deadlines, - ::testing::ElementsAre( - clock_before + maximum_idle_period_duration(), - clock_before + 2 * maximum_idle_period_duration(), - clock_before + 3 * maximum_idle_period_duration())); + EXPECT_THAT( + actual_deadlines, + testing::ElementsAre(clock_before + maximum_idle_period_duration(), + clock_before + 2 * maximum_idle_period_duration(), + clock_before + 3 * maximum_idle_period_duration())); // Check that idle tasks don't run after the idle period ends with a // new BeginMainFrame. @@ -2401,7 +2401,7 @@ PostTestTasks(&run_order, "T1 T2"); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T1"), std::string("T2"))); + testing::ElementsAre(std::string("T1"), std::string("T2"))); } TEST_F(RendererSchedulerImplTest, StopAndResumeRenderer) { @@ -2410,12 +2410,12 @@ auto pause_handle = scheduler_->PauseRenderer(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); pause_handle.reset(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T1"), std::string("T2"))); + testing::ElementsAre(std::string("T1"), std::string("T2"))); } TEST_F(RendererSchedulerImplTest, StopAndThrottleTimerQueue) { @@ -2427,7 +2427,7 @@ scheduler_->task_queue_throttler()->IncreaseThrottleRefCount( static_cast<TaskQueue*>(timer_task_runner_.get())); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); } TEST_F(RendererSchedulerImplTest, ThrottleAndPauseRenderer) { @@ -2439,7 +2439,7 @@ RunUntilIdle(); auto pause_handle = scheduler_->PauseRenderer(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); } TEST_F(RendererSchedulerImplTest, MultipleStopsNeedMultipleResumes) { @@ -2450,20 +2450,20 @@ auto pause_handle2 = scheduler_->PauseRenderer(); auto pause_handle3 = scheduler_->PauseRenderer(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); pause_handle1.reset(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); pause_handle2.reset(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); pause_handle3.reset(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T1"), std::string("T2"))); + testing::ElementsAre(std::string("T1"), std::string("T2"))); } TEST_F(RendererSchedulerImplTest, PauseRenderer) { @@ -2474,15 +2474,15 @@ EnableIdleTasks(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("I1"))); // Tasks are executed when renderer is resumed. run_order.clear(); pause_handle.reset(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("T1"))); + testing::ElementsAre(std::string("L1"), std::string("T1"))); } TEST_F(RendererSchedulerImplTest, UseCaseToString) { @@ -2519,7 +2519,7 @@ std::vector<std::string> run_order; PostTestTasks(&run_order, "D1 C1"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); } TEST_F(RendererSchedulerImplTest, TestRendererBackgroundedTimerSuspension) { @@ -2536,7 +2536,7 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T1"), std::string("T2"))); + testing::ElementsAre(std::string("T1"), std::string("T2"))); run_order.clear(); PostTestTasks(&run_order, "T3"); @@ -2544,7 +2544,7 @@ now += base::TimeDelta::FromSeconds(1); clock_.SetNowTicks(now); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("T3"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("T3"))); // Advance the time until after the scheduled timer queue suspension. now = base::TimeTicks() + delay_for_background_tab_stopping() + @@ -2559,19 +2559,19 @@ now += base::TimeDelta::FromSeconds(10); clock_.SetNowTicks(now); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("V1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("V1"))); run_order.clear(); scheduler_->SetRendererBackgrounded(false); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T4"), std::string("T5"))); + testing::ElementsAre(std::string("T4"), std::string("T5"))); // Subsequent timer tasks should fire as usual. run_order.clear(); PostTestTasks(&run_order, "T6"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("T6"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("T6"))); } TEST_F(RendererSchedulerImplTest, TestRendererBackgroundedLoadingSuspension) { @@ -2590,7 +2590,7 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("L2"))); + testing::ElementsAre(std::string("L1"), std::string("L2"))); run_order.clear(); PostTestTasks(&run_order, "L3"); @@ -2598,7 +2598,7 @@ now += base::TimeDelta::FromSeconds(1); clock_.SetNowTicks(now); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("L3"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("L3"))); // Advance the time until after the scheduled loading queue suspension. now = base::TimeTicks() + delay_for_background_tab_stopping() + @@ -2613,18 +2613,18 @@ now += base::TimeDelta::FromSeconds(10); clock_.SetNowTicks(now); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre()); + EXPECT_THAT(run_order, testing::ElementsAre()); scheduler_->SetRendererBackgrounded(false); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L4"), std::string("L5"))); + testing::ElementsAre(std::string("L4"), std::string("L5"))); // Subsequent loading tasks should fire as usual. run_order.clear(); PostTestTasks(&run_order, "L6"); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("L6"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("L6"))); } TEST_F(RendererSchedulerImplTest, TestRendererBackgroundedRendererKeepActive) { @@ -2643,7 +2643,7 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("T1"))); + testing::ElementsAre(std::string("L1"), std::string("T1"))); run_order.clear(); PostTestTasks(&run_order, "L2 T2"); @@ -2652,7 +2652,7 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L2"), std::string("T2"))); + testing::ElementsAre(std::string("L2"), std::string("T2"))); // Advance the time until after the scheduled timer queue suspension. now = base::TimeTicks() + delay_for_background_tab_stopping() + @@ -2668,8 +2668,8 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L3"), std::string("T3"), - std::string("V1"))); + testing::ElementsAre(std::string("L3"), std::string("T3"), + std::string("V1"))); run_order.clear(); clock_.SetNowTicks(now); @@ -2690,7 +2690,7 @@ clock_.SetNowTicks(now); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L4"), std::string("T4"))); + testing::ElementsAre(std::string("L4"), std::string("T4"))); } TEST_F(RendererSchedulerImplTest, @@ -2709,7 +2709,7 @@ EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"))); // Emit a BeginMainFrame, and the loading task should get blocked. DoMainFrame(); @@ -2723,7 +2723,7 @@ EXPECT_TRUE(LoadingTasksSeemExpensive()); EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2744,7 +2744,7 @@ EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_FALSE(TouchStartExpectedSoon()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_ANIMATION, GetRAILMode()); } @@ -2765,7 +2765,7 @@ EXPECT_FALSE(LoadingTasksSeemExpensive()); EXPECT_TRUE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2801,7 +2801,7 @@ EXPECT_TRUE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("T1"), std::string("D1"))); + testing::ElementsAre(std::string("T1"), std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_ANIMATION, GetRAILMode()); } @@ -2824,7 +2824,7 @@ EXPECT_FALSE(LoadingTasksSeemExpensive()); EXPECT_TRUE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2846,7 +2846,7 @@ EXPECT_FALSE(LoadingTasksSeemExpensive()); EXPECT_TRUE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2865,7 +2865,7 @@ RunUntilIdle(); // The expensive loading task gets blocked. - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2890,7 +2890,7 @@ EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_EQ(1, NavigationTaskExpectedCount()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"))); // After the nagigation has been cancelled, the expensive loading tasks should // get blocked. @@ -2907,7 +2907,7 @@ EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_EQ(0, NavigationTaskExpectedCount()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2934,7 +2934,7 @@ EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_EQ(2, NavigationTaskExpectedCount()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"))); run_order.clear(); scheduler_->RemovePendingNavigation( @@ -2951,7 +2951,7 @@ EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_EQ(1, NavigationTaskExpectedCount()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("L1"), std::string("D1"))); + testing::ElementsAre(std::string("L1"), std::string("D1"))); run_order.clear(); scheduler_->RemovePendingNavigation( @@ -2967,7 +2967,7 @@ EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_TRUE(TouchStartExpectedSoon()); EXPECT_EQ(0, NavigationTaskExpectedCount()); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("D1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1"))); EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode()); } @@ -2989,7 +2989,7 @@ EXPECT_TRUE(LoadingTasksSeemExpensive()); EXPECT_FALSE(TimerTasksSeemExpensive()); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("C1"), std::string("L1"))); + testing::ElementsAre(std::string("C1"), std::string("L1"))); EXPECT_EQ(v8::PERFORMANCE_ANIMATION, GetRAILMode()); } @@ -3939,9 +3939,8 @@ mock_task_runner_->RunUntilTime(base::TimeTicks() + base::TimeDelta::FromMilliseconds(1100)); - EXPECT_THAT(run_times, - ::testing::ElementsAre(base::TimeTicks() + - base::TimeDelta::FromSeconds(1))); + EXPECT_THAT(run_times, testing::ElementsAre(base::TimeTicks() + + base::TimeDelta::FromSeconds(1))); run_times.clear(); timer_task_runner_->PostDelayedTask( @@ -3954,8 +3953,8 @@ base::TimeDelta::FromMilliseconds(1500)); EXPECT_THAT(run_times, - ::testing::ElementsAre(base::TimeTicks() + - base::TimeDelta::FromMilliseconds(1300))); + testing::ElementsAre(base::TimeTicks() + + base::TimeDelta::FromMilliseconds(1300))); } TEST_F(RendererSchedulerImplTest, UnresponsiveMainThread) { @@ -4189,13 +4188,13 @@ EnableIdleTasks(); RunUntilIdle(); EXPECT_THAT(run_order, - ::testing::ElementsAre(std::string("D1"), std::string("C1"), - std::string("L1"), std::string("I1"))); + testing::ElementsAre(std::string("D1"), std::string("C1"), + std::string("L1"), std::string("I1"))); // The rest queued tasks fire when the timers are resumed. run_order.clear(); scheduler_->ResumeTimersForAndroidWebView(); RunUntilIdle(); - EXPECT_THAT(run_order, ::testing::ElementsAre(std::string("T1"))); + EXPECT_THAT(run_order, testing::ElementsAre(std::string("T1"))); } #endif // defined(OS_ANDROID)
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc index c783f40..78b63ac 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc
@@ -10,7 +10,7 @@ #include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/task_queue.h" #include "platform/scheduler/child/task_runner_impl.h" -#include "platform/scheduler/renderer/page_scheduler_impl.h" +#include "platform/scheduler/main_thread/page_scheduler_impl.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/task_cost_estimator_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/task_cost_estimator_unittest.cc index 5747c3e..0fed20979 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/task_cost_estimator_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/task_cost_estimator_unittest.cc
@@ -13,7 +13,7 @@ namespace blink { namespace scheduler { -class TaskCostEstimatorTest : public ::testing::Test { +class TaskCostEstimatorTest : public testing::Test { public: TaskCostEstimatorTest() = default; ~TaskCostEstimatorTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/user_model_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/user_model_unittest.cc index 49edc3f..26a11789 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/user_model_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/user_model_unittest.cc
@@ -11,7 +11,7 @@ namespace blink { namespace scheduler { -class UserModelTest : public ::testing::Test { +class UserModelTest : public testing::Test { public: UserModelTest() = default; ~UserModelTest() override = default;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc index 2276cd5..947f052 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc
@@ -36,7 +36,7 @@ MOCK_METHOD0(DidProcessTask, void()); }; -class WebThreadImplForRendererSchedulerTest : public ::testing::Test { +class WebThreadImplForRendererSchedulerTest : public testing::Test { public: WebThreadImplForRendererSchedulerTest() = default; @@ -75,7 +75,7 @@ MockTask task; { - ::testing::InSequence sequence; + testing::InSequence sequence; EXPECT_CALL(observer, WillProcessTask()); EXPECT_CALL(task, Run()); EXPECT_CALL(observer, DidProcessTask()); @@ -94,7 +94,7 @@ SetWorkBatchSizeForTesting(kWorkBatchSize); { - ::testing::InSequence sequence; + testing::InSequence sequence; EXPECT_CALL(observer, WillProcessTask()); EXPECT_CALL(task, Run()); EXPECT_CALL(observer, DidProcessTask()); @@ -114,7 +114,7 @@ SetWorkBatchSizeForTesting(kWorkBatchSize); { - ::testing::InSequence sequence; + testing::InSequence sequence; EXPECT_CALL(observer, WillProcessTask()); EXPECT_CALL(task1, Run()); EXPECT_CALL(observer, DidProcessTask()); @@ -141,7 +141,7 @@ SetWorkBatchSizeForTesting(kWorkBatchSize); { - ::testing::InSequence sequence; + testing::InSequence sequence; EXPECT_CALL(observer, WillProcessTask()); EXPECT_CALL(task1, Run()); EXPECT_CALL(observer, DidProcessTask()); @@ -180,7 +180,7 @@ thread_->AddTaskObserver(&observer); { - ::testing::InSequence sequence; + testing::InSequence sequence; // One callback for EnterRunLoop. EXPECT_CALL(observer, WillProcessTask());
diff --git a/third_party/WebKit/Source/platform/scheduler/test/fake_page_scheduler.h b/third_party/WebKit/Source/platform/scheduler/test/fake_page_scheduler.h index 66acff88..454afb6 100644 --- a/third_party/WebKit/Source/platform/scheduler/test/fake_page_scheduler.h +++ b/third_party/WebKit/Source/platform/scheduler/test/fake_page_scheduler.h
@@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_TEST_FAKE_PAGE_SCHEDULER_H_ #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_TEST_FAKE_PAGE_SCHEDULER_H_ -#include "platform/scheduler/renderer/page_scheduler.h" +#include "platform/scheduler/public/page_scheduler.h" namespace blink { namespace scheduler {
diff --git a/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc b/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc index 8a0736a..2409d6a 100644 --- a/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc
@@ -16,8 +16,8 @@ namespace { -using ::testing::_; -using ::testing::Mock; +using testing::_; +using testing::Mock; class FakeHistogram : public base::HistogramBase { public:
diff --git a/third_party/WebKit/Source/platform/scheduler/util/thread_load_tracker_unittest.cc b/third_party/WebKit/Source/platform/scheduler/util/thread_load_tracker_unittest.cc index 5e8a259..ba01d6e 100644 --- a/third_party/WebKit/Source/platform/scheduler/util/thread_load_tracker_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/util/thread_load_tracker_unittest.cc
@@ -4,7 +4,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::testing::ElementsAre; +using testing::ElementsAre; namespace blink { namespace scheduler {
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp index 714dbe0..ad503229 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -41,9 +41,9 @@ namespace blink { -using ::testing::AtLeast; -using ::testing::Return; -using ::testing::_; +using testing::AtLeast; +using testing::Return; +using testing::_; static double g_mocked_time = 0.0;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp index 03db129..4f3c440 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -22,8 +22,8 @@ namespace { -using ::testing::_; -using ::testing::Return; +using testing::_; +using testing::Return; class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock { public: @@ -34,7 +34,7 @@ } // namespace -class ScrollableAreaTest : public ::testing::Test { +class ScrollableAreaTest : public testing::Test { private: base::MessageLoop message_loop_; };
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp index cd52531..61d4e797 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp
@@ -9,7 +9,7 @@ namespace blink { -using ::testing::Return; +using testing::Return; namespace { @@ -29,7 +29,7 @@ } // namespace -class ScrollbarThemeAuraTest : public ::testing::Test { +class ScrollbarThemeAuraTest : public testing::Test { private: base::MessageLoop message_loop_; };
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlayTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlayTest.cpp index 5a3564b..fb1a9447 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlayTest.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlayTest.cpp
@@ -9,10 +9,10 @@ namespace blink { -using ::testing::NiceMock; -using ::testing::Return; +using testing::NiceMock; +using testing::Return; -class ScrollbarThemeOverlayTest : public ::testing::Test { +class ScrollbarThemeOverlayTest : public testing::Test { private: base::MessageLoop message_loop_; };
diff --git a/third_party/WebKit/Source/platform/testing/CompositorTest.h b/third_party/WebKit/Source/platform/testing/CompositorTest.h index 8ff0d5a..9b3ee23 100644 --- a/third_party/WebKit/Source/platform/testing/CompositorTest.h +++ b/third_party/WebKit/Source/platform/testing/CompositorTest.h
@@ -13,7 +13,7 @@ namespace blink { -class CompositorTest : public ::testing::Test { +class CompositorTest : public testing::Test { WTF_MAKE_NONCOPYABLE(CompositorTest); public:
diff --git a/third_party/WebKit/Source/platform/testing/MockWebCrypto.cpp b/third_party/WebKit/Source/platform/testing/MockWebCrypto.cpp index 4a51c5a..700e6c7e 100644 --- a/third_party/WebKit/Source/platform/testing/MockWebCrypto.cpp +++ b/third_party/WebKit/Source/platform/testing/MockWebCrypto.cpp
@@ -11,11 +11,11 @@ namespace blink { -using ::testing::_; -using ::testing::DoAll; -using ::testing::InSequence; -using ::testing::Return; -using ::testing::SetArgReferee; +using testing::_; +using testing::DoAll; +using testing::InSequence; +using testing::Return; +using testing::SetArgReferee; // MemEq(p, len) expects memcmp(arg, p, len) == 0, where |arg| is the argument // to be matched. @@ -24,7 +24,7 @@ len, std::string("pointing to memory") + (negation ? " not" : "") + " equal to \"" + std::string(static_cast<const char*>(p), len) + - "\" (length=" + ::testing::PrintToString(len) + ")") { + "\" (length=" + testing::PrintToString(len) + ")") { return memcmp(arg, p, len) == 0; }
diff --git a/third_party/WebKit/Source/platform/testing/MockWebCrypto.h b/third_party/WebKit/Source/platform/testing/MockWebCrypto.h index 1db4902a..be61b33 100644 --- a/third_party/WebKit/Source/platform/testing/MockWebCrypto.h +++ b/third_party/WebKit/Source/platform/testing/MockWebCrypto.h
@@ -19,7 +19,7 @@ static std::unique_ptr<MockWebCrypto> Create() { return std::unique_ptr<MockWebCrypto>( - new ::testing::StrictMock<MockWebCrypto>()); + new testing::StrictMock<MockWebCrypto>()); } MOCK_METHOD5(Encrypt, @@ -131,7 +131,7 @@ ~MockWebCryptoDigestor() override = default; static MockWebCryptoDigestor* Create() { - return new ::testing::StrictMock<MockWebCryptoDigestor>(); + return new testing::StrictMock<MockWebCryptoDigestor>(); } void ExpectConsumeAndFinish(const void* input_data,
diff --git a/third_party/WebKit/Source/platform/testing/PaintTestConfigurations.h b/third_party/WebKit/Source/platform/testing/PaintTestConfigurations.h index fb9e5b18..4763ddb 100644 --- a/third_party/WebKit/Source/platform/testing/PaintTestConfigurations.h +++ b/third_party/WebKit/Source/platform/testing/PaintTestConfigurations.h
@@ -18,7 +18,7 @@ }; class PaintTestConfigurations - : public ::testing::WithParamInterface<unsigned>, + : public testing::WithParamInterface<unsigned>, private ScopedRootLayerScrollingForTest, private ScopedSlimmingPaintV175ForTest, private ScopedSlimmingPaintV2ForTest,
diff --git a/third_party/WebKit/Source/platform/testing/PictureMatchers.cpp b/third_party/WebKit/Source/platform/testing/PictureMatchers.cpp index 4c92298..fb4c6b0 100644 --- a/third_party/WebKit/Source/platform/testing/PictureMatchers.cpp +++ b/third_party/WebKit/Source/platform/testing/PictureMatchers.cpp
@@ -82,14 +82,13 @@ }; class DrawsRectanglesMatcher - : public ::testing::MatcherInterface<const SkPicture&> { + : public testing::MatcherInterface<const SkPicture&> { public: DrawsRectanglesMatcher(const Vector<RectWithColor>& rects_with_color) : rects_with_color_(rects_with_color) {} - bool MatchAndExplain( - const SkPicture& picture, - ::testing::MatchResultListener* listener) const override { + bool MatchAndExplain(const SkPicture& picture, + testing::MatchResultListener* listener) const override { DrawsRectangleCanvas canvas; picture.playback(&canvas); const auto& actual_rects = canvas.RectsWithColor(); @@ -134,16 +133,16 @@ } // namespace -::testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect& rect, - Color color) { +testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect& rect, + Color color) { Vector<RectWithColor> rects_with_color; rects_with_color.push_back(RectWithColor(rect, color)); - return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rects_with_color)); + return testing::MakeMatcher(new DrawsRectanglesMatcher(rects_with_color)); } -::testing::Matcher<const SkPicture&> DrawsRectangles( +testing::Matcher<const SkPicture&> DrawsRectangles( const Vector<RectWithColor>& rects_with_color) { - return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rects_with_color)); + return testing::MakeMatcher(new DrawsRectanglesMatcher(rects_with_color)); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/PictureMatchers.h b/third_party/WebKit/Source/platform/testing/PictureMatchers.h index 9e28e47..9dacc22 100644 --- a/third_party/WebKit/Source/platform/testing/PictureMatchers.h +++ b/third_party/WebKit/Source/platform/testing/PictureMatchers.h
@@ -21,7 +21,7 @@ // requested. // Note that clips which appear outside of a transform are not currently // supported. -::testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect&, Color); +testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect&, Color); struct RectWithColor { RectWithColor(const FloatRect& rect_arg, const Color& color_arg) @@ -32,7 +32,7 @@ // Same as above, but matches a number of rectangles equal to the size of the // given vector. -::testing::Matcher<const SkPicture&> DrawsRectangles( +testing::Matcher<const SkPicture&> DrawsRectangles( const Vector<RectWithColor>&); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/ShapingLineBreakerPerfTest.cpp b/third_party/WebKit/Source/platform/testing/ShapingLineBreakerPerfTest.cpp index 445c3d83..8b061dd 100644 --- a/third_party/WebKit/Source/platform/testing/ShapingLineBreakerPerfTest.cpp +++ b/third_party/WebKit/Source/platform/testing/ShapingLineBreakerPerfTest.cpp
@@ -42,7 +42,7 @@ } // anonymous namespace -class ShapingLineBreakerPerfTest : public ::testing::Test { +class ShapingLineBreakerPerfTest : public testing::Test { public: ShapingLineBreakerPerfTest() : timer_(kWarmupRuns,
diff --git a/third_party/WebKit/Source/platform/text/CharacterTest.cpp b/third_party/WebKit/Source/platform/text/CharacterTest.cpp index 7b0e5a1..c7ab40e 100644 --- a/third_party/WebKit/Source/platform/text/CharacterTest.cpp +++ b/third_party/WebKit/Source/platform/text/CharacterTest.cpp
@@ -9,19 +9,18 @@ namespace blink { -::testing::AssertionResult IsCJKIdeographOrSymbolWithMessage( - UChar32 codepoint) { +testing::AssertionResult IsCJKIdeographOrSymbolWithMessage(UChar32 codepoint) { const size_t kFormatBufferSize = 10; char formatted_as_hex[kFormatBufferSize]; snprintf(formatted_as_hex, kFormatBufferSize, "0x%x", codepoint); if (Character::IsCJKIdeographOrSymbol(codepoint)) { - return ::testing::AssertionSuccess() + return testing::AssertionSuccess() << "Codepoint " << formatted_as_hex << " is a CJKIdeographOrSymbol."; } - return ::testing::AssertionFailure() << "Codepoint " << formatted_as_hex - << " is not a CJKIdeographOrSymbol."; + return testing::AssertionFailure() << "Codepoint " << formatted_as_hex + << " is not a CJKIdeographOrSymbol."; } TEST(CharacterTest, HammerEmojiVsCJKIdeographOrSymbol) {
diff --git a/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp b/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp index 76e2386..2b34d0a 100644 --- a/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp +++ b/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp
@@ -31,7 +31,7 @@ namespace blink { -class DateTimeFormatTest : public ::testing::Test { +class DateTimeFormatTest : public testing::Test { public: using FieldType = DateTimeFormat::FieldType;
diff --git a/third_party/WebKit/Source/platform/text/HyphenationTest.cpp b/third_party/WebKit/Source/platform/text/HyphenationTest.cpp index 0811206..6af8b9d0 100644 --- a/third_party/WebKit/Source/platform/text/HyphenationTest.cpp +++ b/third_party/WebKit/Source/platform/text/HyphenationTest.cpp
@@ -31,7 +31,7 @@ } }; -class HyphenationTest : public ::testing::Test { +class HyphenationTest : public testing::Test { protected: void TearDown() override { FontGlobalContext::ClearForTesting(); } @@ -134,7 +134,7 @@ // Line breaker is not supposed to pass with trailing spaces. String trailing_space("principle "); EXPECT_THAT(hyphenation->HyphenLocations(trailing_space), - ::testing::AnyOf(ElementsAre(), ElementsAre(6, 4))); + testing::AnyOf(ElementsAre(), ElementsAre(6, 4))); EXPECT_EQ(0u, hyphenation->LastHyphenLocation(trailing_space, 10)); } @@ -148,8 +148,8 @@ ASSERT_TRUE(hyphenation) << "Cannot find the hyphenation for en-us"; Vector<size_t, 8> locations = hyphenation->HyphenLocations("hyphenation"); - EXPECT_THAT(locations, ::testing::AnyOf(ElementsAreArray({6, 2}), - ElementsAreArray({7, 6, 2}))); + EXPECT_THAT(locations, testing::AnyOf(ElementsAreArray({6, 2}), + ElementsAreArray({7, 6, 2}))); } TEST_F(HyphenationTest, German) {
diff --git a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp index 06c11d8..7c578b3e 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
@@ -37,7 +37,7 @@ namespace blink { -class LocaleICUTest : public ::testing::Test { +class LocaleICUTest : public testing::Test { public: // Labels class is used for printing results in EXPECT_EQ macro. class Labels {
diff --git a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp index 45b18f5..9edb412 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
@@ -43,7 +43,7 @@ } }; -class LocaleMacTest : public ::testing::Test { +class LocaleMacTest : public testing::Test { protected: enum { kJanuary = 0,
diff --git a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp index 54b4f40..ece3bb3 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
@@ -39,7 +39,7 @@ namespace blink { -class LocaleWinTest : public ::testing::Test { +class LocaleWinTest : public testing::Test { protected: enum { kJanuary = 0,
diff --git a/third_party/WebKit/Source/platform/text/TextBoundariesTest.cpp b/third_party/WebKit/Source/platform/text/TextBoundariesTest.cpp index 88af1b9b..dd9f4a9 100644 --- a/third_party/WebKit/Source/platform/text/TextBoundariesTest.cpp +++ b/third_party/WebKit/Source/platform/text/TextBoundariesTest.cpp
@@ -12,7 +12,7 @@ namespace blink { -class TextBoundariesTest : public ::testing::Test {}; +class TextBoundariesTest : public testing::Test {}; namespace {
diff --git a/third_party/WebKit/Source/platform/text/TextBreakIteratorTest.cpp b/third_party/WebKit/Source/platform/text/TextBreakIteratorTest.cpp index 4c3d9f03..c20dd0b 100644 --- a/third_party/WebKit/Source/platform/text/TextBreakIteratorTest.cpp +++ b/third_party/WebKit/Source/platform/text/TextBreakIteratorTest.cpp
@@ -10,7 +10,7 @@ namespace blink { -class TextBreakIteratorTest : public ::testing::Test { +class TextBreakIteratorTest : public testing::Test { protected: void SetTestString(const char* test_string) { test_string_ = String::FromUTF8(test_string); @@ -47,7 +47,7 @@ break_positions.push_back(i); } EXPECT_THAT(break_positions, - ::testing::ElementsAreArray(expected_break_positions)) + testing::ElementsAreArray(expected_break_positions)) << test_string_ << " " << break_iterator.BreakType() << " " << break_iterator.BreakSpace(); } @@ -62,7 +62,7 @@ break_positions.push_back(i); } EXPECT_THAT(break_positions, - ::testing::ElementsAreArray(expected_break_positions)) + testing::ElementsAreArray(expected_break_positions)) << test_string_ << " " << break_iterator.BreakType() << " " << break_iterator.BreakSpace(); } @@ -80,11 +80,11 @@ LineBreakType::kBreakCharacter, LineBreakType::kKeepAll}; class BreakTypeTest : public TextBreakIteratorTest, - public ::testing::WithParamInterface<LineBreakType> {}; + public testing::WithParamInterface<LineBreakType> {}; INSTANTIATE_TEST_CASE_P(TextBreakIteratorTest, BreakTypeTest, - ::testing::ValuesIn(all_break_types)); + testing::ValuesIn(all_break_types)); TEST_P(BreakTypeTest, EmptyString) { LazyLineBreakIterator iterator(g_empty_string);
diff --git a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp index 2bc10fb..f50b1854 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
@@ -344,7 +344,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << test.base << ", " << test.relative); + SCOPED_TRACE(testing::Message() << test.base << ", " << test.relative); const KURL base(test.base); const KURL expected("http://example.com/path"); const KURL actual(base, test.relative); @@ -432,7 +432,7 @@ }; for (const auto& test : cases) { - SCOPED_TRACE(::testing::Message() << test.input << ", " << test.expected); + SCOPED_TRACE(testing::Message() << test.input << ", " << test.expected); const KURL input(test.input); const KURL expected(test.expected); EXPECT_EQ(input, expected) << input.GetString() << expected.GetString();
diff --git a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp index 9e387ea..10888cc 100644 --- a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
@@ -143,7 +143,7 @@ platform->SetPublicSuffix("com"); for (const auto& test : inputs) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); scoped_refptr<const SecurityOrigin> origin_to_test = SecurityOrigin::CreateFromString(test.origin); @@ -202,7 +202,7 @@ OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::kAllowRegisterableDomains); - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin << ", Domain: " << entry1.Registerable().Utf8().data()); EXPECT_EQ(test.expected, entry1.MatchesOrigin(*origin_to_test)); @@ -258,7 +258,7 @@ OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::kAllowRegisterableDomains); - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin << ", Domain: " << entry1.Registerable().Utf8().data()); EXPECT_EQ(test.expected, entry1.MatchesOrigin(*origin_to_test)); @@ -304,7 +304,7 @@ platform->SetPublicSuffix("com"); for (const auto& test : inputs) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); scoped_refptr<const SecurityOrigin> origin_to_test = SecurityOrigin::CreateFromString(test.origin); @@ -335,7 +335,7 @@ platform->SetPublicSuffix("com"); for (const auto& test : inputs) { - SCOPED_TRACE(::testing::Message() << "Host: " << test.host); + SCOPED_TRACE(testing::Message() << "Host: " << test.host); OriginAccessEntry entry(test.protocol, test.host, OriginAccessEntry::kDisallowSubdomains); EXPECT_EQ(test.is_ip_address, entry.HostIsIPAddress()) << test.host; @@ -363,7 +363,7 @@ platform->SetPublicSuffix("com"); for (const auto& test : inputs) { - SCOPED_TRACE(::testing::Message() + SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); scoped_refptr<const SecurityOrigin> origin_to_test = SecurityOrigin::CreateFromString(test.origin);
diff --git a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp index 6a667450..c0721a4 100644 --- a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
@@ -12,7 +12,7 @@ const char kTestScheme[] = "test-scheme"; const char kTestScheme2[] = "test-scheme-2"; -class SchemeRegistryTest : public ::testing::Test { +class SchemeRegistryTest : public testing::Test { void TearDown() override { SchemeRegistry::RemoveURLSchemeRegisteredAsBypassingContentSecurityPolicy( kTestScheme);
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp index 8a682727..88deaba 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -46,7 +46,7 @@ const uint16_t kMaxAllowedPort = UINT16_MAX; -class SecurityOriginTest : public ::testing::Test {}; +class SecurityOriginTest : public testing::Test {}; TEST_F(SecurityOriginTest, ValidPortsCreateNonUniqueOrigins) { uint16_t ports[] = {0, 80, 443, 5000, kMaxAllowedPort}; @@ -354,7 +354,7 @@ }; for (const TestCase& test : cases) { - SCOPED_TRACE(::testing::Message() << "raw host: '" << test.host << "'"); + SCOPED_TRACE(testing::Message() << "raw host: '" << test.host << "'"); String host = String::FromUTF8(test.host); bool success = false; String canonical_host = SecurityOrigin::CanonicalizeHost(host, &success);
diff --git a/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp b/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp index e7cd936..ecad0519 100644 --- a/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp
@@ -39,10 +39,10 @@ namespace { template <typename Set> -class ListOrLinkedHashSetTest : public ::testing::Test {}; +class ListOrLinkedHashSetTest : public testing::Test {}; using SetTypes = - ::testing::Types<ListHashSet<int>, ListHashSet<int, 1>, LinkedHashSet<int>>; + testing::Types<ListHashSet<int>, ListHashSet<int, 1>, LinkedHashSet<int>>; TYPED_TEST_CASE(ListOrLinkedHashSetTest, SetTypes); TYPED_TEST(ListOrLinkedHashSetTest, RemoveFirst) { @@ -404,12 +404,12 @@ int DummyRefCounted::ref_invokes_count_ = 0; template <typename Set> -class ListOrLinkedHashSetRefPtrTest : public ::testing::Test {}; +class ListOrLinkedHashSetRefPtrTest : public testing::Test {}; using RefPtrSetTypes = - ::testing::Types<ListHashSet<scoped_refptr<DummyRefCounted>>, - ListHashSet<scoped_refptr<DummyRefCounted>, 1>, - LinkedHashSet<scoped_refptr<DummyRefCounted>>>; + testing::Types<ListHashSet<scoped_refptr<DummyRefCounted>>, + ListHashSet<scoped_refptr<DummyRefCounted>, 1>, + LinkedHashSet<scoped_refptr<DummyRefCounted>>>; TYPED_TEST_CASE(ListOrLinkedHashSetRefPtrTest, RefPtrSetTypes); TYPED_TEST(ListOrLinkedHashSetRefPtrTest, WithRefPtr) { @@ -516,12 +516,12 @@ }; template <typename Set> -class ListOrLinkedHashSetTranslatorTest : public ::testing::Test {}; +class ListOrLinkedHashSetTranslatorTest : public testing::Test {}; using TranslatorSetTypes = - ::testing::Types<ListHashSet<Complicated, 256, ComplicatedHashFunctions>, - ListHashSet<Complicated, 1, ComplicatedHashFunctions>, - LinkedHashSet<Complicated, ComplicatedHashFunctions>>; + testing::Types<ListHashSet<Complicated, 256, ComplicatedHashFunctions>, + ListHashSet<Complicated, 1, ComplicatedHashFunctions>, + LinkedHashSet<Complicated, ComplicatedHashFunctions>>; TYPED_TEST_CASE(ListOrLinkedHashSetTranslatorTest, TranslatorSetTypes); TYPED_TEST(ListOrLinkedHashSetTranslatorTest, ComplexityTranslator) { @@ -623,11 +623,11 @@ } template <typename Set> -class ListOrLinkedHashSetCountCopyTest : public ::testing::Test {}; +class ListOrLinkedHashSetCountCopyTest : public testing::Test {}; -using CountCopySetTypes = ::testing::Types<ListHashSet<CountCopy>, - ListHashSet<CountCopy, 1>, - LinkedHashSet<CountCopy>>; +using CountCopySetTypes = testing::Types<ListHashSet<CountCopy>, + ListHashSet<CountCopy, 1>, + LinkedHashSet<CountCopy>>; TYPED_TEST_CASE(ListOrLinkedHashSetCountCopyTest, CountCopySetTypes); TYPED_TEST(ListOrLinkedHashSetCountCopyTest, @@ -655,11 +655,11 @@ } template <typename Set> -class ListOrLinkedHashSetMoveOnlyTest : public ::testing::Test {}; +class ListOrLinkedHashSetMoveOnlyTest : public testing::Test {}; -using MoveOnlySetTypes = ::testing::Types<ListHashSet<MoveOnlyHashValue>, - ListHashSet<MoveOnlyHashValue, 1>, - LinkedHashSet<MoveOnlyHashValue>>; +using MoveOnlySetTypes = testing::Types<ListHashSet<MoveOnlyHashValue>, + ListHashSet<MoveOnlyHashValue, 1>, + LinkedHashSet<MoveOnlyHashValue>>; TYPED_TEST_CASE(ListOrLinkedHashSetMoveOnlyTest, MoveOnlySetTypes); TYPED_TEST(ListOrLinkedHashSetMoveOnlyTest, MoveOnlyValue) {
diff --git a/third_party/WebKit/Source/platform/wtf/VectorTest.cpp b/third_party/WebKit/Source/platform/wtf/VectorTest.cpp index 91eccc1..2285d4e7 100644 --- a/third_party/WebKit/Source/platform/wtf/VectorTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/VectorTest.cpp
@@ -424,7 +424,7 @@ "MojoMoveOnlyType can't be copied with memcpy."); class VectorWithDifferingInlineCapacityTest - : public ::testing::TestWithParam<size_t> {}; + : public testing::TestWithParam<size_t> {}; template <size_t inlineCapacity> void TestVectorDestructorAndConstructorCallsWhenSwappingWithInlineCapacity() {
diff --git a/third_party/WebKit/Source/platform/wtf/experimental/ContainerTypeOperationsTest.cpp b/third_party/WebKit/Source/platform/wtf/experimental/ContainerTypeOperationsTest.cpp index 4033a3e..7ace5be 100644 --- a/third_party/WebKit/Source/platform/wtf/experimental/ContainerTypeOperationsTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/experimental/ContainerTypeOperationsTest.cpp
@@ -27,7 +27,7 @@ } // namespace template <typename T> -class ContainerTypeOperationsTest : public ::testing::Test {}; +class ContainerTypeOperationsTest : public testing::Test {}; TYPED_TEST_CASE_P(ContainerTypeOperationsTest); @@ -75,7 +75,7 @@ REGISTER_TYPED_TEST_CASE_P(ContainerTypeOperationsTest, Completeness); -using PodTestTypes = ::testing::Types<int, char, int*, Pod>; +using PodTestTypes = testing::Types<int, char, int*, Pod>; INSTANTIATE_TYPED_TEST_CASE_P(Pod, ContainerTypeOperationsTest, PodTestTypes);
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py index 161a92e..7b9d6f8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py
@@ -136,8 +136,7 @@ # Blink style. 'Source/platform/scheduler', 'public/platform/scheduler'], - ['-readability/parameter_name', - '-readability/control_flow']) + ['-readability/control_flow']) ]
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py index 20fedef..ceb4773 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py
@@ -223,33 +223,6 @@ current_line = lines[current_row] -def _convert_to_lower_with_underscores(text): - """Converts all text strings in camelCase or PascalCase to lowers with underscores.""" - - # First add underscores before any capital letter followed by a lower case letter - # as long as it is in a word. - # (This put an underscore before Password but not P and A in WPAPassword). - text = sub(r'(?<=[A-Za-z0-9])([A-Z])(?=[a-z])', r'_\1', text) - - # Next add underscores before capitals at the end of words if it was - # preceded by lower case letter or number. - # (This puts an underscore before A in isA but not A in CBA). - text = sub(r'(?<=[a-z0-9])([A-Z])(?=\b)', r'_\1', text) - - # Next add underscores when you have a capital letter which is followed by a capital letter - # but is not proceeded by one. (This puts an underscore before A in 'WordADay'). - text = sub(r'(?<=[a-z0-9])([A-Z][A-Z_])', r'_\1', text) - - return text.lower() - - -def _create_acronym(text): - """Creates an acronym for the given text.""" - # Removes all lower case letters except those starting words. - text = sub(r'(?<!\b)[a-z]', '', text) - return text.upper() - - def up_to_unmatched_closing_paren(s): """Splits a string into two parts up to first unmatched ')'. @@ -317,21 +290,6 @@ return self.row.__cmp__(other.row) or self.column.__cmp__(other.column) -class Parameter(object): - """Information about one function parameter.""" - - def __init__(self, parameter, parameter_name_index, row): - self.type = parameter[:parameter_name_index].strip() - # Remove any initializers from the parameter name (e.g. int i = 5). - self.name = sub(r'=.*', '', parameter[parameter_name_index:]).strip() - self.row = row - - @memoized - def lower_with_underscores_name(self): - """Returns the parameter name in the lower with underscores format.""" - return _convert_to_lower_with_underscores(self.name) - - class SingleLineView(object): """Converts multiple lines into a single line (with line breaks replaced by a space) to allow for easier searching. @@ -364,90 +322,6 @@ self._row_lengths = [len(line) + 1 for line in trimmed_lines] self._starting_row = start_position.row - def convert_column_to_row(self, single_line_column_number): - """Convert the column number from the single line into the original - line number. - - Special cases: - * Columns in the added spaces are considered part of the previous line. - * Columns beyond the end of the line are consider part the last line - in the view. - """ - total_columns = 0 - row_offset = 0 - while (row_offset < len(self._row_lengths) - 1 and - single_line_column_number >= total_columns + self._row_lengths[row_offset]): - total_columns += self._row_lengths[row_offset] - row_offset += 1 - return self._starting_row + row_offset - - -def create_skeleton_parameters(all_parameters): - """Converts a parameter list to a skeleton version. - - The skeleton only has one word for the parameter name, one word for the type, - and commas after each parameter and only there. Everything in the skeleton - remains in the same columns as the original. - """ - all_simplifications = ( - # Remove template parameters, function declaration parameters, etc. - r'(<[^<>]*?>)|(\([^\(\)]*?\))|(\{[^\{\}]*?\})', - # Remove all initializers. - r'=[^,]*', - # Remove :: and everything before it. - r'[^,]*::', - # Remove modifiers like &, *. - r'[&*]', - # Remove const modifiers. - r'\bconst\s+(?=[A-Za-z])', - # Remove numerical modifiers like long. - r'\b(unsigned|long|short)\s+(?=unsigned|long|short|int|char|double|float)') - - skeleton_parameters = all_parameters - for simplification in all_simplifications: - skeleton_parameters = iteratively_replace_matches_with_char(simplification, ' ', skeleton_parameters) - # If there are any parameters, then add a , after the last one to - # make a regular pattern of a , following every parameter. - if skeleton_parameters.strip(): - skeleton_parameters += ',' - return skeleton_parameters - - -def find_parameter_name_index(skeleton_parameter): - """Determines where the parameter name starts given the skeleton parameter.""" - # The first space from the right in the simplified parameter is where the parameter - # name starts unless the first space is before any content in the simplified parameter. - before_name_index = skeleton_parameter.rstrip().rfind(' ') - if before_name_index != -1 and skeleton_parameter[:before_name_index].strip(): - return before_name_index + 1 - return len(skeleton_parameter) - - -def parameter_list(elided_lines, start_position, end_position): - """Generator for a function's parameters.""" - # Create new positions that omit the outer parenthesis of the parameters. - start_position = Position(row=start_position.row, column=start_position.column + 1) - end_position = Position(row=end_position.row, column=end_position.column - 1) - single_line_view = SingleLineView(elided_lines, start_position, end_position) - skeleton_parameters = create_skeleton_parameters(single_line_view.single_line) - end_index = -1 - - while True: - # Find the end of the next parameter. - start_index = end_index + 1 - end_index = skeleton_parameters.find(',', start_index) - - # No comma means that all parameters have been parsed. - if end_index == -1: - return - row = single_line_view.convert_column_to_row(end_index) - - # Parse the parameter into a type and parameter name. - skeleton_parameter = skeleton_parameters[start_index:end_index] - name_offset = find_parameter_name_index(skeleton_parameter) - parameter = single_line_view.single_line[start_index:end_index] - yield Parameter(parameter, name_offset, row) - class _FunctionState(object): """Tracks current function name and the number of lines in its body. @@ -497,15 +371,6 @@ clean_lines.elided, parameter_end_position, body_start_position).single_line self.is_pure = bool(match(r'\s*=\s*0\s*', characters_after_parameters)) self._clean_lines = clean_lines - self._parameter_list = None - - def parameter_list(self): - if not self._parameter_list: - # Store the final result as a tuple since that is immutable. - self._parameter_list = tuple(parameter_list(self._clean_lines.elided, - self.parameter_start_position, self.parameter_end_position)) - - return self._parameter_list def count(self, line_number): """Count line in current function body.""" @@ -1469,68 +1334,6 @@ function_state.count(line_number) # Count non-blank/non-comment lines. -def _check_parameter_name_against_text(parameter, text, error): - """Checks to see if the parameter name is contained within the text. - - Return false if the check failed (i.e. an error was produced). - """ - - # Treat 'lower with underscores' as a canonical form because it is - # case insensitive while still retaining word breaks. (This ensures that - # 'elate' doesn't look like it is duplicating of 'NateLate'.) - canonical_parameter_name = parameter.lower_with_underscores_name() - - # Appends "object" to all text to catch variables that did the same (but only - # do this when the parameter name is more than a single character to avoid - # flagging 'b' which may be an ok variable when used in an rgba function). - if len(canonical_parameter_name) > 1: - text = sub(r'(\w)\b', r'\1Object', text) - canonical_text = _convert_to_lower_with_underscores(text) - - # Used to detect cases like ec for ExceptionCode. - acronym = _create_acronym(text).lower() - if canonical_text.find(canonical_parameter_name) != -1 or acronym.find(canonical_parameter_name) != -1: - info_url = 'https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/blink-c++.md' + \ - '#Leave-obvious-parameter-names-out-of-function-declarations' - error(parameter.row, 'readability/parameter_name', 5, - 'The parameter name "%s" adds no information, so it should be removed. See %s.' % (parameter.name, info_url)) - return False - return True - - -def check_function_definition(filename, file_extension, clean_lines, line_number, function_state, error): - """Check that function definitions for style issues. - - Specifically, check that parameter names in declarations add information. - - Args: - filename: Filename of the file that is being processed. - file_extension: The current file extension, without the leading dot. - clean_lines: A CleansedLines instance containing the file. - line_number: The number of the line to check. - function_state: Current function name and lines in body so far. - error: The function to call with any errors found. - """ - if line_number != function_state.body_start_position.row: - return - - parameter_list = function_state.parameter_list() - for parameter in parameter_list: - # Do checks specific to function declarations and parameter names. - if not function_state.is_declaration or not parameter.name: - continue - - # Check the parameter name against the function name for single parameter set functions. - if len(parameter_list) == 1 and match('set[A-Z]', function_state.current_function): - trimmed_function_name = function_state.current_function[len('set'):] - if not _check_parameter_name_against_text(parameter, trimmed_function_name, error): - continue # Since an error was noted for this name, move to the next parameter. - - # Check the parameter name against the type. - if not _check_parameter_name_against_text(parameter, parameter.type, error): - continue # Since an error was noted for this name, move to the next parameter. - - def check_pass_ptr_usage(clean_lines, line_number, function_state, error): """Check for proper usage of Pass*Ptr. @@ -2787,7 +2590,6 @@ return if match(r'\s*\b__asm\b', raw_lines[line]): # Ignore asm lines as they format differently. return - check_function_definition(filename, file_extension, clean_lines, line, function_state, error) check_pass_ptr_usage(clean_lines, line, function_state, error) check_style(clean_lines, line, file_state, error) check_language(filename, clean_lines, line, file_extension, include_state, @@ -2861,7 +2663,6 @@ 'readability/fn_size', # TODO(dcheng): Turn on the clang plugin checks and remove this. 'readability/inheritance', - 'readability/parameter_name', 'readability/pass_ptr', 'readability/utf8', 'runtime/arrays',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py index f797f52..b6c1512e 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -90,17 +90,6 @@ """Supports testing functions that do not need CppStyleTestBase.""" - def test_convert_to_lower_with_underscores(self): - self.assertEqual(cpp_style._convert_to_lower_with_underscores('ABC'), 'abc') - self.assertEqual(cpp_style._convert_to_lower_with_underscores('aB'), 'a_b') - self.assertEqual(cpp_style._convert_to_lower_with_underscores('isAName'), 'is_a_name') - self.assertEqual(cpp_style._convert_to_lower_with_underscores('AnotherTest'), 'another_test') - self.assertEqual(cpp_style._convert_to_lower_with_underscores('_ABC'), '_abc') - - def test_create_acronym(self): - self.assertEqual(cpp_style._create_acronym('ABC'), 'ABC') - self.assertEqual(cpp_style._create_acronym('IsAName'), 'IAN') - def test_is_c_or_objective_c(self): clean_lines = cpp_style.CleansedLines(['']) clean_objc_lines = cpp_style.CleansedLines(['#import "header.h"']) @@ -111,42 +100,11 @@ self.assertFalse(cpp_style._FileState(clean_lines, 'h').is_c_or_objective_c()) self.assertTrue(cpp_style._FileState(clean_objc_lines, 'h').is_c_or_objective_c()) - def test_parameter(self): - # Test type. - parameter = cpp_style.Parameter('ExceptionCode', 13, 1) - self.assertEqual(parameter.type, 'ExceptionCode') - self.assertEqual(parameter.name, '') - self.assertEqual(parameter.row, 1) - - # Test type and name. - parameter = cpp_style.Parameter('scoped_refptr<MyClass> parent', 22, 1) - self.assertEqual(parameter.type, 'scoped_refptr<MyClass>') - self.assertEqual(parameter.name, 'parent') - self.assertEqual(parameter.row, 1) - - # Test type, no name, with default value. - parameter = cpp_style.Parameter('MyClass = 0', 7, 0) - self.assertEqual(parameter.type, 'MyClass') - self.assertEqual(parameter.name, '') - self.assertEqual(parameter.row, 0) - - # Test type, name, and default value. - parameter = cpp_style.Parameter('MyClass a = 0', 7, 0) - self.assertEqual(parameter.type, 'MyClass') - self.assertEqual(parameter.name, 'a') - self.assertEqual(parameter.row, 0) - def test_single_line_view(self): start_position = cpp_style.Position(row=1, column=1) end_position = cpp_style.Position(row=3, column=1) single_line_view = cpp_style.SingleLineView(['0', 'abcde', 'fgh', 'i'], start_position, end_position) self.assertEqual(single_line_view.single_line, 'bcde fgh i') - self.assertEqual(single_line_view.convert_column_to_row(0), 1) - self.assertEqual(single_line_view.convert_column_to_row(4), 1) - self.assertEqual(single_line_view.convert_column_to_row(5), 2) - self.assertEqual(single_line_view.convert_column_to_row(8), 2) - self.assertEqual(single_line_view.convert_column_to_row(9), 3) - self.assertEqual(single_line_view.convert_column_to_row(100), 3) start_position = cpp_style.Position(row=0, column=3) end_position = cpp_style.Position(row=0, column=4) @@ -158,64 +116,6 @@ single_line_view = cpp_style.SingleLineView(['""', '""', '""'], start_position, end_position) self.assertEqual(single_line_view.single_line, '""') - def test_create_skeleton_parameters(self): - self.assertEqual(cpp_style.create_skeleton_parameters(''), '') - self.assertEqual(cpp_style.create_skeleton_parameters(' '), ' ') - self.assertEqual(cpp_style.create_skeleton_parameters('long'), 'long,') - self.assertEqual(cpp_style.create_skeleton_parameters('const unsigned long int'), ' int,') - self.assertEqual(cpp_style.create_skeleton_parameters('long int*'), ' int ,') - self.assertEqual(cpp_style.create_skeleton_parameters('scoped_refptr<Foo> a'), 'scoped_refptr a,') - self.assertEqual(cpp_style.create_skeleton_parameters( - 'ComplexTemplate<NestedTemplate1<MyClass1, MyClass2>, NestedTemplate1<MyClass1, MyClass2> > param, int second'), - 'ComplexTemplate param, int second,') - self.assertEqual(cpp_style.create_skeleton_parameters('int = 0, Namespace::Type& a'), 'int , Type a,') - # Create skeleton parameters is a bit too aggressive with function variables, but - # it allows for parsing other parameters and declarations like this are rare. - self.assertEqual(cpp_style.create_skeleton_parameters('void (*fn)(int a, int b), Namespace::Type& a'), - 'void , Type a,') - - # This doesn't look like functions declarations but the simplifications help to eliminate false positives. - self.assertEqual(cpp_style.create_skeleton_parameters('b{d}'), 'b ,') - - def test_find_parameter_name_index(self): - self.assertEqual(cpp_style.find_parameter_name_index(' int a '), 5) - self.assertEqual(cpp_style.find_parameter_name_index(' scoped_refptr '), 19) - self.assertEqual(cpp_style.find_parameter_name_index('double'), 6) - - def test_parameter_list(self): - elided_lines = ['int blah(scoped_refptr<MyClass> paramName,', - 'const Other1Class& foo,', - ('const ComplexTemplate<Class1, NestedTemplate<P1, P2> >* const * param = ' - 'new ComplexTemplate<Class1, NestedTemplate<P1, P2> >(34, 42),'), - 'int* myCount = 0);'] - start_position = cpp_style.Position(row=0, column=8) - end_position = cpp_style.Position(row=3, column=16) - - expected_parameters = ({'type': 'scoped_refptr<MyClass>', 'name': 'paramName', 'row': 0}, - {'type': 'const Other1Class&', 'name': 'foo', 'row': 1}, - {'type': 'const ComplexTemplate<Class1, NestedTemplate<P1, P2> >* const *', - 'name': 'param', - 'row': 2}, - {'type': 'int*', 'name': 'myCount', 'row': 3}) - index = 0 - for parameter in cpp_style.parameter_list(elided_lines, start_position, end_position): - expected_parameter = expected_parameters[index] - self.assertEqual(parameter.type, expected_parameter['type']) - self.assertEqual(parameter.name, expected_parameter['name']) - self.assertEqual(parameter.row, expected_parameter['row']) - index += 1 - self.assertEqual(index, len(expected_parameters)) - - def test_check_parameter_against_text(self): - error_collector = ErrorCollector(self.assertTrue) - parameter = cpp_style.Parameter('FooF ooF', 4, 1) - self.assertFalse(cpp_style._check_parameter_name_against_text(parameter, 'FooF', error_collector)) - self.assertEqual( - error_collector.results(), - 'The parameter name "ooF" adds no information, so it should be removed. ' - 'See https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/blink-c++.md' - '#Leave-obvious-parameter-names-out-of-function-declarations. [readability/parameter_name] [5]') - class CppStyleTestBase(unittest.TestCase): """Provides some useful helper functions for cpp_style tests. @@ -497,97 +397,6 @@ # Simple test case with something that is not a function. self.perform_function_detection(['class Stuff;'], None) - def test_parameter_list(self): - # A function with no arguments. - self.perform_function_detection( - ['void functionName();'], - {'name': 'functionName', - 'function_name_start_position': (0, 5), - 'parameter_start_position': (0, 17), - 'parameter_end_position': (0, 19), - 'body_start_position': (0, 19), - 'end_position': (0, 20), - 'is_pure': False, - 'is_declaration': True, - 'parameter_list': ()}) - - # A function with one argument. - self.perform_function_detection( - ['void functionName(int);'], - {'name': 'functionName', - 'function_name_start_position': (0, 5), - 'parameter_start_position': (0, 17), - 'parameter_end_position': (0, 22), - 'body_start_position': (0, 22), - 'end_position': (0, 23), - 'is_pure': False, - 'is_declaration': True, - 'parameter_list': - ({'type': 'int', 'name': '', 'row': 0},)}) - - # A function with unsigned and short arguments - self.perform_function_detection( - ['void functionName(unsigned a, short b, long c, long long short unsigned int);'], - {'name': 'functionName', - 'function_name_start_position': (0, 5), - 'parameter_start_position': (0, 17), - 'parameter_end_position': (0, 76), - 'body_start_position': (0, 76), - 'end_position': (0, 77), - 'is_pure': False, - 'is_declaration': True, - 'parameter_list': - ({'type': 'unsigned', 'name': 'a', 'row': 0}, - {'type': 'short', 'name': 'b', 'row': 0}, - {'type': 'long', 'name': 'c', 'row': 0}, - {'type': 'long long short unsigned int', 'name': '', 'row': 0})}) - - # Some parameter type with modifiers and no parameter names. - self.perform_function_detection( - [ - 'virtual void determineARIADropEffects(Vector<String>*&, ' - 'const unsigned long int*&, const MediaPlayer::Preload, ' - 'Other<Other2, Other3<P1, P2> >, int);' - ], - {'name': 'determineARIADropEffects', - 'parameter_start_position': (0, 37), - 'function_name_start_position': (0, 13), - 'parameter_end_position': (0, 147), - 'body_start_position': (0, 147), - 'end_position': (0, 148), - 'is_pure': False, - 'is_declaration': True, - 'parameter_list': - ({'type': 'Vector<String>*&', 'name': '', 'row': 0}, - {'type': 'const unsigned long int*&', 'name': '', 'row': 0}, - {'type': 'const MediaPlayer::Preload', 'name': '', 'row': 0}, - {'type': 'Other<Other2, Other3<P1, P2> >', 'name': '', 'row': 0}, - {'type': 'int', 'name': '', 'row': 0})}) - - # Try parsing a function with a very complex definition. - self.perform_function_detection( - ['#define MyMacro(a) a', - 'virtual', - 'AnotherTemplate<Class1, Class2> aFunctionName(scoped_refptr<MyClass> paramName,', - 'const Other1Class& foo,', - ('const ComplexTemplate<Class1, NestedTemplate<P1, P2> >* const * param = ' - 'new ComplexTemplate<Class1, NestedTemplate<P1, P2> >(34, 42),'), - 'int* myCount = 0);'], - {'name': 'aFunctionName', - 'function_name_start_position': (2, 32), - 'parameter_start_position': (2, 45), - 'parameter_end_position': (5, 17), - 'body_start_position': (5, 17), - 'end_position': (5, 18), - 'is_pure': False, - 'is_declaration': True, - 'parameter_list': - ({'type': 'scoped_refptr<MyClass>', 'name': 'paramName', 'row': 2}, - {'type': 'const Other1Class&', 'name': 'foo', 'row': 3}, - {'type': 'const ComplexTemplate<Class1, NestedTemplate<P1, P2> >* const *', 'name': 'param', 'row': 4}, - {'type': 'int*', 'name': 'myCount', 'row': 5})}, - detection_line=2) - class CppStyleTest(CppStyleTestBase): @@ -2916,71 +2725,6 @@ 'isascii() function. [runtime/ctype_function] [4]', 'foo.cpp') - def test_parameter_names(self): - # Leave meaningless variable names out of function declarations. - # This variable name is very long. # pylint: disable=invalid-name - meaningless_variable_name_error_message = ( - 'The parameter name "%s" adds no information, so it should be removed. ' - 'See https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/blink-c++.md' - '#Leave-obvious-parameter-names-out-of-function-declarations. [readability/parameter_name] [5]') - - parameter_error_rules = ('-', '+readability/parameter_name') - # No variable name, so no error. - self.assertEqual( - '', - self.perform_lint('void func(int);', 'test.cpp', parameter_error_rules)) - - # Verify that copying the name of the set function causes the error (with some odd casing). - self.assertEqual( - meaningless_variable_name_error_message % 'itemCount', - self.perform_lint('void setItemCount(size_t itemCount);', 'test.cpp', parameter_error_rules)) - self.assertEqual( - meaningless_variable_name_error_message % 'abcCount', - self.perform_lint('void setABCCount(size_t abcCount);', 'test.cpp', parameter_error_rules)) - - # Verify that copying a type name will trigger the warning (even if the type is a template parameter). - self.assertEqual( - meaningless_variable_name_error_message % 'context', - self.perform_lint('void funct(scoped_refptr<ScriptExecutionContext> context);', 'test.cpp', parameter_error_rules)) - - # Verify that acronyms as variable names trigger the error (for both set functions and type names). - self.assertEqual( - meaningless_variable_name_error_message % 'ec', - self.perform_lint('void setExceptionCode(int ec);', 'test.cpp', parameter_error_rules)) - self.assertEqual( - meaningless_variable_name_error_message % 'ec', - self.perform_lint('void funct(ExceptionCode ec);', 'test.cpp', parameter_error_rules)) - - # 'object' alone, appended, or as part of an acronym is meaningless. - self.assertEqual( - meaningless_variable_name_error_message % 'object', - self.perform_lint('void funct(RenderView object);', 'test.cpp', parameter_error_rules)) - self.assertEqual( - meaningless_variable_name_error_message % 'viewObject', - self.perform_lint('void funct(RenderView viewObject);', 'test.cpp', parameter_error_rules)) - self.assertEqual( - meaningless_variable_name_error_message % 'rvo', - self.perform_lint('void funct(RenderView rvo);', 'test.cpp', parameter_error_rules)) - - # Check that r, g, b, and a are allowed. - self.assertEqual( - '', - self.perform_lint('void setRGBAValues(int r, int g, int b, int a);', 'test.cpp', parameter_error_rules)) - - # Verify that a simple substring match isn't done which would cause false positives. - self.assertEqual( - '', - self.perform_lint('void setNateLateCount(size_t elate);', 'test.cpp', parameter_error_rules)) - self.assertEqual( - '', - self.perform_lint('void funct(NateLate elate);', 'test.cpp', parameter_error_rules)) - - # Don't have generate warnings for functions (only declarations). - self.assertEqual( - '', - self.perform_lint( - 'void funct(scoped_refptr<ScriptExecutionContext> context)\n{\n}\n', 'test.cpp', parameter_error_rules)) - def test_redundant_virtual(self): self.assert_lint('virtual void fooMethod() override;', '"virtual" is redundant since function is already declared as "override" [readability/inheritance] [4]')
diff --git a/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc b/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc index d013294..2402a43 100644 --- a/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc +++ b/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc
@@ -10,7 +10,7 @@ namespace { -class ApproximatedDeviceMemoryTest : public ::testing::Test {}; +class ApproximatedDeviceMemoryTest : public testing::Test {}; TEST_F(ApproximatedDeviceMemoryTest, GetApproximatedDeviceMemory) { ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(128); // 128MB
diff --git a/third_party/WebKit/common/feature_policy/feature_policy_unittest.cc b/third_party/WebKit/common/feature_policy/feature_policy_unittest.cc index 0218c447..382901f 100644 --- a/third_party/WebKit/common/feature_policy/feature_policy_unittest.cc +++ b/third_party/WebKit/common/feature_policy/feature_policy_unittest.cc
@@ -25,7 +25,7 @@ } // namespace -class FeaturePolicyTest : public ::testing::Test { +class FeaturePolicyTest : public testing::Test { protected: FeaturePolicyTest() : feature_list_(
diff --git a/third_party/WebKit/common/origin_trials/trial_token_unittest.cc b/third_party/WebKit/common/origin_trials/trial_token_unittest.cc index 1a88309..291db94e 100644 --- a/third_party/WebKit/common/origin_trials/trial_token_unittest.cc +++ b/third_party/WebKit/common/origin_trials/trial_token_unittest.cc
@@ -734,7 +734,7 @@ EXPECT_FALSE(empty_token) << "Invalid trial token should not parse."; } -INSTANTIATE_TEST_CASE_P(, TrialTokenTest, ::testing::ValuesIn(kInvalidTokens)); +INSTANTIATE_TEST_CASE_P(, TrialTokenTest, testing::ValuesIn(kInvalidTokens)); TEST_F(TrialTokenTest, ParseValidToken) { std::unique_ptr<TrialToken> token = Parse(kSampleTokenJSON);
diff --git a/third_party/WebKit/public/platform/WebRuntimeFeatures.h b/third_party/WebKit/public/platform/WebRuntimeFeatures.h index d056722..2b7b63e 100644 --- a/third_party/WebKit/public/platform/WebRuntimeFeatures.h +++ b/third_party/WebKit/public/platform/WebRuntimeFeatures.h
@@ -183,7 +183,6 @@ BLINK_PLATFORM_EXPORT static void EnableStopLoadingInBackground(bool); BLINK_PLATFORM_EXPORT static void EnableStopNonTimersInBackground(bool); BLINK_PLATFORM_EXPORT static void EnablePWAFullCodeCache(bool); - BLINK_PLATFORM_EXPORT static void EnableDoubleTapToJumpOnVideo(bool); BLINK_PLATFORM_EXPORT static void EnableCodeCacheAfterExecute(bool); BLINK_PLATFORM_EXPORT static void EnableUnifiedTouchAdjustment(bool); BLINK_PLATFORM_EXPORT static void EnableMojoBlobURLs(bool);
diff --git a/third_party/rnnoise/README.chromium b/third_party/rnnoise/README.chromium index 3b51b2b8..4332774b 100644 --- a/third_party/rnnoise/README.chromium +++ b/third_party/rnnoise/README.chromium
@@ -14,4 +14,8 @@ The library is used for speech processing in WebRTC. Local Modifications: -Only retaining rnn.c, rnn_data.c, tansig_table.h from src/ and COPYING. +Only retaining COPYING and from src/ the following files: +- kiss_fft.c, kiss_fft.h, _kiss_fft_guts.h +- rnn.c +- rnn_data.c +- tansig_table.h
diff --git a/third_party/rnnoise/src/_kiss_fft_guts.h b/third_party/rnnoise/src/_kiss_fft_guts.h new file mode 100644 index 0000000..457bfbca --- /dev/null +++ b/third_party/rnnoise/src/_kiss_fft_guts.h
@@ -0,0 +1,207 @@ +/*Copyright (c) 2003-2004, Mark Borgerding + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE.*/ + +#ifndef THIRD_PARTY_RNNOISE_SRC__KISS_FFT_GUTS_H_ +#define THIRD_PARTY_RNNOISE_SRC__KISS_FFT_GUTS_H_ + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +/* kiss_fft.h + defines kiss_fft_scalar as either short or a float type + and defines + typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ +#include "kiss_fft.h" + +/* + Explanation of macros dealing with complex math: + + C_MUL(m,a,b) : m = a*b + C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise + C_SUB( res, a,b) : res = a - b + C_SUBFROM( res , a) : res -= a + C_ADDTO( res , a) : res += a + * */ +#ifdef FIXED_POINT +// #include "arch.h" + +#define SAMP_MAX 2147483647 +#define TWID_MAX 32767 +#define TRIG_UPSCALE 1 + +#define SAMP_MIN -SAMP_MAX + +#define S_MUL(a, b) MULT16_32_Q15(b, a) + +#define C_MUL(m, a, b) \ + do { \ + (m).r = SUB32_ovflw(S_MUL((a).r, (b).r), S_MUL((a).i, (b).i)); \ + (m).i = ADD32_ovflw(S_MUL((a).r, (b).i), S_MUL((a).i, (b).r)); \ + } while (0) + +#define C_MULC(m, a, b) \ + do { \ + (m).r = ADD32_ovflw(S_MUL((a).r, (b).r), S_MUL((a).i, (b).i)); \ + (m).i = SUB32_ovflw(S_MUL((a).i, (b).r), S_MUL((a).r, (b).i)); \ + } while (0) + +#define C_MULBYSCALAR(c, s) \ + do { \ + (c).r = S_MUL((c).r, s); \ + (c).i = S_MUL((c).i, s); \ + } while (0) + +#define DIVSCALAR(x, k) (x) = S_MUL(x, (TWID_MAX - ((k) >> 1)) / (k) + 1) + +#define C_FIXDIV(c, div) \ + do { \ + DIVSCALAR((c).r, div); \ + DIVSCALAR((c).i, div); \ + } while (0) + +#define C_ADD(res, a, b) \ + do { \ + (res).r = ADD32_ovflw((a).r, (b).r); \ + (res).i = ADD32_ovflw((a).i, (b).i); \ + } while (0) +#define C_SUB(res, a, b) \ + do { \ + (res).r = SUB32_ovflw((a).r, (b).r); \ + (res).i = SUB32_ovflw((a).i, (b).i); \ + } while (0) +#define C_ADDTO(res, a) \ + do { \ + (res).r = ADD32_ovflw((res).r, (a).r); \ + (res).i = ADD32_ovflw((res).i, (a).i); \ + } while (0) + +#define C_SUBFROM(res, a) \ + do { \ + (res).r = ADD32_ovflw((res).r, (a).r); \ + (res).i = SUB32_ovflw((res).i, (a).i); \ + } while (0) + +// #if defined(OPUS_ARM_INLINE_ASM) +// #include "arm/kiss_fft_armv4.h" +// #endif + +// #if defined(OPUS_ARM_INLINE_EDSP) +// #include "arm/kiss_fft_armv5e.h" +// #endif +// #if defined(MIPSr1_ASM) +// #include "mips/kiss_fft_mipsr1.h" +// #endif + +#else /* not FIXED_POINT*/ + +#define S_MUL(a, b) ((a) * (b)) +#define C_MUL(m, a, b) \ + do { \ + (m).r = (a).r * (b).r - (a).i * (b).i; \ + (m).i = (a).r * (b).i + (a).i * (b).r; \ + } while (0) +#define C_MULC(m, a, b) \ + do { \ + (m).r = (a).r * (b).r + (a).i * (b).i; \ + (m).i = (a).i * (b).r - (a).r * (b).i; \ + } while (0) + +#define C_MUL4(m, a, b) C_MUL(m, a, b) + +#define C_FIXDIV(c, div) /* NOOP */ +#define C_MULBYSCALAR(c, s) \ + do { \ + (c).r *= (s); \ + (c).i *= (s); \ + } while (0) +#endif + +#ifndef CHECK_OVERFLOW_OP +#define CHECK_OVERFLOW_OP(a, op, b) /* noop */ +#endif + +#ifndef C_ADD +#define C_ADD(res, a, b) \ + do { \ + CHECK_OVERFLOW_OP((a).r, +, (b).r) \ + CHECK_OVERFLOW_OP((a).i, +, (b).i) \ + (res).r = (a).r + (b).r; \ + (res).i = (a).i + (b).i; \ + } while (0) +#define C_SUB(res, a, b) \ + do { \ + CHECK_OVERFLOW_OP((a).r, -, (b).r) \ + CHECK_OVERFLOW_OP((a).i, -, (b).i) \ + (res).r = (a).r - (b).r; \ + (res).i = (a).i - (b).i; \ + } while (0) +#define C_ADDTO(res, a) \ + do { \ + CHECK_OVERFLOW_OP((res).r, +, (a).r) \ + CHECK_OVERFLOW_OP((res).i, +, (a).i) \ + (res).r += (a).r; \ + (res).i += (a).i; \ + } while (0) + +#define C_SUBFROM(res, a) \ + do { \ + CHECK_OVERFLOW_OP((res).r, -, (a).r) \ + CHECK_OVERFLOW_OP((res).i, -, (a).i) \ + (res).r -= (a).r; \ + (res).i -= (a).i; \ + } while (0) +#endif /* C_ADD defined */ + +#ifdef FIXED_POINT +/*# define KISS_FFT_COS(phase) +TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase)))) # define +KISS_FFT_SIN(phase) TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * sin +(phase))))*/ +#define KISS_FFT_COS(phase) floor(.5 + TWID_MAX * cos(phase)) +#define KISS_FFT_SIN(phase) floor(.5 + TWID_MAX * sin(phase)) +#define HALF_OF(x) ((x) >> 1) +#elif defined(USE_SIMD) +#define KISS_FFT_COS(phase) _mm_set1_ps(cos(phase)) +#define KISS_FFT_SIN(phase) _mm_set1_ps(sin(phase)) +#define HALF_OF(x) ((x)*_mm_set1_ps(.5f)) +#else +#define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) +#define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) +#define HALF_OF(x) ((x)*.5f) +#endif + +#define kf_cexp(x, phase) \ + do { \ + (x)->r = KISS_FFT_COS(phase); \ + (x)->i = KISS_FFT_SIN(phase); \ + } while (0) + +#define kf_cexp2(x, phase) \ + do { \ + (x)->r = TRIG_UPSCALE * celt_cos_norm((phase)); \ + (x)->i = TRIG_UPSCALE * celt_cos_norm((phase)-32768); \ + } while (0) + +#endif // THIRD_PARTY_RNNOISE_SRC__KISS_FFT_GUTS_H_
diff --git a/third_party/rnnoise/src/kiss_fft.c b/third_party/rnnoise/src/kiss_fft.c new file mode 100644 index 0000000..54d7bf7c --- /dev/null +++ b/third_party/rnnoise/src/kiss_fft.c
@@ -0,0 +1,606 @@ +/*Copyright (c) 2003-2004, Mark Borgerding + Lots of modifications by Jean-Marc Valin + Copyright (c) 2005-2007, Xiph.Org Foundation + Copyright (c) 2008, Xiph.Org Foundation, CSIRO + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE.*/ + +/* This code is originally from Mark Borgerding's KISS-FFT but has been + heavily modified to better suit Opus */ + +#ifndef SKIP_CONFIG_H +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif +#endif + +#include "_kiss_fft_guts.h" +#define CUSTOM_MODES + +/* The guts header contains all the multiplication and addition macros that are defined for + complex numbers. It also delares the kf_ internal functions. +*/ + +static void kf_bfly2( + kiss_fft_cpx * Fout, + int m, + int N + ) +{ + kiss_fft_cpx * Fout2; + int i; + (void)m; +#ifdef CUSTOM_MODES + if (m==1) + { + celt_assert(m==1); + for (i=0;i<N;i++) + { + kiss_fft_cpx t; + Fout2 = Fout + 1; + t = *Fout2; + C_SUB( *Fout2 , *Fout , t ); + C_ADDTO( *Fout , t ); + Fout += 2; + } + } else +#endif + { + opus_val16 tw; + tw = QCONST16(0.7071067812f, 15); + /* We know that m==4 here because the radix-2 is just after a radix-4 */ + celt_assert(m==4); + for (i=0;i<N;i++) + { + kiss_fft_cpx t; + Fout2 = Fout + 4; + t = Fout2[0]; + C_SUB( Fout2[0] , Fout[0] , t ); + C_ADDTO( Fout[0] , t ); + + t.r = S_MUL(ADD32_ovflw(Fout2[1].r, Fout2[1].i), tw); + t.i = S_MUL(SUB32_ovflw(Fout2[1].i, Fout2[1].r), tw); + C_SUB( Fout2[1] , Fout[1] , t ); + C_ADDTO( Fout[1] , t ); + + t.r = Fout2[2].i; + t.i = -Fout2[2].r; + C_SUB( Fout2[2] , Fout[2] , t ); + C_ADDTO( Fout[2] , t ); + + t.r = S_MUL(SUB32_ovflw(Fout2[3].i, Fout2[3].r), tw); + t.i = S_MUL(NEG32_ovflw(ADD32_ovflw(Fout2[3].i, Fout2[3].r)), tw); + C_SUB( Fout2[3] , Fout[3] , t ); + C_ADDTO( Fout[3] , t ); + Fout += 8; + } + } +} + +static void kf_bfly4( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_state *st, + int m, + int N, + int mm + ) +{ + int i; + + if (m==1) + { + /* Degenerate case where all the twiddles are 1. */ + for (i=0;i<N;i++) + { + kiss_fft_cpx scratch0, scratch1; + + C_SUB( scratch0 , *Fout, Fout[2] ); + C_ADDTO(*Fout, Fout[2]); + C_ADD( scratch1 , Fout[1] , Fout[3] ); + C_SUB( Fout[2], *Fout, scratch1 ); + C_ADDTO( *Fout , scratch1 ); + C_SUB( scratch1 , Fout[1] , Fout[3] ); + + Fout[1].r = ADD32_ovflw(scratch0.r, scratch1.i); + Fout[1].i = SUB32_ovflw(scratch0.i, scratch1.r); + Fout[3].r = SUB32_ovflw(scratch0.r, scratch1.i); + Fout[3].i = ADD32_ovflw(scratch0.i, scratch1.r); + Fout+=4; + } + } else { + int j; + kiss_fft_cpx scratch[6]; + const kiss_twiddle_cpx *tw1,*tw2,*tw3; + const int m2=2*m; + const int m3=3*m; + kiss_fft_cpx * Fout_beg = Fout; + for (i=0;i<N;i++) + { + Fout = Fout_beg + i*mm; + tw3 = tw2 = tw1 = st->twiddles; + /* m is guaranteed to be a multiple of 4. */ + for (j=0;j<m;j++) + { + C_MUL(scratch[0],Fout[m] , *tw1 ); + C_MUL(scratch[1],Fout[m2] , *tw2 ); + C_MUL(scratch[2],Fout[m3] , *tw3 ); + + C_SUB( scratch[5] , *Fout, scratch[1] ); + C_ADDTO(*Fout, scratch[1]); + C_ADD( scratch[3] , scratch[0] , scratch[2] ); + C_SUB( scratch[4] , scratch[0] , scratch[2] ); + C_SUB( Fout[m2], *Fout, scratch[3] ); + tw1 += fstride; + tw2 += fstride*2; + tw3 += fstride*3; + C_ADDTO( *Fout , scratch[3] ); + + Fout[m].r = ADD32_ovflw(scratch[5].r, scratch[4].i); + Fout[m].i = SUB32_ovflw(scratch[5].i, scratch[4].r); + Fout[m3].r = SUB32_ovflw(scratch[5].r, scratch[4].i); + Fout[m3].i = ADD32_ovflw(scratch[5].i, scratch[4].r); + ++Fout; + } + } + } +} + + +#ifndef RADIX_TWO_ONLY + +static void kf_bfly3( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_state *st, + int m, + int N, + int mm + ) +{ + int i; + size_t k; + const size_t m2 = 2*m; + const kiss_twiddle_cpx *tw1,*tw2; + kiss_fft_cpx scratch[5]; + kiss_twiddle_cpx epi3; + + kiss_fft_cpx * Fout_beg = Fout; +#ifdef FIXED_POINT + /*epi3.r = -16384;*/ /* Unused */ + epi3.i = -28378; +#else + epi3 = st->twiddles[fstride*m]; +#endif + for (i=0;i<N;i++) + { + Fout = Fout_beg + i*mm; + tw1=tw2=st->twiddles; + /* For non-custom modes, m is guaranteed to be a multiple of 4. */ + k=m; + do { + + C_MUL(scratch[1],Fout[m] , *tw1); + C_MUL(scratch[2],Fout[m2] , *tw2); + + C_ADD(scratch[3],scratch[1],scratch[2]); + C_SUB(scratch[0],scratch[1],scratch[2]); + tw1 += fstride; + tw2 += fstride*2; + + Fout[m].r = SUB32_ovflw(Fout->r, HALF_OF(scratch[3].r)); + Fout[m].i = SUB32_ovflw(Fout->i, HALF_OF(scratch[3].i)); + + C_MULBYSCALAR( scratch[0] , epi3.i ); + + C_ADDTO(*Fout,scratch[3]); + + Fout[m2].r = ADD32_ovflw(Fout[m].r, scratch[0].i); + Fout[m2].i = SUB32_ovflw(Fout[m].i, scratch[0].r); + + Fout[m].r = SUB32_ovflw(Fout[m].r, scratch[0].i); + Fout[m].i = ADD32_ovflw(Fout[m].i, scratch[0].r); + + ++Fout; + } while(--k); + } +} + + +#ifndef OVERRIDE_kf_bfly5 +static void kf_bfly5( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_state *st, + int m, + int N, + int mm + ) +{ + kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; + int i, u; + kiss_fft_cpx scratch[13]; + const kiss_twiddle_cpx *tw; + kiss_twiddle_cpx ya,yb; + kiss_fft_cpx * Fout_beg = Fout; + +#ifdef FIXED_POINT + ya.r = 10126; + ya.i = -31164; + yb.r = -26510; + yb.i = -19261; +#else + ya = st->twiddles[fstride*m]; + yb = st->twiddles[fstride*2*m]; +#endif + tw=st->twiddles; + + for (i=0;i<N;i++) + { + Fout = Fout_beg + i*mm; + Fout0=Fout; + Fout1=Fout0+m; + Fout2=Fout0+2*m; + Fout3=Fout0+3*m; + Fout4=Fout0+4*m; + + /* For non-custom modes, m is guaranteed to be a multiple of 4. */ + for ( u=0; u<m; ++u ) { + scratch[0] = *Fout0; + + C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); + C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); + C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); + C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); + + C_ADD( scratch[7],scratch[1],scratch[4]); + C_SUB( scratch[10],scratch[1],scratch[4]); + C_ADD( scratch[8],scratch[2],scratch[3]); + C_SUB( scratch[9],scratch[2],scratch[3]); + + Fout0->r = ADD32_ovflw(Fout0->r, ADD32_ovflw(scratch[7].r, scratch[8].r)); + Fout0->i = ADD32_ovflw(Fout0->i, ADD32_ovflw(scratch[7].i, scratch[8].i)); + + scratch[5].r = ADD32_ovflw(scratch[0].r, ADD32_ovflw(S_MUL(scratch[7].r,ya.r), S_MUL(scratch[8].r,yb.r))); + scratch[5].i = ADD32_ovflw(scratch[0].i, ADD32_ovflw(S_MUL(scratch[7].i,ya.r), S_MUL(scratch[8].i,yb.r))); + + scratch[6].r = ADD32_ovflw(S_MUL(scratch[10].i,ya.i), S_MUL(scratch[9].i,yb.i)); + scratch[6].i = NEG32_ovflw(ADD32_ovflw(S_MUL(scratch[10].r,ya.i), S_MUL(scratch[9].r,yb.i))); + + C_SUB(*Fout1,scratch[5],scratch[6]); + C_ADD(*Fout4,scratch[5],scratch[6]); + + scratch[11].r = ADD32_ovflw(scratch[0].r, ADD32_ovflw(S_MUL(scratch[7].r,yb.r), S_MUL(scratch[8].r,ya.r))); + scratch[11].i = ADD32_ovflw(scratch[0].i, ADD32_ovflw(S_MUL(scratch[7].i,yb.r), S_MUL(scratch[8].i,ya.r))); + scratch[12].r = SUB32_ovflw(S_MUL(scratch[9].i,ya.i), S_MUL(scratch[10].i,yb.i)); + scratch[12].i = SUB32_ovflw(S_MUL(scratch[10].r,yb.i), S_MUL(scratch[9].r,ya.i)); + + C_ADD(*Fout2,scratch[11],scratch[12]); + C_SUB(*Fout3,scratch[11],scratch[12]); + + ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; + } + } +} +#endif /* OVERRIDE_kf_bfly5 */ + + +#endif + + +#ifdef CUSTOM_MODES + +static +void compute_bitrev_table( + int Fout, + opus_int16 *f, + const size_t fstride, + int in_stride, + opus_int16 * factors, + const kiss_fft_state *st + ) +{ + const int p=*factors++; /* the radix */ + const int m=*factors++; /* stage's fft length/p */ + + /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/ + if (m==1) + { + int j; + for (j=0;j<p;j++) + { + *f = Fout+j; + f += fstride*in_stride; + } + } else { + int j; + for (j=0;j<p;j++) + { + compute_bitrev_table( Fout , f, fstride*p, in_stride, factors,st); + f += fstride*in_stride; + Fout += m; + } + } +} + +/* facbuf is populated by p1,m1,p2,m2, ... + where + p[i] * m[i] = m[i-1] + m0 = n */ +static +int kf_factor(int n,opus_int16 * facbuf) +{ + int p=4; + int i; + int stages=0; + int nbak = n; + + /*factor out powers of 4, powers of 2, then any remaining primes */ + do { + while (n % p) { + switch (p) { + case 4: p = 2; break; + case 2: p = 3; break; + default: p += 2; break; + } + if (p>32000 || (opus_int32)p*(opus_int32)p > n) + p = n; /* no more factors, skip to end */ + } + n /= p; +#ifdef RADIX_TWO_ONLY + if (p!=2 && p != 4) +#else + if (p>5) +#endif + { + return 0; + } + facbuf[2*stages] = p; + if (p==2 && stages > 1) + { + facbuf[2*stages] = 4; + facbuf[2] = 2; + } + stages++; + } while (n > 1); + n = nbak; + /* Reverse the order to get the radix 4 at the end, so we can use the + fast degenerate case. It turns out that reversing the order also + improves the noise behaviour. */ + for (i=0;i<stages/2;i++) + { + int tmp; + tmp = facbuf[2*i]; + facbuf[2*i] = facbuf[2*(stages-i-1)]; + facbuf[2*(stages-i-1)] = tmp; + } + for (i=0;i<stages;i++) + { + n /= facbuf[2*i]; + facbuf[2*i+1] = n; + } + return 1; +} + +static void compute_twiddles(kiss_twiddle_cpx *twiddles, int nfft) +{ + int i; +#ifdef FIXED_POINT + for (i=0;i<nfft;++i) { + opus_val32 phase = -i; + kf_cexp2(twiddles+i, DIV32(SHL32(phase,17),nfft)); + } +#else + for (i=0;i<nfft;++i) { + const double pi=3.14159265358979323846264338327; + double phase = ( -2*pi /nfft ) * i; + kf_cexp(twiddles+i, phase ); + } +#endif +} + +int opus_fft_alloc_arch_c(kiss_fft_state *st) { + (void)st; + return 0; +} + +/* + * + * Allocates all necessary storage space for the fft and ifft. + * The return value is a contiguous block of memory. As such, + * It can be freed with free(). + * */ +kiss_fft_state *opus_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem, + const kiss_fft_state *base, int arch) +{ + kiss_fft_state *st=NULL; + size_t memneeded = sizeof(struct kiss_fft_state); /* twiddle factors*/ + + if ( lenmem==NULL ) { + st = ( kiss_fft_state*)KISS_FFT_MALLOC( memneeded ); + }else{ + if (mem != NULL && *lenmem >= memneeded) + st = (kiss_fft_state*)mem; + *lenmem = memneeded; + } + if (st) { + opus_int16 *bitrev; + kiss_twiddle_cpx *twiddles; + + st->nfft=nfft; +#ifdef FIXED_POINT + st->scale_shift = celt_ilog2(st->nfft); + if (st->nfft == 1<<st->scale_shift) + st->scale = Q15ONE; + else + st->scale = (1073741824+st->nfft/2)/st->nfft>>(15-st->scale_shift); +#else + st->scale = 1.f / nfft; + // fprintf(stderr, "NFFT: %d -> %f\n", nfft, st->scale); +#endif + if (base != NULL) + { + st->twiddles = base->twiddles; + st->shift = 0; + while (st->shift < 32 && nfft<<st->shift != base->nfft) + st->shift++; + if (st->shift>=32) + goto fail; + } else { + st->twiddles = twiddles = (kiss_twiddle_cpx*)KISS_FFT_MALLOC(sizeof(kiss_twiddle_cpx)*nfft); + compute_twiddles(twiddles, nfft); + st->shift = -1; + } + if (!kf_factor(nfft,st->factors)) + { + goto fail; + } + + /* bitrev */ + st->bitrev = bitrev = (opus_int16*)KISS_FFT_MALLOC(sizeof(opus_int16)*nfft); + if (st->bitrev==NULL) + goto fail; + compute_bitrev_table(0, bitrev, 1,1, st->factors,st); + + /* Initialize architecture specific fft parameters */ + if (opus_fft_alloc_arch(st, arch)) + goto fail; + } + return st; +fail: + opus_fft_free(st, arch); + return NULL; +} + +kiss_fft_state *opus_fft_alloc(int nfft,void * mem,size_t * lenmem, int arch) +{ + return opus_fft_alloc_twiddles(nfft, mem, lenmem, NULL, arch); +} + +void opus_fft_free_arch_c(kiss_fft_state *st) { + (void)st; +} + +void opus_fft_free(const kiss_fft_state *cfg, int arch) +{ + if (cfg) + { + opus_fft_free_arch((kiss_fft_state *)cfg, arch); + opus_free((opus_int16*)cfg->bitrev); + if (cfg->shift < 0) + opus_free((kiss_twiddle_cpx*)cfg->twiddles); + opus_free((kiss_fft_state*)cfg); + } +} + +#endif /* CUSTOM_MODES */ + +void opus_fft_impl(const kiss_fft_state *st, kiss_fft_cpx *fout) +{ + int m2, m; + int p; + int L; + int fstride[MAXFACTORS]; + int i; + int shift; + + /* st->shift can be -1 */ + shift = st->shift>0 ? st->shift : 0; + + fstride[0] = 1; + L=0; + do { + p = st->factors[2*L]; + m = st->factors[2*L+1]; + fstride[L+1] = fstride[L]*p; + L++; + } while(m!=1); + m = st->factors[2*L-1]; + for (i=L-1;i>=0;i--) + { + if (i!=0) + m2 = st->factors[2*i-1]; + else + m2 = 1; + switch (st->factors[2*i]) + { + case 2: + kf_bfly2(fout, m, fstride[i]); + break; + case 4: + kf_bfly4(fout,fstride[i]<<shift,st,m, fstride[i], m2); + break; + #ifndef RADIX_TWO_ONLY + case 3: + kf_bfly3(fout,fstride[i]<<shift,st,m, fstride[i], m2); + break; + case 5: + kf_bfly5(fout,fstride[i]<<shift,st,m, fstride[i], m2); + break; + #endif + } + m = m2; + } +} + +void opus_fft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin, kiss_fft_cpx *fout) +{ + int i; + opus_val16 scale; +// #ifdef FIXED_POINT +// // Allows us to scale with MULT16_32_Q16(), which is faster than +// // MULT16_32_Q15() on ARM. +// int scale_shift = st->scale_shift-1; +// #endif + scale = st->scale; + + celt_assert2 (fin != fout, "In-place FFT not supported"); + /* Bit-reverse the input */ + // fprintf(stderr, "nfft %d\n", st->nfft); + // celt_assert(0); + for (i=0;i<st->nfft;i++) + { + kiss_fft_cpx x = fin[i]; + // fout[st->bitrev[i]].r = SHR32(MULT16_32_Q16(scale, x.r), scale_shift); + // fout[st->bitrev[i]].i = SHR32(MULT16_32_Q16(scale, x.i), scale_shift); + fout[st->bitrev[i]].r = scale * x.r; + fout[st->bitrev[i]].i = scale * x.i; + } + opus_fft_impl(st, fout); +} + + +void opus_ifft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) +{ + int i; + celt_assert2 (fin != fout, "In-place FFT not supported"); + /* Bit-reverse the input */ + for (i=0;i<st->nfft;i++) + fout[st->bitrev[i]] = fin[i]; + for (i=0;i<st->nfft;i++) + fout[i].i = -fout[i].i; + opus_fft_impl(st, fout); + for (i=0;i<st->nfft;i++) + fout[i].i = -fout[i].i; +}
diff --git a/third_party/rnnoise/src/kiss_fft.h b/third_party/rnnoise/src/kiss_fft.h new file mode 100644 index 0000000..0d8a0a8 --- /dev/null +++ b/third_party/rnnoise/src/kiss_fft.h
@@ -0,0 +1,210 @@ +/*Copyright (c) 2003-2004, Mark Borgerding + Lots of modifications by Jean-Marc Valin + Copyright (c) 2005-2007, Xiph.Org Foundation + Copyright (c) 2008, Xiph.Org Foundation, CSIRO + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE.*/ + +#ifndef THIRD_PARTY_RNNOISE_SRC_KISS_FFT_H_ +#define THIRD_PARTY_RNNOISE_SRC_KISS_FFT_H_ + +#include <math.h> +#include <stdlib.h> +#include "arch.h" + +#include <stdlib.h> +#define opus_alloc(x) malloc(x) +#define opus_free(x) free(x) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef USE_SIMD +#include <xmmintrin.h> +#define kiss_fft_scalar __m128 +#define KISS_FFT_MALLOC(nbytes) memalign(16, nbytes) +#else +#define KISS_FFT_MALLOC opus_alloc +#endif + +#ifdef FIXED_POINT +#include "arch.h" + +#define kiss_fft_scalar opus_int32 +#define kiss_twiddle_scalar opus_int16 + +#else +#ifndef kiss_fft_scalar +/* default is float */ +#define kiss_fft_scalar float +#define kiss_twiddle_scalar float +#define KF_SUFFIX _celt_single +#endif +#endif + +typedef struct { + kiss_fft_scalar r; + kiss_fft_scalar i; +} kiss_fft_cpx; + +typedef struct { + kiss_twiddle_scalar r; + kiss_twiddle_scalar i; +} kiss_twiddle_cpx; + +#define MAXFACTORS 8 +/* e.g. an fft of length 128 has 4 factors + as far as kissfft is concerned + 4*4*4*2 + */ + +typedef struct arch_fft_state { + int is_supported; + void* priv; +} arch_fft_state; + +typedef struct kiss_fft_state { + int nfft; + opus_val16 scale; +#ifdef FIXED_POINT + int scale_shift; +#endif + int shift; + opus_int16 factors[2 * MAXFACTORS]; + const opus_int16* bitrev; + const kiss_twiddle_cpx* twiddles; + arch_fft_state* arch_fft; +} kiss_fft_state; + +// #if defined(HAVE_ARM_NE10) +// #include "arm/fft_arm.h" +// #endif + +/*typedef struct kiss_fft_state* kiss_fft_cfg;*/ + +/** + * opus_fft_alloc + * + * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. + * + * typical usage: kiss_fft_cfg mycfg=opus_fft_alloc(1024,0,NULL,NULL); + * + * The return value from fft_alloc is a cfg buffer used internally + * by the fft routine or NULL. + * + * If lenmem is NULL, then opus_fft_alloc will allocate a cfg buffer using + * malloc. The returned value should be free()d when done to avoid memory leaks. + * + * The state can be placed in a user supplied buffer 'mem': + * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, + * then the function places the cfg in mem and the size used in *lenmem + * and returns mem. + * + * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), + * then the function returns NULL and places the minimum cfg + * buffer size in *lenmem. + * */ + +kiss_fft_state* opus_fft_alloc_twiddles(int nfft, + void* mem, + size_t* lenmem, + const kiss_fft_state* base, + int arch); + +kiss_fft_state* opus_fft_alloc(int nfft, void* mem, size_t* lenmem, int arch); + +/** + * opus_fft(cfg,in_out_buf) + * + * Perform an FFT on a complex input buffer. + * for a forward FFT, + * fin should be f[0] , f[1] , ... ,f[nfft-1] + * fout will be F[0] , F[1] , ... ,F[nfft-1] + * Note that each element is complex and can be accessed like + f[k].r and f[k].i + * */ +void opus_fft_c(const kiss_fft_state* cfg, + const kiss_fft_cpx* fin, + kiss_fft_cpx* fout); +void opus_ifft_c(const kiss_fft_state* cfg, + const kiss_fft_cpx* fin, + kiss_fft_cpx* fout); + +void opus_fft_impl(const kiss_fft_state* st, kiss_fft_cpx* fout); +void opus_ifft_impl(const kiss_fft_state* st, kiss_fft_cpx* fout); + +void opus_fft_free(const kiss_fft_state* cfg, int arch); + +void opus_fft_free_arch_c(kiss_fft_state* st); +int opus_fft_alloc_arch_c(kiss_fft_state* st); + +#if !defined(OVERRIDE_OPUS_FFT) +/* Is run-time CPU detection enabled on this platform? */ +#if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) + +extern int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK + 1])( + kiss_fft_state* st); + +#define opus_fft_alloc_arch(_st, arch) \ + ((*OPUS_FFT_ALLOC_ARCH_IMPL[(arch)&OPUS_ARCHMASK])(_st)) + +extern void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK + 1])( + kiss_fft_state* st); +#define opus_fft_free_arch(_st, arch) \ + ((*OPUS_FFT_FREE_ARCH_IMPL[(arch)&OPUS_ARCHMASK])(_st)) + +extern void (*const OPUS_FFT[OPUS_ARCHMASK + 1])(const kiss_fft_state* cfg, + const kiss_fft_cpx* fin, + kiss_fft_cpx* fout); +#define opus_fft(_cfg, _fin, _fout, arch) \ + ((*OPUS_FFT[(arch)&OPUS_ARCHMASK])(_cfg, _fin, _fout)) + +extern void (*const OPUS_IFFT[OPUS_ARCHMASK + 1])(const kiss_fft_state* cfg, + const kiss_fft_cpx* fin, + kiss_fft_cpx* fout); +#define opus_ifft(_cfg, _fin, _fout, arch) \ + ((*OPUS_IFFT[(arch)&OPUS_ARCHMASK])(_cfg, _fin, _fout)) + +#else /* else for if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) */ + +#define opus_fft_alloc_arch(_st, arch) \ + ((void)(arch), opus_fft_alloc_arch_c(_st)) + +#define opus_fft_free_arch(_st, arch) ((void)(arch), opus_fft_free_arch_c(_st)) + +#define opus_fft(_cfg, _fin, _fout, arch) \ + ((void)(arch), opus_fft_c(_cfg, _fin, _fout)) + +#define opus_ifft(_cfg, _fin, _fout, arch) \ + ((void)(arch), opus_ifft_c(_cfg, _fin, _fout)) + +#endif /* end if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) */ +#endif /* end if !defined(OVERRIDE_OPUS_FFT) */ + +#ifdef __cplusplus +} +#endif + +#endif // THIRD_PARTY_RNNOISE_SRC_KISS_FFT_H_
diff --git a/tools/binary_size/diagnose_bloat.py b/tools/binary_size/diagnose_bloat.py index dffab1c..dda4e071 100755 --- a/tools/binary_size/diagnose_bloat.py +++ b/tools/binary_size/diagnose_bloat.py
@@ -115,7 +115,8 @@ class ResourceSizesDiff(BaseDiff): - _SUMMARY_SECTIONS = ('Breakdown', 'Specifics', 'StaticInitializersCount') + _SUMMARY_SECTIONS = ( + 'Breakdown', 'Dex', 'Specifics', 'StaticInitializersCount') # Sections where it makes sense to sum subsections into a section total. _AGGREGATE_SECTIONS = ( 'InstallBreakdown', 'Breakdown', 'MainLibInfo', 'Uncompressed')
diff --git a/tools/cygprofile/check_orderfile.py b/tools/cygprofile/check_orderfile.py index f17e32a..e99107f 100755 --- a/tools/cygprofile/check_orderfile.py +++ b/tools/cygprofile/check_orderfile.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/check_orderfile_unittest.py b/tools/cygprofile/check_orderfile_unittest.py index 644b9c33..8205bc5 100755 --- a/tools/cygprofile/check_orderfile_unittest.py +++ b/tools/cygprofile/check_orderfile_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/compare_orderfiles.py b/tools/cygprofile/compare_orderfiles.py index b110d8e..272afeb 100755 --- a/tools/cygprofile/compare_orderfiles.py +++ b/tools/cygprofile/compare_orderfiles.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/cyglog_to_orderfile.py b/tools/cygprofile/cyglog_to_orderfile.py index cf9afbb..6337135 100755 --- a/tools/cygprofile/cyglog_to_orderfile.py +++ b/tools/cygprofile/cyglog_to_orderfile.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/cyglog_to_orderfile_unittest.py b/tools/cygprofile/cyglog_to_orderfile_unittest.py index 2aae4d4..e2d8d61 100755 --- a/tools/cygprofile/cyglog_to_orderfile_unittest.py +++ b/tools/cygprofile/cyglog_to_orderfile_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/cygprofile_utils.py b/tools/cygprofile/cygprofile_utils.py old mode 100755 new mode 100644 index 4219a15..4169c6b7 --- a/tools/cygprofile/cygprofile_utils.py +++ b/tools/cygprofile/cygprofile_utils.py
@@ -1,4 +1,3 @@ -#!/usr/bin/python # 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.
diff --git a/tools/cygprofile/cygprofile_utils_unittest.py b/tools/cygprofile/cygprofile_utils_unittest.py index 84e0a61..8fbd15e5 100755 --- a/tools/cygprofile/cygprofile_utils_unittest.py +++ b/tools/cygprofile/cygprofile_utils_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py index 96348a5..9d438cb 100755 --- a/tools/cygprofile/orderfile_generator_backend.py +++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 2013 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. @@ -29,7 +29,14 @@ import cygprofile_utils import patch_orderfile import process_profiles -import profile_android_startup + +try: + import profile_android_startup +except ImportError as e: + logging.error( + 'Import error, if this happens outside unittests, this module will ' + 'not work correctly. Error: %s', e) + import symbol_extractor
diff --git a/tools/cygprofile/orderfile_generator_backend_unittest.py b/tools/cygprofile/orderfile_generator_backend_unittest.py index 525b9bd..4d95f803 100755 --- a/tools/cygprofile/orderfile_generator_backend_unittest.py +++ b/tools/cygprofile/orderfile_generator_backend_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/patch_native_library.py b/tools/cygprofile/patch_native_library.py deleted file mode 100755 index 7fa1885..0000000 --- a/tools/cygprofile/patch_native_library.py +++ /dev/null
@@ -1,312 +0,0 @@ -#!/usr/bin/python -# 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. - -"""Patches redundant calls to function instrumentation with NOPs.""" - -import argparse -import copy -import logging -import os -import re -import struct -import subprocess -import sys - -# Python has a symbol builtin module, so the android one needs to be first in -# the import path. -_SRC_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) -sys.path.insert(0, os.path.join( - _SRC_PATH, 'third_party', 'android_platform', 'development', 'scripts')) -import symbol - -_OBJDUMP = symbol.ToolPath('objdump') -_STRIP = symbol.ToolPath('strip') - - -class SymbolData(object): - """Data about a symbol, extracted from objdump output.""" - - SYMBOL_RE = re.compile('^([0-9a-f]{8}) <(.*)>:$') - assert SYMBOL_RE.match('002dcc84 <_ZN3net8QuicTime5Delta11FromSecondsEx>:') - _BLX_RE = re.compile('^ {1,2}([0-9a-f]{6,7}):.*blx\t[0-9a-f]{6,7} <(.*)>') - assert _BLX_RE.match( - ' 2dd03e: f3f3 ee16 ' - 'blx\t6d0c6c <_ZN16content_settings14PolicyProvider27UpdateManaged' - 'DefaultSettingERKNS0_30PrefsForManagedDefaultMapEntryE+0x120>') - _BL_ENTER_RE = re.compile('^ {1,2}([0-9a-f]{6,7}):.*bl\t[0-9a-f]{6,7} ' - '<__cyg_profile_func_enter>') - _BL_EXIT_RE = re.compile('^ {1,2}([0-9a-f]{6,7}):.*bl\t[0-9a-f]{6,7} ' - '<__cyg_profile_func_exit>') - assert(_BL_ENTER_RE.match(' 1a66d84: f3ff d766 bl\t' - '2a66c54 <__cyg_profile_func_enter>')) - - def __init__(self, name, offset, bl_enter, bl_exit, blx): - """Constructor. - - Args: - name: (str) Mangled symbol name. - offset: (int) Offset into the native library - bl_enter: ([int]) List of offsets at which short jumps to the enter - instrumentation are found. - bl_exit: ([int]) List of offsets at which short jumps to the exit - instrumentation are found. - blx: ([(int, str)]) (instruction_offset, target_offset) for long jumps. - The target is encoded, for instance _ZNSt6__ndk14ceilEf+0x28. - """ - self.name = name - self.offset = offset - self.bl_enter = bl_enter - self.bl_exit = bl_exit - self.blx = blx - - @classmethod - def FromObjdumpLines(cls, lines): - """Returns an instance of SymbolData from objdump lines. - - Args: - lines: ([str]) Symbol disassembly. - """ - offset, name = cls.SYMBOL_RE.match(lines[0]).groups() - symbol_data = cls(name, int(offset, 16), [], [], []) - for line in lines[1:]: - if cls._BL_ENTER_RE.match(line): - offset = int(cls._BL_ENTER_RE.match(line).group(1), 16) - symbol_data.bl_enter.append(offset) - elif cls._BL_EXIT_RE.match(line): - offset = int(cls._BL_EXIT_RE.match(line).group(1), 16) - symbol_data.bl_exit.append(offset) - elif cls._BLX_RE.match(line): - offset, name = cls._BLX_RE.match(line).groups() - offset = int(offset, 16) - symbol_data.blx.append((offset, name)) - return symbol_data - - -def RunObjdumpAndParse(native_library_filename): - """Calls Objdump and parses its output. - - Args: - native_library_filename: (str) Path to the natve library. - - Returns: - [SymbolData] - """ - p = subprocess.Popen([_OBJDUMP, '-d', native_library_filename, '-j', '.text'], - stdout=subprocess.PIPE, bufsize=-1) - result = [] - # Skip initial blank lines. - while not p.stdout.readline().startswith('Disassembly of section .text'): - continue - - next_line = p.stdout.readline() - while True: - if not next_line: - break - # skip to new symbol - while not SymbolData.SYMBOL_RE.match(next_line): - next_line = p.stdout.readline() - - symbol_lines = [next_line] - next_line = p.stdout.readline() - while next_line.strip(): - symbol_lines.append(next_line) - next_line = p.stdout.readline() - result.append(SymbolData.FromObjdumpLines(symbol_lines)) - # EOF - p.wait() - return result - - -def ResolveBlxTargets(symbols_data, native_lib_filename): - """Parses the binary, and resolves all targets of long jumps. - - Args: - symbols_data: ([SymbolData]) As returned by RunObjdumpAndParse(). - native_lib_filename: (str) Path to the unstripped native library. - - Returns: - {"blx_target_name": "actual jump target symbol name"} - """ - blx_targets = set() - blx_target_to_offset = {} - for symbol_data in symbols_data: - for (_, target) in symbol_data.blx: - blx_targets.add(target) - logging.info('Found %d distinct BLX targets', len(blx_targets)) - name_to_offset = {s.name: s.offset for s in symbols_data} - offset_to_name = {s.offset: s.name for s in symbols_data} - unmatched_count = 0 - for target in blx_targets: - if '+' not in target: - continue - # FunkySymbolName+0x12bc - name, offset = target.split('+') - if name not in name_to_offset: - unmatched_count += 1 - continue - offset = int(offset, 16) - absolute_offset = name_to_offset[name] + offset - blx_target_to_offset[target] = absolute_offset - logging.info('Unmatched BLX offsets: %d', unmatched_count) - - logging.info('Reading the native library') - content = bytearray(open(native_lib_filename, 'rb').read()) - - # Expected instructions are: - # ldr r12, [pc, #4] # Here + 12 - # add r12, pc, r12 - # bx r12 - # Some offset. (4 bytes) - # Note that the first instructions loads from pc + 8 + 4, per ARM - # documentation. See - # http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473e/Cacdbfji.html - # Reversed for little endian. - ldr_r12_constant = bytearray(b'\xe5\x9f\xc0\x04'[::-1]) - unmatched_loads_count = 0 - add_r12_pc_r12 = bytearray(b'\xe0\x8f\xc0\x0c'[::-1]) - unmatched_adds_count = 0 - bx_r12 = bytearray(b'\xe1\x2f\xff\x1c'[::-1]) - unmatched_bx_count = 0 - unmatched_targets_count = 0 - blx_target_name_to_symbol = {} - for (target_name, offset) in blx_target_to_offset.items(): - actual_bytes = content[offset:offset+4] - if actual_bytes != ldr_r12_constant: - unmatched_loads_count += 1 - continue - actual_bytes = content[offset+4:offset+8] - if actual_bytes != add_r12_pc_r12: - unmatched_adds_count += 1 - continue - actual_bytes = content[offset+8:offset+12] - if actual_bytes != bx_r12: - unmatched_bx_count += 1 - continue - # Congratulations, you've passed all the tests. The next value must be - # an offset. - offset_bytearray = content[offset+12:offset+16] - offset_from_pc = struct.unpack('<i', offset_bytearray)[0] - # Jumping to THUMB code, last bit is set to 1 to indicate the instruction - # set. The actual address is aligned on 4 bytes though. - assert offset_from_pc & 1 - offset_from_pc &= ~1 - if offset_from_pc % 4: - unmatched_targets_count += 1 - continue - # PC points 8 bytes ahead of the ADD instruction, which is itself 4 bytes - # ahead of the jump target. Add 8 + 4 bytes to the destination. - target_offset = offset + offset_from_pc + 8 + 4 - if target_offset not in offset_to_name: - unmatched_targets_count += 1 - continue - blx_target_name_to_symbol[target_name] = offset_to_name[target_offset] - logging.info('Unmatched instruction sequence = %d %d %d', - unmatched_loads_count, unmatched_adds_count, unmatched_bx_count) - logging.info('Unmatched targets = %d', unmatched_targets_count) - return blx_target_name_to_symbol - - -def FindDuplicatedInstrumentationCalls(symbols_data, blx_target_to_symbol_name): - """Finds the extra instrumentation calls. - - Besides not needing the exit instrumentation calls, each function should only - contain one instrumentation call. However since instrumentation calls are - inserted before inlining, some functions contain tens of them. This function - returns the location of the instrumentation calls except the first one, for - all functions. - - Args: - symbols_data: As returned by RunObjdumpAndParse(). - blx_target_to_symbol_name: ({str: str}) As returned by ResolveBlxTargets(). - - Returns: - [int] A list of offsets containing duplicated instrumentation calls. - """ - offsets_to_patch = [] - # Instrumentation calls can be short (bl) calls, or long calls. - # In the second case, the compiler inserts a call using blx to a location - # containing trampoline code. The disassembler doesn't know about that, so - # we use the resolved locations. - for symbol_data in symbols_data: - enter_call_offsets = copy.deepcopy(symbol_data.bl_enter) - exit_call_offsets = copy.deepcopy(symbol_data.bl_exit) - for (offset, target) in symbol_data.blx: - if target not in blx_target_to_symbol_name: - continue - final_target = blx_target_to_symbol_name[target] - if final_target == '__cyg_profile_func_enter': - enter_call_offsets.append(offset) - elif final_target == '__cyg_profile_func_exit': - exit_call_offsets.append(offset) - offsets_to_patch += exit_call_offsets - # Not the first one. - offsets_to_patch += sorted(enter_call_offsets)[1:] - return sorted(offsets_to_patch) - - -def PatchBinary(filename, output_filename, offsets): - """Inserts 4-byte NOPs inside the native library at a list of offsets. - - Args: - filename: (str) File to patch. - output_filename: (str) Path to the patched file. - offsets: ([int]) List of offsets to patch in the binary. - """ - # NOP.w is 0xf3 0xaf 0x80 0x00 for THUMB-2, but the CPU is little endian, - # so reverse bytes (but 2 bytes at a time). - _THUMB_2_NOP = bytearray('\xaf\xf3\x00\x80') - content = bytearray(open(filename, 'rb').read()) - for offset in offsets: - # TODO(lizeb): Assert that it's a BL or BLX - content[offset:offset+4] = _THUMB_2_NOP - open(output_filename, 'wb').write(content) - - -def StripLibrary(unstripped_library_filename): - """Strips a native library. - - Args: - unstripped_library_filename: (str) Path to the library to strip in place. - """ - subprocess.call([_STRIP, unstripped_library_filename]) - - -def Go(build_directory): - unstripped_library_filename = os.path.join(build_directory, 'lib.unstripped', - 'libchrome.so') - logging.info('Running objdump') - symbols_data = RunObjdumpAndParse(unstripped_library_filename) - logging.info('Symbols = %d', len(symbols_data)) - - blx_target_to_symbol_name = ResolveBlxTargets(symbols_data, - unstripped_library_filename) - offsets = FindDuplicatedInstrumentationCalls(symbols_data, - blx_target_to_symbol_name) - logging.info('%d offsets to patch', len(offsets)) - patched_library_filename = unstripped_library_filename + '.patched' - logging.info('Patching the library') - PatchBinary(unstripped_library_filename, patched_library_filename, offsets) - logging.info('Stripping the patched library') - StripLibrary(patched_library_filename) - stripped_library_filename = os.path.join(build_directory, 'libchrome.so') - os.rename(patched_library_filename, stripped_library_filename) - - -def CreateArgumentParser(): - parser = argparse.ArgumentParser(description='Patch the native library') - parser.add_argument('--build_directory', type=str, required=True) - return parser - - -def main(): - logging.basicConfig(level=logging.INFO, - format='%(asctime)s %(levelname)s:%(message)s') - parser = CreateArgumentParser() - args = parser.parse_args() - Go(args.build_directory) - - -if __name__ == '__main__': - main()
diff --git a/tools/cygprofile/patch_native_library_unittest.py b/tools/cygprofile/patch_native_library_unittest.py deleted file mode 100644 index d9f4249..0000000 --- a/tools/cygprofile/patch_native_library_unittest.py +++ /dev/null
@@ -1,57 +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. - -"""Unit tests for patch_native_library.py.""" - -import unittest - -import patch_native_library - - -class PatchNativeLibraryTestCase(unittest.TestCase): - _SYMBOL_LINES = """002f7ee0 <baz>: - 2f7ee0: b570 push {r4, r5, r6, lr} - 2f7ee2: 4e09 ldr r6, [pc, #36] ; (2f7f08 <baz+0x28>) - 2f7ee4: 4674 mov r4, lr - 2f7ee6: 4605 mov r5, r0 - 2f7ee8: 4621 mov r1, r4 - 2f7eea: 447e add r6, pc - 2f7eec: 4630 mov r0, r6 - 2f7eee: f7ff ffa9 bl\t2f7e44 <__cyg_profile_func_enter> - 2f7ef2: 4806 ldr r0, [pc, #24] ; (2f7f0c <baz+0x2c>) - 2f7ef4: 2101 movs r1, #1 - 2f7ef6: 4478 add r0, pc - 2f7ef8: 7001 strb r1, [r0, #0] - 2f7efa: 4630 mov r0, r6 - 2f7efc: 4621 mov r1, r4 - 2f7efe: f3f3 ef58 blx\t6ebdb0 <bar+0x5c> - 2f7f02: 4628 mov r0, r5 - 2f7f04: bd70 pop {r4, r5, r6, pc} - 2f7f06: bf00 nop - 2f7f08: fffffff3 .word 0xfffffff3 - 2f7f0c: 101bdfef .word 0x101bdfef -""" - def testSymbolDataParsing(self): - lines = self._SYMBOL_LINES.split('\n') - symbol_data = patch_native_library.SymbolData.FromObjdumpLines(lines) - self.assertEquals("baz", symbol_data.name) - self.assertEquals(int("002f7ee0", 16), symbol_data.offset) - self.assertEquals([int("2f7eee", 16)], symbol_data.bl_enter) - self.assertEquals([], symbol_data.bl_exit) - self.assertEquals([(int("2f7efe", 16), ("bar+0x5c"))], symbol_data.blx) - - def testFindDuplicatedInstrumentationCals(self): - symbols_data = [ - patch_native_library.SymbolData( - "foo", 1000, [123, 124], [125], [(126, "bar+0x12"), - (127, "foo+0x12")])] - blx_target_to_symbol_name = {"bar+0x12": "__cyg_profile_func_enter"} - offsets = patch_native_library.FindDuplicatedInstrumentationCalls( - symbols_data, blx_target_to_symbol_name) - # Not the first enter call, and not the unmatched blx. - self.assertSetEqual(set([124, 125, 126]), set(offsets)) - - -if __name__ == '__main__': - unittest.main()
diff --git a/tools/cygprofile/patch_orderfile.py b/tools/cygprofile/patch_orderfile.py index 5171c0939..273fb9e3 100755 --- a/tools/cygprofile/patch_orderfile.py +++ b/tools/cygprofile/patch_orderfile.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # Copyright 2013 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.
diff --git a/tools/cygprofile/patch_orderfile_unittest.py b/tools/cygprofile/patch_orderfile_unittest.py index 26b099fb..3f59e0d 100755 --- a/tools/cygprofile/patch_orderfile_unittest.py +++ b/tools/cygprofile/patch_orderfile_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/phased_orderfile.py b/tools/cygprofile/phased_orderfile.py index 49469de..aee4c422 100755 --- a/tools/cygprofile/phased_orderfile.py +++ b/tools/cygprofile/phased_orderfile.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # Copyright 2018 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.
diff --git a/tools/cygprofile/phased_orderfile_unittest.py b/tools/cygprofile/phased_orderfile_unittest.py old mode 100644 new mode 100755 index eaaf8ed..f2209bf --- a/tools/cygprofile/phased_orderfile_unittest.py +++ b/tools/cygprofile/phased_orderfile_unittest.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env vpython # Copyright 2018 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. @@ -77,3 +78,7 @@ opo([], [], [130, 140]), opo([10], [20, 30], [])], phaser._GetOrderfilePhaseOffsets()) + + +if __name__ == "__main__": + unittest.main()
diff --git a/tools/cygprofile/process_profiles.py b/tools/cygprofile/process_profiles.py index ba88534..12b3003 100755 --- a/tools/cygprofile/process_profiles.py +++ b/tools/cygprofile/process_profiles.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/process_profiles_unittest.py b/tools/cygprofile/process_profiles_unittest.py old mode 100644 new mode 100755 index 7d0ead7d..77fc31c --- a/tools/cygprofile/process_profiles_unittest.py +++ b/tools/cygprofile/process_profiles_unittest.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env vpython # 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.
diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py index c71fb53..47ea35f 100755 --- a/tools/cygprofile/profile_android_startup.py +++ b/tools/cygprofile/profile_android_startup.py
@@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 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.
diff --git a/tools/cygprofile/reorder_native_library.py b/tools/cygprofile/reorder_native_library.py index 428b19f..30a09d2 100755 --- a/tools/cygprofile/reorder_native_library.py +++ b/tools/cygprofile/reorder_native_library.py
@@ -1,5 +1,4 @@ -#!/usr/bin/python -# +#!/usr/bin/env vpython # Copyright 2018 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.
diff --git a/tools/cygprofile/symbol_extractor.py b/tools/cygprofile/symbol_extractor.py old mode 100755 new mode 100644 index 452548e..8cf70c3b --- a/tools/cygprofile/symbol_extractor.py +++ b/tools/cygprofile/symbol_extractor.py
@@ -1,4 +1,3 @@ -#!/usr/bin/python # 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.
diff --git a/tools/cygprofile/symbol_extractor_unittest.py b/tools/cygprofile/symbol_extractor_unittest.py index bd2db4a..f852401 100755 --- a/tools/cygprofile/symbol_extractor_unittest.py +++ b/tools/cygprofile/symbol_extractor_unittest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env vpython # 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.
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 3bc9ed6..4a4de78 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -11796,6 +11796,13 @@ <description>User pressed the back icon in the app menu.</description> </action> +<action name="MobileMenuCloseAllIncognitoTabs"> + <owner>gambard@chromium.org</owner> + <description> + User pressed 'Close all incognito tabs' in the app menu. + </description> +</action> + <action name="MobileMenuCloseAllTabs"> <owner>aurimas@chromium.org</owner> <description>User pressed 'Close all tabs' in the app menu.</description> @@ -12612,11 +12619,34 @@ <description>Please enter the description of this user action.</description> </action> +<action name="MobileToolbarShowSearchMenu"> + <owner>gambard@chromium.org</owner> + <description> + User long pressed the 'Search' button to displayed the associated menu. + </description> +</action> + <action name="MobileToolbarShowStackView"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> </action> +<action name="MobileToolbarShowTabGridMenu"> + <owner>gambard@chromium.org</owner> + <description> + User long pressed the Tab Grid button to display the menu associated with + it. + </description> +</action> + +<action name="MobileToolbarShowTabHistoryMenu"> + <owner>gambard@chromium.org</owner> + <description> + User long pressed the toolbar navigation buttons to display the tab history + menu. + </description> +</action> + <action name="MobileToolbarStackViewNewTab"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index da6818a7..15b9e30 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -62752,6 +62752,9 @@ <histogram name="PasswordManager.MultiAccountPasswordUpdateAction" enum="MultiAccountUpdateBubbleUserAction"> + <obsolete> + Deprecated 03/2018 in favor of PasswordManager.UpdateUIDismissalReason. + </obsolete> <owner>dvadym@chromium.org</owner> <summary> A user action when a password update bubble with multiple accounts is shown. @@ -63003,6 +63006,12 @@ </summary> </histogram> +<histogram name="PasswordManager.SaveUIDismissalReason" + enum="PasswordManagerUIDismissalReason"> + <owner>vasilii@chromium.org</owner> + <summary>Why was the save password UI (bubble or infobar) closed?</summary> +</histogram> + <histogram name="PasswordManager.SettingsReconciliation.InitialAndFinalValues" enum="PasswordManagerPreferencesInitialAndFinalValues"> <obsolete> @@ -63309,12 +63318,16 @@ enum="PasswordManagerUIDismissalReason"> <owner>vasilii@chromium.org</owner> <summary> - Why was the password manager's UI (bubble or infobar) closed? + Why was the password manager's UI (bubble or infobar) closed? Save and + update UI are tracked separately. </summary> </histogram> <histogram name="PasswordManager.UpdatePasswordSubmissionEvent" enum="UpdatePasswordSubmissionEvent"> + <obsolete> + Deprecated 03/2018 in favor of PasswordManager.UpdateUIDismissalReason. + </obsolete> <owner>dvadym@chromium.org</owner> <owner>vasilii@chromium.org</owner> <summary> @@ -63329,6 +63342,12 @@ </summary> </histogram> +<histogram name="PasswordManager.UpdateUIDismissalReason" + enum="PasswordManagerUIDismissalReason"> + <owner>vasilii@chromium.org</owner> + <summary>Why was the update password UI (bubble or infobar) closed?</summary> +</histogram> + <histogram name="PasswordManager.UsernameCorrectionFound" enum="BooleanUsernameCorrectionVote"> <owner>kolos@chromium.org</owner>
diff --git a/tools/perf/benchmarks/loading_metrics_category.py b/tools/perf/benchmarks/loading_metrics_category.py index 4c9e5a9d..1e9c149 100644 --- a/tools/perf/benchmarks/loading_metrics_category.py +++ b/tools/perf/benchmarks/loading_metrics_category.py
@@ -22,5 +22,9 @@ # necessary to compute time-to-interactive. cat_filter.AddIncludedCategory('toplevel') + # "network" category is used to capture ResourceLoad events necessary to + # properly compute time-to-interactive. + cat_filter.AddDisabledByDefault('disabled-by-default-network') + tbm_options.AddTimelineBasedMetric('loadingMetric') return tbm_options
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index 9fc8840..58e3b94 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -54,9 +54,6 @@ crbug.com/736817 [ Nexus_5X ] blink_perf.svg/FlowerFromMyGarden.html [ Skip ] crbug.com/736817 [ Nexus_5X ] blink_perf.svg/SvgNestedUse.html [ Skip ] -# Benchmark: jetstream -crbug.com/825224 [ Android_One ] jetstream/http://browserbench.org/JetStream/ [ Skip ] - # Benchmark: loading.desktop crbug.com/723783 [ Win ] loading.desktop/Orange [ Skip ] crbug.com/752611 [ Linux ] loading.desktop/uol.com.br [ Skip ] @@ -94,7 +91,7 @@ crbug.com/611167 [ Android_Svelte ] memory.long_running_idle_gmail_background_tbmv2/* [ Skip ] # Benchmark: octane -[ Android_One ] octane/http://chromium.github.io/octane/index.html?auto=1 [ Skip ] +crbug.com/764875 [ Android_One ] octane/http://chromium.github.io/octane/index.html?auto=1 [ Skip ] # Benchmark: oilpan_gc_times.key_silk_cases crbug.com/446332 [ All ] oilpan_gc_times.key_silk_cases/inbox_app.html?slide_drawer [ Skip ]
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc index ac903da0..476f69f 100644 --- a/ui/ozone/platform/x11/ozone_platform_x11.cc +++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -108,15 +108,12 @@ private: // Performs initialization steps need by both UI and GPU. void InitializeCommon(const InitParams& params) { + // TODO(kylechar): Add DCHECK we only enter InitializeCommon() twice for + // single process mode. if (common_initialized_) return; - // If XOpenDisplay() failed there is nothing we can do. Crash here instead - // of crashing later. If you are crashing here, make sure there is an X - // server running and $DISPLAY is set. - CHECK(gfx::GetXDisplay()) << "Missing X server or $DISPLAY"; - - // Always initialize in multi-thread mode, since this is used only during + // Always initialze in multi-thread mode, since this is used only during // development. XInitThreads();
diff --git a/ui/views/controls/focus_ring.h b/ui/views/controls/focus_ring.h index f6ecc2a..9350679 100644 --- a/ui/views/controls/focus_ring.h +++ b/ui/views/controls/focus_ring.h
@@ -7,13 +7,14 @@ #include "ui/native_theme/native_theme.h" #include "ui/views/view.h" +#include "ui/views/views_export.h" namespace views { // FocusRing is a View that is designed to act as an indicator of focus for its // parent. It is a stand-alone view that paints to a layer which extends beyond // the bounds of its parent view. -class FocusRing : public View { +class VIEWS_EXPORT FocusRing : public View { public: static const char kViewClassName[];