| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "content/public/browser/navigation_details.h" | 15 #include "content/public/browser/navigation_details.h" |
| 16 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 17 #include "grit/browser_resources.h" | 17 #include "grit/browser_resources.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 GURL CreateResource(const std::string& content) { | 23 GURL CreateResource(const std::string& content) { |
| 24 base::FilePath path; | 24 base::FilePath path; |
| 25 EXPECT_TRUE(base::CreateTemporaryFile(&path)); | 25 EXPECT_TRUE(base::CreateTemporaryFile(&path)); |
| 26 EXPECT_TRUE(file_util::WriteFile(path, content.c_str(), content.size())); | 26 EXPECT_TRUE(base::WriteFile(path, content.c_str(), content.size())); |
| 27 return GURL("file:///" + path.AsUTF8Unsafe()); | 27 return GURL("file:///" + path.AsUTF8Unsafe()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Test the CrOS login screen resource loading mechanism. | 30 // Test the CrOS login screen resource loading mechanism. |
| 31 class ResourceLoaderBrowserTest : public InProcessBrowserTest { | 31 class ResourceLoaderBrowserTest : public InProcessBrowserTest { |
| 32 public: | 32 public: |
| 33 ResourceLoaderBrowserTest() {} | 33 ResourceLoaderBrowserTest() {} |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 36 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 JSExpect("!!document.querySelector('div#root h1#bar')"); | 128 JSExpect("!!document.querySelector('div#root h1#bar')"); |
| 129 | 129 |
| 130 // Check that the JS was loaded and evaluated. | 130 // Check that the JS was loaded and evaluated. |
| 131 JSExpect("stuff.loaded"); | 131 JSExpect("stuff.loaded"); |
| 132 | 132 |
| 133 // Check that the styles were loaded. | 133 // Check that the styles were loaded. |
| 134 JSExpect("!!document.head.querySelector('link').innerHTML.indexOf('red')"); | 134 JSExpect("!!document.head.querySelector('link').innerHTML.indexOf('red')"); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace | 137 } // namespace |
| OLD | NEW |