| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 6 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 CancelLoginDialog() { | 34 CancelLoginDialog() { |
| 35 registrar_.Add(this, | 35 registrar_.Add(this, |
| 36 chrome::NOTIFICATION_AUTH_NEEDED, | 36 chrome::NOTIFICATION_AUTH_NEEDED, |
| 37 content::NotificationService::AllSources()); | 37 content::NotificationService::AllSources()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual ~CancelLoginDialog() {} | 40 virtual ~CancelLoginDialog() {} |
| 41 | 41 |
| 42 virtual void Observe(int type, | 42 virtual void Observe(int type, |
| 43 const content::NotificationSource& source, | 43 const content::NotificationSource& source, |
| 44 const content::NotificationDetails& details) { | 44 const content::NotificationDetails& details) OVERRIDE { |
| 45 LoginHandler* handler = | 45 LoginHandler* handler = |
| 46 content::Details<LoginNotificationDetails>(details).ptr()->handler(); | 46 content::Details<LoginNotificationDetails>(details).ptr()->handler(); |
| 47 handler->CancelAuth(); | 47 handler->CancelAuth(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 content::NotificationRegistrar registrar_; | 51 content::NotificationRegistrar registrar_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(CancelLoginDialog); | 53 DISALLOW_COPY_AND_ASSIGN(CancelLoginDialog); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| 57 | 57 |
| 58 class ExtensionWebRequestApiTest : public ExtensionApiTest { | 58 class ExtensionWebRequestApiTest : public ExtensionApiTest { |
| 59 public: | 59 public: |
| 60 virtual void SetUpInProcessBrowserTestFixture() { | 60 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 61 // TODO(battre): remove this when declarative webRequest API becomes stable. | 61 // TODO(battre): remove this when declarative webRequest API becomes stable. |
| 62 CommandLine::ForCurrentProcess()->AppendSwitch( | 62 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 63 switches::kEnableExperimentalExtensionApis); | 63 switches::kEnableExperimentalExtensionApis); |
| 64 | 64 |
| 65 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 65 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 66 host_resolver()->AddRule("*", "127.0.0.1"); | 66 host_resolver()->AddRule("*", "127.0.0.1"); |
| 67 ASSERT_TRUE(StartTestServer()); | 67 ASSERT_TRUE(StartTestServer()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void RunPermissionTest( | 70 void RunPermissionTest( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, PostData2) { | 260 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, PostData2) { |
| 261 // Test HTML form POST data access with the multipart and plaintext encoding. | 261 // Test HTML form POST data access with the multipart and plaintext encoding. |
| 262 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << | 262 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << |
| 263 message_; | 263 message_; |
| 264 } | 264 } |
| 265 | 265 |
| 266 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 266 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
| 267 DeclarativeSendMessage) { | 267 DeclarativeSendMessage) { |
| 268 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; | 268 ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; |
| 269 } | 269 } |
| OLD | NEW |