Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: chrome/test/ui/layout_plugin_uitest.cc

Issue 3020005: Move tests for the layout test plugin to the right fixture. (Closed)
Patch Set: fix instead of flaky Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/ui/npapi_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/common/chrome_paths.h" 9 #include "chrome/common/chrome_paths.h"
10 #include "chrome/common/url_constants.h"
11 #include "chrome/test/ui_test_utils.h"
10 #include "chrome/test/automation/tab_proxy.h" 12 #include "chrome/test/automation/tab_proxy.h"
11 #include "chrome/test/ui/npapi_test_helper.h" 13 #include "chrome/test/ui/npapi_test_helper.h"
12 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
13 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
14 16
17 using npapi_test::kTestCompleteCookie;
18 using npapi_test::kTestCompleteSuccess;
19
20 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi");
21
15 #if defined(OS_WIN) 22 #if defined(OS_WIN)
16 static const char kTestPluginName[] = "npapi_layout_test_plugin.dll"; 23 static const char kTestPluginName[] = "npapi_layout_test_plugin.dll";
17 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
18 static const char kTestPluginName[] = "TestNetscapePlugIn.plugin"; 25 static const char kTestPluginName[] = "TestNetscapePlugIn.plugin";
19 #elif defined(OS_LINUX) 26 #elif defined(OS_LINUX)
20 static const char kTestPluginName[] = "libnpapi_layout_test_plugin.so"; 27 static const char kTestPluginName[] = "libnpapi_layout_test_plugin.so";
21 #endif 28 #endif
22 29
23 class LayoutPluginTester : public NPAPITesterBase { 30 class LayoutPluginTester : public NPAPITesterBase {
24 protected: 31 protected:
(...skipping 11 matching lines...) Expand all
36 std::wstring title; 43 std::wstring title;
37 scoped_refptr<TabProxy> tab = GetActiveTab(); 44 scoped_refptr<TabProxy> tab = GetActiveTab();
38 ASSERT_TRUE(tab); 45 ASSERT_TRUE(tab);
39 EXPECT_TRUE(tab->GetTabTitle(&title)); 46 EXPECT_TRUE(tab->GetTabTitle(&title));
40 EXPECT_EQ(L"Layout Test Plugin Test", title); 47 EXPECT_EQ(L"Layout Test Plugin Test", title);
41 48
42 ASSERT_TRUE(tab->GoBack()); 49 ASSERT_TRUE(tab->GoBack());
43 EXPECT_TRUE(tab->GetTabTitle(&title)); 50 EXPECT_TRUE(tab->GetTabTitle(&title));
44 EXPECT_EQ(L"", title); 51 EXPECT_EQ(L"", title);
45 } 52 }
53
54 // Tests if a plugin executing a self deleting script using NPN_GetURL
55 // works without crashing or hanging
56 TEST_F(LayoutPluginTester, SelfDeletePluginGetUrl) {
57 const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_geturl.html"));
58 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
59 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
60 WaitForFinish("self_delete_plugin_geturl", "1", url,
61 kTestCompleteCookie, kTestCompleteSuccess,
62 action_max_timeout_ms());
63 }
64
65 // Tests if a plugin executing a self deleting script using Invoke
66 // works without crashing or hanging
67 // Flaky. See http://crbug.com/30702
68 TEST_F(LayoutPluginTester, FLAKY_SelfDeletePluginInvoke) {
69 const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_invoke.html"));
70 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
71 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
72 WaitForFinish("self_delete_plugin_invoke", "1", url,
73 kTestCompleteCookie, kTestCompleteSuccess,
74 action_max_timeout_ms());
75 }
76
77 TEST_F(LayoutPluginTester, NPObjectReleasedOnDestruction) {
78 if (UITest::in_process_renderer())
79 return;
80
81 const FilePath test_case(
82 FILE_PATH_LITERAL("npobject_released_on_destruction.html"));
83 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
84 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
85
86 scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
87 ASSERT_TRUE(window_proxy);
88 ASSERT_TRUE(window_proxy->AppendTab(GURL(chrome::kAboutBlankURL)));
89
90 scoped_refptr<TabProxy> tab_proxy(window_proxy->GetTab(0));
91 ASSERT_TRUE(tab_proxy.get());
92 ASSERT_TRUE(tab_proxy->Close(true));
93 }
94
95 // Test that a dialog is properly created when a plugin throws an
96 // exception. Should be run for in and out of process plugins, but
97 // the more interesting case is out of process, where we must route
98 // the exception to the correct renderer.
99 TEST_F(LayoutPluginTester, NPObjectSetException) {
100 const FilePath test_case(FILE_PATH_LITERAL("npobject_set_exception.html"));
101 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
102 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
103 WaitForFinish("npobject_set_exception", "1", url,
104 kTestCompleteCookie, kTestCompleteSuccess,
105 action_max_timeout_ms());
106 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/ui/npapi_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698