OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
8 #include "chrome/browser/task_manager/task_manager.h" | 8 #include "chrome/browser/task_manager/task_manager.h" |
9 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 9 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_dialogs.h" | 11 #include "chrome/browser/ui/browser_dialogs.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "extensions/common/switches.h" | 13 #include "extensions/common/switches.h" |
14 | 14 |
15 // Sometimes times out on Mac OS and Windows | 15 // Sometimes times out on Mac OS and Windows |
16 // crbug.com/97499 | 16 // crbug.com/97499 |
17 // Also on Linux: crbug.com/130138 | 17 // Also on Linux: crbug.com/130138 |
18 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHR
OMEOS) | 18 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHR
OMEOS) |
19 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Processes) { | 19 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Processes) { |
20 #else | 20 #else |
21 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Processes) { | 21 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Processes) { |
22 #endif | 22 #endif |
23 CommandLine::ForCurrentProcess()->AppendSwitch( | |
24 extensions::switches::kEnableExperimentalExtensionApis); | |
25 | |
26 ASSERT_TRUE(RunExtensionTest("processes/api")) << message_; | 23 ASSERT_TRUE(RunExtensionTest("processes/api")) << message_; |
27 } | 24 } |
28 | 25 |
29 // http://crbug.com/31663 | 26 // http://crbug.com/31663 |
30 // TODO(linux_aura) http://crbug.com/163931 | 27 // TODO(linux_aura) http://crbug.com/163931 |
31 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) | 28 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) |
32 | 29 |
33 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ProcessesVsTaskManager) { | 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ProcessesVsTaskManager) { |
34 CommandLine::ForCurrentProcess()->AppendSwitch( | |
35 extensions::switches::kEnableExperimentalExtensionApis); | |
36 | |
37 // Ensure task manager is not yet updating | 31 // Ensure task manager is not yet updating |
38 TaskManagerModel* model = TaskManager::GetInstance()->model(); | 32 TaskManagerModel* model = TaskManager::GetInstance()->model(); |
39 EXPECT_EQ(0, model->update_requests_); | 33 EXPECT_EQ(0, model->update_requests_); |
40 EXPECT_EQ(TaskManagerModel::IDLE, model->update_state_); | 34 EXPECT_EQ(TaskManagerModel::IDLE, model->update_state_); |
41 | 35 |
42 // Load extension that adds listener in background page | 36 // Load extension that adds listener in background page |
43 ExtensionTestMessageListener listener("ready", false); | 37 ExtensionTestMessageListener listener("ready", false); |
44 ASSERT_TRUE(LoadExtension( | 38 ASSERT_TRUE(LoadExtension( |
45 test_data_dir_.AppendASCII("processes").AppendASCII("onupdated"))); | 39 test_data_dir_.AppendASCII("processes").AppendASCII("onupdated"))); |
46 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 40 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
47 | 41 |
48 // Ensure the task manager has started updating | 42 // Ensure the task manager has started updating |
49 EXPECT_EQ(1, model->update_requests_); | 43 EXPECT_EQ(1, model->update_requests_); |
50 EXPECT_EQ(TaskManagerModel::TASK_PENDING, model->update_state_); | 44 EXPECT_EQ(TaskManagerModel::TASK_PENDING, model->update_state_); |
51 | 45 |
52 // Now show the task manager and wait for it to be ready | 46 // Now show the task manager and wait for it to be ready |
53 chrome::ShowTaskManager(browser()); | 47 chrome::ShowTaskManager(browser()); |
54 | 48 |
55 EXPECT_EQ(2, model->update_requests_); | 49 EXPECT_EQ(2, model->update_requests_); |
56 EXPECT_EQ(TaskManagerModel::TASK_PENDING, model->update_state_); | 50 EXPECT_EQ(TaskManagerModel::TASK_PENDING, model->update_state_); |
57 | 51 |
58 // Unload the extension and check that listener count decreases | 52 // Unload the extension and check that listener count decreases |
59 UnloadExtension(last_loaded_extension_id_); | 53 UnloadExtension(last_loaded_extension_id_); |
60 EXPECT_EQ(1, model->update_requests_); | 54 EXPECT_EQ(1, model->update_requests_); |
61 } | 55 } |
62 | 56 |
63 #endif | 57 #endif |
OLD | NEW |