• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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/basictypes.h"
6 #include "base/file_path.h"
7 #include "build/build_config.h"
8 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h"
10 #include "net/base/net_util.h"
11 
12 class DefaultPluginUITest : public UITest {
13  public:
DefaultPluginUITest()14   DefaultPluginUITest() {
15     dom_automation_enabled_ = true;
16   }
17 };
18 
19 #if defined(OS_WIN)
20 #define MAYBE_DefaultPluginLoadTest DISABLED_DefaultPluginLoadTest
21 #else
22 #define MAYBE_DefaultPluginLoadTest DefaultPluginLoadTest
23 #endif
TEST_F(DefaultPluginUITest,MAYBE_DefaultPluginLoadTest)24 TEST_F(DefaultPluginUITest, MAYBE_DefaultPluginLoadTest) {
25   // Open page with default plugin.
26   FilePath test_file(test_data_directory_);
27   test_file = test_file.AppendASCII("default_plugin.html");
28   NavigateToURL(net::FilePathToFileURL(test_file));
29 
30   // Check that the default plugin was loaded. It executes a bit of javascript
31   // in the HTML file which replaces the innerHTML of div |result| with "DONE".
32   scoped_refptr<TabProxy> tab(GetActiveTab());
33   std::wstring out;
34   ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
35       L"domAutomationController.send("
36       L"document.getElementById('result').innerHTML)", &out));
37   ASSERT_EQ(L"DONE", out);
38 }
39