OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/browser/extensions/user_script_loader.h" | 5 #include "chrome/browser/extensions/user_script_loader.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 BrowserThread::FILE, base::MessageLoop::current())); | 56 BrowserThread::FILE, base::MessageLoop::current())); |
57 ui_thread_.reset(new content::TestBrowserThread( | 57 ui_thread_.reset(new content::TestBrowserThread( |
58 BrowserThread::UI, base::MessageLoop::current())); | 58 BrowserThread::UI, base::MessageLoop::current())); |
59 } | 59 } |
60 | 60 |
61 virtual void TearDown() { | 61 virtual void TearDown() { |
62 file_thread_.reset(); | 62 file_thread_.reset(); |
63 ui_thread_.reset(); | 63 ui_thread_.reset(); |
64 } | 64 } |
65 | 65 |
66 virtual void Observe(int type, | 66 void Observe(int type, |
67 const content::NotificationSource& source, | 67 const content::NotificationSource& source, |
68 const content::NotificationDetails& details) override { | 68 const content::NotificationDetails& details) override { |
69 DCHECK(type == extensions::NOTIFICATION_USER_SCRIPTS_UPDATED); | 69 DCHECK(type == extensions::NOTIFICATION_USER_SCRIPTS_UPDATED); |
70 | 70 |
71 shared_memory_ = content::Details<base::SharedMemory>(details).ptr(); | 71 shared_memory_ = content::Details<base::SharedMemory>(details).ptr(); |
72 if (base::MessageLoop::current() == &message_loop_) | 72 if (base::MessageLoop::current() == &message_loop_) |
73 base::MessageLoop::current()->Quit(); | 73 base::MessageLoop::current()->Quit(); |
74 } | 74 } |
75 | 75 |
76 // Directory containing user scripts. | 76 // Directory containing user scripts. |
77 base::ScopedTempDir temp_dir_; | 77 base::ScopedTempDir temp_dir_; |
78 | 78 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 UserScriptList user_scripts; | 257 UserScriptList user_scripts; |
258 user_scripts.push_back(user_script); | 258 user_scripts.push_back(user_script); |
259 | 259 |
260 UserScriptLoader::LoadScriptsForTest(&user_scripts); | 260 UserScriptLoader::LoadScriptsForTest(&user_scripts); |
261 | 261 |
262 EXPECT_EQ(content, user_scripts[0].js_scripts()[0].GetContent().as_string()); | 262 EXPECT_EQ(content, user_scripts[0].js_scripts()[0].GetContent().as_string()); |
263 } | 263 } |
264 | 264 |
265 } // namespace extensions | 265 } // namespace extensions |
OLD | NEW |