Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / streams_private / streams_private_apitest.cc
index c7907c9..00b5b4e 100644 (file)
@@ -101,6 +101,14 @@ scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
     return response.PassAs<HttpResponse>();
   }
 
+  // RTF files for testing chrome.streamsPrivate.abort().
+  if (request.relative_url == "/abort.rtf" ||
+      request.relative_url == "/no_abort.rtf") {
+    response->set_code(net::HTTP_OK);
+    response->set_content_type("application/rtf");
+    return response.PassAs<HttpResponse>();
+  }
+
   // Respond to /favicon.ico for navigating to the page.
   if (request.relative_url == "/favicon.ico") {
     response->set_code(net::HTTP_NOT_FOUND);
@@ -133,11 +141,11 @@ class StreamsPrivateApiTest : public ExtensionApiTest {
     ExtensionApiTest::SetUpOnMainThread();
   }
 
-  virtual void CleanUpOnMainThread() OVERRIDE {
+  virtual void TearDownOnMainThread() OVERRIDE {
     // Tear down the test server.
     EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete());
     test_server_.reset();
-    ExtensionApiTest::CleanUpOnMainThread();
+    ExtensionApiTest::TearDownOnMainThread();
   }
 
   void InitializeDownloadSettings() {
@@ -421,4 +429,26 @@ IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, Headers) {
   EXPECT_TRUE(catcher.GetNextResult());
 }
 
+// Tests that chrome.streamsPrivate.abort() works correctly.
+IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, Abort) {
+#if defined(OS_WIN) && defined(USE_ASH)
+  // Disable this test in Metro+Ash for now (http://crbug.com/262796).
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
+    return;
+#endif
+
+  ASSERT_TRUE(LoadTestExtension()) << message_;
+
+  ResultCatcher catcher;
+  ui_test_utils::NavigateToURL(browser(),
+                               test_server_->GetURL("/no_abort.rtf"));
+  base::MessageLoop::current()->RunUntilIdle();
+  EXPECT_TRUE(catcher.GetNextResult());
+
+  ui_test_utils::NavigateToURL(browser(),
+                               test_server_->GetURL("/abort.rtf"));
+  base::MessageLoop::current()->RunUntilIdle();
+  EXPECT_TRUE(catcher.GetNextResult());
+}
+
 }  // namespace