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

Unified Diff: chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.h

Issue 290453006: Quick & dirty example of a WebUIBrowserTest using LoginManagerTestHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: broken test Created 6 years, 7 months 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
Index: chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.h
diff --git a/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.h b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.h
new file mode 100644
index 0000000000000000000000000000000000000000..8c48bdcddda11d541f714cd679b457221d83c21d
--- /dev/null
+++ b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.h
@@ -0,0 +1,92 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SHARED_OPTIONS_BROWSERTEST_H_
+#define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SHARED_OPTIONS_BROWSERTEST_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/test/base/web_ui_browsertest.h"
+
+#include "chrome/browser/chromeos/login/existing_user_controller.h"
+
+#include "chrome/browser/chromeos/login/ui/mock_login_display_host.h"
+
+#include "chrome/browser/chromeos/login/ui/mock_login_display.h"
+
+
+//#include "content/public/browser/web_ui_message_handler.h"
+
+//#include "base/prefs/pref_service.h"
+
+#include "chrome/browser/chromeos/login/login_manager_test_helper.h"
+//#include "chrome/browser/chromeos/login/startup_utils.h"
+//#include "chrome/browser/chromeos/login/user_adding_screen.h"
+//#include "chrome/browser/chromeos/login/user_manager.h"
+//#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
+//#include "chrome/browser/ui/browser.h"
+//#include "chrome/common/chrome_switches.h"
+//#include "chrome/common/pref_names.h"
+//#include "chrome/test/base/ui_test_utils.h"
+//#include "chrome/browser/ui/tabs/tab_strip_model.h"
+//#include "chromeos/settings/cros_settings_names.h"
+//#include "content/public/browser/web_contents.h"
+//#include "content/public/test/browser_test_utils.h"
+//#include "content/public/test/test_utils.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+namespace chromeos {
+
+class CrosSettingsProvider;
+class User;
+
+// todo: // This is a helper class used by options_browsertest.js to feed the navigation
+// history back to the test. blah blah
+class SharedOptionsTest : public WebUIBrowserTest,
+ public content::WebUIMessageHandler {
+ public:
+ SharedOptionsTest();
+ virtual ~SharedOptionsTest();
+
+ // WebUIBrowserTest implementation.
+ virtual void SetUpOnMainThread() OVERRIDE;
+ virtual void CleanUpOnMainThread() OVERRIDE;
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
+ virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
+
+ // WebUIMessageHandler implementation.
+ virtual void RegisterMessages() OVERRIDE;
+
+ // WebUIBrowserTest implementation.
+ virtual content::WebUIMessageHandler* GetMockMessageHandler() OVERRIDE;
+
+ void SetUpLoginDisplay();
+
+protected:
+ void CheckOptionsUI(const User* user, bool is_primary);
+
+ StubCrosSettingsProvider stub_settings_provider_;
+ CrosSettingsProvider* device_settings_provider_;
+ scoped_ptr<LoginManagerTestHelper> login_manager_test_helper_;
+
+ private:
+ // A callback for the 'optionsTestReportHistory' message, this sends the
+ // URLs in the "back" tab history, including the current entry, back to the
+ // WebUI via a callback.
+ void ReportHistory(const base::ListValue* list_value);
+
+ void RegisterUsers(const base::ListValue* list_value);
+ void LogInUser(const base::ListValue* list_value);
+ void AddUser(const base::ListValue* list_value);
+ scoped_ptr<ExistingUserController> existing_user_controller_;
+ scoped_ptr<MockLoginDisplayHost> mock_login_display_host_;
+ MockLoginDisplay* mock_login_display_;
+
+ DISALLOW_COPY_AND_ASSIGN(SharedOptionsTest);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SHARED_OPTIONS_BROWSERTEST_H_

Powered by Google App Engine
This is Rietveld 408576698