OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/base_paths.h" | |
6 #include "base/files/file_util.h" | |
7 #include "base/path_service.h" | |
8 #include "chrome/browser/extensions/extension_apitest.h" | |
9 #include "chrome/test/base/ui_test_utils.h" | |
10 #include "content/public/test/browser_test_utils.h" | |
11 #include "extensions/browser/extension_registry.h" | |
12 #include "extensions/test/result_catcher.h" | |
13 | |
14 // The test extension id is set by the key value in the manifest. | |
15 const char* kExtensionId = "oickdpebdnfbgkcaoklfcdhjniefkcji"; | |
16 | |
17 class MimeHandlerViewTest : public ExtensionApiTest { | |
18 public: | |
19 ~MimeHandlerViewTest() override {} | |
20 | |
21 const extensions::Extension* LoadTestExtension() { | |
22 const extensions::Extension* extension = LoadExtension( | |
23 test_data_dir_.AppendASCII("mime_handler_view")); | |
24 if (!extension) | |
25 return nullptr; | |
26 | |
27 CHECK_EQ(std::string(kExtensionId), extension->id()); | |
28 | |
29 return extension; | |
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 } | |
45 }; | |
46 | |
47 // Not working on Windows because of crbug.com/443466. | |
48 #if defined(OS_WIN) | |
49 #define MAYBE_PostMessage DISABLED_PostMessage | |
50 #define MAYBE_Basic DISABLED_Basic | |
51 #define MAYBE_Embedded DISABLED_Embedded | |
52 #define MAYBE_Abort DISABLED_Abort | |
53 #else | |
54 #define MAYBE_PostMessage PostMessage | |
55 #define MAYBE_Basic Basic | |
56 #define MAYBE_Embedded Embedded | |
57 #define MAYBE_Abort Abort | |
58 #endif | |
59 | |
60 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_PostMessage) { | |
61 RunTest("test_postmessage.html"); | |
62 } | |
63 | |
64 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Basic) { | |
65 RunTest("testBasic.csv"); | |
66 } | |
67 | |
68 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Embedded) { | |
69 RunTest("test_embedded.html"); | |
70 } | |
71 | |
72 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, MAYBE_Abort) { | |
73 RunTest("testAbort.csv"); | |
74 } | |
OLD | NEW |