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

Unified Diff: chrome/browser/devtools/devtools_sanity_browsertest.cc

Issue 12319114: Extract debugger target enumeration into a separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger
Patch Set: Rebase Created 7 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_sanity_browsertest.cc
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 67a61c2652e551b60816bb1a445b332e04edbd90..40d03ebe09c0bc7a0cd8ae45013275bd1d802f38 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -11,7 +11,9 @@
#include "base/stringprintf.h"
#include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/devtools/browser_list_tabcontents_provider.h"
#include "chrome/browser/devtools/devtools_window.h"
+#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/unpacked_installer.h"
@@ -29,6 +31,7 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_client_host.h"
+#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
@@ -37,6 +40,7 @@
#include "content/public/browser/worker_service.h"
#include "content/public/browser/worker_service_observer.h"
#include "content/public/test/browser_test_utils.h"
+#include "net/base/tcp_listen_socket.h"
#include "net/test/test_server.h"
using content::BrowserThread;
@@ -610,4 +614,74 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestAddMessageToConsole) {
CloseDevToolsWindow();
}
+class RemoteDebuggingTest : public ExtensionBrowserTest {
+
+ class ResultCatcher : public content::NotificationObserver {
+ public:
+ ResultCatcher()
+ : notification_(chrome::NOTIFICATION_CHROME_END) {
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED,
+ content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED,
+ content::NotificationService::AllSources());
+ }
+
+ virtual ~ResultCatcher() {
+ }
+
+ // Pumps the UI loop until a notification is received that an API test
+ // succeeded or failed. Returns true if the test succeeded, false otherwise.
+ bool GetNextResult() {
+ if (!received())
+ content::RunMessageLoop();
+
+ if (!received())
+ NOTREACHED();
+
+ return notification_ == chrome::NOTIFICATION_EXTENSION_TEST_PASSED;
+ }
+
+ private:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE {
+ if (received())
+ return;
+ notification_ = static_cast<chrome::NotificationType>(type);
+ MessageLoopForUI::current()->Quit();
+ }
+
+ content::NotificationRegistrar registrar_;
+
+ chrome::NotificationType notification_;
+
+ bool received() { return notification_ != chrome::NOTIFICATION_CHROME_END; }
+ };
+
+ protected:
+
+ bool RunExtensionTest(const std::string& directory) {
+ content::DevToolsHttpHandler* devtools_http_handler_ =
+ content::DevToolsHttpHandler::Start(
+ new net::TCPListenSocketFactory("127.0.0.1", 9222),
+ "",
+ new BrowserListTabContentsProvider(
+ profile(), chrome::HOST_DESKTOP_TYPE_NATIVE));
+
+ base::FilePath test_data_path;
+ PathService::Get(chrome::DIR_TEST_DATA, &test_data_path);
+ LoadExtension(
+ test_data_path.AppendASCII("devtools").AppendASCII(directory));
+
+ ResultCatcher catcher;
+ bool result = catcher.GetNextResult();
+ devtools_http_handler_->Stop();
+ return result;
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, TargetList) {
+ ASSERT_TRUE(RunExtensionTest("target_list"));
+}
+
} // namespace
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698