// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/basictypes.h"
#include "base/file_path.h"
#include "build/build_config.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"

class IFrameTest : public UITest {
 protected:
  void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) {
    FilePath test_file(test_data_directory_);
    test_file = test_file.AppendASCII(url);

    NavigateToURL(net::FilePathToFileURL(test_file));
    EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle());
  }
};

TEST_F(IFrameTest, Crash) {
  NavigateAndVerifyTitle("iframe.html", L"iframe test");
}

TEST_F(IFrameTest, InEmptyFrame) {
  NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test");
}

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/basictypes.h"
#include "base/file_path.h"
#include "build/build_config.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"

class IFrameTest : public UITest {
 protected:
  void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) {
    FilePath test_file(test_data_directory_);
    test_file = test_file.AppendASCII(url);

    NavigateToURL(net::FilePathToFileURL(test_file));
    EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle());
  }
};

TEST_F(IFrameTest, Crash) {
  NavigateAndVerifyTitle("iframe.html", L"iframe test");
}

// Fails consistently on Linux ChromeOS: http://crbug.com/100101
#if defined(OS_CHROMEOS)
#define MAYBE_InEmptyFrame FAILS_InEmptyFrame
#else
#define MAYBE_InEmptyFrame InEmptyFrame
#endif
TEST_F(IFrameTest, MAYBE_InEmptyFrame) {
  NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test");
}

Mark IFrameTest.InEmptyFrame FAILS_ on OS_CHROMEOS.
Mark IFrameTest.InEmptyFrame FAILS_ on OS_CHROMEOS.

BUG=100101
TEST=Failures expected on ChromeOS.
TBR=oshima

Review URL: http://codereview.chromium.org/8248004

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@105155 0039d316-1c4b-4281-b951-d872f2087c98
