diff options
-rw-r--r-- | chrome/browser/chromeos/update_browsertest.cc | 119 | ||||
-rw-r--r-- | chrome/browser/chromeos/update_observer.cc | 36 | ||||
-rw-r--r-- | chrome/browser/chromeos/update_observer.h | 37 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 |
6 files changed, 0 insertions, 201 deletions
diff --git a/chrome/browser/chromeos/update_browsertest.cc b/chrome/browser/chromeos/update_browsertest.cc deleted file mode 100644 index f2351baf..0000000 --- a/chrome/browser/chromeos/update_browsertest.cc +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2011 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/memory/ref_counted.h" -#include "base/utf_string_conversions.h" -#include "chrome/browser/chromeos/cros/mock_update_library.h" -#include "chrome/browser/chromeos/update_observer.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/common/url_constants.h" -#include "chrome/test/automation/dom_element_proxy.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" - -using ::testing::AnyNumber; -using ::testing::InvokeWithoutArgs; -using ::testing::Return; -using ::testing::ReturnRef; -using ::testing::_; -using ::testing::Invoke; -using ::testing::Exactly; - -namespace { - -typedef ObserverList<chromeos::UpdateLibrary::Observer> Observers; - -void CallObservers(chromeos::MockUpdateLibrary* lib, - Observers* observers, - const chromeos::UpdateLibrary::Status& x) { - EXPECT_CALL(*lib, status()) - .Times(AnyNumber()) - .WillRepeatedly((ReturnRef(x))) - .RetiresOnSaturation(); - FOR_EACH_OBSERVER(chromeos::UpdateLibrary::Observer, *observers, - UpdateStatusChanged(lib)); -} - -void FireSuccessSequence(chromeos::MockUpdateLibrary* lib, - Observers* observer) { - chromeos::UpdateLibrary::Status status; - - status.status = chromeos::UPDATE_STATUS_IDLE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_CHECKING_FOR_UPDATE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_UPDATE_AVAILABLE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_DOWNLOADING; - status.download_progress = 10; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_DOWNLOADING; - status.download_progress = 50; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_DOWNLOADING; - status.download_progress = 90; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_VERIFYING; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_FINALIZING; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT; - CallObservers(lib, observer, status); -} - -void FireFailureSequence(chromeos::MockUpdateLibrary* lib, - Observers* observer) { - chromeos::UpdateLibrary::Status status; - - status.status = chromeos::UPDATE_STATUS_IDLE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_CHECKING_FOR_UPDATE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_UPDATE_AVAILABLE; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_DOWNLOADING; - status.download_progress = 10; - CallObservers(lib, observer, status); - - status.status = chromeos::UPDATE_STATUS_ERROR; - status.download_progress = 10; - CallObservers(lib, observer, status); -} - -class UpdateBrowserTest : public InProcessBrowserTest { - public: - UpdateBrowserTest() {} -}; - -IN_PROC_BROWSER_TEST_F(UpdateBrowserTest, Notifications) { - scoped_ptr<chromeos::MockUpdateLibrary> lib( - new chromeos::MockUpdateLibrary()); - - Observers observers; - - EXPECT_CALL(*lib, AddObserver(_)) - .WillRepeatedly(Invoke(&observers, - &Observers::AddObserver)); - - chromeos::UpdateObserver* observe = - new chromeos::UpdateObserver(browser()->profile()); - lib->AddObserver(observe); - - FireSuccessSequence(lib.get(), &observers); - FireFailureSequence(lib.get(), &observers); -} - -} // namespace diff --git a/chrome/browser/chromeos/update_observer.cc b/chrome/browser/chromeos/update_observer.cc deleted file mode 100644 index 33b13a1..0000000 --- a/chrome/browser/chromeos/update_observer.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/update_observer.h" - -#include "base/string_number_conversions.h" -#include "base/utf_string_conversions.h" -#include "chrome/common/time_format.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "ui/base/l10n/l10n_util.h" - -namespace chromeos { - -UpdateObserver::UpdateObserver(Profile* profile) - : notification_(profile, "update.chromeos", IDR_NOTIFICATION_UPDATE, - l10n_util::GetStringUTF16(IDS_UPDATE_TITLE)) {} - -UpdateObserver::~UpdateObserver() { - notification_.Hide(); -} - -void UpdateObserver::UpdateStatusChanged(UpdateLibrary* library) { -#if 0 - // TODO seanparent@chromium.org : This update should only be shown when an - // update is critical and should include a restart button using the - // update_engine restart API. Currently removed entirely per Kan's request. - - if (library->status().status == UPDATE_STATUS_UPDATED_NEED_REBOOT) { - notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED), true); - } -#endif -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/update_observer.h b/chrome/browser/chromeos/update_observer.h deleted file mode 100644 index 3ec372b..0000000 --- a/chrome/browser/chromeos/update_observer.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_UPDATE_OBSERVER_H_ -#define CHROME_BROWSER_CHROMEOS_UPDATE_OBSERVER_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/time.h" -#include "chrome/browser/chromeos/cros/update_library.h" -#include "chrome/browser/chromeos/notifications/system_notification.h" - -class Profile; - -namespace chromeos { - -// The update observer displays a system notification when the an update is -// available. - -class UpdateObserver : public UpdateLibrary::Observer { - public: - explicit UpdateObserver(Profile* profile); - virtual ~UpdateObserver(); - - private: - virtual void UpdateStatusChanged(UpdateLibrary* library); - - SystemNotification notification_; - - DISALLOW_COPY_AND_ASSIGN(UpdateObserver); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_UPDATE_OBSERVER_H_ - diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 7ba03b7..779f025 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -102,7 +102,6 @@ #include "chrome/browser/chromeos/low_battery_observer.h" #include "chrome/browser/chromeos/network_message_observer.h" #include "chrome/browser/chromeos/sms_observer.h" -#include "chrome/browser/chromeos/update_observer.h" #if defined(TOOLKIT_USES_GTK) #include "chrome/browser/chromeos/wm_message_listener.h" #endif @@ -617,11 +616,6 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line, chromeos::CrosLibrary::Get()->GetPowerLibrary()->AddObserver( low_battery_observer); - static chromeos::UpdateObserver* update_observer = - new chromeos::UpdateObserver(profile); - chromeos::CrosLibrary::Get()->GetUpdateLibrary()->AddObserver( - update_observer); - static chromeos::NetworkMessageObserver* network_message_observer = new chromeos::NetworkMessageObserver(profile); chromeos::CrosLibrary::Get()->GetNetworkLibrary() diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index a0f09e4..7d1c4d1 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -794,8 +794,6 @@ 'browser/chromeos/tab_closeable_state_watcher.h', 'browser/chromeos/tab_first_render_watcher.cc', 'browser/chromeos/tab_first_render_watcher.h', - 'browser/chromeos/update_observer.cc', - 'browser/chromeos/update_observer.h', 'browser/chromeos/upgrade_detector_chromeos.cc', 'browser/chromeos/upgrade_detector_chromeos.h', 'browser/chromeos/user_cros_settings_provider.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index b07f990..3ae3df2 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2334,7 +2334,6 @@ 'browser/chromeos/status/power_menu_button_browsertest.cc', 'browser/chromeos/status/status_area_view_browsertest.cc', 'browser/chromeos/tab_closeable_state_watcher_browsertest.cc', - 'browser/chromeos/update_browsertest.cc', 'browser/content_settings/content_settings_browsertest.cc', 'browser/crash_recovery_browsertest.cc', 'browser/custom_handlers/protocol_handler_registry_browsertest.cc', |