diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py index 7bee07b4..b4f04517 100755 --- a/build/android/resource_sizes.py +++ b/build/android/resource_sizes.py
@@ -827,8 +827,6 @@ dest='dump_sis', help='Run dump-static-initializers.py to get the list' 'of static initializers (slow).') - argparser.add_argument('-d', '--device', - help='Dummy option for perf runner.') argparser.add_argument('--estimate-patch-size', action='store_true', help='Include patch size estimates. Useful for perf '
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsSheetVisibilityChangeObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsSheetVisibilityChangeObserverTest.java index e809870..6b50c2d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsSheetVisibilityChangeObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsSheetVisibilityChangeObserverTest.java
@@ -27,6 +27,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.Restriction; +import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ntp.NtpUiCaptureTestData; @@ -132,6 +133,7 @@ @Test @MediumTest + @RetryOnFailure public void testHomeSheetVisibilityOnNewTab() { // Show the new tab view ThreadUtils.runOnUiThreadBlocking(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java index 424e7add..5a980dd8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java
@@ -87,11 +87,14 @@ } @Test - @SmallTest - @Feature({"Webapps"}) - @RetryOnFailure - @MinAndroidSdkLevel(Build.VERSION_CODES.M) // NotificationManager.getActiveNotifications - @CommandLineFlags.Add({"enable-features=" + ChromeFeatureList.PWA_PERSISTENT_NOTIFICATION}) + /* + @SmallTest + @Feature({"Webapps"}) + @RetryOnFailure + @MinAndroidSdkLevel(Build.VERSION_CODES.M) // NotificationManager.getActiveNotifications + @CommandLineFlags.Add({"enable-features=" + ChromeFeatureList.PWA_PERSISTENT_NOTIFICATION}) + */ + @DisabledTest(message = "crbug.com/774491") public void testNotification_copyUrl() throws Exception { Notification notification = getWebappNotification(); Assert.assertNotNull(notification);
diff --git a/chrome/app/md_extensions_strings.grdp b/chrome/app/md_extensions_strings.grdp index f41c7f7..2fe1dd7 100644 --- a/chrome/app/md_extensions_strings.grdp +++ b/chrome/app/md_extensions_strings.grdp
@@ -22,6 +22,9 @@ <message name="IDS_MD_EXTENSIONS_ERROR_STACK_TRACE" desc="The label for the stack trace of an extension's error."> Stack Trace </message> + <message name="IDS_MD_EXTENSIONS_LEARN_MORE" desc="Learn more text"> + Learn more + </message> <message name="IDS_MD_EXTENSIONS_ITEM_ERRORS" desc="The label of the button to bring the user to the page showing an extension's errors."> Errors </message>
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc index 220cbcf..df43fa0 100644 --- a/chrome/browser/chromeos/tether/tether_service.cc +++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -17,7 +17,7 @@ #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" -#include "chromeos/components/tether/initializer_impl.h" +#include "chromeos/components/tether/tether_component_impl.h" #include "chromeos/network/network_connect.h" #include "chromeos/network/network_type_pattern.h" #include "components/cryptauth/cryptauth_service.h" @@ -64,7 +64,7 @@ registry->RegisterBooleanPref(prefs::kInstantTetheringBleAdvertisingSupported, true); - chromeos::tether::InitializerImpl::RegisterProfilePrefs(registry); + chromeos::tether::TetherComponentImpl::RegisterProfilePrefs(registry); } // static @@ -123,9 +123,7 @@ weak_ptr_factory_(this) { power_manager_client_->AddObserver(this); session_manager_client_->AddObserver(this); - cryptauth_service_->GetCryptAuthDeviceManager()->AddObserver(this); - network_state_handler_->AddObserver(this, FROM_HERE); registrar_.Init(profile_->GetPrefs()); @@ -133,6 +131,11 @@ base::Bind(&TetherService::OnPrefsChanged, weak_ptr_factory_.GetWeakPtr())); + UMA_HISTOGRAM_BOOLEAN("InstantTethering.UserPreference.OnStartup", + IsEnabledbyPreference()); + PA_LOG(INFO) << "TetherService has started. Initial user preference value: " + << IsEnabledbyPreference(); + // GetAdapter may call OnBluetoothAdapterFetched immediately which can cause // problems with the Fake implementation since the class is not fully // constructed yet. Post the GetAdapter call to avoid this. @@ -144,8 +147,8 @@ } TetherService::~TetherService() { - if (initializer_) - initializer_->RemoveObserver(this); + if (tether_component_) + tether_component_->RemoveObserver(this); } void TetherService::StartTetherIfPossible() { @@ -154,29 +157,33 @@ return; } - // Do not initialize the Tether component if it already exists. - if (initializer_) + // Do not initialize the TetherComponent if it already exists. + if (tether_component_) return; - PA_LOG(INFO) << "Starting up Tether component."; - initializer_ = chromeos::tether::InitializerImpl::Factory::NewInstance( - cryptauth_service_, notification_presenter_.get(), profile_->GetPrefs(), - network_state_handler_, - chromeos::NetworkHandler::Get()->managed_network_configuration_handler(), - chromeos::NetworkConnect::Get(), - chromeos::NetworkHandler::Get()->network_connection_handler(), adapter_); + PA_LOG(INFO) << "Starting up TetherComponent."; + tether_component_ = + chromeos::tether::TetherComponentImpl::Factory::NewInstance( + cryptauth_service_, notification_presenter_.get(), + profile_->GetPrefs(), network_state_handler_, + chromeos::NetworkHandler::Get() + ->managed_network_configuration_handler(), + chromeos::NetworkConnect::Get(), + chromeos::NetworkHandler::Get()->network_connection_handler(), + adapter_); } void TetherService::StopTetherIfNecessary() { - if (!initializer_ || - initializer_->status() != chromeos::tether::Initializer::Status::ACTIVE) { + if (!tether_component_ || + tether_component_->status() != + chromeos::tether::TetherComponent::Status::ACTIVE) { return; } - PA_LOG(INFO) << "Shutting down Tether component."; + PA_LOG(INFO) << "Shutting down TetherComponent."; - initializer_->AddObserver(this); - initializer_->RequestShutdown(); + tether_component_->AddObserver(this); + tether_component_->RequestShutdown(); } void TetherService::Shutdown() { @@ -211,12 +218,12 @@ void TetherService::SuspendDone(const base::TimeDelta& sleep_duration) { suspended_ = false; - // If there was a previous Initializer instance in the process of an + // If there was a previous TetherComponent instance in the process of an // asynchronous shutdown, that session is stale by this point. Kill it now, so // that the next session can start up immediately. - if (initializer_) { - initializer_->RemoveObserver(this); - initializer_.reset(); + if (tether_component_) { + tether_component_->RemoveObserver(this); + tether_component_.reset(); } UpdateTetherTechnologyState(); @@ -283,20 +290,23 @@ if (is_enabled != was_pref_enabled) { profile_->GetPrefs()->SetBoolean(prefs::kInstantTetheringEnabled, is_enabled); + UMA_HISTOGRAM_BOOLEAN("InstantTethering.UserPreference.OnToggle", + is_enabled); + PA_LOG(INFO) << "Tether user preference changed. New value: " << is_enabled; } UpdateTetherTechnologyState(); } void TetherService::OnShutdownComplete() { - DCHECK(initializer_->status() == - chromeos::tether::Initializer::Status::SHUT_DOWN); - initializer_->RemoveObserver(this); - initializer_.reset(); - PA_LOG(INFO) << "Tether component was shut down."; + DCHECK(tether_component_->status() == + chromeos::tether::TetherComponent::Status::SHUT_DOWN); + tether_component_->RemoveObserver(this); + tether_component_.reset(); + PA_LOG(INFO) << "TetherComponent was shut down."; // It is possible that the Tether TechnologyState was set to ENABLED while the - // previous Initializer instance was shutting down. If that was the case, - // restart the Tether component. + // previous TetherComponent instance was shutting down. If that was the case, + // restart TetherComponent. if (!shut_down_) StartTetherIfPossible(); } @@ -328,7 +338,7 @@ StartTetherIfPossible(); } else { // If Tether should not be enabled, shut down the component before notifying - // NetworkStateHandler. This ensures that nothing in the Tether component + // NetworkStateHandler. This ensures that nothing in TetherComponent // attempts to edit Tether networks or properties when the network stack is // not ready for them. StopTetherIfNecessary();
diff --git a/chrome/browser/chromeos/tether/tether_service.h b/chrome/browser/chromeos/tether/tether_service.h index c2ba070..4226042 100644 --- a/chrome/browser/chromeos/tether/tether_service.h +++ b/chrome/browser/chromeos/tether/tether_service.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/initializer.h" +#include "chromeos/components/tether/tether_component.h" #include "chromeos/dbus/power_manager_client.h" #include "chromeos/dbus/session_manager_client.h" #include "chromeos/network/network_state_handler.h" @@ -41,7 +41,7 @@ public cryptauth::CryptAuthDeviceManager::Observer, public device::BluetoothAdapter::Observer, public chromeos::NetworkStateHandlerObserver, - public chromeos::tether::Initializer::Observer { + public chromeos::tether::TetherComponent::Observer { public: TetherService(Profile* profile, chromeos::PowerManagerClient* power_manager_client, @@ -88,7 +88,7 @@ // chromeos::NetworkStateHandlerObserver: void DeviceListChanged() override; - // chromeos::tether::Initializer::Observer: + // chromeos::tether::TetherComponent::Observer: void OnShutdownComplete() override; // Callback when the controlling pref changes. @@ -227,7 +227,7 @@ chromeos::NetworkStateHandler* network_state_handler_; std::unique_ptr<chromeos::tether::NotificationPresenter> notification_presenter_; - std::unique_ptr<chromeos::tether::Initializer> initializer_; + std::unique_ptr<chromeos::tether::TetherComponent> tether_component_; PrefChangeRegistrar registrar_; scoped_refptr<device::BluetoothAdapter> adapter_;
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/chromeos/tether/tether_service_unittest.cc index 09ca3c7..7813705 100644 --- a/chrome/browser/chromeos/tether/tether_service_unittest.cc +++ b/chrome/browser/chromeos/tether/tether_service_unittest.cc
@@ -20,9 +20,9 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/chromeos_switches.h" -#include "chromeos/components/tether/fake_initializer.h" #include "chromeos/components/tether/fake_notification_presenter.h" -#include "chromeos/components/tether/initializer_impl.h" +#include "chromeos/components/tether/fake_tether_component.h" +#include "chromeos/components/tether/tether_component_impl.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_power_manager_client.h" #include "chromeos/dbus/fake_session_manager_client.h" @@ -128,15 +128,15 @@ int updated_technology_state_count_ = 0; }; -class FakeInitializerWithDestructorCallback - : public chromeos::tether::FakeInitializer { +class FakeTetherComponentWithDestructorCallback + : public chromeos::tether::FakeTetherComponent { public: - FakeInitializerWithDestructorCallback( + FakeTetherComponentWithDestructorCallback( const base::Closure& destructor_callback) - : FakeInitializer(false /* has_asynchronous_shutdown */), + : FakeTetherComponent(false /* has_asynchronous_shutdown */), destructor_callback_(destructor_callback) {} - ~FakeInitializerWithDestructorCallback() override { + ~FakeTetherComponentWithDestructorCallback() override { destructor_callback_.Run(); } @@ -144,19 +144,19 @@ base::Closure destructor_callback_; }; -class TestInitializerFactory final - : public chromeos::tether::InitializerImpl::Factory { +class TestTetherComponentFactory final + : public chromeos::tether::TetherComponentImpl::Factory { public: - TestInitializerFactory() {} + TestTetherComponentFactory() {} - // Returns nullptr if no Initializer has been created or if the last one that - // was created has already been deleted. - FakeInitializerWithDestructorCallback* active_initializer() { - return active_initializer_; + // Returns nullptr if no TetherComponent has been created or if the last one + // that was created has already been deleted. + FakeTetherComponentWithDestructorCallback* active_tether_component() { + return active_tether_component_; } - // chromeos::tether::InitializerImpl::Factory: - std::unique_ptr<chromeos::tether::Initializer> BuildInstance( + // chromeos::tether::TetherComponentImpl::Factory: + std::unique_ptr<chromeos::tether::TetherComponent> BuildInstance( cryptauth::CryptAuthService* cryptauth_service, chromeos::tether::NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -166,16 +166,16 @@ chromeos::NetworkConnect* network_connect, chromeos::NetworkConnectionHandler* network_connection_handler, scoped_refptr<device::BluetoothAdapter> adapter) override { - active_initializer_ = new FakeInitializerWithDestructorCallback( - base::Bind(&TestInitializerFactory::OnActiveInitializerDeleted, + active_tether_component_ = new FakeTetherComponentWithDestructorCallback( + base::Bind(&TestTetherComponentFactory::OnActiveTetherComponentDeleted, base::Unretained(this))); - return base::WrapUnique(active_initializer_); + return base::WrapUnique(active_tether_component_); } private: - void OnActiveInitializerDeleted() { active_initializer_ = nullptr; } + void OnActiveTetherComponentDeleted() { active_tether_component_ = nullptr; } - FakeInitializerWithDestructorCallback* active_initializer_ = nullptr; + FakeTetherComponentWithDestructorCallback* active_tether_component_ = nullptr; }; } // namespace @@ -223,9 +223,10 @@ .WillByDefault(Invoke(this, &TetherServiceTest::IsBluetoothPowered)); device::BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); - test_initializer_factory_ = base::WrapUnique(new TestInitializerFactory()); - chromeos::tether::InitializerImpl::Factory::SetInstanceForTesting( - test_initializer_factory_.get()); + test_tether_component_factory_ = + base::WrapUnique(new TestTetherComponentFactory()); + chromeos::tether::TetherComponentImpl::Factory::SetInstanceForTesting( + test_tether_component_factory_.get()); } void TearDown() override { @@ -330,8 +331,9 @@ } void VerifyTetherActiveStatus(bool expected_active) { - EXPECT_EQ(expected_active, - test_initializer_factory_->active_initializer() != nullptr); + EXPECT_EQ( + expected_active, + test_tether_component_factory_->active_tether_component() != nullptr); } const content::TestBrowserThreadBundle thread_bundle_; @@ -343,7 +345,7 @@ std::unique_ptr<TestingPrefServiceSimple> test_pref_service_; std::unique_ptr<NiceMock<MockCryptAuthDeviceManager>> mock_cryptauth_device_manager_; - std::unique_ptr<TestInitializerFactory> test_initializer_factory_; + std::unique_ptr<TestTetherComponentFactory> test_tether_component_factory_; chromeos::tether::FakeNotificationPresenter* fake_notification_presenter_; base::MockTimer* mock_timer_; std::unique_ptr<cryptauth::FakeCryptAuthService> fake_cryptauth_service_; @@ -385,7 +387,7 @@ VerifyTetherActiveStatus(true /* expected_active */); // Use an asynchronous shutdown. - test_initializer_factory_->active_initializer() + test_tether_component_factory_->active_tether_component() ->set_has_asynchronous_shutdown(true); // Disable the Tether preference. This should trigger the asynchrnous @@ -394,8 +396,9 @@ // Tether should be active, but shutting down. VerifyTetherActiveStatus(true /* expected_active */); - EXPECT_EQ(chromeos::tether::Initializer::Status::SHUTTING_DOWN, - test_initializer_factory_->active_initializer()->status()); + EXPECT_EQ( + chromeos::tether::TetherComponent::Status::SHUTTING_DOWN, + test_tether_component_factory_->active_tether_component()->status()); // Tether should be AVAILABLE. EXPECT_EQ( @@ -404,8 +407,9 @@ chromeos::NetworkTypePattern::Tether())); // Complete the shutdown process; TetherService should delete its - // Initializer instance. - test_initializer_factory_->active_initializer()->FinishAsynchronousShutdown(); + // TetherComponent instance. + test_tether_component_factory_->active_tether_component() + ->FinishAsynchronousShutdown(); VerifyTetherActiveStatus(false /* expected_active */); } @@ -814,6 +818,9 @@ EXPECT_FALSE( profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringEnabled)); VerifyTetherActiveStatus(false /* expected_active */); + histogram_tester_.ExpectBucketCount( + "InstantTethering.UserPreference.OnToggle", false, + 1u /* expected_count */); SetTetherTechnologyStateEnabled(true); EXPECT_EQ(chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED, @@ -822,6 +829,9 @@ EXPECT_TRUE( profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringEnabled)); VerifyTetherActiveStatus(true /* expected_active */); + histogram_tester_.ExpectBucketCount( + "InstantTethering.UserPreference.OnToggle", true, + 1u /* expected_count */); VerifyTetherFeatureStateRecorded(TetherService::TetherFeatureState::ENABLED, 2 /* expected_count */);
diff --git a/chrome/browser/resources/md_extensions/detail_view.html b/chrome/browser/resources/md_extensions/detail_view.html index c66a6a5..81c8294 100644 --- a/chrome/browser/resources/md_extensions/detail_view.html +++ b/chrome/browser/resources/md_extensions/detail_view.html
@@ -80,6 +80,11 @@ color: var(--paper-grey-900); } + #learn-more-link { + color: var(--google-blue-700); + text-decoration: none; + } + .section { @apply(--cr-section); } @@ -185,7 +190,13 @@ hidden$="[[!data.disableReasons.suspiciousInstall]]"> <div> <iron-icon class="warning-icon" icon="cr:warning"></iron-icon> - <span>$i18n{itemSuspiciousInstall}</span> + <span> + $i18n{itemSuspiciousInstall} + <a target="_blank" id="learn-more-link" + href="$i18n{suspiciousInstallHelpUrl}"> + $i18n{learnMore} + </a> + </span> </div> </div> <div class="section continuation warning" id="corrupted-warning"
diff --git a/chrome/browser/resources/md_extensions/item.html b/chrome/browser/resources/md_extensions/item.html index 2f35703..f8090b51 100644 --- a/chrome/browser/resources/md_extensions/item.html +++ b/chrome/browser/resources/md_extensions/item.html
@@ -100,6 +100,11 @@ margin: 0 4px; } + #learn-more-link { + color: var(--google-blue-700); + text-decoration: none; + } + #source-indicator { -webkit-margin-start: 30px; margin-top: 30px; @@ -201,6 +206,10 @@ <div id="suspicious-warning" hidden$="[[!data.disableReasons.suspiciousInstall]]"> $i18n{itemSuspiciousInstall} + <a target="_blank" id="learn-more-link" + href="$i18n{suspiciousInstallHelpUrl}"> + $i18n{learnMore} + </a> </div> <div id="corrupted-warning" hidden$="[[!data.disableReasons.corruptInstall]]">
diff --git a/chrome/browser/ui/cocoa/new_tab_button.mm b/chrome/browser/ui/cocoa/new_tab_button.mm index bd8f593..767e405a 100644 --- a/chrome/browser/ui/cocoa/new_tab_button.mm +++ b/chrome/browser/ui/cocoa/new_tab_button.mm
@@ -338,7 +338,6 @@ NSImage* newTabButtonImage = [[[NSImage alloc] initWithSize:newTabButtonImageSize] autorelease]; - [newTabButtonImage setCacheMode:NSImageCacheAlways]; [newTabButtonImage addRepresentation:imageRep]; return newTabButtonImage;
diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc index 140aaea..0641634 100644 --- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc +++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
@@ -6,28 +6,22 @@ #include "base/macros.h" #include "base/strings/utf_string_conversions.h" -#include "build/build_config.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/search.h" -#include "chrome/browser/themes/theme_service.h" -#include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/search/instant_test_utils.h" #include "chrome/browser/ui/search/instant_uitest_base.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/webui/theme_source.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/omnibox/browser/omnibox_edit_model.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/url_data_source.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" -#include "extensions/browser/extension_registry.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" @@ -70,77 +64,6 @@ bool is_focused_; }; -// TODO(treib): There's no reason for this to be in interactive_ui_tests. Move -// it to regular browser_tests instead. -class InstantThemeTest : public ExtensionBrowserTest, public InstantTestBase { - public: - InstantThemeTest() {} - - protected: - void SetUpInProcessBrowserTestFixture() override { - ASSERT_TRUE(https_test_server().Start()); - GURL base_url = https_test_server().GetURL("/instant_extended.html"); - GURL ntp_url = https_test_server().GetURL("/instant_extended_ntp.html"); - InstantTestBase::Init(base_url, ntp_url, false); - } - - void SetUpOnMainThread() override { - ExtensionBrowserTest::SetUpOnMainThread(); - - content::URLDataSource::Add(profile(), new ThemeSource(profile())); - } - - void InstallThemeAndVerify(const std::string& theme_dir, - const std::string& theme_name) { - bool had_previous_theme = - !!ThemeServiceFactory::GetThemeForProfile(profile()); - - const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_dir); - // Themes install asynchronously so we must check the number of enabled - // extensions after theme install completes. - size_t num_before = extensions::ExtensionRegistry::Get(profile()) - ->enabled_extensions() - .size(); - content::WindowedNotificationObserver theme_change_observer( - chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - content::Source<ThemeService>( - ThemeServiceFactory::GetForProfile(profile()))); - ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( - theme_path, 1, ExtensionBrowserTest::browser())); - theme_change_observer.Wait(); - size_t num_after = extensions::ExtensionRegistry::Get(profile()) - ->enabled_extensions() - .size(); - // If a theme was already installed, we're just swapping one for another, so - // no change in extension count. - int expected_change = had_previous_theme ? 0 : 1; - EXPECT_EQ(num_before + expected_change, num_after); - - const extensions::Extension* new_theme = - ThemeServiceFactory::GetThemeForProfile(profile()); - ASSERT_NE(nullptr, new_theme); - ASSERT_EQ(new_theme->name(), theme_name); - } - - // Loads a named image from |image_url| in the given |tab|. |loaded| - // returns whether the image was able to load without error. - // The method returns true if the JavaScript executed cleanly. - bool LoadImage(content::WebContents* tab, - const GURL& image_url, - bool* loaded) { - std::string js_chrome = - "var img = document.createElement('img');" - "img.onerror = function() { domAutomationController.send(false); };" - "img.onload = function() { domAutomationController.send(true); };" - "img.src = '" + - image_url.spec() + "';"; - return content::ExecuteScriptAndExtractBool(tab, js_chrome, loaded); - } - - private: - DISALLOW_COPY_AND_ASSIGN(InstantThemeTest); -}; - // Test to verify that switching tabs should not dispatch onmostvisitedchanged // events. IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NoMostVisitedChangedOnTabSwitch) { @@ -173,111 +96,6 @@ EXPECT_EQ(1, on_most_visited_change_calls_); } -IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeBackgroundAccess) { - ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); - ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); - - ui_test_utils::NavigateToURLWithDisposition( - browser(), GURL(chrome::kChromeUINewTabURL), - WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - - // The "Instant" New Tab should have access to chrome-search: scheme but not - // chrome: scheme. - const GURL chrome_url("chrome://theme/IDR_THEME_NTP_BACKGROUND"); - const GURL search_url("chrome-search://theme/IDR_THEME_NTP_BACKGROUND"); - content::WebContents* tab = - browser()->tab_strip_model()->GetActiveWebContents(); - bool loaded = false; - ASSERT_TRUE(LoadImage(tab, chrome_url, &loaded)); - EXPECT_FALSE(loaded) << chrome_url; - ASSERT_TRUE(LoadImage(tab, search_url, &loaded)); - EXPECT_TRUE(loaded) << search_url; -} - -// Flaky on all bots. http://crbug.com/335297. -IN_PROC_BROWSER_TEST_F(InstantThemeTest, - DISABLED_NoThemeBackgroundChangeEventOnTabSwitch) { - ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); - - // Install a theme. - ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); - ASSERT_EQ(1, browser()->tab_strip_model()->count()); - - // Open new tab. - ui_test_utils::NavigateToURLWithDisposition( - browser(), GURL(chrome::kChromeUINewTabURL), - WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - ASSERT_EQ(2, browser()->tab_strip_model()->count()); - - // Make sure the tab did not receive an onthemechange event for the - // already-installed theme. (An event *is* sent, but that happens before the - // page can register its handler.) - content::WebContents* active_tab = - browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); - int on_theme_changed_calls = 0; - ASSERT_TRUE(instant_test_utils::GetIntFromJS( - active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); - EXPECT_EQ(0, on_theme_changed_calls); - - // Activate the previous tab. - browser()->tab_strip_model()->ActivateTabAt(0, false); - ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); - - // Switch back to new tab. - browser()->tab_strip_model()->ActivateTabAt(1, false); - ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); - - // Confirm that new tab got no onthemechange event while switching tabs. - active_tab = browser()->tab_strip_model()->GetActiveWebContents(); - on_theme_changed_calls = 0; - ASSERT_TRUE(instant_test_utils::GetIntFromJS( - active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); - EXPECT_EQ(0, on_theme_changed_calls); -} - -// Flaky on all bots. http://crbug.com/335297, http://crbug.com/265971. -IN_PROC_BROWSER_TEST_F(InstantThemeTest, - DISABLED_SendThemeBackgroundChangedEvent) { - ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); - - // Install a theme. - ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); - ASSERT_EQ(1, browser()->tab_strip_model()->count()); - - // Open new tab. - ui_test_utils::NavigateToURLWithDisposition( - browser(), GURL(chrome::kChromeUINewTabURL), - WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - ASSERT_EQ(2, browser()->tab_strip_model()->count()); - - // Make sure the tab did not receive an onthemechange event for the - // already-installed theme. (An event *is* sent, but that happens before the - // page can register its handler.) - content::WebContents* active_tab = - browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); - int on_theme_changed_calls = 0; - ASSERT_TRUE(instant_test_utils::GetIntFromJS( - active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); - EXPECT_EQ(0, on_theme_changed_calls); - - // Install a different theme. - ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme2", "snowflake theme")); - - // Confirm that the new tab got notified about the theme changed event. - on_theme_changed_calls = 0; - ASSERT_TRUE(instant_test_utils::GetIntFromJS( - active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); - EXPECT_EQ(1, on_theme_changed_calls); -} - // Flaky on all bots since re-enabled in r208032, crbug.com/253092 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DISABLED_NavigateBackToNTP) { ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
diff --git a/chrome/browser/ui/search/instant_theme_browsertest.cc b/chrome/browser/ui/search/instant_theme_browsertest.cc new file mode 100644 index 0000000..d045d5e3 --- /dev/null +++ b/chrome/browser/ui/search/instant_theme_browsertest.cc
@@ -0,0 +1,199 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/macros.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/extensions/extension_browsertest.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/search/instant_test_base.h" +#include "chrome/browser/ui/search/instant_test_utils.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/webui/theme_source.h" +#include "chrome/common/url_constants.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "content/public/browser/url_data_source.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_utils.h" +#include "extensions/browser/extension_registry.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "testing/gtest/include/gtest/gtest.h" + +class InstantThemeTest : public ExtensionBrowserTest, public InstantTestBase { + public: + InstantThemeTest() {} + + protected: + void SetUpInProcessBrowserTestFixture() override { + ASSERT_TRUE(https_test_server().Start()); + GURL base_url = https_test_server().GetURL("/instant_extended.html"); + GURL ntp_url = https_test_server().GetURL("/instant_extended_ntp.html"); + InstantTestBase::Init(base_url, ntp_url, false); + } + + void SetUpOnMainThread() override { + ExtensionBrowserTest::SetUpOnMainThread(); + + content::URLDataSource::Add(profile(), new ThemeSource(profile())); + } + + void InstallThemeAndVerify(const std::string& theme_dir, + const std::string& theme_name) { + bool had_previous_theme = + !!ThemeServiceFactory::GetThemeForProfile(profile()); + + const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_dir); + // Themes install asynchronously so we must check the number of enabled + // extensions after theme install completes. + size_t num_before = extensions::ExtensionRegistry::Get(profile()) + ->enabled_extensions() + .size(); + content::WindowedNotificationObserver theme_change_observer( + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, + content::Source<ThemeService>( + ThemeServiceFactory::GetForProfile(profile()))); + ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( + theme_path, 1, ExtensionBrowserTest::browser())); + theme_change_observer.Wait(); + size_t num_after = extensions::ExtensionRegistry::Get(profile()) + ->enabled_extensions() + .size(); + // If a theme was already installed, we're just swapping one for another, so + // no change in extension count. + int expected_change = had_previous_theme ? 0 : 1; + EXPECT_EQ(num_before + expected_change, num_after); + + const extensions::Extension* new_theme = + ThemeServiceFactory::GetThemeForProfile(profile()); + ASSERT_NE(nullptr, new_theme); + ASSERT_EQ(new_theme->name(), theme_name); + } + + // Loads a named image from |image_url| in the given |tab|. |loaded| + // returns whether the image was able to load without error. + // The method returns true if the JavaScript executed cleanly. + bool LoadImage(content::WebContents* tab, + const GURL& image_url, + bool* loaded) { + std::string js_chrome = + "var img = document.createElement('img');" + "img.onerror = function() { domAutomationController.send(false); };" + "img.onload = function() { domAutomationController.send(true); };" + "img.src = '" + + image_url.spec() + "';"; + return content::ExecuteScriptAndExtractBool(tab, js_chrome, loaded); + } + + private: + DISALLOW_COPY_AND_ASSIGN(InstantThemeTest); +}; + +IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeBackgroundAccess) { + ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); + ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); + + ui_test_utils::NavigateToURLWithDisposition( + browser(), GURL(chrome::kChromeUINewTabURL), + WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + + // The "Instant" New Tab should have access to chrome-search: scheme but not + // chrome: scheme. + const GURL chrome_url("chrome://theme/IDR_THEME_NTP_BACKGROUND"); + const GURL search_url("chrome-search://theme/IDR_THEME_NTP_BACKGROUND"); + content::WebContents* tab = + browser()->tab_strip_model()->GetActiveWebContents(); + bool loaded = false; + ASSERT_TRUE(LoadImage(tab, chrome_url, &loaded)); + EXPECT_FALSE(loaded) << chrome_url; + ASSERT_TRUE(LoadImage(tab, search_url, &loaded)); + EXPECT_TRUE(loaded) << search_url; +} + +// Flaky on all bots. http://crbug.com/335297. +IN_PROC_BROWSER_TEST_F(InstantThemeTest, + DISABLED_NoThemeBackgroundChangeEventOnTabSwitch) { + ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); + + // Install a theme. + ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); + ASSERT_EQ(1, browser()->tab_strip_model()->count()); + + // Open new tab. + ui_test_utils::NavigateToURLWithDisposition( + browser(), GURL(chrome::kChromeUINewTabURL), + WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + ASSERT_EQ(2, browser()->tab_strip_model()->count()); + + // Make sure the tab did not receive an onthemechange event for the + // already-installed theme. (An event *is* sent, but that happens before the + // page can register its handler.) + content::WebContents* active_tab = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); + int on_theme_changed_calls = 0; + ASSERT_TRUE(instant_test_utils::GetIntFromJS( + active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); + EXPECT_EQ(0, on_theme_changed_calls); + + // Activate the previous tab. + browser()->tab_strip_model()->ActivateTabAt(0, false); + ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); + + // Switch back to new tab. + browser()->tab_strip_model()->ActivateTabAt(1, false); + ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); + + // Confirm that new tab got no onthemechange event while switching tabs. + active_tab = browser()->tab_strip_model()->GetActiveWebContents(); + on_theme_changed_calls = 0; + ASSERT_TRUE(instant_test_utils::GetIntFromJS( + active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); + EXPECT_EQ(0, on_theme_changed_calls); +} + +// Flaky on all bots. http://crbug.com/335297, http://crbug.com/265971. +IN_PROC_BROWSER_TEST_F(InstantThemeTest, + DISABLED_SendThemeBackgroundChangedEvent) { + ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); + + // Install a theme. + ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); + ASSERT_EQ(1, browser()->tab_strip_model()->count()); + + // Open new tab. + ui_test_utils::NavigateToURLWithDisposition( + browser(), GURL(chrome::kChromeUINewTabURL), + WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + ASSERT_EQ(2, browser()->tab_strip_model()->count()); + + // Make sure the tab did not receive an onthemechange event for the + // already-installed theme. (An event *is* sent, but that happens before the + // page can register its handler.) + content::WebContents* active_tab = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); + int on_theme_changed_calls = 0; + ASSERT_TRUE(instant_test_utils::GetIntFromJS( + active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); + EXPECT_EQ(0, on_theme_changed_calls); + + // Install a different theme. + ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme2", "snowflake theme")); + + // Confirm that the new tab got notified about the theme changed event. + on_theme_changed_calls = 0; + ASSERT_TRUE(instant_test_utils::GetIntFromJS( + active_tab, "onThemeChangedCalls", &on_theme_changed_calls)); + EXPECT_EQ(1, on_theme_changed_calls); +}
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index 4b9dafa..5692c0ba 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -205,6 +205,7 @@ l10n_util::GetStringFUTF16( IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); + source->AddLocalizedString("learnMore", IDS_MD_EXTENSIONS_LEARN_MORE); source->AddLocalizedString( "loadErrorCouldNotLoadManifest", IDS_MD_EXTENSIONS_LOAD_ERROR_COULD_NOT_LOAD_MANIFEST); @@ -251,6 +252,12 @@ IDS_MD_EXTENSIONS_SHORTCUT_SCOPE_IN_CHROME); source->AddLocalizedString("shortcutTypeAShortcut", IDS_MD_EXTENSIONS_TYPE_A_SHORTCUT); + source->AddString( + "suspiciousInstallHelpUrl", + base::ASCIIToUTF16(google_util::AppendGoogleLocaleParam( + GURL(chrome::kRemoveNonCWSExtensionURL), + g_browser_process->GetApplicationLocale()) + .spec())); source->AddLocalizedString("toolbarDevMode", IDS_MD_EXTENSIONS_DEVELOPER_MODE); source->AddLocalizedString("toolbarLoadUnpacked",
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index dee2920..56fa72b 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1505,6 +1505,7 @@ "../browser/ui/search/instant_test_base.h", "../browser/ui/search/instant_test_utils.cc", "../browser/ui/search/instant_test_utils.h", + "../browser/ui/search/instant_theme_browsertest.cc", "../browser/ui/search/local_ntp_browsertest.cc", "../browser/ui/search/new_tab_page_interceptor_browsertest.cc", "../browser/ui/search_engines/search_engine_tab_helper_browsertest.cc",
diff --git a/chromeos/components/tether/BUILD.gn b/chromeos/components/tether/BUILD.gn index 422a177..1cb15b1 100644 --- a/chromeos/components/tether/BUILD.gn +++ b/chromeos/components/tether/BUILD.gn
@@ -56,10 +56,6 @@ "host_scanner.h", "host_scanner_operation.cc", "host_scanner_operation.h", - "initializer.cc", - "initializer.h", - "initializer_impl.cc", - "initializer_impl.h", "keep_alive_operation.cc", "keep_alive_operation.h", "keep_alive_scheduler.cc", @@ -86,6 +82,10 @@ "persistent_host_scan_cache_impl.h", "pref_names.cc", "pref_names.h", + "tether_component.cc", + "tether_component.h", + "tether_component_impl.cc", + "tether_component_impl.h", "tether_connector.h", "tether_connector_impl.cc", "tether_connector_impl.h", @@ -142,12 +142,12 @@ "fake_error_tolerant_ble_advertisement.h", "fake_host_scan_cache.cc", "fake_host_scan_cache.h", - "fake_initializer.cc", - "fake_initializer.h", "fake_network_configuration_remover.cc", "fake_network_configuration_remover.h", "fake_notification_presenter.cc", "fake_notification_presenter.h", + "fake_tether_component.cc", + "fake_tether_component.h", "fake_tether_connector.cc", "fake_tether_connector.h", "fake_tether_disconnector.cc", @@ -207,7 +207,6 @@ "host_scan_scheduler_unittest.cc", "host_scanner_operation_unittest.cc", "host_scanner_unittest.cc", - "initializer_impl_unittest.cc", "keep_alive_operation_unittest.cc", "keep_alive_scheduler_unittest.cc", "master_host_scan_cache_unittest.cc", @@ -219,6 +218,7 @@ "network_list_sorter_unittest.cc", "notification_remover_unittest.cc", "persistent_host_scan_cache_impl_unittest.cc", + "tether_component_impl_unittest.cc", "tether_connector_impl_unittest.cc", "tether_disconnector_impl_unittest.cc", "tether_host_fetcher_unittest.cc",
diff --git a/chromeos/components/tether/fake_initializer.cc b/chromeos/components/tether/fake_initializer.cc deleted file mode 100644 index 0b4e109c..0000000 --- a/chromeos/components/tether/fake_initializer.cc +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/tether/fake_initializer.h" - -namespace chromeos { - -namespace tether { - -FakeInitializer::FakeInitializer(bool has_asynchronous_shutdown) - : has_asynchronous_shutdown_(has_asynchronous_shutdown) {} - -FakeInitializer::~FakeInitializer() {} - -void FakeInitializer::FinishAsynchronousShutdown() { - DCHECK(status() == Initializer::Status::SHUTTING_DOWN); - TransitionToStatus(Initializer::Status::SHUT_DOWN); -} - -void FakeInitializer::RequestShutdown() { - DCHECK(status() == Initializer::Status::ACTIVE); - - if (has_asynchronous_shutdown_) - TransitionToStatus(Initializer::Status::SHUTTING_DOWN); - else - TransitionToStatus(Initializer::Status::SHUT_DOWN); -} - -} // namespace tether - -} // namespace chromeos
diff --git a/chromeos/components/tether/fake_initializer.h b/chromeos/components/tether/fake_initializer.h deleted file mode 100644 index b7f4234..0000000 --- a/chromeos/components/tether/fake_initializer.h +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_INITIALIZER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_INITIALIZER_H_ - -#include "base/macros.h" -#include "chromeos/components/tether/initializer.h" - -namespace chromeos { - -namespace tether { - -// Test double for Initializer. -class FakeInitializer : public Initializer { - public: - explicit FakeInitializer(bool has_asynchronous_shutdown); - ~FakeInitializer() override; - - void set_has_asynchronous_shutdown(bool has_asynchronous_shutdown) { - has_asynchronous_shutdown_ = has_asynchronous_shutdown; - } - - // Should only be called when status() == SHUTTING_DOWN. - void FinishAsynchronousShutdown(); - - // Initializer: - void RequestShutdown() override; - - private: - bool has_asynchronous_shutdown_; - - DISALLOW_COPY_AND_ASSIGN(FakeInitializer); -}; - -} // namespace tether - -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_INITIALIZER_H_
diff --git a/chromeos/components/tether/fake_tether_component.cc b/chromeos/components/tether/fake_tether_component.cc new file mode 100644 index 0000000..a59baa5 --- /dev/null +++ b/chromeos/components/tether/fake_tether_component.cc
@@ -0,0 +1,32 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/components/tether/fake_tether_component.h" + +namespace chromeos { + +namespace tether { + +FakeTetherComponent::FakeTetherComponent(bool has_asynchronous_shutdown) + : has_asynchronous_shutdown_(has_asynchronous_shutdown) {} + +FakeTetherComponent::~FakeTetherComponent() {} + +void FakeTetherComponent::FinishAsynchronousShutdown() { + DCHECK(status() == TetherComponent::Status::SHUTTING_DOWN); + TransitionToStatus(TetherComponent::Status::SHUT_DOWN); +} + +void FakeTetherComponent::RequestShutdown() { + DCHECK(status() == TetherComponent::Status::ACTIVE); + + if (has_asynchronous_shutdown_) + TransitionToStatus(TetherComponent::Status::SHUTTING_DOWN); + else + TransitionToStatus(TetherComponent::Status::SHUT_DOWN); +} + +} // namespace tether + +} // namespace chromeos
diff --git a/chromeos/components/tether/fake_tether_component.h b/chromeos/components/tether/fake_tether_component.h new file mode 100644 index 0000000..5f7340d --- /dev/null +++ b/chromeos/components/tether/fake_tether_component.h
@@ -0,0 +1,41 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ +#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ + +#include "base/macros.h" +#include "chromeos/components/tether/tether_component.h" + +namespace chromeos { + +namespace tether { + +// Test double for TetherComponent. +class FakeTetherComponent : public TetherComponent { + public: + explicit FakeTetherComponent(bool has_asynchronous_shutdown); + ~FakeTetherComponent() override; + + void set_has_asynchronous_shutdown(bool has_asynchronous_shutdown) { + has_asynchronous_shutdown_ = has_asynchronous_shutdown; + } + + // Should only be called when status() == SHUTTING_DOWN. + void FinishAsynchronousShutdown(); + + // Initializer: + void RequestShutdown() override; + + private: + bool has_asynchronous_shutdown_; + + DISALLOW_COPY_AND_ASSIGN(FakeTetherComponent); +}; + +} // namespace tether + +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_
diff --git a/chromeos/components/tether/initializer.h b/chromeos/components/tether/initializer.h deleted file mode 100644 index b4a841b..0000000 --- a/chromeos/components/tether/initializer.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ -#define CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ - -#include "base/macros.h" -#include "base/observer_list.h" - -namespace chromeos { - -namespace tether { - -// Initializes the Tether component. -class Initializer { - public: - class Observer { - public: - Observer() {} - virtual ~Observer() {} - - virtual void OnShutdownComplete() = 0; - }; - - enum class Status { ACTIVE, SHUTTING_DOWN, SHUT_DOWN }; - - Initializer(); - virtual ~Initializer(); - - // Requests that the Tether component shuts down. If the component can be shut - // down synchronously, this causes Initializer to transition to the SHUT_DOWN - // status immediately. However, if the component requires an asynchronous - // shutdown, the class transitions to the SHUTTING_DOWN status; once an - // asynchronous shutdown completes, Initializer transitions to the SHUT_DOWN - // status and notifies observers. - virtual void RequestShutdown() = 0; - - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); - - Status status() { return status_; } - void TransitionToStatus(Status new_status); - - private: - Status status_ = Status::ACTIVE; - base::ObserverList<Observer> observer_list_; - - DISALLOW_COPY_AND_ASSIGN(Initializer); -}; - -} // namespace tether - -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_
diff --git a/chromeos/components/tether/initializer.cc b/chromeos/components/tether/tether_component.cc similarity index 63% rename from chromeos/components/tether/initializer.cc rename to chromeos/components/tether/tether_component.cc index 495e700..687ea74 100644 --- a/chromeos/components/tether/initializer.cc +++ b/chromeos/components/tether/tether_component.cc
@@ -2,25 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/initializer.h" +#include "chromeos/components/tether/tether_component.h" namespace chromeos { namespace tether { -Initializer::Initializer() {} +TetherComponent::TetherComponent() {} -Initializer::~Initializer() {} +TetherComponent::~TetherComponent() {} -void Initializer::AddObserver(Observer* observer) { +void TetherComponent::AddObserver(Observer* observer) { observer_list_.AddObserver(observer); } -void Initializer::RemoveObserver(Observer* observer) { +void TetherComponent::RemoveObserver(Observer* observer) { observer_list_.RemoveObserver(observer); } -void Initializer::TransitionToStatus(Status new_status) { +void TetherComponent::TransitionToStatus(Status new_status) { if (status_ == new_status) return;
diff --git a/chromeos/components/tether/tether_component.h b/chromeos/components/tether/tether_component.h new file mode 100644 index 0000000..228d7ad5 --- /dev/null +++ b/chromeos/components/tether/tether_component.h
@@ -0,0 +1,56 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_ +#define CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_ + +#include "base/macros.h" +#include "base/observer_list.h" + +namespace chromeos { + +namespace tether { + +// Initializes the Tether component. +class TetherComponent { + public: + class Observer { + public: + Observer() {} + virtual ~Observer() {} + + virtual void OnShutdownComplete() = 0; + }; + + enum class Status { ACTIVE, SHUTTING_DOWN, SHUT_DOWN }; + + TetherComponent(); + virtual ~TetherComponent(); + + // Requests that the Tether component shuts down. If the component can be shut + // down synchronously, this causes TetherComponent to transition to the + // SHUT_DOWN status immediately. However, if the component requires an + // asynchronous shutdown, the class transitions to the SHUTTING_DOWN status; + // once an asynchronous shutdown completes, TetherComponent transitions to the + // SHUT_DOWN status and notifies observers. + virtual void RequestShutdown() = 0; + + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + Status status() { return status_; } + void TransitionToStatus(Status new_status); + + private: + Status status_ = Status::ACTIVE; + base::ObserverList<Observer> observer_list_; + + DISALLOW_COPY_AND_ASSIGN(TetherComponent); +}; + +} // namespace tether + +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_
diff --git a/chromeos/components/tether/initializer_impl.cc b/chromeos/components/tether/tether_component_impl.cc similarity index 90% rename from chromeos/components/tether/initializer_impl.cc rename to chromeos/components/tether/tether_component_impl.cc index 2fc8aee..18c03be 100644 --- a/chromeos/components/tether/initializer_impl.cc +++ b/chromeos/components/tether/tether_component_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 "chromeos/components/tether/initializer_impl.h" +#include "chromeos/components/tether/tether_component_impl.h" #include "base/bind.h" #include "chromeos/components/tether/active_host.h" @@ -59,10 +59,11 @@ } // namespace // static -InitializerImpl::Factory* InitializerImpl::Factory::factory_instance_ = nullptr; +TetherComponentImpl::Factory* TetherComponentImpl::Factory::factory_instance_ = + nullptr; // static -std::unique_ptr<Initializer> InitializerImpl::Factory::NewInstance( +std::unique_ptr<TetherComponent> TetherComponentImpl::Factory::NewInstance( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -81,19 +82,19 @@ } // static -void InitializerImpl::Factory::SetInstanceForTesting(Factory* factory) { +void TetherComponentImpl::Factory::SetInstanceForTesting(Factory* factory) { factory_instance_ = factory; } // static -void InitializerImpl::RegisterProfilePrefs(PrefRegistrySimple* registry) { +void TetherComponentImpl::RegisterProfilePrefs(PrefRegistrySimple* registry) { ActiveHost::RegisterPrefs(registry); PersistentHostScanCacheImpl::RegisterPrefs(registry); TetherHostResponseRecorder::RegisterPrefs(registry); WifiHotspotDisconnectorImpl::RegisterPrefs(registry); } -std::unique_ptr<Initializer> InitializerImpl::Factory::BuildInstance( +std::unique_ptr<TetherComponent> TetherComponentImpl::Factory::BuildInstance( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -102,13 +103,13 @@ NetworkConnect* network_connect, NetworkConnectionHandler* network_connection_handler, scoped_refptr<device::BluetoothAdapter> adapter) { - return base::WrapUnique(new InitializerImpl( + return base::WrapUnique(new TetherComponentImpl( cryptauth_service, notification_presenter, pref_service, network_state_handler, managed_network_configuration_handler, network_connect, network_connection_handler, adapter)); } -InitializerImpl::InitializerImpl( +TetherComponentImpl::TetherComponentImpl( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -130,7 +131,7 @@ CreateComponent(); } -InitializerImpl::~InitializerImpl() { +TetherComponentImpl::~TetherComponentImpl() { network_state_handler_->set_tether_sort_delegate(nullptr); if (disconnect_tethering_request_sender_) @@ -140,9 +141,9 @@ // Note: The asynchronous shutdown flow does not scale well (see // crbug.com/761532). // TODO(khorimoto): Refactor this flow. -void InitializerImpl::RequestShutdown() { +void TetherComponentImpl::RequestShutdown() { // If shutdown has already happened, there is nothing else to do. - if (status() != Initializer::Status::ACTIVE) + if (status() != TetherComponent::Status::ACTIVE) return; // If there is an active connection, it needs to be disconnected before the @@ -160,28 +161,28 @@ } if (!IsAsyncShutdownRequired()) { - TransitionToStatus(Initializer::Status::SHUT_DOWN); + TransitionToStatus(TetherComponent::Status::SHUT_DOWN); return; } - TransitionToStatus(Initializer::Status::SHUTTING_DOWN); + TransitionToStatus(TetherComponent::Status::SHUTTING_DOWN); StartAsynchronousShutdown(); } -void InitializerImpl::OnAllAdvertisementsUnregistered() { +void TetherComponentImpl::OnAllAdvertisementsUnregistered() { FinishAsynchronousShutdownIfPossible(); } -void InitializerImpl::OnPendingDisconnectRequestsComplete() { +void TetherComponentImpl::OnPendingDisconnectRequestsComplete() { FinishAsynchronousShutdownIfPossible(); } -void InitializerImpl::OnDiscoverySessionStateChanged( +void TetherComponentImpl::OnDiscoverySessionStateChanged( bool discovery_session_active) { FinishAsynchronousShutdownIfPossible(); } -void InitializerImpl::CreateComponent() { +void TetherComponentImpl::CreateComponent() { network_list_sorter_ = base::MakeUnique<NetworkListSorter>(); network_state_handler_->set_tether_sort_delegate(network_list_sorter_.get()); tether_host_fetcher_ = @@ -276,11 +277,11 @@ network_state_handler_, active_host_.get(), master_host_scan_cache_.get()); crash_recovery_manager_->RestorePreCrashStateIfNecessary( - base::Bind(&InitializerImpl::OnPreCrashStateRestored, + base::Bind(&TetherComponentImpl::OnPreCrashStateRestored, weak_ptr_factory_.GetWeakPtr())); } -bool InitializerImpl::IsAsyncShutdownRequired() { +bool TetherComponentImpl::IsAsyncShutdownRequired() { // All of the asynchronous shutdown procedures depend on Bluetooth. If // Bluetooth is off, there is no way to complete these tasks. if (!adapter_->IsPowered()) @@ -306,7 +307,7 @@ return false; } -void InitializerImpl::OnPreCrashStateRestored() { +void TetherComponentImpl::OnPreCrashStateRestored() { // |crash_recovery_manager_| is no longer needed since it has completed. crash_recovery_manager_.reset(); @@ -314,8 +315,8 @@ host_scan_scheduler_->ScheduleScan(); } -void InitializerImpl::StartAsynchronousShutdown() { - DCHECK(status() == Initializer::Status::SHUTTING_DOWN); +void TetherComponentImpl::StartAsynchronousShutdown() { + DCHECK(status() == TetherComponent::Status::SHUTTING_DOWN); DCHECK(disconnect_tethering_request_sender_->HasPendingRequests()); // |ble_scanner_| and |disconnect_tethering_request_sender_| require @@ -352,8 +353,8 @@ network_list_sorter_.reset(); } -void InitializerImpl::FinishAsynchronousShutdownIfPossible() { - DCHECK(status() == Initializer::Status::SHUTTING_DOWN); +void TetherComponentImpl::FinishAsynchronousShutdownIfPossible() { + DCHECK(status() == TetherComponent::Status::SHUTTING_DOWN); // If the asynchronous shutdown is not yet complete (i.e., only some of the // shutdown requirements are complete), do not shut down yet. @@ -378,7 +379,7 @@ local_device_data_provider_.reset(); tether_host_fetcher_.reset(); - TransitionToStatus(Initializer::Status::SHUT_DOWN); + TransitionToStatus(TetherComponent::Status::SHUT_DOWN); } } // namespace tether
diff --git a/chromeos/components/tether/initializer_impl.h b/chromeos/components/tether/tether_component_impl.h similarity index 87% rename from chromeos/components/tether/initializer_impl.h rename to chromeos/components/tether/tether_component_impl.h index 617a3e1..50af71d 100644 --- a/chromeos/components/tether/initializer_impl.h +++ b/chromeos/components/tether/tether_component_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 CHROMEOS_COMPONENTS_TETHER_INITIALIZER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_INITIALIZER_IMPL_H_ +#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ +#define CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ #include <memory> @@ -15,7 +15,7 @@ #include "chromeos/components/tether/ble_advertiser.h" #include "chromeos/components/tether/ble_scanner.h" #include "chromeos/components/tether/disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/initializer.h" +#include "chromeos/components/tether/tether_component.h" #include "components/prefs/pref_registry_simple.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_advertisement.h" @@ -66,16 +66,16 @@ class WifiHotspotDisconnector; // Initializes the Tether Chrome OS component. -class InitializerImpl : public Initializer, - public BleAdvertiser::Observer, - public BleScanner::Observer, - public DisconnectTetheringRequestSender::Observer { +class TetherComponentImpl : public TetherComponent, + public BleAdvertiser::Observer, + public BleScanner::Observer, + public DisconnectTetheringRequestSender::Observer { public: static void RegisterProfilePrefs(PrefRegistrySimple* registry); class Factory { public: - static std::unique_ptr<Initializer> NewInstance( + static std::unique_ptr<TetherComponent> NewInstance( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -89,7 +89,7 @@ static void SetInstanceForTesting(Factory* factory); protected: - virtual std::unique_ptr<Initializer> BuildInstance( + virtual std::unique_ptr<TetherComponent> BuildInstance( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -104,7 +104,7 @@ static Factory* factory_instance_; }; - InitializerImpl( + TetherComponentImpl( cryptauth::CryptAuthService* cryptauth_service, NotificationPresenter* notification_presenter, PrefService* pref_service, @@ -113,10 +113,10 @@ NetworkConnect* network_connect, NetworkConnectionHandler* network_connection_handler, scoped_refptr<device::BluetoothAdapter> adapter); - ~InitializerImpl() override; + ~TetherComponentImpl() override; protected: - // Initializer: + // TetherComponent: void RequestShutdown() override; // BleAdvertiser::Observer: @@ -129,7 +129,7 @@ void OnPendingDisconnectRequestsComplete() override; private: - friend class InitializerImplTest; + friend class TetherComponentImplTest; void CreateComponent(); bool IsAsyncShutdownRequired(); @@ -148,7 +148,7 @@ // Declare new objects in the order that they will be created during // initialization to ensure that they are destroyed in the correct order. This - // order will be enforced by InitializerTest.TestCreateAndDestroy. + // order will be enforced by TetherComponentImplTest.TestCreateAndDestroy. std::unique_ptr<NetworkListSorter> network_list_sorter_; std::unique_ptr<TetherHostFetcher> tether_host_fetcher_; std::unique_ptr<cryptauth::LocalDeviceDataProvider> @@ -189,13 +189,13 @@ network_connection_handler_tether_delegate_; std::unique_ptr<CrashRecoveryManager> crash_recovery_manager_; - base::WeakPtrFactory<InitializerImpl> weak_ptr_factory_; + base::WeakPtrFactory<TetherComponentImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(InitializerImpl); + DISALLOW_COPY_AND_ASSIGN(TetherComponentImpl); }; } // namespace tether } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_IMPL_H_ +#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_
diff --git a/chromeos/components/tether/initializer_impl_unittest.cc b/chromeos/components/tether/tether_component_impl_unittest.cc similarity index 89% rename from chromeos/components/tether/initializer_impl_unittest.cc rename to chromeos/components/tether/tether_component_impl_unittest.cc index 5db593dc..e234fbb 100644 --- a/chromeos/components/tether/initializer_impl_unittest.cc +++ b/chromeos/components/tether/tether_component_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 "chromeos/components/tether/initializer_impl.h" +#include "chromeos/components/tether/tether_component_impl.h" #include <memory> @@ -114,10 +114,10 @@ } // namespace -class InitializerTest : public NetworkStateTest { +class TetherComponentImplTest : public NetworkStateTest { protected: - InitializerTest() : NetworkStateTest() {} - ~InitializerTest() override {} + TetherComponentImplTest() : NetworkStateTest() {} + ~TetherComponentImplTest() override {} void SetUp() override { DBusThreadManager::Initialize(); @@ -128,7 +128,7 @@ NetworkStateHandler::TECHNOLOGY_ENABLED); test_pref_service_ = base::MakeUnique<TestingPrefServiceSimple>(); - InitializerImpl::RegisterProfilePrefs(test_pref_service_->registry()); + TetherComponentImpl::RegisterProfilePrefs(test_pref_service_->registry()); } void TearDown() override { @@ -146,11 +146,11 @@ NetworkConnect* network_connect, NetworkConnectionHandler* network_connection_handler, scoped_refptr<device::BluetoothAdapter> adapter) { - Initializer* initializer = new InitializerImpl( + TetherComponent* tether_component = new TetherComponentImpl( cryptauth_service, notification_presenter, pref_service, network_state_handler, managed_network_configuration_handler, network_connect, network_connection_handler, adapter); - delete initializer; + delete tether_component; } base::test::ScopedTaskEnvironment scoped_task_environment_; @@ -158,13 +158,13 @@ std::unique_ptr<TestingPrefServiceSimple> test_pref_service_; private: - DISALLOW_COPY_AND_ASSIGN(InitializerTest); + DISALLOW_COPY_AND_ASSIGN(TetherComponentImplTest); }; -// This test ensures that Initializer's destructor runs in the correct order and -// results in a correct clean-up of all created components. If the destructor -// were to result in an error being thrown, this test would fail. -TEST_F(InitializerTest, TestCreateAndDestroy) { +// This test ensures that TetherComponentImpl's destructor runs in the correct +// order and results in a correct clean-up of all created components. If the +// destructor were to result in an error being thrown, this test would fail. +TEST_F(TetherComponentImplTest, TestCreateAndDestroy) { std::unique_ptr<NiceMock<MockCryptAuthDeviceManager>> mock_device_manager = base::WrapUnique(new NiceMock<MockCryptAuthDeviceManager>()); @@ -205,8 +205,9 @@ base::MakeRefCounted<NiceMock<device::MockBluetoothAdapter>>(); // Call an instance method of the test instead of initializing and destroying - // here because the friend relationship between Initializer and - // InitializerTest only applies to the class itself, not these test functions. + // here because the friend relationship between TetherComponent and + // TetherComponentImplTest only applies to the class itself, not these test + // functions. InitializeAndDestroy( fake_cryptauth_service.get(), fake_notification_presenter.get(), test_pref_service_.get(), network_state_handler(),
diff --git a/net/spdy/chromium/spdy_session.cc b/net/spdy/chromium/spdy_session.cc index dc4f23b..6f0cbfd 100644 --- a/net/spdy/chromium/spdy_session.cc +++ b/net/spdy/chromium/spdy_session.cc
@@ -857,8 +857,7 @@ SpdyStreamId stream_id = unclaimed_it->second.stream_id; if (active_streams_.find(stream_id) == active_streams_.end()) { - ResetStream(stream_id, ERROR_CODE_CANCEL, - "Cancelled push stream with url: " + url.spec()); + ResetStream(stream_id, ERROR_CODE_CANCEL, "Cancelled push stream."); } unclaimed_pushed_streams_.erase(unclaimed_it); } @@ -1567,10 +1566,9 @@ ActiveStreamMap::iterator associated_it = active_streams_.find(associated_stream_id); if (associated_it == active_streams_.end()) { - EnqueueResetStreamFrame( - stream_id, request_priority, ERROR_CODE_STREAM_CLOSED, - SpdyStringPrintf("Received push for inactive associated stream %d", - associated_stream_id)); + EnqueueResetStreamFrame(stream_id, request_priority, + ERROR_CODE_STREAM_CLOSED, + "Inactive associated stream."); return; } @@ -1586,30 +1584,23 @@ if (gurl.SchemeIs("https")) { EnqueueResetStreamFrame( stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, - SpdyStringPrintf("Rejected push of cross origin HTTPS content %d " - "from trusted proxy", - associated_stream_id)); + "Cross origin HTTPS content from trusted proxy."); return; } } else { if (!gurl.SchemeIs("https") || !associated_url.SchemeIs("https")) { EnqueueResetStreamFrame( stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, - SpdyStringPrintf("Rejected cross origin pushed stream %d: " - "both pushed URL and associated URL " - "must have https scheme.", - associated_stream_id)); + "Both pushed URL and associated URL must have https scheme."); return; } SSLInfo ssl_info; CHECK(GetSSLInfo(&ssl_info)); if (!CanPool(transport_security_state_, ssl_info, associated_url.host(), gurl.host())) { - EnqueueResetStreamFrame( - stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, - SpdyStringPrintf("Rejected pushed stream %d because certificate " - "does not match pushed URL.", - associated_stream_id)); + EnqueueResetStreamFrame(stream_id, request_priority, + ERROR_CODE_REFUSED_STREAM, + "Certificate does not match pushed URL."); return; } } @@ -1620,19 +1611,17 @@ SpdyHeaderBlock::const_iterator it = headers.find(kHttp2MethodHeader); if (it == headers.end() || (it->second.compare("GET") != 0 && it->second.compare("HEAD") != 0)) { - EnqueueResetStreamFrame( - stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, - SpdyStringPrintf( - "Rejected push stream %d due to inadequate request method", - associated_stream_id)); + EnqueueResetStreamFrame(stream_id, request_priority, + ERROR_CODE_REFUSED_STREAM, + "Inadequate request method."); return; } // Insertion fails if there already is a pushed stream with the same path. if (!unclaimed_pushed_streams_.insert(gurl, stream_id, time_func_())) { - EnqueueResetStreamFrame( - stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, - "Received duplicate pushed stream with url: " + gurl.spec()); + EnqueueResetStreamFrame(stream_id, request_priority, + ERROR_CODE_REFUSED_STREAM, + "Duplicate pushed stream with url: " + gurl.spec()); return; } @@ -2496,10 +2485,7 @@ void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { DCHECK(stream); - SpdyString description = - SpdyStringPrintf("ABANDONED (stream_id=%d): ", stream->stream_id()) + - stream->url().spec(); - stream->LogStreamError(status, description); + stream->LogStreamError(status, "Abandoned."); // We don't increment the streams abandoned counter here. If the // stream isn't active (i.e., it hasn't written anything to the wire // yet) then it's as if it never existed. If it is active, then @@ -2655,21 +2641,17 @@ } else if (error_code == ERROR_CODE_HTTP_1_1_REQUIRED) { // TODO(bnc): Record histogram with number of open streams capped at 50. if (net_log().IsCapturing()) { - it->second->LogStreamError( - ERR_HTTP_1_1_REQUIRED, - SpdyStringPrintf( - "Closing session because server reset stream with error %s.", - ErrorCodeToString(error_code))); + it->second->LogStreamError(ERR_HTTP_1_1_REQUIRED, + "Closing session because server reset stream " + "with ERR_HTTP_1_1_REQUIRED."); } DoDrainSession(ERR_HTTP_1_1_REQUIRED, "HTTP_1_1_REQUIRED for stream."); } else { RecordProtocolErrorHistogram( PROTOCOL_ERROR_RST_STREAM_FOR_NON_ACTIVE_STREAM); if (net_log().IsCapturing()) { - it->second->LogStreamError( - ERR_SPDY_PROTOCOL_ERROR, - SpdyStringPrintf("Server reset stream with error %s.", - ErrorCodeToString(error_code))); + it->second->LogStreamError(ERR_SPDY_PROTOCOL_ERROR, + "Server reset stream."); } // TODO(mbelshe): Map from Spdy-protocol errors to something sensical. // For now, it doesn't matter much - it is a protocol error. @@ -2868,9 +2850,7 @@ if (delta_window_size < 1) { ResetStreamIterator( it, ERROR_CODE_FLOW_CONTROL_ERROR, - SpdyStringPrintf("Received WINDOW_UPDATE with an invalid " - "delta_window_size %d", - delta_window_size)); + "Received WINDOW_UPDATE with an invalid delta_window_size."); return; }
diff --git a/services/resource_coordinator/memory_instrumentation/graph.h b/services/resource_coordinator/memory_instrumentation/graph.h index d329c21..954d203 100644 --- a/services/resource_coordinator/memory_instrumentation/graph.h +++ b/services/resource_coordinator/memory_instrumentation/graph.h
@@ -109,8 +109,9 @@ bool is_explicit() const { return explicit_; } void set_explicit(bool explicit_node) { explicit_ = explicit_node; } GlobalDumpGraph::Edge* owns_edge() const { return owns_edge_; } - const std::vector<GlobalDumpGraph::Edge*>& owned_by_edges() const { - return owned_by_edges_; + std::map<std::string, Node*>* children() { return &children_; } + std::vector<GlobalDumpGraph::Edge*>* owned_by_edges() { + return &owned_by_edges_; } const Node* parent() const { return parent_; } const GlobalDumpGraph::Process* dump_graph() const { return dump_graph_; }
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor.cc b/services/resource_coordinator/memory_instrumentation/graph_processor.cc index 52ce177..92bdb3f 100644 --- a/services/resource_coordinator/memory_instrumentation/graph_processor.cc +++ b/services/resource_coordinator/memory_instrumentation/graph_processor.cc
@@ -60,6 +60,16 @@ for (auto& pid_to_dump : process_dumps) { AddEdges(pid_to_dump.second, global_graph.get()); } + + auto* global_root = global_graph->shared_memory_graph()->root(); + + // Third pass: mark recursively nodes as weak if they don't have an associated + // dump and all their children are weak. + MarkImplicitWeakParentsRecursively(global_root); + for (auto& pid_to_process : global_graph->process_dump_graphs()) { + MarkImplicitWeakParentsRecursively(pid_to_process.second->root()); + } + return global_graph; } @@ -133,4 +143,31 @@ } } +void GraphProcessor::MarkImplicitWeakParentsRecursively(Node* node) { + // Ensure that we aren't in a bad state where we have an implicit node + // which doesn't have any children. + DCHECK(node->is_explicit() || !node->children()->empty()); + + // Check that at this stage, any node which is weak is only so because + // it was explicitly created as such. + DCHECK(!node->is_weak() || node->is_explicit()); + + // If a node is already weak then all children will be marked weak at a + // later stage. + if (node->is_weak()) + return; + + // Recurse into each child and find out if all the children of this node are + // weak. + bool all_children_weak = true; + for (auto& path_to_child : *node->children()) { + MarkImplicitWeakParentsRecursively(path_to_child.second); + all_children_weak = all_children_weak && path_to_child.second->is_weak(); + } + + // If all the children are weak and the parent is only an implicit one then we + // consider the parent as weak as well and we will later remove it. + node->set_weak(!node->is_explicit() && all_children_weak); +} + } // namespace memory_instrumentation \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor.h b/services/resource_coordinator/memory_instrumentation/graph_processor.h index ae23cde..3e91ba4c 100644 --- a/services/resource_coordinator/memory_instrumentation/graph_processor.h +++ b/services/resource_coordinator/memory_instrumentation/graph_processor.h
@@ -22,6 +22,8 @@ process_dumps); private: + friend class GraphProcessorTest; + static void CollectAllocatorDumps( const base::trace_event::ProcessMemoryDump& source, GlobalDumpGraph* global_graph, @@ -29,6 +31,8 @@ static void AddEdges(const base::trace_event::ProcessMemoryDump& source, GlobalDumpGraph* global_graph); + + static void MarkImplicitWeakParentsRecursively(GlobalDumpGraph::Node* node); }; } // namespace memory_instrumentation
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc b/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc index 5903f6dc..ac89f2c 100644 --- a/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc +++ b/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc
@@ -15,8 +15,18 @@ using base::trace_event::MemoryDumpArgs; using base::trace_event::MemoryDumpLevelOfDetail; using base::trace_event::ProcessMemoryDump; +using Node = GlobalDumpGraph::Node; -TEST(GraphProcessorTest, ComputeMemoryGraph) { +class GraphProcessorTest : public testing::Test { + public: + GraphProcessorTest() {} + + void MarkImplicitWeakParentsRecursively(Node* node) { + GraphProcessor::MarkImplicitWeakParentsRecursively(node); + } +}; + +TEST_F(GraphProcessorTest, ComputeMemoryGraph) { std::map<ProcessId, ProcessMemoryDump> process_dumps; MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED}; @@ -70,4 +80,77 @@ ASSERT_EQ(edge_it->priority(), 10); } +TEST_F(GraphProcessorTest, MarkWeakParentsSimple) { + GlobalDumpGraph graph; + Node parent(graph.shared_memory_graph(), nullptr); + Node first(graph.shared_memory_graph(), &parent); + Node second(graph.shared_memory_graph(), &parent); + + parent.InsertChild("first", &first); + parent.InsertChild("second", &second); + + // Case where one child is not weak. + parent.set_explicit(false); + parent.set_weak(false); + first.set_explicit(true); + first.set_weak(true); + second.set_explicit(true); + second.set_weak(false); + + // The function should be a no-op. + MarkImplicitWeakParentsRecursively(&parent); + ASSERT_FALSE(parent.is_weak()); + ASSERT_TRUE(first.is_weak()); + ASSERT_FALSE(second.is_weak()); + + // Case where all children is weak. + second.set_weak(true); + + // The function should mark parent as weak. + MarkImplicitWeakParentsRecursively(&parent); + ASSERT_TRUE(parent.is_weak()); + ASSERT_TRUE(first.is_weak()); + ASSERT_TRUE(second.is_weak()); +} + +TEST_F(GraphProcessorTest, MarkWeakParentsComplex) { + GlobalDumpGraph graph; + Node parent(graph.shared_memory_graph(), nullptr); + Node first(graph.shared_memory_graph(), &parent); + Node first_child(graph.shared_memory_graph(), &first); + Node first_grandchild(graph.shared_memory_graph(), &first_child); + + parent.InsertChild("first", &first); + first.InsertChild("child", &first_child); + first_child.InsertChild("child", &first_grandchild); + + // |first| is explicitly storng but |first_child| is implicitly so. + parent.set_explicit(false); + parent.set_weak(false); + first.set_explicit(true); + first.set_weak(false); + first_child.set_explicit(false); + first_child.set_weak(false); + first_grandchild.set_weak(true); + first_grandchild.set_explicit(true); + + // That should lead to |first_child| marked implicitly weak. + MarkImplicitWeakParentsRecursively(&parent); + ASSERT_FALSE(parent.is_weak()); + ASSERT_FALSE(first.is_weak()); + ASSERT_TRUE(first_child.is_weak()); + ASSERT_TRUE(first_grandchild.is_weak()); + + // Reset and change so that first is now only implicitly strong. + first.set_explicit(false); + first_child.set_weak(false); + + // The whole chain should now be weak. + MarkImplicitWeakParentsRecursively(&parent); + ASSERT_TRUE(parent.is_weak()); + ASSERT_TRUE(first.is_weak()); + ASSERT_TRUE(first_child.is_weak()); + ASSERT_TRUE(first_grandchild.is_weak()); +} + } // namespace memory_instrumentation \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index e7d37bb4..caf91fe 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -3070,6 +3070,15 @@ crbug.com/773013 virtual/gpu-rasterization/images/color-profile-background-image-cross-fade.html [ NeedsManualRebaseline ] crbug.com/773013 virtual/gpu-rasterization/images/color-profile-mask-image-svg.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring-in-positioned-container.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring-outline-color.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring-with-paint-root-offset.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-focus-ring.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-overflowing-polygon-focus-ring.html [ NeedsManualRebaseline ] +crbug.com/774474 virtual/gpu-rasterization/images/imagemap-polygon-focus-ring.html [ NeedsManualRebaseline ] + # Sheriff failures 2017-07-20 crbug.com/747163 [ Linux ] imagecapture/MediaStreamTrack-applyConstraints.html [ Pass Crash ] crbug.com/747163 [ Linux ] imagecapture/MediaStreamTrack-getSettings.html [ Pass Crash ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 3d04256..6bd0a6fd 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -116210,16 +116210,6 @@ {} ] ], - "progress-events/Status.html": [ - [ - {} - ] - ], - "progress-events/tests/submissions/Samsung/resources/no-content-length.py": [ - [ - {} - ] - ], "quirks-mode/OWNERS": [ [ {} @@ -134373,6 +134363,18 @@ {} ] ], + "XMLHttpRequest/firing-events-http-content-length.html": [ + [ + "/XMLHttpRequest/firing-events-http-content-length.html", + {} + ] + ], + "XMLHttpRequest/firing-events-http-no-content-length.html": [ + [ + "/XMLHttpRequest/firing-events-http-no-content-length.html", + {} + ] + ], "XMLHttpRequest/formdata-blob.htm": [ [ "/XMLHttpRequest/formdata-blob.htm", @@ -134771,6 +134773,18 @@ } ] ], + "XMLHttpRequest/progressevent-constructor.html": [ + [ + "/XMLHttpRequest/progressevent-constructor.html", + {} + ] + ], + "XMLHttpRequest/progressevent-interface.html": [ + [ + "/XMLHttpRequest/progressevent-interface.html", + {} + ] + ], "XMLHttpRequest/response-data-arraybuffer.htm": [ [ "/XMLHttpRequest/response-data-arraybuffer.htm", @@ -171171,30 +171185,6 @@ {} ] ], - "progress-events/constructor.html": [ - [ - "/progress-events/constructor.html", - {} - ] - ], - "progress-events/interface.html": [ - [ - "/progress-events/interface.html", - {} - ] - ], - "progress-events/tests/submissions/Samsung/firing-events-http-content-length.html": [ - [ - "/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html", - {} - ] - ], - "progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html": [ - [ - "/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html", - {} - ] - ], "quirks-mode/blocks-ignore-line-height.html": [ [ "/quirks-mode/blocks-ignore-line-height.html", @@ -200224,6 +200214,14 @@ "4970811cfd2c1bdd1a08af6dd16eda8ffbff8ffd", "testharness" ], + "XMLHttpRequest/firing-events-http-content-length.html": [ + "b02468fa9d3d36190e4490cbbcb5a010403705c1", + "testharness" + ], + "XMLHttpRequest/firing-events-http-no-content-length.html": [ + "5ec562a5be5de822248ad9a4da82db1490363a67", + "testharness" + ], "XMLHttpRequest/folder.txt": [ "4dca56d05a21f0d018cd311f43e134e4501cf6d9", "support" @@ -200524,6 +200522,14 @@ "628ce3c9ee69aa9d4bb1b044f8d7a86095c7b0bc", "testharness" ], + "XMLHttpRequest/progressevent-constructor.html": [ + "33782c1562d7c60c50d4fa54a92c082cbeb2928c", + "testharness" + ], + "XMLHttpRequest/progressevent-interface.html": [ + "a614d8381b4fa9d04aef6c2a08889451b1b086a2", + "testharness" + ], "XMLHttpRequest/resources/accept-language.py": [ "c8e945b53770efb8e4312f457a5a7261bc88a36c", "support" @@ -269669,7 +269675,7 @@ "support" ], "html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt": [ - "855a8f2f0816512bfc7385179e920f5f14bad1c7", + "7c64b84f7f2033b7f2f51f2ff54353a62e0d8fb2", "support" ], "html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html": [ @@ -286412,30 +286418,6 @@ "bb2738dafe22a65000695059dfb22d1b3559772d", "support" ], - "progress-events/Status.html": [ - "2f34189d3c5515acab1431c80e4e97392a8afcc1", - "support" - ], - "progress-events/constructor.html": [ - "d38d6eebf28444181dfc59b49ee348845d06ff0c", - "testharness" - ], - "progress-events/interface.html": [ - "a614d8381b4fa9d04aef6c2a08889451b1b086a2", - "testharness" - ], - "progress-events/tests/submissions/Samsung/firing-events-http-content-length.html": [ - "2788ec7607b0d75049e84ea0edc75afe71bcb002", - "testharness" - ], - "progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html": [ - "9e5fbf0716e1a1ba3c0628ea2c1bc807d6819a9d", - "testharness" - ], - "progress-events/tests/submissions/Samsung/resources/no-content-length.py": [ - "1a6c21ff409b1c16a45a58d1fafd1c8da28ce7c5", - "support" - ], "quirks-mode/OWNERS": [ "bec450f77cd9a3a2f278cc41724ae55f23b883a3", "support"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-content-length.html similarity index 66% rename from third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html rename to third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-content-length.html index d897a71..6e54852 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-content-length.html
@@ -4,7 +4,7 @@ <title>ProgressEvent: firing events for HTTP with Content-Length</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <link rel="help" href="http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#firing-events-using-the-progressevent-interface-for-http" data-tested-assertations="/following-sibling::ol/li[1] /following-sibling::ol/li[2]" /> + <link rel="help" href="https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface"> </head> <body> <div id="log"></div> @@ -17,20 +17,20 @@ xhr.onprogress = function(pe) { test.step(function() { if(pe.type == "progress") { - assert_true(pe.loaded >= 0, "loaded is initialize to the number of HTTP entity body bytes transferred."); - assert_true(pe.lengthComputable, "lengthComputable is true."); - assert_not_equals(pe.total, 0, "total is not zero."); + assert_greater_than_equal(pe.loaded, 0, "loaded"); + assert_true(pe.lengthComputable, "lengthComputable"); + assert_equals(pe.total, 1300, "total"); } }, "Check lengthComputed, loaded, total when Content-Length is given."); } // "loadstart", "error", "abort", "load" tests are out of scope. // They SHOULD be tested in each spec that implement ProgressEvent. - + xhr.onloadend = function(pe) { test.done(); } - xhr.open("GET", "resources/img.jpg", true); + xhr.open("GET", "resources/trickle.py?ms=0&count=100&specifylength=1", true); xhr.send(null); }) </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-no-content-length.html similarity index 66% rename from third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html rename to third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-no-content-length.html index b30b03af..2a4614aa 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/firing-events-http-no-content-length.html
@@ -4,7 +4,7 @@ <title>ProgressEvent: firing events for HTTP with no Content-Length</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <link rel="help" href="http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#firing-events-using-the-progressevent-interface-for-http" data-tested-assertations="/following-sibling::ol/li[1] /following-sibling::ol/li[2]" /> + <link rel="help" href="https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface"> </head> <body> <div id="log"></div> @@ -17,9 +17,9 @@ xhr.onprogress = function(pe) { test.step(function() { if(pe.type == "progress") { - assert_true(pe.loaded >= 0, "loaded is initialize to the number of HTTP entity body bytes transferred."); - assert_false(pe.lengthComputable, "lengthComputable is false."); - assert_equals(pe.total, 0, "total is zero."); + assert_greater_than_equal(pe.loaded, 0, "loaded"); + assert_false(pe.lengthComputable, "lengthComputable"); + assert_equals(pe.total, 0, "total"); } }, "Check lengthComputed, loaded, total when Content-Length is NOT given."); } @@ -30,7 +30,7 @@ xhr.onloadend = function(pe) { test.done(); } - xhr.open("GET", "resources/no-content-length.py", true); + xhr.open("GET", "resources/trickle.py?ms=0&count=100", true); xhr.send(null); }) </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/constructor.html b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/progressevent-constructor.html similarity index 94% rename from third_party/WebKit/LayoutTests/external/wpt/progress-events/constructor.html rename to third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/progressevent-constructor.html index 19d77f94..0e771f4 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/progress-events/constructor.html +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/progressevent-constructor.html
@@ -1,6 +1,6 @@ <!doctype html> <title>ProgressEvent constructor</title> -<link rel="help" href="https://www.w3.org/TR/progress-events/#interface-progressevent"> +<link rel="help" href="https://xhr.spec.whatwg.org/#interface-progressevent"> <link rel="help" href="https://dom.spec.whatwg.org/#concept-event-constructor"> <link rel="help" href="https://dom.spec.whatwg.org/#interface-event"> <script src=/resources/testharness.js></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/interface.html b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/progressevent-interface.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/progress-events/interface.html rename to third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/progressevent-interface.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/Status.html b/third_party/WebKit/LayoutTests/external/wpt/progress-events/Status.html deleted file mode 100644 index f2aee75..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/progress-events/Status.html +++ /dev/null
@@ -1,26 +0,0 @@ -<!doctype html> -<html> -<head> - <title>Progress Events Test Status</title> -</head> -<body> - -<h2>Progress Events Test Suite Status</h2> - -<p>This test suite is part of the -<a href="http://www.w3.org/2008/webapps/wiki/">Web Application WG's</a> -Test Repository as described in WebApps' -<a href="http://www.w3.org/2008/webapps/wiki/Testing">Testing Wiki</a>. -</p> - -<p>The test suite is for the -<a href="http://dev.w3.org/2006/webapi/progress/">Progress Events</a> specification. -</p> - -<ul> - <li>Test suite status: The group has reviewed and approved all tests in the approved folder.</li> - <li>Test suite Facilitator: Jungkee Song</li> -</ul> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/resources/no-content-length.py b/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/resources/no-content-length.py deleted file mode 100644 index 0b47ff1..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/progress-events/tests/submissions/Samsung/resources/no-content-length.py +++ /dev/null
@@ -1,15 +0,0 @@ -def main(request, response): - response.headers.update([('Transfer-Encoding', 'chunked'), - ('Content-Type', 'text/html'), - ('Connection', 'keep-alive')]) - response.write_status_headers() - response.explicit_flush = True - - string = "W3C" - for i in xrange(1000): - response.writer.write("%s\r\n%s\r\n" % (len(string), string)) - response.writer.flush(); - - response.writer.write("0\r\n\r\n") - response.writer.flush(); -
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLAreaElement/area-cursor.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLAreaElement/area-cursor.html index 36fbb02..5cf1df9f 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLAreaElement/area-cursor.html +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLAreaElement/area-cursor.html
@@ -8,8 +8,8 @@ testRunner.dumpAsText(); document.body.offsetLeft; var target = document.querySelector('area'); - eventSender.mouseMoveTo((target.offsetLeft + target.offsetRight) / 2, - (target.offsetTop + target.offsetTop) / 2); + eventSender.mouseMoveTo(target.offsetLeft + target.offsetWidth / 2, + target.offsetTop + target.offsetHeight / 2); document.getElementById('result').innerHTML = '' + window.getComputedStyle(target).cursor; } </script>
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.h b/third_party/WebKit/Source/core/animation/InterpolableValue.h index 98d3d4d8..bb8070c 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValue.h +++ b/third_party/WebKit/Source/core/animation/InterpolableValue.h
@@ -45,7 +45,6 @@ // Keep interpolate private, but allow calls within the hierarchy without // knowledge of type. friend class InterpolableNumber; - friend class InterpolableBool; friend class InterpolableList; friend class AnimationInterpolableValueTest;
diff --git a/third_party/WebKit/Source/platform/wtf/BUILD.gn b/third_party/WebKit/Source/platform/wtf/BUILD.gn index 36dbc8a..d7c132a 100644 --- a/third_party/WebKit/Source/platform/wtf/BUILD.gn +++ b/third_party/WebKit/Source/platform/wtf/BUILD.gn
@@ -357,7 +357,6 @@ "text/StringBufferTest.cpp", "text/StringBuilderTest.cpp", "text/StringImplTest.cpp", - "text/StringOperatorsTest.cpp", "text/StringToNumberTest.cpp", "text/StringViewTest.cpp", "text/TextCodecICUTest.cpp",
diff --git a/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.cpp b/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.cpp index 7733e17..3390944 100644 --- a/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.cpp +++ b/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.cpp
@@ -8,12 +8,6 @@ #include "platform/wtf/text/StringImpl.h" -// This macro is helpful for testing how many intermediate Strings are created -// while evaluating an expression containing operator+. -#ifndef WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING -#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() ((void)0) -#endif - void WTF::StringTypeAdapter<char*>::WriteTo(LChar* destination) const { for (unsigned i = 0; i < length_; ++i) destination[i] = static_cast<LChar>(buffer_[i]); @@ -72,7 +66,6 @@ void WTF::StringTypeAdapter<StringView>::WriteTo(LChar* destination) const { DCHECK(Is8Bit()); StringImpl::CopyChars(destination, view_.Characters8(), view_.length()); - WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); } void WTF::StringTypeAdapter<StringView>::WriteTo(UChar* destination) const { @@ -80,5 +73,4 @@ StringImpl::CopyChars(destination, view_.Characters8(), view_.length()); else StringImpl::CopyChars(destination, view_.Characters16(), view_.length()); - WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); }
diff --git a/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.h b/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.h index 7dbb8e5..f026488 100644 --- a/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.h +++ b/third_party/WebKit/Source/platform/wtf/text/StringConcatenate.h
@@ -33,12 +33,6 @@ #include "platform/wtf/text/AtomicString.h" #endif -// This macro is helpful for testing how many intermediate Strings are created -// while evaluating an expression containing operator+. -#ifndef WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING -#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() ((void)0) -#endif - namespace WTF { template <typename StringType>
diff --git a/third_party/WebKit/Source/platform/wtf/text/StringOperatorsTest.cpp b/third_party/WebKit/Source/platform/wtf/text/StringOperatorsTest.cpp deleted file mode 100644 index cd82a55d..0000000 --- a/third_party/WebKit/Source/platform/wtf/text/StringOperatorsTest.cpp +++ /dev/null
@@ -1,248 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * 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 INC. AND ITS 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 APPLE INC. OR ITS 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. - */ - -#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() (++wtfStringCopyCount) - -static int wtfStringCopyCount; - -#include "build/build_config.h" -#include "platform/wtf/text/WTFString.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace WTF { - -#define EXPECT_N_WTF_STRING_COPIES(count, expr) \ - do { \ - wtfStringCopyCount = 0; \ - String __test_string = expr; \ - (void)__test_string; \ - EXPECT_EQ(count, wtfStringCopyCount) << #expr; \ - } while (false) - -TEST(StringOperatorsTest, DISABLED_StringOperators) { - String string("String"); - AtomicString atomic_string("AtomicString"); - const char* literal = "ASCIILiteral"; - - EXPECT_EQ(0, wtfStringCopyCount); - - EXPECT_N_WTF_STRING_COPIES(2, string + string); - EXPECT_N_WTF_STRING_COPIES(2, string + atomic_string); - EXPECT_N_WTF_STRING_COPIES(2, atomic_string + string); - EXPECT_N_WTF_STRING_COPIES(2, atomic_string + atomic_string); - - EXPECT_N_WTF_STRING_COPIES(1, "C string" + string); - EXPECT_N_WTF_STRING_COPIES(1, string + "C string"); - EXPECT_N_WTF_STRING_COPIES(1, "C string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES(1, atomic_string + "C string"); - - EXPECT_N_WTF_STRING_COPIES(1, literal + string); - EXPECT_N_WTF_STRING_COPIES(1, string + literal); - EXPECT_N_WTF_STRING_COPIES(1, literal + atomic_string); - EXPECT_N_WTF_STRING_COPIES(1, atomic_string + literal); - - EXPECT_N_WTF_STRING_COPIES(2, "C string" + string + "C string" + string); - EXPECT_N_WTF_STRING_COPIES(2, "C string" + (string + "C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, ("C string" + string) + ("C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, string + "C string" + string + "C string"); - EXPECT_N_WTF_STRING_COPIES(2, string + ("C string" + string + "C string")); - EXPECT_N_WTF_STRING_COPIES(2, (string + "C string") + (string + "C string")); - - EXPECT_N_WTF_STRING_COPIES(2, literal + string + literal + string); - EXPECT_N_WTF_STRING_COPIES(2, literal + (string + literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, (literal + string) + (literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, string + literal + string + literal); - EXPECT_N_WTF_STRING_COPIES(2, string + (literal + string + literal)); - EXPECT_N_WTF_STRING_COPIES(2, (string + literal) + (string + literal)); - - EXPECT_N_WTF_STRING_COPIES(2, literal + string + "C string" + string); - EXPECT_N_WTF_STRING_COPIES(2, literal + (string + "C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, (literal + string) + ("C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, "C string" + string + literal + string); - EXPECT_N_WTF_STRING_COPIES(2, "C string" + (string + literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, ("C string" + string) + (literal + string)); - - EXPECT_N_WTF_STRING_COPIES( - 2, literal + atomic_string + "C string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, literal + (atomic_string + "C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (literal + atomic_string) + ("C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + atomic_string + literal + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + (atomic_string + literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, ("C string" + atomic_string) + (literal + atomic_string)); - - EXPECT_N_WTF_STRING_COPIES(2, literal + atomic_string + "C string" + string); - EXPECT_N_WTF_STRING_COPIES(2, - literal + (atomic_string + "C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, - (literal + atomic_string) + ("C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, "C string" + atomic_string + literal + string); - EXPECT_N_WTF_STRING_COPIES(2, - "C string" + (atomic_string + literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, - ("C string" + atomic_string) + (literal + string)); - - EXPECT_N_WTF_STRING_COPIES(2, literal + string + "C string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES(2, - literal + (string + "C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, - (literal + string) + ("C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, "C string" + string + literal + atomic_string); - EXPECT_N_WTF_STRING_COPIES(2, - "C string" + (string + literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, - ("C string" + string) + (literal + atomic_string)); - - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + atomic_string + "C string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + (atomic_string + "C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, ("C string" + atomic_string) + ("C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + "C string" + atomic_string + "C string"); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + ("C string" + atomic_string + "C string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (atomic_string + "C string") + (atomic_string + "C string")); - - EXPECT_N_WTF_STRING_COPIES(2, - literal + atomic_string + literal + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, literal + (atomic_string + literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (literal + atomic_string) + (literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, - atomic_string + literal + atomic_string + literal); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + (literal + atomic_string + literal)); - EXPECT_N_WTF_STRING_COPIES( - 2, (atomic_string + literal) + (atomic_string + literal)); - - EXPECT_N_WTF_STRING_COPIES(2, - "C string" + string + "C string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + (string + "C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, ("C string" + string) + ("C string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, - string + "C string" + atomic_string + "C string"); - EXPECT_N_WTF_STRING_COPIES( - 2, string + ("C string" + atomic_string + "C string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (string + "C string") + (atomic_string + "C string")); - - EXPECT_N_WTF_STRING_COPIES(2, literal + string + literal + atomic_string); - EXPECT_N_WTF_STRING_COPIES(2, literal + (string + literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, (literal + string) + (literal + atomic_string)); - EXPECT_N_WTF_STRING_COPIES(2, string + literal + atomic_string + literal); - EXPECT_N_WTF_STRING_COPIES(2, string + (literal + atomic_string + literal)); - EXPECT_N_WTF_STRING_COPIES(2, (string + literal) + (atomic_string + literal)); - - EXPECT_N_WTF_STRING_COPIES(2, - "C string" + atomic_string + "C string" + string); - EXPECT_N_WTF_STRING_COPIES( - 2, "C string" + (atomic_string + "C string" + string)); - EXPECT_N_WTF_STRING_COPIES( - 2, ("C string" + atomic_string) + ("C string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, - atomic_string + "C string" + string + "C string"); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + ("C string" + string + "C string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (atomic_string + "C string") + (string + "C string")); - - EXPECT_N_WTF_STRING_COPIES(2, literal + atomic_string + literal + string); - EXPECT_N_WTF_STRING_COPIES(2, literal + (atomic_string + literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, (literal + atomic_string) + (literal + string)); - EXPECT_N_WTF_STRING_COPIES(2, atomic_string + literal + string + literal); - EXPECT_N_WTF_STRING_COPIES(2, atomic_string + (literal + string + literal)); - EXPECT_N_WTF_STRING_COPIES(2, (atomic_string + literal) + (string + literal)); - -#if defined(COMPILER_MSVC) - EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + string); - EXPECT_N_WTF_STRING_COPIES(1, string + L"wide string"); - EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES(1, atomic_string + L"wide string"); - - EXPECT_N_WTF_STRING_COPIES(2, - L"wide string" + string + L"wide string" + string); - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + (string + L"wide string" + string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (L"wide string" + string) + (L"wide string" + string)); - EXPECT_N_WTF_STRING_COPIES(2, - string + L"wide string" + string + L"wide string"); - EXPECT_N_WTF_STRING_COPIES( - 2, string + (L"wide string" + string + L"wide string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (string + L"wide string") + (string + L"wide string")); - - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + atomic_string + L"wide string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + (atomic_string + L"wide string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (L"wide string" + atomic_string) + (L"wide string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + L"wide string" + atomic_string + L"wide string"); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + (L"wide string" + atomic_string + L"wide string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (atomic_string + L"wide string") + (atomic_string + L"wide string")); - - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + string + L"wide string" + atomic_string); - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + (string + L"wide string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (L"wide string" + string) + (L"wide string" + atomic_string)); - EXPECT_N_WTF_STRING_COPIES( - 2, string + L"wide string" + atomic_string + L"wide string"); - EXPECT_N_WTF_STRING_COPIES( - 2, string + (L"wide string" + atomic_string + L"wide string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (string + L"wide string") + (atomic_string + L"wide string")); - - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + atomic_string + L"wide string" + string); - EXPECT_N_WTF_STRING_COPIES( - 2, L"wide string" + (atomic_string + L"wide string" + string)); - EXPECT_N_WTF_STRING_COPIES( - 2, (L"wide string" + atomic_string) + (L"wide string" + string)); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + L"wide string" + string + L"wide string"); - EXPECT_N_WTF_STRING_COPIES( - 2, atomic_string + (L"wide string" + string + L"wide string")); - EXPECT_N_WTF_STRING_COPIES( - 2, (atomic_string + L"wide string") + (string + L"wide string")); -#endif -} - -} // namespace WTF
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 8cdab8d5..af3f7d49 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -29039,6 +29039,26 @@ </summary> </histogram> +<histogram name="InstantTethering.UserPreference.OnStartup" + enum="BooleanEnabled"> + <owner>hansberry@chromium.com</owner> + <summary> + Provides the count of the number of users who have the Instant Tethering + toggle enabled vs. disabled on startup. This metric is logged each time a + user logs into a Chromebook. + </summary> +</histogram> + +<histogram name="InstantTethering.UserPreference.OnToggle" + enum="BooleanEnabled"> + <owner>hansberry@chromium.com</owner> + <summary> + Provides the count of the number of times users have enabled or disabled the + user preference for Mobile data. This metric is logged each time the value + is toggled. + </summary> +</histogram> + <histogram name="interstitial.authority_invalid_time" units="ms"> <obsolete> Removed on 8/1/13.