| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const extensions::Extension* LoadTestExtension() { | 21 const extensions::Extension* LoadTestExtension() { |
| 22 const extensions::Extension* extension = LoadExtension( | 22 const extensions::Extension* extension = LoadExtension( |
| 23 test_data_dir_.AppendASCII("mime_handler_view")); | 23 test_data_dir_.AppendASCII("mime_handler_view")); |
| 24 if (!extension) | 24 if (!extension) |
| 25 return nullptr; | 25 return nullptr; |
| 26 | 26 |
| 27 CHECK_EQ(std::string(kExtensionId), extension->id()); | 27 CHECK_EQ(std::string(kExtensionId), extension->id()); |
| 28 | 28 |
| 29 return extension; | 29 return extension; |
| 30 } | 30 } |
| 31 |
| 32 void RunTest(const std::string& path) { |
| 33 const extensions::Extension* extension = LoadTestExtension(); |
| 34 ASSERT_TRUE(extension); |
| 35 |
| 36 extensions::ResultCatcher catcher; |
| 37 |
| 38 GURL extension_url("chrome-extension://" + std::string(kExtensionId) + "/" + |
| 39 path); |
| 40 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 41 |
| 42 if (!catcher.GetNextResult()) |
| 43 FAIL() << catcher.message(); |
| 44 } |
| 31 }; | 45 }; |
| 32 | 46 |
| 33 // Not working on Windows because of crbug.com/443466. | 47 // Not working on Windows because of crbug.com/443466. |
| 34 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 35 #define MAYBE_PostMessage DISABLED_PostMessage | 49 #define MAYBE_PostMessage DISABLED_PostMessage |
| 50 #define MAYBE_Basic DISABLED_Basic |
| 51 #define MAYBE_Embedded DISABLED_Embedded |
| 52 #define MAYBE_Abort DISABLED_Abort |
| 36 #else | 53 #else |
| 37 #define MAYBE_PostMessage PostMessage | 54 #define MAYBE_PostMessage PostMessage |
| 55 #define MAYBE_Basic Basic |
| 56 #define MAYBE_Embedded Embedded |
| 57 #define MAYBE_Abort Abort |
| 38 #endif | 58 #endif |
| 39 | 59 |
| 40 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_PostMessage) { | 60 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_PostMessage) { |
| 41 const extensions::Extension* extension = LoadTestExtension(); | 61 RunTest("test_postmessage.html"); |
| 42 ASSERT_TRUE(extension); | 62 } |
| 43 | 63 |
| 44 extensions::ResultCatcher catcher; | 64 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Basic) { |
| 65 RunTest("testBasic.csv"); |
| 66 } |
| 45 | 67 |
| 46 GURL extension_url("chrome-extension://" + | 68 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Embedded) { |
| 47 std::string(kExtensionId) + | 69 RunTest("test_embedded.html"); |
| 48 "/test_postmessage.html"); | 70 } |
| 49 ui_test_utils::NavigateToURL(browser(), extension_url); | |
| 50 | 71 |
| 51 if (!catcher.GetNextResult()) | 72 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Abort) { |
| 52 FAIL() << catcher.message(); | 73 RunTest("testAbort.csv"); |
| 53 } | 74 } |
| OLD | NEW |