| 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/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 CancelLoginDialog() { | 36 CancelLoginDialog() { |
| 37 registrar_.Add(this, | 37 registrar_.Add(this, |
| 38 chrome::NOTIFICATION_AUTH_NEEDED, | 38 chrome::NOTIFICATION_AUTH_NEEDED, |
| 39 content::NotificationService::AllSources()); | 39 content::NotificationService::AllSources()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual ~CancelLoginDialog() {} | 42 virtual ~CancelLoginDialog() {} |
| 43 | 43 |
| 44 virtual void Observe(int type, | 44 virtual void Observe(int type, |
| 45 const content::NotificationSource& source, | 45 const content::NotificationSource& source, |
| 46 const content::NotificationDetails& details) OVERRIDE { | 46 const content::NotificationDetails& details) override { |
| 47 LoginHandler* handler = | 47 LoginHandler* handler = |
| 48 content::Details<LoginNotificationDetails>(details).ptr()->handler(); | 48 content::Details<LoginNotificationDetails>(details).ptr()->handler(); |
| 49 handler->CancelAuth(); | 49 handler->CancelAuth(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 content::NotificationRegistrar registrar_; | 53 content::NotificationRegistrar registrar_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(CancelLoginDialog); | 55 DISALLOW_COPY_AND_ASSIGN(CancelLoginDialog); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 class ExtensionWebRequestApiTest : public ExtensionApiTest { | 60 class ExtensionWebRequestApiTest : public ExtensionApiTest { |
| 61 public: | 61 public: |
| 62 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 62 virtual void SetUpInProcessBrowserTestFixture() override { |
| 63 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 63 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 64 host_resolver()->AddRule("*", "127.0.0.1"); | 64 host_resolver()->AddRule("*", "127.0.0.1"); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void RunPermissionTest( | 67 void RunPermissionTest( |
| 68 const char* extension_directory, | 68 const char* extension_directory, |
| 69 bool load_extension_with_incognito_permission, | 69 bool load_extension_with_incognito_permission, |
| 70 bool wait_for_extension_loaded_in_incognito, | 70 bool wait_for_extension_loaded_in_incognito, |
| 71 const char* expected_content_regular_window, | 71 const char* expected_content_regular_window, |
| 72 const char* exptected_content_incognito_window); | 72 const char* exptected_content_incognito_window); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Reload extension and wait for rules to be set up again. This should not | 315 // Reload extension and wait for rules to be set up again. This should not |
| 316 // crash the browser. | 316 // crash the browser. |
| 317 ExtensionTestMessageListener listener2("done", true); | 317 ExtensionTestMessageListener listener2("done", true); |
| 318 ExtensionTestMessageListener listener_incognito2("done_incognito", true); | 318 ExtensionTestMessageListener listener_incognito2("done_incognito", true); |
| 319 | 319 |
| 320 ReloadExtension(extension->id()); | 320 ReloadExtension(extension->id()); |
| 321 | 321 |
| 322 EXPECT_TRUE(listener2.WaitUntilSatisfied()); | 322 EXPECT_TRUE(listener2.WaitUntilSatisfied()); |
| 323 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied()); | 323 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied()); |
| 324 } | 324 } |
| OLD | NEW |