OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/automation/extension_automation_constants.h" | 9 #include "chrome/browser/automation/extension_automation_constants.h" |
10 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 10 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // through code, instead of having to contort the browser into a state | 50 // through code, instead of having to contort the browser into a state |
51 // suitable for testing. | 51 // suitable for testing. |
52 // | 52 // |
53 // By default, makes Chrome forward all Chrome Extension API function calls | 53 // By default, makes Chrome forward all Chrome Extension API function calls |
54 // via the automation interface. To override this, call set_functions_enabled() | 54 // via the automation interface. To override this, call set_functions_enabled() |
55 // with a list of function names that should be forwarded, | 55 // with a list of function names that should be forwarded, |
56 class ExtensionUITest : public ExternalTabUITest { | 56 class ExtensionUITest : public ExternalTabUITest { |
57 public: | 57 public: |
58 explicit ExtensionUITest(const std::string& extension_path) | 58 explicit ExtensionUITest(const std::string& extension_path) |
59 : loop_(MessageLoop::current()) { | 59 : loop_(MessageLoop::current()) { |
60 FilePath filename(test_data_directory_); | 60 FilePath filename = test_data_directory_.AppendASCII(extension_path); |
61 filename = filename.AppendASCII(extension_path); | 61 launch_arguments_.AppendSwitchPath(switches::kLoadExtension, filename); |
62 launch_arguments_.AppendSwitchWithValue(switches::kLoadExtension, | |
63 filename.value()); | |
64 functions_enabled_.push_back("*"); | 62 functions_enabled_.push_back("*"); |
65 } | 63 } |
66 | 64 |
67 void set_functions_enabled( | 65 void set_functions_enabled( |
68 const std::vector<std::string>& functions_enabled) { | 66 const std::vector<std::string>& functions_enabled) { |
69 functions_enabled_ = functions_enabled; | 67 functions_enabled_ = functions_enabled; |
70 } | 68 } |
71 | 69 |
72 void SetUp() { | 70 void SetUp() { |
73 ExternalTabUITest::SetUp(); | 71 ExternalTabUITest::SetUp(); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 ASSERT_EQ(arraysize(events_), event_count_.size()); | 479 ASSERT_EQ(arraysize(events_), event_count_.size()); |
482 for (std::map<std::string, int>::iterator i = event_count_.begin(); | 480 for (std::map<std::string, int>::iterator i = event_count_.begin(); |
483 i != event_count_.end(); ++i) { | 481 i != event_count_.end(); ++i) { |
484 const std::pair<std::string, int>& value = *i; | 482 const std::pair<std::string, int>& value = *i; |
485 EXPECT_EQ(1, value.second); | 483 EXPECT_EQ(1, value.second); |
486 } | 484 } |
487 } | 485 } |
488 #endif // defined(OS_WIN) | 486 #endif // defined(OS_WIN) |
489 | 487 |
490 } // namespace | 488 } // namespace |
OLD | NEW |