Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: chrome/browser/extensions/system/system_apitest.cc

Issue 8747003: Add private system extension API to get system update status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for the case with no update on non-ChromeOS platforms Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/system/system_api.cc ('k') | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/system/system_apitest.cc
diff --git a/chrome/browser/extensions/system/system_apitest.cc b/chrome/browser/extensions/system/system_apitest.cc
index a4555faf98d80f68e9069de83adb1ee8a7e2dcf0..900669c6f08e581c2da9547849d34b890dea11f1 100644
--- a/chrome/browser/extensions/system/system_apitest.cc
+++ b/chrome/browser/extensions/system/system_apitest.cc
@@ -8,9 +8,65 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/pref_names.h"
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SystemApi) {
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h"
+#include "chrome/browser/chromeos/dbus/mock_update_engine_client.h"
+
+using chromeos::UpdateEngineClient;
+using ::testing::Return;
+#endif
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, GetIncognitoModeAvailability) {
PrefService* pref_service = browser()->profile()->GetPrefs();
pref_service->SetInteger(prefs::kIncognitoModeAvailability, 1);
- EXPECT_TRUE(RunComponentExtensionTest("system")) << message_;
+ EXPECT_TRUE(RunComponentExtensionTest(
+ "system/get_incognito_mode_availability")) << message_;
+}
+
+#if defined(OS_CHROMEOS)
+
+class GetUpdateStatusApiTest : public ExtensionApiTest {
+ public:
+ GetUpdateStatusApiTest() : mock_update_engine_client_(NULL) {}
+
+ virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
+ ExtensionApiTest::SetUpInProcessBrowserTestFixture();
+ chromeos::MockDBusThreadManager* mock_dbus_thread_manager =
+ new chromeos::MockDBusThreadManager;
+ chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager);
+ mock_update_engine_client_ =
+ mock_dbus_thread_manager->mock_update_engine_client();
+ }
+
+ virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
+ chromeos::DBusThreadManager::Shutdown();
+ ExtensionApiTest::TearDownInProcessBrowserTestFixture();
+ }
+
+ protected:
+ chromeos::MockUpdateEngineClient* mock_update_engine_client_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetUpdateStatusApiTest);
+};
+
+IN_PROC_BROWSER_TEST_F(GetUpdateStatusApiTest, Progress) {
+ UpdateEngineClient::Status status_not_available;
+ status_not_available.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
+ UpdateEngineClient::Status status_updating;
+ status_updating.status = UpdateEngineClient::UPDATE_STATUS_DOWNLOADING;
+ status_updating.download_progress = 0.5;
+ UpdateEngineClient::Status status_boot_needed;
+ status_boot_needed.status =
+ UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
+
+ EXPECT_CALL(*mock_update_engine_client_, GetLastStatus())
+ .WillOnce(Return(status_not_available))
+ .WillOnce(Return(status_updating))
+ .WillOnce(Return(status_boot_needed));
+ ASSERT_TRUE(RunComponentExtensionTest(
+ "system/get_update_status")) << message_;
}
+
+#endif
« no previous file with comments | « chrome/browser/extensions/system/system_api.cc ('k') | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698